PageSourceSearch

https://www.butterstack.com/assets/application-7059aff9531c6d28846…156e5aa19aa00fba8dd2afe9c35e3fbe8206520d.js

js butterstack.com collected 2026-09-25 18:36:14 UTC 3,158,185 bytes, 8,839 lines download raw bytes

1(()=>{var Tst=Object.create;var KP=Object.defineProperty;var Ast=Object.getOwnPropertyDescriptor;var Est=Object.getOwnPropertyNames;var kst=Object.getPrototypeOf,Pst=Object.prototype.hasOwnProperty;var NH=i=>t=>{var e=i[t];if(e)return e();throw new Error("Module not found in bundle: "+t)};var _n=(i,t,e)=>()=>{if(e)throw e[0];try{return i&&(t=i(i=0)),t}catch(n){throw e=[n],n}};var uo=(i,t)=>()=>{try{return t||i((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},Le=(i,t)=>{for(var e in t)KP(i,e,{get:t[e],enumerable:!0})},Rst=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Est(t))!Pst.call(i,s)&&s!==e&&KP(i,s,{get:()=>t[s],enumerable:!(n=Ast(t,s))||n.enumerable});return i};var il=(i,t,e)=>(e=i!=null?Tst(kst(i)):{},Rst(t||!i||!i.__esModule?KP(e,"default",{value:i,enumerable:!0}):e,i));var Gh,oC=_n(()=>{Gh={logger:typeof console<"u"?console:void 0,WebSocket:typeof WebSocket<"u"?WebSocket:void 0}});var Ki,gm=_n(()=>{oC();Ki={log(...i){this.enabled&&(i.push(Date.now()),Gh.logger.log("[ActionCable]",...i))}}});var Kv,aC,Jv,lC,RR=_n(()=>{gm();Kv=()=>new Date().getTime(),aC=i=>(Kv()-i)/1e3,Jv=class{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=Kv(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),Ki.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=Kv(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),Ki.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordMessage(){this.pingedAt=Kv()}recordConnect(){this.reconnectAttempts=0,delete this.disconnectedAt,Ki.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=Kv(),Ki.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:e}=this.constructor,n=Math.pow(1+e,Math.min(this.reconnectAttempts,10)),r=(this.reconnectAttempts===0?1:e)*Math.random();return t*1e3*n*(1+r)}reconnectIfStale(){this.connectionIsStale()&&(Ki.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${aC(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?Ki.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${aC(this.disconnectedAt)} s`):(Ki.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return aC(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&aC(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(Ki.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())},200)}};Jv.staleThreshold=6;Jv.reconnectionBackoffRate=.15;lC=Jv});var Zv,DR=_n(()=>{Zv={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 Qv,LR,Brt,v6,ty,cC,IR=_n(()=>{oC();RR();DR();gm();({message_types:Qv,protocols:LR}=Zv),Brt=LR.slice(0,LR.length-1),v6=[].indexOf,ty=class{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new lC(this),this.disconnected=!0}send(t){return this.isOpen()?(this.webSocket.send(JSON.stringify(t)),!0):!1}open(){if(this.isActive())return Ki.log(`Attempted to open WebSocket, but existing socket is ${this.get
1State()}`),!1;{let t=[...LR,...this.consumer.subprotocols||[]];return Ki.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${t}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new Gh.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(Ki.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(t){Ki.log("Failed to reopen WebSocket",t)}finally{Ki.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 v6.call(Brt,this.getProtocol())>=0}isState(...t){return v6.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in Gh.WebSocket)if(Gh.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){let e=this.events[t].bind(this);this.webSocket[`on${t}`]=e}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){}}};ty.reopenDelay=500;ty.prototype.events={message(i){if(!this.isProtocolSupported())return;let{identifier:t,message:e,reason:n,reconnect:s,type:r}=JSON.parse(i.data);switch(this.monitor.recordMessage(),r){case Qv.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case Qv.disconnect:return Ki.log(`Disconnecting. Reason: ${n}`),this.close({allowReconnect:s});case Qv.ping:return null;case Qv.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 Qv.rejection:return this.subscriptions.reject(t);default:return this.subscriptions.notify(t,"received",e)}},open(){if(Ki.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return Ki.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(i){if(Ki.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){Ki.log("WebSocket onerror event")}};cC=ty});var Frt,Of,OR=_n(()=>{Frt=function(i,t){if(t!=null)for(let e in t){let n=t[e];i[e]=n}return i},Of=class{constructor(t,e={},n){this.consumer=t,this.identifier=JSON.stringify(e),Frt(this,n)}perform(t,e={}){return e.action=t,this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}});var NR,uC,BR=_n(()=>{gm();NR=class{constructor(t){this.subscriptions=t,this.pendingSubscriptions=[]}guarantee(t){this.pendingSubscriptions.indexOf(t)==-1?(Ki.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):Ki.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing()}forget(t){Ki.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(e=>e!==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=>{Ki.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t)})},500)}},uC=NR});var Nf,FR=_n(()=>{gm();OR();BR();Nf=class{constructor(t){this.consumer=t,this.guarantor=new uC(this),this.subscriptions=[]}create(t,e){let n=t,s=typeof n=="object"?n:{channel:n},r=new Of(this.consumer,s,e);return this.add(r)}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(e=>(this.forget(e),this.notify(e,"rejected"),e))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter(e=>e!==t),t}findAll(t){return this.subscriptions.filter(e=>e.identifier===t)}reload(){return this.subscriptions.map(t=>this.subscribe(t))}notifyAll(t,...e){return this.subscriptions.map(n=>this.notify(n,t,...e))}notify(t,e,...n){let s;return typeof t=="string"?s=this.findAll(t):s=[t],s.map(r=>typeof r[e]=="function"?r[e](...n):void 0)}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t)}confirmSubscription(t){Ki.log(`Subscription confirmed ${t}`),this.findAll(t).map(e=>this.guarantor.forget(e))}sendCommand(t,e){let{identifier:n}=t;return this.consumer.send({command:e,identifier:n})}}});function UR(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 mm,y6=_n(()=>{IR();FR();mm=class{constructor(t){this._url=t,this.subscriptions=new Nf(this),this.connection=new cC(this),this.subprotocols=[]}get url(){return UR(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 w6={};Le(w6,{Connection:()=>cC,ConnectionMonitor:()=>lC,Consumer:()=>mm,INTERNAL:()=>Zv,Subscription:()=>Of,SubscriptionGuarantor:()=>uC,Subscriptions:()=>Nf,adapters:()=>Gh,createConsumer:()=>Urt,createWebSocketURL:()=>UR,getConfig:()=>x6,logger:()=>Ki});function Urt(i=x6("url")||Zv.default_mount_path){return new mm(i)}function x6(i){let t=document.head.querySelector(`meta[name='action-cable-${i}']`);if(t)return t.getAttribute("content")}var _6=_n(()=>{oC();IR();RR();y6();DR();gm();OR();BR();FR()});function hn(i,t){var e={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&t.indexOf(n)<0&&(e[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(i);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(i,n[s])&&(e[n[s]]=i[n[s]]);return e}function rn(i,t,e,n){var s=arguments.length,r=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(o=i[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r}function rM(i,t,e,n){function s(r){return r instanceof e?r:new e(function(o){o(r)})}return new(e||(e=Promise))(function(r,o){function a(u){try{c(n.next(u))}catch(h){o(h)}}function l(u){try{c(n.throw(u))}catch(h){o(h)}}function c(u){u.done?r(u.value):s(u.value).then(a,l)}c((n=n.apply(i,t||[])).next())})}var Sn=_n(()=>{});var KY=uo((nue,iA)=>{(function(i,t,e){if(!i)return;for(var n={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},s={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},r={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},o={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},a,l=1;l<20;++l)n[111+l]="f"+l;for(l=0;l<=9;++l)n[l+96]=l.toString();function c(k,O,I){if(k.addEventListener){k.addEventListener(O,I,!1);return}k.attachEvent("on"+O,I)}function u(k){if(k.type=="keypress"){var O=String.fromCharCode(k.which);return k.shiftKey||(O=O.toLowerCase()),O}return n[k.which]?n[k.which]:s[k.which]?s[k.which]:String.fromCharCode(k.which).toLowerCase()}function h(k,O){return k.sort().join(",")===O.sort().join(",")}function d(k){var O=[];return k.shiftKey&&O.push("shift"),k.altKey&&O.push("alt"),k.ctrlKey&&O.push("ctrl"),k.metaKey&&O.push("meta"),O}function p(k){if(k.preventDefault){k.preventDefault();return}k.returnValue=!1}function g(k){if(k.stopPropagation){k.stopPropagation();return}k.cancelBubble=!0}function y(k){return k=="shift"||k=="ctrl"||k=="alt"||k=="meta"}function x(){if(!a){a={};for(var k in n)k>95&&k<112||n.hasOwnProperty(k)&&(a[n[k]]=k)}return a}function w(k,O,I){return I||(I=x()[k]?"keydown":"keypress"),I=="keypress"&&O.length&&(I="keydown"),I}function M(k){return k==="+"?["+"]:(k=k.replace(/\+{2}/g,"+plus"),k.split("+"))}function A(k,O){var I,U,V,q=[];for(I=M(k),V=0;V<I.length;++V)U=I[V],o[U]&&(U=o[U]),O&&O!="keypress"&&r[U]&&(U=r[U],q.push("shift")),y(U)&&q.push(U);return O=w(U,q,O),{key:U,modifiers:q,action:O}}function C(k,O){return k===null||k===t?!1:k===O?!0:C(k.parentNode,O)}function R(k){var O=this;if(k=k||t,!(O instanceof R))return new R(k);O.target=k,O._callbacks={},O._directMap={};var I={},U,V=!1,q=!1,X=!1;function j(vt){vt=vt||{};var yt=!1,kt;for(kt in I){if(vt[kt]){yt=!0;continue}I[kt]=0}yt||(X=!1)}function W(vt,yt,kt,Wt,jt,ae){var ee,Bt,Gt=[],Qt=kt.type;if(!O._callbacks[vt])return[];for(Qt=="keyup"&&y(vt)&&(yt=[vt]),ee=0;ee<O._callbacks[vt].length;++ee)if(Bt=O._callbacks[vt][ee],!(!Wt&&Bt.seq&&I[Bt.seq]!=Bt.level)&&Qt==Bt.action&&(Qt=="keypress"&&!kt.metaKey&&!kt.ctrlKey||h(yt,Bt.modifiers))){var xe=!Wt&&Bt.combo==jt,Ut=Wt&&Bt.seq==Wt&&Bt.level==ae;(xe||Ut)&&O._callbacks[vt].splice(ee,1),Gt.push(Bt)}return Gt}function _(vt,yt,kt,Wt){O.stopCallback(yt,yt.target||yt.srcElement,kt,Wt)||vt(yt,kt)===!1&&(p(yt),g(yt))}O._handleKey=function(vt,yt,kt){var Wt=W(vt,yt,kt),jt,ae={},ee=0,Bt=!1;for(jt=0;jt<Wt.length;++jt)Wt[jt].seq&&(ee=Math.max(ee,Wt[jt].level));for(jt=0;jt<Wt.length;++jt){if(Wt[jt].seq){if(Wt[jt].level!=ee)continue;Bt=!0,ae[Wt[jt].seq]=1,_(Wt[jt].callback,kt,Wt[jt].combo,Wt[jt].seq);continue}Bt||_(Wt[jt].callback,kt,Wt[jt].combo)}var Gt=kt.type=="keypress"&&q;kt.type==X&&!y(vt)&&!Gt&&j(ae),q=Bt&&kt.type=="keydown"};function at(vt){typeof vt.which!="number"&&(vt.which=vt.keyCode);var yt=u(vt);if(yt){if(vt.type=="keyup"&&V===yt){V=!1;return}O.handleKey(yt,d(vt),vt)}}function ct(){clearTimeout(U),U=setTimeout(j,1e3)}function pt(vt,yt,kt,Wt){I[vt]=0;function jt(Qt){return function(){X=Qt,++I[vt],ct()}}function ae(Qt){_(kt,Qt,vt),Wt!=="keyup"&&(V=u(Qt)),setTimeout(j,10)}for(var ee=0;ee<yt.length;++ee){var Bt=ee+1===yt.length,Gt=Bt?ae:jt(Wt||A(yt[ee+1]).action);Et(yt[ee],Gt,Wt,vt,ee)}}function Et(vt,yt,kt,Wt,jt){O._directMap[vt+":"+kt]=yt,vt=vt.replace(/\s+/g," ");var ae=vt.split(" "),ee;if(ae.length>1){pt(vt,ae,yt,kt);return}ee=A(vt,kt),O._callbacks[ee.key]=O._callbacks[ee.key]||[],W(ee.key,ee.modifiers,{type:ee.action},Wt,vt,jt),O._callbacks[ee.key][Wt?"unshift":"push"]({callback:yt,modifiers:ee.modifiers,action:ee.action,seq:Wt,level:jt,combo:vt})}O._bindMultiple=function(vt,yt,kt){for(var Wt=0;Wt<vt.length;++Wt)Et(vt[Wt],yt,kt)},c(k,"keypress",at),c(k,"keydown",at),c(k,"keyup",at)}R.prototype.bind=function(k,O,I){var U=this;return k=k instanceof Array?k:[k],U._bindMultiple.call(U,k,O,I),U},R.prototype.unbind=function(k,O){var I=this;return I.bind.call(I,k,function(){},O)},R.prototype.trigger=function(k,O){var I=this;return I._directMap[k+":"+O]&&I._directMap[k+":"+O]({},k),I},R.prototype.reset=function(){var k=this;return k._callbacks={},k._directMap={},k},R.prototype.stopCallback=function(k,O){var I=this;if((" "+O.className+" ").indexOf(" mousetrap ")>-1||C(O,I.target))return!1;if("composedPath"in k&&typeof k.composedPath=="function"){var U=k.composedPath()[0];U!==k.target&&(O=U)}return O.tagName=="INPUT"||O.tagName=="SELECT"||O.tagName=="TEXTAREA"||O.isContentEditable},R.prototype.handleKey=function(){var k=this;return k._handleKey.apply(k,arguments)},R.addKeycodes=function(k){for(var O in k)k.hasOwnProperty(O)&&(n[O]=k[O]);a=null},R.init=function(){var k=R(t);for(var O in k)O.charAt(0)!=="_"&&(R[O]=(function(I){return function(){return k[I].apply(k,arguments)}})(O))},R.init(),i.Mousetrap=R,typeof iA<"u"&&iA.exports&&(iA.exports=R),typeof define=="function"&&define.amd&&define(function(){return R})})(typeof window<"u"?window:null,typeof window<"u"?document:null)});var CX=uo((jx,r3)=>{(function(t,e){typeof jx=="object"&&typeof r3=="object"?r3.exports=e():typeof define=="function"&&define.amd?define([],e):typeof jx=="object"?jx.ClipboardJS=e():t.ClipboardJS=e()})(jx,function(){return(function(){var i={686:(function(n,s,r){"use strict";r.d(s,{default:function(){return Et}});var o=r(279),a=r.n(o),l=r(370),c=r.n(l),u=r(817),h=r.n(u);function d(vt){try{return document.execCommand(vt)}catch{return!1}}var p=function(yt){var kt=h()(yt);return d("cut"),kt},g=p;function y(vt){var yt=document.documentElement.getAttribute("dir")==="rtl",kt=document.createElement("textarea");
vendor: 8,597 bytes, line 1
1kt.style.fontSize="12pt",kt.style.border="0",kt.style.padding="0",kt.style.margin="0",kt.style.position="absolute",kt.style[yt?"right":"left"]="-9999px";var Wt=window.pageYOffset||document.documentElement.scrollTop;return kt.style.top="".concat(Wt,"px"),kt.setAttribute("readonly",""),kt.value=vt,kt}var x=function(yt,kt){var Wt=y(yt);kt.container.appendChild(Wt);var jt=h()(Wt);return d("copy"),Wt.remove(),jt},w=function(yt){var kt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},Wt="";return typeof yt=="string"?Wt=x(yt,kt):yt instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(yt?.type)?Wt=x(yt.value,kt):(Wt=h()(yt),d("copy")),Wt},M=w;function A(vt){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?A=function(kt){return typeof kt}:A=function(kt){return kt&&typeof Symbol=="function"&&kt.constructor===Symbol&&kt!==Symbol.prototype?"symbol":typeof kt},A(vt)}var C=function(){var yt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},kt=yt.action,Wt=kt===void 0?"copy":kt,jt=yt.container,ae=yt.target,ee=yt.text;if(Wt!=="copy"&&Wt!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(ae!==void 0)if(ae&&A(ae)==="object"&&ae.nodeType===1){if(Wt==="copy"&&ae.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(Wt==="cut"&&(ae.hasAttribute("readonly")||ae.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(ee)return M(ee,{container:jt});if(ae)return Wt==="cut"?g(ae):M(ae,{container:jt})},R=C;function k(vt){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(kt){return typeof kt}:k=function(kt){return kt&&typeof Symbol=="function"&&kt.constructor===Symbol&&kt!==Symbol.prototype?"symbol":typeof kt},k(vt)}function O(vt,yt){if(!(vt instanceof yt))throw new TypeError("Cannot call a class as a function")}function I(vt,yt){for(var kt=0;kt<yt.length;kt++){var Wt=yt[kt];Wt.enumerable=Wt.enumerable||!1,Wt.configurable=!0,"value"in Wt&&(Wt.writable=!0),Object.defineProperty(vt,Wt.key,Wt)}}function U(vt,yt,kt){return yt&&I(vt.prototype,yt),kt&&I(vt,kt),vt}function V(vt,yt){if(typeof yt!="function"&&yt!==null)throw new TypeError("Super expression must either be null or a function");vt.prototype=Object.create(yt&&yt.prototype,{constructor:{value:vt,writable:!0,configurable:!0}}),yt&&q(vt,yt)}function q(vt,yt){return q=Object.setPrototypeOf||function(Wt,jt){return Wt.__proto__=jt,Wt},q(vt,yt)}function X(vt){var yt=_();return function(){var Wt=at(vt),jt;if(yt){var ae=at(this).constructor;jt=Reflect.construct(Wt,arguments,ae)}else jt=Wt.apply(this,arguments);return j(this,jt)}}function j(vt,yt){return yt&&(k(yt)==="object"||typeof yt=="function")?yt:W(vt)}function W(vt){if(vt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return vt}function _(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function at(vt){return at=Object.setPrototypeOf?Object.getPrototypeOf:function(kt){return kt.__proto__||Object.getPrototypeOf(kt)},at(vt)}function ct(vt,yt){var kt="data-clipboard-".concat(vt);if(yt.hasAttribute(kt))return yt.getAttribute(kt)}var pt=(function(vt){V(kt,vt);var yt=X(kt);function kt(Wt,jt){var ae;return O(this,kt),ae=yt.call(this),ae.resolveOptions(jt),ae.listenClick(Wt),ae}return U(kt,[{key:"resolveOptions",value:function(){var jt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof jt.action=="function"?jt.action:this.defaultAction,this.target=typeof jt.target=="function"?jt.target:this.defaultTarget,this.text=typeof jt.text=="function"?jt.text:this.defaultText,this.container=k(jt.container)==="object"?jt.container:document.body}},{key:"listenClick",value:function(jt){var ae=this;this.listener=c()(jt,"click",function(ee){return ae.onClick(ee)})}},{key:"onClick",value:function(jt){var ae=jt.delegateTarget||jt.currentTarget,ee=this.action(ae)||"copy",Bt=R({action:ee,container:this.container,target:this.target(ae),text:this.text(ae)});this.emit(Bt?"success":"error",{action:ee,text:Bt,trigger:ae,clearSelection:function(){ae&&ae.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(jt){return ct("action",jt)}},{key:"defaultTarget",value:function(jt){var ae=ct("target",jt);if(ae)return document.querySelector(ae)}},{key:"defaultText",value:function(jt){return ct("text",jt)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(jt){var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return M(jt,ae)}},{key:"cut",value:function(jt){return g(jt)}},{key:"isSupported",value:function(){var jt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],ae=typeof jt=="string"?[jt]:jt,ee=!!document.queryCommandSupported;return ae.forEach(function(Bt){ee=ee&&!!document.queryCommandSupported(Bt)}),ee}}]),kt})(a()),Et=pt}),828:(function(n){var s=9;if(typeof Element<"u"&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}function o(a,l){for(;a&&a.nodeType!==s;){if(typeof a.matches=="function"&&a.matches(l))return a;a=a.parentNode}}n.exports=o}),438:(function(n,s,r){var o=r(828);function a(u,h,d,p,g){var y=c.apply(this,arguments);return u.addEventListener(d,y,g),{destroy:function(){u.removeEventListener(d,y,g)}}}function l(u,h,d,p,g){return typeof u.addEventListener=="function"?a.apply(null,arguments):typeof d=="function"?a.bind(null,document).apply(null,arguments):(typeof u=="string"&&(u=document.querySelectorAll(u)),Array.prototype.map.call(u,function(y){return a(y,h,d,p,g)}))}function c(u,h,d,p){return function(g){g.delegateTarget=o(g.target,h),g.delegateTarget&&p.call(u,g)}}n.exports=l}),879:(function(n,s){s.node=function(r){return r!==void 0&&r instanceof HTMLElement&&r.nodeType===1},s.nodeList=function(r){var o=Object.prototype.toString.call(r);return r!==void 0&&(o==="[object NodeList]"||o==="[object HTMLCollection]")&&"length"in r&&(r.length===0||s.node(r[0]))},s.string=function(r){return typeof r=="string"||r instanceof String},s.fn=function(r){var o=Object.prototype.toString.call(r);return o==="[object Function]"}}),370:(function(n,s,r){var o=r(879),a=r(438);function l(d,p,g){if(!d&&!p&&!g)throw new Error("Missing required arguments");if(!o.string(p))throw new TypeError("Second argument must be a String");if(!o.fn(g))throw new TypeError("Third argument must be a Function");if(o.node(d))return c(d,p,g);if(o.nodeList(d))return u(d,p,g);if(o.string(d))return h(d,p,g);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function c(d,p,g){return d.addEventListener(p,g),{destroy:function(){d.removeEventListener(p,g)}}}function u(d,p,g){return Array.prototype.forEach.call(d,function(y){y.addEventListener(p,g)}),{destroy:function(){Array.prototype.forEach.call(d,function(y){y.removeEventListener(p,g)})}}}function h(d,p,g){return a(document.body,d,p,g)}n.exports=l}),817:(function(n){function s(r){var o;if(r.nodeName==="SELECT")r.focus(),o=r.value;else if(r.nodeName==="INPUT"||r.nodeName==="TEXTAREA"){var a=r.hasAttribute("readonly");a||r.setAttribute("readonly",""),r.select(),r.setSelectionRange(0,r.value.length),a||r.removeAttribute("readonly"),o=r.value}else{r.hasAttribute("contenteditable")&&r.focus();var l=window.getSelection(),c=document.createRange();c.selectNodeContents(r),l.removeAllRanges(),l.addRange(c),o=l.toString()}return o}n.exports=s}),279:(function(n){function s(){}s.prototype={on:function(r,o,a){var l=this.e||(this.e={});return(l[r]||(l[r]=[])).push({fn:o,ctx:a}),this},once:function(r,o,a){var l=this;function c(){l.off(r,c),o.apply(a,arguments)}return c._=o,this.on(r,c,a)},emit:function(r){var o=[].slice.call(arguments,1),a=((this.e||(this.e={}))[r]||[]).slice(),l=0,c=a.length;for(l;l<c;l++)a[l].fn.apply(a[l].ctx,o);return this},off:function(r,o){var a=this.e||(this.e={}),l=a[r],c=[];if(l&&o)for(var u=0,h=l.length;u<h;u++)l[u].fn!==o&&l[u].fn._!==o&&c.push(l[u]);return c.length?a[r]=c:delete a[r],this}},n.exports=s,n.exports.TinyEmitter=s}
1)},t={};function e(n){if(t[n])return t[n].exports;var s=t[n]={exports:{}};return i[n](s,s.exports,e),s.exports}return(function(){e.n=function(n){var s=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(s,{a:s}),s}})(),(function(){e.d=function(n,s){for(var r in s)e.o(s,r)&&!e.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:s[r]})}})(),(function(){e.o=function(n,s){return Object.prototype.hasOwnProperty.call(n,s)}})(),e(686)})().default})});var SA,CA,k3,cK,Qx,uK,Gu,P3,MA,R3=_n(()=>{SA=window,CA=SA.ShadowRoot&&(SA.ShadyCSS===void 0||SA.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,k3=Symbol(),cK=new WeakMap,Qx=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==k3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(CA&&t===void 0){let n=e!==void 0&&e.length===1;n&&(t=cK.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&cK.set(e,t))}return t}toString(){return this.cssText}},uK=i=>new Qx(typeof i=="string"?i:i+"",void 0,k3),Gu=(i,...t)=>{let e=i.length===1?i[0]:t.reduce(((n,s,r)=>n+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[r+1]),i[0]);return new Qx(e,i,k3)},P3=(i,t)=>{CA?i.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((e=>{let n=document.createElement("style"),s=SA.litNonce;s!==void 0&&n.setAttribute("nonce",s),n.textContent=e.cssText,i.appendChild(n)}))},MA=CA?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let n of t.cssRules)e+=n.cssText;return uK(e)})(i):i});var D3,TA,hK,_Tt,dK,I3,fK,L3,O3,qu,tw=_n(()=>{R3();R3();TA=window,hK=TA.trustedTypes,_Tt=hK?hK.emptyScript:"",dK=TA.reactiveElementPolyfillSupport,I3={toAttribute(i,t){switch(t){case Boolean:i=i?_Tt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},fK=(i,t)=>t!==i&&(t==t||i==i),L3={attribute:!0,type:String,converter:I3,reflect:!1,hasChanged:fK},O3="finalized",qu=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();let t=[];return this.elementProperties.forEach(((e,n)=>{let s=this._$Ep(n,e);s!==void 0&&(this._$Ev.set(s,n),t.push(s))})),t}static createProperty(t,e=L3){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){let n=typeof t=="symbol"?Symbol():"__"+t,s=this.getPropertyDescriptor(t,n,e);s!==void 0&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,n){return{get(){return this[e]},set(s){let r=this[t];this[e]=s,this.requestUpdate(t,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||L3}static finalize(){if(this.hasOwnProperty(O3))return!1;this[O3]=!0;let t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let e=this.properties,n=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(let s of n)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){let e=[];
1if(Array.isArray(t)){let n=new Set(t.flat(1/0).reverse());for(let s of n)e.unshift(MA(s))}else t!==void 0&&e.push(MA(t));return e}static _$Ep(t,e){let n=e.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach((e=>e(this)))}addController(t){var e,n;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((n=t.hostConnected)===null||n===void 0||n.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;let e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return P3(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach((e=>{var n;return(n=e.hostConnected)===null||n===void 0?void 0:n.call(e)}))}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach((e=>{var n;return(n=e.hostDisconnected)===null||n===void 0?void 0:n.call(e)}))}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$EO(t,e,n=L3){var s;let r=this.constructor._$Ep(t,n);if(r!==void 0&&n.reflect===!0){let o=(((s=n.converter)===null||s===void 0?void 0:s.toAttribute)!==void 0?n.converter:I3).toAttribute(e,n.type);this._$El=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$El=null}}_$AK(t,e){var n;let s=this.constructor,r=s._$Ev.get(t);if(r!==void 0&&this._$El!==r){let o=s.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?o.converter:I3;this._$El=r,this[r]=a.fromAttribute(e,o.type),this._$El=null}}requestUpdate(t,e,n){let s=!0;t!==void 0&&(((n=n||this.constructor.getPropertyOptions(t)).hasChanged||fK)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),n.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,n))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((s,r)=>this[r]=s)),this._$Ei=void 0);let e=!1,n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),(t=this._$ES)===null||t===void 0||t.forEach((s=>{var r;return(r=s.hostUpdate)===null||r===void 0?void 0:r.call(s)})),this.update(n)):this._$Ek()}catch(s){throw e=!1,this._$Ek(),s}e&&this._$AE(n)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach((n=>{var s;return(s=n.hostUpdated)===null||s===void 0?void 0:s.call(n)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach(((e,n)=>this._$EO(n,this[n],e))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};qu[O3]=!0,qu.elementProperties=new Map,qu.elementStyles=[],qu.shadowRootOptions={mode:"open"},dK?.({ReactiveElement:qu}),((D3=TA.reactiveElementVersions)!==null&&D3!==void 0?D3:TA.reactiveElementVersions=[]).push("1.6.3")});function MK(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return pK!==void 0?pK.createHTML(t):t}function Up(i,t,e=i,n){var s,r,o,a;if(t===zr)return t;let l=n!==void 0?(s=e._$Co)===null||s===void 0?void 0:s[n]:e._$Cl,c=iw(t)?void 0:t._$litDirective$;return l?.constructor!==c&&((r=l?._$AO)===null||r===void 0||r.call(l,!1),c===void 0?l=void 0:(l=new c(i),l._$AT(i,e,n)),n!==void 0?((o=(a=e)._$Co)!==null&&o!==void 0?o:a._$Co=[])[n]=l:e._$Cl=l),l!==void 0&&(t=Up(i,l._$AS(i,t.values),l,n)),t}var N3,AA,H0,pK,EA,Yu,F3,STt,Fp,nw,iw,wK,_K,B3,ew,gK,mK,Np,bK,vK,SK,CK,Tr,zme,zr,ds,yK,Bp,TK,sw,kA,j0,zp,PA,CTt,RA,DA,LA,AK,xK,EK,ec=_n(()=>{AA=window,H0=AA.trustedTypes,pK=H0?H0.createPolicy("lit-html",{createHTML:i=>i}):void 0,EA="$lit$",Yu=`lit$${(Math.random()+"").slice(9)}$`,F3="?"+Yu,STt=`<${F3}>`,Fp=document,nw=()=>Fp.createComment(""),iw=i=>i===null||typeof i!="object"&&typeof i!="function",wK=Array.isArray,_K=i=>wK(i)||typeof i?.[Symbol.iterator]=="function",B3=`[ 	
2\f\r]`,ew=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gK=/-->
vendor: 4,452 bytes, lines 2-3
2/g,mK=/>/g,Np=RegExp(`>|${B3}(?:([^\\s"'>=/]+)(${B3}*=${B3}*(?:[^ 	
3\f\r"'\`<>=]|("|')|))|$)`,"g"),bK=/'/g,vK=/"/g,SK=/^(?:script|style|textarea|title)$/i,CK=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),Tr=CK(1),zme=CK(2),zr=Symbol.for("lit-noChange"),ds=Symbol.for("lit-nothing"),yK=new WeakMap,Bp=Fp.createTreeWalker(Fp,129,null,!1);TK=(i,t)=>{let e=i.length-1,n=[],s,r=t===2?"<svg>":"",o=ew;for(let a=0;a<e;a++){let l=i[a],c,u,h=-1,d=0;for(;d<l.length&&(o.lastIndex=d,u=o.exec(l),u!==null);)d=o.lastIndex,o===ew?u[1]==="!--"?o=gK:u[1]!==void 0?o=mK:u[2]!==void 0?(SK.test(u[2])&&(s=RegExp("</"+u[2],"g")),o=Np):u[3]!==void 0&&(o=Np):o===Np?u[0]===">"?(o=s??ew,h=-1):u[1]===void 0?h=-2:(h=o.lastIndex-u[2].length,c=u[1],o=u[3]===void 0?Np:u[3]==='"'?vK:bK):o===vK||o===bK?o=Np:o===gK||o===mK?o=ew:(o=Np,s=void 0);let p=o===Np&&i[a+1].startsWith("/>")?" ":"";r+=o===ew?l+STt:h>=0?(n.push(c),l.slice(0,h)+EA+l.slice(h)+Yu+p):l+Yu+(h===-2?(n.push(void 0),a):p)}return[MK(i,r+(i[e]||"<?>")+(t===2?"</svg>":"")),n]},sw=class i{constructor({strings:t,_$litType$:e},n){let s;this.parts=[];let r=0,o=0,a=t.length-1,l=this.parts,[c,u]=TK(t,e);if(this.el=i.createElement(c,n),Bp.currentNode=this.el.content,e===2){let h=this.el.content,d=h.firstChild;d.remove(),h.append(...d.childNodes)}for(;(s=Bp.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes()){let h=[];for(let d of s.getAttributeNames())if(d.endsWith(EA)||d.startsWith(Yu)){let p=u[o++];if(h.push(d),p!==void 0){let g=s.getAttribute(p.toLowerCase()+EA).split(Yu),y=/([.?@])?(.*)/.exec(p);l.push({type:1,index:r,name:y[2],strings:g,ctor:y[1]==="."?PA:y[1]==="?"?RA:y[1]==="@"?DA:zp})}else l.push({type:6,index:r})}for(let d of h)s.removeAttribute(d)}if(SK.test(s.tagName)){let h=s.textContent.split(Yu),d=h.length-1;if(d>0){s.textContent=H0?H0.emptyScript:"";for(let p=0;p<d;p++)s.append(h[p],nw()),Bp.nextNode(),l.push({type:2,index:++r});s.append(h[d],nw())}}}else if(s.nodeType===8)if(s.data===F3)l.push({type:2,index:r});else{let h=-1;for(;(h=s.data.indexOf(Yu,h+1))!==-1;)l.push({type:7,index:r}),h+=Yu.length-1}r++}}static createElement(t,e){let n=Fp.createElement("template");return n.innerHTML=t,n}};kA=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;let{el:{content:n},parts:s}=this._$AD,r=((e=t?.creationScope)!==null&&e!==void 0?e:Fp).importNode(n,!0);Bp.currentNode=r;let o=Bp.nextNode(),a=0,l=0,c=s[0];for(;c!==void 0;){if(a===c.index){let u;c.type===2?u=new j0(o,o.nextSibling,this,t):c.type===1?u=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(u=new LA(o,this,t)),this._$AV.push(u),c=s[++l]}a!==c?.index&&(o=Bp.nextNode(),a++)}return Bp.currentNode=Fp,r}v(t){let e=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}},j0=class i{constructor(t,e,n,s){var r;this.type=2,this._$AH=ds,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=s,this._$Cp=(r=s?.isConnected)===null||r===void 0||r}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Up(this,t,e),iw(t)?t===ds||t==null||t===""?(this._$AH!==ds&&this._$AR(),this._$AH=ds):t!==this._$AH&&t!==zr&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):_K(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==ds&&iw(this._$AH)?this._$AA.nextSibling.data=t:this.$(Fp.createTextNode(t)),this._$AH=t}g(t){var e;let{values:n,_$litType$:s}=t,r=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=sw.createElement(MK(s.h,s.h[0]),this.options)),s);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===r)this._$AH.v(n);else{let o=new kA(r,this),a=o.u(this.options);o.v(n),this.$(a),this._$AH=o}}_$AC(t){let e=yK.get(t.strings);return e===void 0&&yK.set(t.strings,e=new sw(t)),e}T(t){wK(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,n,s=0;for(let r of t)s===e.length?e.push(n=new i(this.k(nw()),this.k(nw()),this,this.options)):n=e[s],n._$AI(r),s++;s<e.length&&(this._$AR(n&&n._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var n;
3for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}},zp=class{constructor(t,e,n,s,r){this.type=1,this._$AH=ds,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=ds}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,n,s){let r=this.strings,o=!1;if(r===void 0)t=Up(this,t,e,0),o=!iw(t)||t!==this._$AH&&t!==zr,o&&(this._$AH=t);else{let a=t,l,c;for(t=r[0],l=0;l<r.length-1;l++)c=Up(this,a[n+l],e,l),c===zr&&(c=this._$AH[l]),o||(o=!iw(c)||c!==this._$AH[l]),c===ds?t=ds:t!==ds&&(t+=(c??"")+r[l+1]),this._$AH[l]=c}o&&!s&&this.j(t)}j(t){t===ds?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},PA=class extends zp{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===ds?void 0:t}},CTt=H0?H0.emptyScript:"",RA=class extends zp{constructor(){super(...arguments),this.type=4}j(t){t&&t!==ds?this.element.setAttribute(this.name,CTt):this.element.removeAttribute(this.name)}},DA=class extends zp{constructor(t,e,n,s,r){super(t,e,n,s,r),this.type=5}_$AI(t,e=this){var n;if((t=(n=Up(this,t,e,0))!==null&&n!==void 0?n:ds)===zr)return;let s=this._$AH,r=t===ds&&s!==ds||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==ds&&(s===ds||r);r&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,n;typeof this._$AH=="function"?this._$AH.call((n=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&n!==void 0?n:this.element,t):this._$AH.handleEvent(t)}},LA=class{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){Up(this,t)}},AK={O:EA,P:Yu,A:F3,C:1,M:TK,L:kA,R:_K,D:Up,I:j0,V:zp,H:RA,N:DA,U:PA,F:LA},xK=AA.litHtmlPolyfillSupport;xK?.(sw,j0),((N3=AA.litHtmlVersions)!==null&&N3!==void 0?N3:AA.litHtmlVersions=[]).push("2.8.0");EK=(i,t,e)=>{var n,s;let r=(n=e?.renderBefore)!==null&&n!==void 0?n:t,o=r._$litPart$;if(o===void 0){let a=(s=e?.renderBefore)!==null&&s!==void 0?s:null;r._$litPart$=o=new j0(t.insertBefore(nw(),a),a,void 0,e??{})}return o._$AI(i),o}});var U3,z3,pa,kK,V3=_n(()=>{tw();tw();ec();ec();pa=class extends qu{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;let n=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=n.firstChild),n}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=EK(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return zr}};pa.finalized=!0,pa._$litElement$=!0,(U3=globalThis.litElementHydrateSupport)===null||U3===void 0||U3.call(globalThis,{LitElement:pa});kK=globalThis.litElementPolyfillSupport;kK?.({LitElement:pa});((z3=globalThis.litElementVersions)!==null&&z3!==void 0?z3:globalThis.litElementVersions=[]).push("3.3.3")});var W0=_n(()=>{tw();ec();V3()});var Ld,H3=_n(()=>{Ld=i=>t=>typeof t=="function"?((e,n)=>(customElements.define(e,n),n))(i,t):((e,n)=>{let{kind:s,elements:r}=n;return{kind:s,elements:r,finisher(o){customElements.define(e,o)}}})(i,t)});function ks(i){return(t,e)=>e!==void 0?TTt(i,t,e):MTt(i,t)}var MTt,TTt,IA=_n(()=>{MTt=(i,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(e){e.createProperty(t.key,i)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,i)}},TTt=(i,t,e)=>{t.constructor.createProperty(e,i)}});function Xu(i){return ks({...i,state:!0})}var j3=_n(()=>{IA();});var Vp=_n(()=>{});var W3=_n(()=>{Vp();});var $3=_n(()=>{Vp();});var G3=_n(()=>{Vp();});var q3=_n(()=>{Vp();});var Y3,h0e,OA=_n(()=>{Vp();h0e=((Y3=window.HTMLSlotElement)===null||Y3===void 0?void 0:Y3.prototype.assignedElements)!=null?(i,t)=>i.assignedElements(t):(i,t)=>i.assignedNodes(t).filter((e=>e.nodeType===Node.ELEMENT_NODE))});var X3=_n(()=>{Vp();OA();});var NA=_n(()=>{H3();IA();j3();W3();$3();G3();q3();OA();X3()});var po,nc,Fa,Id=_n(()=>{po={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},nc=i=>(...t)=>({_$litDirective$:i,values:t}),Fa=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}});var ATt,BA,PK,$0,Od,ETt,FA,RK,UA,zA=_n(()=>{ec();({I:ATt}=AK),BA=i=>i.strings===void 0,PK=()=>document.createComment(""),$0=(i,t,e)=>{var n;let s=i._$AA.parentNode,r=t===void 0?i._$AB:t._$AA;if(e===void 0){let o=s.insertBefore(PK(),r),a=s.insertBefore(PK(),r);e=new ATt(o,a,i,i.options)}else{let o=e._$AB.nextSibling,a=e._$AM,l=a!==i;if(l){let c;(n=e._$AQ)===null||n===void 0||n.call(e,i),e._$AM=i,e._$AP!==void 0&&(c=i._$AU)!==a._$AU&&e._$AP(c)}if(o!==r||l){let c=e._$AA;
3for(;c!==o;){let u=c.nextSibling;s.insertBefore(c,r),c=u}}}return e},Od=(i,t,e=i)=>(i._$AI(t,e),i),ETt={},FA=(i,t=ETt)=>i._$AH=t,RK=i=>i._$AH,UA=i=>{var t;(t=i._$AP)===null||t===void 0||t.call(i,!1,!0);let e=i._$AA,n=i._$AB.nextSibling;for(;e!==n;){let s=e.nextSibling;e.remove(),e=s}}});var DK,LK,IK=_n(()=>{ec();Id();zA();DK=(i,t,e)=>{let n=new Map;for(let s=t;s<=e;s++)n.set(i[s],s);return n},LK=nc(class extends Fa{constructor(i){if(super(i),i.type!==po.CHILD)throw Error("repeat() can only be used in text expressions")}ct(i,t,e){let n;e===void 0?e=t:t!==void 0&&(n=t);let s=[],r=[],o=0;for(let a of i)s[o]=n?n(a,o):o,r[o]=e(a,o),o++;return{values:r,keys:s}}render(i,t,e){return this.ct(i,t,e).values}update(i,[t,e,n]){var s;let r=RK(i),{values:o,keys:a}=this.ct(t,e,n);if(!Array.isArray(r))return this.ut=a,o;let l=(s=this.ut)!==null&&s!==void 0?s:this.ut=[],c=[],u,h,d=0,p=r.length-1,g=0,y=o.length-1;for(;d<=p&&g<=y;)if(r[d]===null)d++;else if(r[p]===null)p--;else if(l[d]===a[g])c[g]=Od(r[d],o[g]),d++,g++;else if(l[p]===a[y])c[y]=Od(r[p],o[y]),p--,y--;else if(l[d]===a[y])c[y]=Od(r[d],o[y]),$0(i,c[y+1],r[d]),d++,y--;else if(l[p]===a[g])c[g]=Od(r[p],o[g]),$0(i,r[d],r[p]),p--,g++;else if(u===void 0&&(u=DK(a,g,y),h=DK(l,d,p)),u.has(l[d]))if(u.has(l[p])){let x=h.get(a[g]),w=x!==void 0?r[x]:null;if(w===null){let M=$0(i,r[d]);Od(M,o[g]),c[g]=M}else c[g]=Od(w,o[g]),$0(i,r[d],w),r[x]=null;g++}else UA(r[p]),p--;else UA(r[d]),d++;for(;g<=y;){let x=$0(i,c[y+1]);Od(x,o[g]),c[g++]=x}for(;d<=p;){let x=r[d++];x!==null&&UA(x)}return this.ut=a,FA(i,c),zr}})});var OK=_n(()=>{IK()});var NK,BK=_n(()=>{ec();Id();zA();NK=nc(class extends Fa{constructor(i){if(super(i),i.type!==po.PROPERTY&&i.type!==po.ATTRIBUTE&&i.type!==po.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!BA(i))throw Error("`live` bindings can only contain a single expression")}render(i){return i}update(i,[t]){if(t===zr||t===ds)return t;let e=i.element,n=i.name;if(i.type===po.PROPERTY){if(t===e[n])return zr}else if(i.type===po.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(n))return zr}else if(i.type===po.ATTRIBUTE&&e.getAttribute(n)===t+"")return zr;return FA(i),t}})});var FK=_n(()=>{BK()});function kTt(i){this._$AN!==void 0?(VA(this),this._$AM=i,UK(this)):this._$AM=i}function PTt(i,t=!1,e=0){let n=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(t)if(Array.isArray(n))for(let r=e;r<n.length;r++)ow(n[r],!1),VA(n[r]);else n!=null&&(ow(n,!1),VA(n));else ow(this,i)}var ow,VA,UK,RTt,HA,zK=_n(()=>{zA();Id();Id();ow=(i,t)=>{var e,n;let s=i._$AN;if(s===void 0)return!1;for(let r of s)(n=(e=r)._$AO)===null||n===void 0||n.call(e,t,!1),ow(r,t);return!0},VA=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},UK=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),RTt(t)}};RTt=i=>{var t,e,n,s;i.type==po.CHILD&&((t=(n=i)._$AP)!==null&&t!==void 0||(n._$AP=PTt),(e=(s=i)._$AQ)!==null&&e!==void 0||(s._$AQ=kTt))},HA=class extends Fa{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,n){super._$AT(t,e,n),UK(this),this.isConnected=t._$AU}_$AO(t,e=!0){var n,s;t!==this.isConnected&&(this.isConnected=t,t?(n=this.reconnected)===null||n===void 0||n.call(this):(s=this.disconnected)===null||s===void 0||s.call(this)),e&&(ow(this,t),VA(this))}setValue(t){if(BA(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}});var jA,J3,K3,WA,Z3=_n(()=>{ec();zK();Id();jA=()=>new J3,J3=class{},K3=new WeakMap,WA=nc(class extends HA{render(i){return ds}update(i,[t]){var e;let n=t!==this.G;return n&&this.G!==void 0&&this.ot(void 0),(n||this.rt!==this.lt)&&(this.G=t,this.dt=(e=i.options)===null||e===void 0?void 0:e.host,this.ot(this.lt=i.element)),ds}ot(i){var t;if(typeof this.G=="function"){let e=(t=this.dt)!==null&&t!==void 0?t:globalThis,n=K3.get(e);n===void 0&&(n=new WeakMap,K3.set(e,n)),n.get(this.G)!==void 0&&this.G.call(this.dt,void 0),n.set(this.G,i),i!==void 0&&this.G.call(this.dt,i)}else this.G.value=i}get rt(){var i,t,e;return typeof this.G=="function"?(t=K3.get((i=this.dt)!==null&&i!==void 0?i:globalThis))===null||t===void 0?void 0:t.get(this.G):(e=this.G)===null||e===void 0?void 0:e.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}})});var aw,VK=_n(()=>{ec();Id();aw=nc(class extends Fa{constructor(i){var t;if(super(i),i.type!==po.ATTRIBUTE||i.name!=="class"||((t=i.strings)===null||t===void 0?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter((t=>i[t])).join(" ")+" "}update(i,[t]){var e,n;if(this.it===void 0){this.it=new Set,i.strings!==void 0&&(this.nt=ne
3w Set(i.strings.join(" ").split(/\s/).filter((r=>r!==""))));for(let r in t)t[r]&&!(!((e=this.nt)===null||e===void 0)&&e.has(r))&&this.it.add(r);return this.render(t)}let s=i.element.classList;this.it.forEach((r=>{r in t||(s.remove(r),this.it.delete(r))}));for(let r in t){let o=!!t[r];o===this.it.has(r)||!((n=this.nt)===null||n===void 0)&&n.has(r)||(o?(s.add(r),this.it.add(r)):(s.remove(r),this.it.delete(r)))}return zr}})});var Q3=_n(()=>{VK()});function eB(i,t,e){i.addEventListener?i.addEventListener(t,e,!1):i.attachEvent&&i.attachEvent("on".concat(t),function(){e(window.event)})}function qK(i,t){for(var e=t.slice(0,t.length-1),n=0;n<e.length;n++)e[n]=i[e[n].toLowerCase()];return e}function YK(i){typeof i!="string"&&(i=""),i=i.replace(/\s/g,"");for(var t=i.split(","),e=t.lastIndexOf("");e>=0;)t[e-1]+=",",t.splice(e,1),e=t.lastIndexOf("");return t}function DTt(i,t){for(var e=i.length>=t.length?i:t,n=i.length>=t.length?t:i,s=!0,r=0;r<e.length;r++)n.indexOf(e[r])===-1&&(s=!1);return s}function ZK(i){KK=i||"all"}function cw(){return KK||"all"}function LTt(){return Ps.slice(0)}function ITt(i){var t=i.target||i.srcElement,e=t.tagName,n=!0;return(t.isContentEditable||(e==="INPUT"||e==="TEXTAREA"||e==="SELECT")&&!t.readOnly)&&(n=!1),n}function OTt(i){return typeof i=="string"&&(i=GA(i)),Ps.indexOf(i)!==-1}function NTt(i,t){var e,n;i||(i=cw());for(var s in Vr)if(Object.prototype.hasOwnProperty.call(Vr,s))for(e=Vr[s],n=0;n<e.length;)e[n].scope===i?e.splice(n,1):n++;cw()===i&&ZK(t||"all")}function BTt(i){var t=i.keyCode||i.which||i.charCode,e=Ps.indexOf(t);if(e>=0&&Ps.splice(e,1),i.key&&i.key.toLowerCase()==="meta"&&Ps.splice(0,Ps.length),(t===93||t===224)&&(t=91),t in to){to[t]=!1;for(var n in Hp)Hp[n]===t&&(Hs[n]=!1)}}function FTt(i){if(!i)Object.keys(Vr).forEach(function(o){return delete Vr[o]});else if(Array.isArray(i))i.forEach(function(o){o.key&&nB(o)});else if(typeof i=="object")i.key&&nB(i);else if(typeof i=="string"){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];var s=e[0],r=e[1];typeof s=="function"&&(r=s,s=""),nB({key:i,scope:s,method:r,splitKey:"+"})}}function WK(i,t,e,n){if(t.element===n){var s;if(t.scope===e||t.scope==="all"){s=t.mods.length>0;for(var r in to)Object.prototype.hasOwnProperty.call(to,r)&&(!to[r]&&t.mods.indexOf(+r)>-1||to[r]&&t.mods.indexOf(+r)===-1)&&(s=!1);(t.mods.length===0&&!to[16]&&!to[18]&&!to[17]&&!to[91]||s||t.shortcut==="*")&&t.method(i,t)===!1&&(i.preventDefault?i.preventDefault():i.returnValue=!1,i.stopPropagation&&i.stopPropagation(),i.cancelBubble&&(i.cancelBubble=!0))}}}function $K(i,t){var e=Vr["*"],n=i.keyCode||i.which||i.charCode;if(Hs.filter.call(this,i)){if((n===93||n===224)&&(n=91),Ps.indexOf(n)===-1&&n!==229&&Ps.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(g){var y=HK[g];i[g]&&Ps.indexOf(y)===-1?Ps.push(y):!i[g]&&Ps.indexOf(y)>-1?Ps.splice(Ps.indexOf(y),1):g==="metaKey"&&i[g]&&Ps.length===3&&(i.ctrlKey||i.shiftKey||i.altKey||(Ps=Ps.slice(Ps.indexOf(y))))}),n in to){to[n]=!0;for(var s in Hp)Hp[s]===n&&(Hs[s]=!0);if(!e)return}for(var r in to)Object.prototype.hasOwnProperty.call(to,r)&&(to[r]=i[HK[r]]);i.getModifierState&&!(i.altKey&&!i.ctrlKey)&&i.getModifierState("AltGraph")&&(Ps.indexOf(17)===-1&&Ps.push(17),Ps.indexOf(18)===-1&&Ps.push(18),to[17]=!0,to[18]=!0);var o=cw();if(e)for(var a=0;a<e.length;a++)e[a].scope===o&&(i.type==="keydown"&&e[a].keydown||i.type==="keyup"&&e[a].keyup)&&WK(i,e[a],o,t);if(n in Vr){for(var l=0;l<Vr[n].length;l++)if((i.type==="keydown"&&Vr[n][l].keydown||i.type==="keyup"&&Vr[n][l].keyup)&&Vr[n][l].key){for(var c=Vr[n][l],u=c.splitKey,h=c.key.split(u),d=[],p=0;p<h.length;p++)d.push(GA(h[p]));d.sort().join("")===Ps.sort().join("")&&WK(i,c,o,t)}}}}function UTt(i){return JK.indexOf(i)>-1}function Hs(i,t,e){Ps=[];var n=YK(i),s=[],r="all",o=document,a=0,l=!1,c=!0,u="+";for(e===void 0&&typeof t=="function"&&(e=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(r=t.scope),t.element&&(o=t.element),t.keyup&&(l=t.keyup),t.keydown!==void 0&&(c=t.keydown),typeof t.splitKey=="string"&&(u=t.splitKey)),typeof t=="string"&&(r=t);a<n.length;a++)i=n[a].split(u),s=[],i.length>1&&(s=qK(Hp,i)),i=i[i.length-1],i=i==="*"?"*":GA(i),i in Vr||(Vr[i]=[]),Vr[i].push({keyup:l,keydown:c,scope:r,mods:s,shortcut:n[a],method:e,key:n[a],splitKey:u,element:o});typeof o<"u"&&!UTt(o)&&window&&(JK.push(o),eB(o,"keydown",function(h){$K(h,o)}
3),jK||(jK=!0,eB(window,"focus",function(){Ps=[]})),eB(o,"keyup",function(h){$K(h,o),BTt(h)}))}var tB,XK,Hp,HK,to,Vr,lw,Ps,jK,KK,JK,GA,nB,iB,$A,GK,QK=_n(()=>{tB=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;XK={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":tB?173:189,"=":tB?61:187,";":tB?59:186,"'":222,"[":219,"]":221,"\\":220},Hp={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,command:91},HK={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},to={16:!1,18:!1,17:!1,91:!1},Vr={};for(lw=1;lw<20;lw++)XK["f".concat(lw)]=111+lw;Ps=[],jK=!1,KK="all",JK=[],GA=function(t){return XK[t.toLowerCase()]||Hp[t.toLowerCase()]||t.toUpperCase().charCodeAt(0)};nB=function(t){var e=t.key,n=t.scope,s=t.method,r=t.splitKey,o=r===void 0?"+":r,a=YK(e);a.forEach(function(l){var c=l.split(o),u=c.length,h=c[u-1],d=h==="*"?"*":GA(h);if(Vr[d]){n||(n=cw());var p=u>1?qK(Hp,c):[];Vr[d]=Vr[d].filter(function(g){var y=s?g.method===s:!0;return!(y&&g.scope===n&&DTt(g.mods,p))})}})};iB={setScope:ZK,getScope:cw,deleteScope:NTt,getPressedKeyCodes:LTt,isPressed:OTt,filter:ITt,unbind:FTt};for($A in iB)Object.prototype.hasOwnProperty.call(iB,$A)&&(Hs[$A]=iB[$A]);typeof window<"u"&&(GK=window.hotkeys,Hs.noConflict=function(i){return i&&window.hotkeys===Hs&&(window.hotkeys=GK),Hs},window.hotkeys=Hs)});var tJ=_n(()=>{Z3()});var uw,jp,eJ=_n(()=>{W0();NA();tJ();uw=function(i,t,e,n){var s=arguments.length,r=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(o=i[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},jp=class extends pa{constructor(){super(...arguments),this.placeholder="",this.hideBreadcrumbs=!1,this.breadcrumbHome="Home",this.breadcrumbs=[],this._inputRef=jA()}render(){let t="";if(!this.hideBreadcrumbs){let e=[];for(let n of this.breadcrumbs)e.push(Tr`<button
4            tabindex="-1"
5            @click=${()=>this.selectParent(n)}
6            class="breadcrumb"
7          >
8            ${n}
9          </button>`);t=Tr`<div class="breadcrumb-list">
10        <button
11          tabindex="-1"
12          @click=${()=>this.selectParent()}
13          class="breadcrumb"
14        >
15          ${this.breadcrumbHome}
16        </button>
17        ${e}
18      </div>`}return Tr`
19      ${t}
20      <div part="ninja-input-wrapper" class="search-wrapper">
21        <input
22          part="ninja-input"
23          type="text"
24          id="search"
25          spellcheck="false"
26          autocomplete="off"
27          @input="${this._handleInput}"
28          ${WA(this._inputRef)}
29          placeholder="${this.placeholder}"
30          class="search"
31        />
32      </div>
33    `}setSearch(t){this._inputRef.value&&(this._inputRef.value.value=t)}focusSearch(){requestAnimationFrame(()=>this._inputRef.value.focus())}_handleInput(t){let e=t.target;this.dispatchEvent(new CustomEvent("change",{detail:{search:e.value},bubbles:!1,composed:!1}))}selectParent(t){this.dispatchEvent(new CustomEvent("setParent",{detail:{parent:t},bubbles:!0,composed:!0}))}firstUpdated(){this.focusSearch()}_close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}};jp.styles=Gu`
34    :host {
35      flex: 1;
36      position: relative;
37    }
38    .search {
39      padding: 1.25em;
40      flex-grow: 1;
41      flex-shrink: 0;
42      margin: 0px;
43      border: none;
44      appearance: none;
45      font-size: 1.125em;
46      background: transparent;
47      caret-color: var(--ninja-accent-color);
48      color: var(--ninja-text-color);
49      outline: none;
50      font-family: var(--ninja-font-family);
51    }
52    .search::placeholder {
53      color: var(--ninja-placeholder-color);
54    }
55    .breadcrumb-list {
56      padding: 1em 4em 0 1em;
57      display: flex;
58      flex-direction: row;
59      align-items: stretch;
60      justify-content: flex-start;
61      flex: initial;
62    }
63
64    .breadcrumb {
65      background: var(--ninja-secondary-background-color);
66      text-align: center;
67      line-height: 1.2em;
68      border-radius: var(--ninja-key-border-radius);
69      border: 0;
70      cursor: pointer;
71      padding: 0.1em 0.5em;
72      color: var(--ninja-secondary-text-color);
73      margin-right: 0.5em;
74      outline: none;
75      font-family: var(--ninja-font-family);
76    }
77
78    .search-wrapper {
79      display: flex;
80      border-bottom: var(--ninja-separate-border);
81    }
82  `;uw([ks()],jp.prototype,"placeholder",void 0);uw([ks({type:Boolean})],jp.prototype,"hideBreadcrumbs",void 0);uw([ks()],jp.prototype,"breadcrumbHome",void 0);uw([ks({type:Array})],jp.prototype,"breadcrumbs",void 0);jp=uw([Ld("ninja-header")],jp)});var hw,nJ,iJ=_n(()=>{ec();Id();hw=class extends Fa{constructor(t){if(super(t),this.et=ds,t.type!==po.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===ds||t==null)return this.ft=void 0,this.et=t;if(t===zr)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;let e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}};hw.directiveName="unsafeHTML",hw.resultType=1;nJ=nc(hw)});var sJ=_n(()=>{iJ()});var rJ=_n(()=>{});var sB=_n(()=>{tw();ec();V3();rJ()});var oJ=_n(()=>{H3();IA();j3();W3();$3();G3();q3();OA();X3()});var aJ,lJ=_n(()=>{sB();aJ=Gu`:host{font-family:var(--mdc-icon-font, "Material Icons");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:"liga"}`});var rB,cJ=_n(()=>{Sn();sB();oJ();lJ();rB=class extends pa{render(){return Tr`<span><slot></slot></span>`}};rB.styles=[aJ];rB=rn([Ld("mwc-icon")],rB)});var qA,G0,uJ=_n(()=>{W0();NA();Q3();sJ();cJ();qA=function(i,t,e,n){var s=arguments.length,r=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(o=i[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},G0=class extends pa{constructor(){super(),this.selected=!1,this.hotKeysJoinedView=!1,this.addEventListener("click",this.click)}ensureInView(){requestAnimationFrame(()=>this.scrollIntoView({block:"nearest"}))}click(){this.dispatchEvent(new CustomEvent("actionsSelected",{detail:this.action,bubbles:!0,composed:!0}))}updated(t){t.has("selected")&&this.selected&&this.ensureInView()}render(){let t;this.action.mdIcon?t=Tr`<mwc-icon part="ninja-icon" class="ninja-icon">${this.action.mdIcon}</mwc-icon>`:this.action.icon&&(t=nJ(this.action.icon||""));let e;
82this.action.hotkey&&(this.hotKeysJoinedView?e=Tr`<div class="ninja-hotkey">${this.action.hotkey}</div>`:e=this.action.hotkey.split("+").map(s=>Tr`<div class="ninja-hotkey">${s}</div>`));let n={selected:this.selected,"ninja-action":!0};return Tr`
83      <div class="ninja-action" part="ninja-action ${this.selected?"ninja-selected":""}" class=${aw(n)}>
84        ${t}
85        <div class="ninja-title">${this.action.title}</div>
86        ${e}
87      </div>
88    `}};G0.styles=Gu`
89    :host {
90      display: flex;
91      width: 100%;
92    }
93    .ninja-action {
94      padding: 0.75em 1em;
95      display: flex;
96      border-left: 2px solid transparent;
97      align-items: center;
98      justify-content: start;
99      outline: none;
100      transition: color 0s ease 0s;
101      width: 100%;
102    }
103    .ninja-action.selected {
104      cursor: pointer;
105      color: var(--ninja-selected-text-color);
106      background-color: var(--ninja-selected-background);
107      border-left: 2px solid var(--ninja-accent-color);
108      outline: none;
109    }
110    .ninja-action.selected .ninja-icon {
111      color: var(--ninja-selected-text-color);
112    }
113    .ninja-icon {
114      font-size: var(--ninja-icon-size);
115      max-width: var(--ninja-icon-size);
116      max-height: var(--ninja-icon-size);
117      margin-right: 1em;
118      color: var(--ninja-icon-color);
119      margin-right: 1em;
120      position: relative;
121    }
122
123    .ninja-title {
124      flex-shrink: 0.01;
125      margin-right: 0.5em;
126      flex-grow: 1;
127      font-size: 0.8125em;
128      white-space: nowrap;
129      overflow: hidden;
130      text-overflow: ellipsis;
131    }
132    .ninja-hotkeys {
133      margin-left: 0.5em;
134      flex-shrink: 0;
135      width: min-content;
136    }
137
138    .ninja-hotkey {
139      background: var(--ninja-secondary-background-color);
140      padding: 0.06em 0.25em;
141      border-radius: var(--ninja-key-border-radius);
142      text-transform: capitalize;
143      color: var(--ninja-secondary-text-color);
144      font-size: 0.75em;
145      margin-left: 0.5em;
146    }
147  `;qA([ks({type:Object})],G0.prototype,"action",void 0);qA([ks({type:Boolean})],G0.prototype,"selected",void 0);qA([ks({type:Boolean})],G0.prototype,"hotKeysJoinedView",void 0);G0=qA([Ld("ninja-action")],G0)});var hJ,dJ=_n(()=>{W0();hJ=Tr` <div class="modal-footer" slot="footer">
148  <span class="help">
149    <svg
150      version="1.0"
151      class="ninja-examplekey"
152      xmlns="http://www.w3.org/2000/svg"
153      viewBox="0 0 1280 1280"
154    >
155      <path
156        d="M1013 376c0 73.4-.4 113.3-1.1 120.2a159.9 159.9 0 0 1-90.2 127.3c-20 9.6-36.7 14-59.2 15.5-7.1.5-121.9.9-255 1h-242l95.5-95.5 95.5-95.5-38.3-38.2-38.2-38.3-160 160c-88 88-160 160.4-160 161 0 .6 72 73 160 161l160 160 38.2-38.3 38.3-38.2-95.5-95.5-95.5-95.5h251.1c252.9 0 259.8-.1 281.4-3.6 72.1-11.8 136.9-54.1 178.5-116.4 8.6-12.9 22.6-40.5 28-55.4 4.4-12 10.7-36.1 13.1-50.6 1.6-9.6 1.8-21 2.1-132.8l.4-122.2H1013v110z"
157      />
158    </svg>
159
160    to select
161  </span>
162  <span class="help">
163    <svg
164      xmlns="http://www.w3.org/2000/svg"
165      class="ninja-examplekey"
166      viewBox="0 0 24 24"
167    >
168      <path d="M0 0h24v24H0V0z" fill="none" />
169      <path
170        d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
171      />
172    </svg>
173    <svg
174      xmlns="http://www.w3.org/2000/svg"
175      class="ninja-examplekey"
176      viewBox="0 0 24 24"
177    >
178      <path d="M0 0h24v24H0V0z" fill="none" />
179      <path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z" />
180    </svg>
181    to navigate
182  </span>
183  <span class="help">
184    <span class="ninja-examplekey esc">esc</span>
185    to close
186  </span>
187  <span class="help">
188    <svg
189      xmlns="http://www.w3.org/2000/svg"
190      class="ninja-examplekey backspace"
191      viewBox="0 0 20 20"
192      fill="currentColor"
193    >
194      <path
195        fill-rule="evenodd"
196        d="M6.707 4.879A3 3 0 018.828 4H15a3 3 0 013 3v6a3 3 0 01-3 3H8.828a3 3 0 01-2.12-.879l-4.415-4.414a1 1 0 010-1.414l4.414-4.414zm4 2.414a1 1 0 00-1.414 1.414L10.586 10l-1.293 1.293a1 1 0 101.414 1.414L12 11.414l1.293 1.293a1 1 0 001.414-1.414L13.414 10l1.293-1.293a1 1 0 00-1.414-1.414L12 8.586l-1.293-1.293z"
197        clip-rule="evenodd"
198      />
199    </svg>
200    move to parent
201  </span>
202</div>`});var fJ,pJ=_n(()=>{W0();fJ=Gu`
203  :host {
204    --ninja-width: 640px;
205    --ninja-backdrop-filter: none;
206    --ninja-overflow-background: rgba(255, 255, 255, 0.5);
207    --ninja-text-color: rgb(60, 65, 73);
208    --ninja-font-size: 16px;
209    --ninja-top: 20%;
210
211    --ninja-key-border-radius: 0.25em;
212    --ninja-accent-color: rgb(110, 94, 210);
213    --ninja-secondary-background-color: rgb(239, 241, 244);
214    --ninja-secondary-text-color: rgb(107, 111, 118);
215
216    --ninja-selected-background: rgb(248, 249, 251);
217
218    --ninja-icon-color: var(--ninja-secondary-text-color);
219    --ninja-icon-size: 1.2em;
220    --ninja-separate-border: 1px solid var(--ninja-secondary-background-color);
221
222    --ninja-modal-background: #fff;
223    --ninja-modal-shadow: rgb(0 0 0 / 50%) 0px 16px 70px;
224
225    --ninja-actions-height: 300px;
226    --ninja-group-text-color: rgb(144, 149, 157);
227
228    --ninja-footer-background: rgba(242, 242, 242, 0.4);
229
230    --ninja-placeholder-color: #8e8e8e;
231
232    font-size: var(--ninja-font-size);
233
234    --ninja-z-index: 1;
235  }
236
237  :host(.dark) {
238    --ninja-backdrop-filter: none;
239    --ninja-overflow-background: rgba(0, 0, 0, 0.7);
240    --ninja-text-color: #7d7d7d;
241
242    --ninja-modal-background: rgba(17, 17, 17, 0.85);
243    --ninja-accent-color: rgb(110, 94, 210);
244    --ninja-secondary-background-color: rgba(51, 51, 51, 0.44);
245    --ninja-secondary-text-color: #888;
246
247    --ninja-selected-text-color: #eaeaea;
248    --ninja-selected-background: rgba(51, 51, 51, 0.44);
249
250    --ninja-icon-color: var(--ninja-secondary-text-color);
251    --ninja-separate-border: 1px solid var(--ninja-secondary-background-color);
252
253    --ninja-modal-shadow: 0 16px 70px rgba(0, 0, 0, 0.2);
254
255    --ninja-group-text-color: rgb(144, 149, 157);
256
257    --ninja-footer-background: rgba(30, 30, 30, 85%);
258  }
259
260  .modal {
261    display: none;
262    position: fixed;
263    z-index: var(--ninja-z-index);
264    left: 0;
265    top: 0;
266    width: 100%;
267    height: 100%;
268    overflow: auto;
269    background: var(--ninja-overflow-background);
270    -webkit-font-smoothing: antialiased;
271    -moz-osx-font-smoothing: grayscale;
272    -webkit-backdrop-filter: var(--ninja-backdrop-filter);
273    backdrop-filter: var(--ninja-backdrop-filter);
274    text-align: left;
275    color: var(--ninja-text-color);
276    font-family: var(--ninja-font-family);
277  }
278  .modal.visible {
279    display: block;
280  }
281
282  .modal-content {
283    position: relative;
284    top: var(--ninja-top);
285    margin: auto;
286    padding: 0;
287    display: flex;
288    flex-direction: column;
289    flex-shrink: 1;
290    -webkit-box-flex: 1;
291    flex-grow: 1;
292    min-width: 0px;
293    will-change: transform;
294    background: var(--ninja-modal-background);
295    border-radius: 0.5em;
296    box-shadow: var(--ninja-modal-shadow);
297    max-width: var(--ninja-width);
298    overflow: hidden;
299  }
300
301  .bump {
302    animation: zoom-in-zoom-out 0.2s ease;
303  }
304
305  @keyframes zoom-in-zoom-out {
306    0% {
307      transform: scale(0.99);
308    }
309    50% {
310      transform: scale(1.01, 1.01);
311    }
312    100% {
313      transform: scale(1, 1);
314    }
315  }
316
317  .ninja-github {
318    color: var(--ninja-keys-text-color);
319    font-weight: normal;
320    text-decoration: none;
321  }
322
323  .actions-list {
324    max-height: var(--ninja-actions-height);
325    overflow: auto;
326    scroll-behavior: smooth;
327    position: relative;
328    margin: 0;
329    padding: 0.5em 0;
330    list-style: none;
331    scroll-behavior: smooth;
332  }
333
334  .group-header {
335    height: 1.375em;
336    line-height: 1.375em;
337    padding-left: 1.25em;
338    padding-top: 0.5em;
339    text-overflow: ellipsis;
340    white-space: nowrap;
341    overflow: hidden;
342    font-size: 0.75em;
343    line-height: 1em;
344    color: var(--ninja-group-text-color);
345    margin: 1px 0;
346  }
347
348  .modal-footer {
349    background: var(--ninja-footer-background);
350    padding: 0.5em 1em;
351    display: flex;
352    /* font-size: 0.75em; */
353    border-top: var(--ninja-separate-border);
354    color: var(--ninja-secondary-text-color);
355  }
356
357  .modal-footer .help {
358    display: flex;
359    margin-right: 1em;
360    align-items: center;
361    font-size: 0.75em;
362  }
363
364  .ninja-examplekey {
365    background: var(--ninja-secondary-background-color);
366    padding: 0.06em 0.25em;
367    border-radius: var(--ninja-key-border-radius);
368    color: var(--ninja-secondary-text-color);
369    width: 1em;
370    height: 1em;
371    margin-right: 0.5em;
372    font-size: 1.25em;
373    fill: currentColor;
374  }
375  .ninja-examplekey.esc {
376    width: auto;
377    height: auto;
378    font-size: 1.1em;
379  }
380  .ninja-examplekey.backspace {
381    opacity: 0.7;
382  }
383`});var gJ={};Le(gJ,{NinjaKeys:()=>Rs});var er,Rs,mJ=_n(()=>{W0();NA();OK();FK();Z3();Q3();QK();eJ();uJ();dJ();pJ();er=function(i,t,e,n){var s=arguments.length,r=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(o=i[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Rs=class extends pa{constructor(){super(...arguments),this.placeholder="Type a command or search...",this.disableHotkeys=!1,this.hideBreadcrumbs=!1,this.openHotkey="cmd+k,ctrl+k",this.navigationUpHotkey="up,shift+tab",this.navigationDownHotkey="down,tab",this.closeHotkey="esc",this.goBackHotkey="backspace",this.selectHotkey="enter",this.hotKeysJoinedView=!1,this.noAutoLoadMdIcons=!1,this.data=[],this.visible=!1,this._bump=!0,this._actionMatches=[],this._search="",this._flatData=[],this._headerRef=jA()}open(t={}){this._bump=!0,this.visible=!0,this._headerRef.value.focusSearch(),this._actionMatches.length>0&&(this._selected=this._actionMatches[0]),this.setParent(t.parent)}close(){this._bump=!1,this.visible=!1}setParent(t){t?this._currentRoot=t:this._currentRoot=void 0,this._selected=void 0,this._search="",this._headerRef.value.setSearch("")}get breadcrumbs(){var t;let e=[],n=(t=this._selected)===null||t===void 0?void 0:t.parent;if(n)for(e.push(n);n;){let s=this._flatData.find(r=>r.id===n);s?.parent&&e.push(s.parent),n=s?s.parent:void 0}return e.reverse()}connectedCallback(){super.connectedCallback(),this.noAutoLoadMdIcons||document.fonts.load("24px Material Icons","apps").then(()=>{}),this._registerInternalHotkeys()}disconnectedCallback(){super.disconnectedCallback(),this._unregisterInternalHotkeys()}_flattern(t,e){let n=[];return t||(t=[]),t.map(s=>{let r=s.children&&s.children.some(a=>typeof a=="string"),o={...s,parent:s.parent||e};return r||(o.children&&o.children.length&&(e=s.id,n=[...n,...o.children]),o.children=o.children?o.children.map(a=>a.id):[]),o}).concat(n.length?this._flattern(n,e):n)}update(t){t.has("data")&&!this.disableHotkeys&&(this._flatData=this._flattern(this.data),this._flatData.filter(e=>!!e.hotkey).forEach(e=>{Hs(e.hotkey,n=>{n.preventDefault(),e.handler&&e.handler(e)})})),super.update(t)}_registerInternalHotkeys(){this.openHotkey&&Hs(this.openHotkey,t=>{t.preventDefault(),this.visible?this.close():this.open()}),this.selectHotkey&&Hs(this.selectHotkey,t=>{this.visible&&(t.preventDefault(),this._actionSelected(this._actionMatches[this._selectedIndex]))}),this.goBackHotkey&&Hs(this.goBackHotkey,t=>{this.visible&&(this._search||(t.preventDefault(),this._goBack()))}),this.navigationDownHotkey&&Hs(this.navigationDownHotkey,t=>{this.visible&&(t.preventDefault(),this._selectedIndex>=this._actionMatches.length-1?this._selected=this._actionMatches[0]:this._selected=this._actionMatches[this._selectedIndex+1])}),this.navigationUpHotkey&&Hs(this.navigationUpHotkey,t=>{this.visible&&(t.preventDefault(),this._selectedIndex===0?this._selected=this._actionMatches[this._actionMatches.length-1]:this._selected=this._actionMatches[this._selectedIndex-1])}),this.closeHotkey&&Hs(this.closeHotkey,()=>{this.visible&&this.close()})}_unregisterInternalHotkeys(){this.openHotkey&&Hs.unbind(this.openHotkey),this.selectHotkey&&Hs.unbind(this.selectHotkey),this.goBackHotkey&&Hs.unbind(this.goBackHotkey),this.navigationDownHotkey&&Hs.unbind(this.navigationDownHotkey),this.navigationUpHotkey&&Hs.unbind(this.navigationUpHotkey),this.closeHotkey&&Hs.unbind(this.closeHotkey)}_actionFocused(t,e){this._selected=t,e.target.ensureInView()}_onTransitionEnd(){this._bump=!1}_goBack(){let t=this.breadcrumbs.length>1?this.breadcrumbs[this.breadcrumbs.length-2]:void 0;this.setParent(t)}render(){let t={bump:this._bump,"modal-content":!0},e={visible:this.visible,modal:!0},s=this._flatData.filter(a=>{var l;
383let c=new RegExp(this._search,"gi"),u=a.title.match(c)||((l=a.keywords)===null||l===void 0?void 0:l.match(c));return(!this._currentRoot&&this._search||a.parent===this._currentRoot)&&u}).reduce((a,l)=>a.set(l.section,[...a.get(l.section)||[],l]),new Map);this._actionMatches=[...s.values()].flat(),this._actionMatches.length>0&&this._selectedIndex===-1&&(this._selected=this._actionMatches[0]),this._actionMatches.length===0&&(this._selected=void 0);let r=a=>Tr` ${LK(a,l=>l.id,l=>{var c;return Tr`<ninja-action
384            exportparts="ninja-action,ninja-selected,ninja-icon"
385            .selected=${NK(l.id===((c=this._selected)===null||c===void 0?void 0:c.id))}
386            .hotKeysJoinedView=${this.hotKeysJoinedView}
387            @mouseover=${u=>this._actionFocused(l,u)}
388            @actionsSelected=${u=>this._actionSelected(u.detail)}
389            .action=${l}
390          ></ninja-action>`})}`,o=[];return s.forEach((a,l)=>{let c=l?Tr`<div class="group-header">${l}</div>`:void 0;o.push(Tr`${c}${r(a)}`)}),Tr`
391      <div @click=${this._overlayClick} class=${aw(e)}>
392        <div class=${aw(t)} @animationend=${this._onTransitionEnd}>
393          <ninja-header
394            exportparts="ninja-input,ninja-input-wrapper"
395            ${WA(this._headerRef)}
396            .placeholder=${this.placeholder}
397            .hideBreadcrumbs=${this.hideBreadcrumbs}
398            .breadcrumbs=${this.breadcrumbs}
399            @change=${this._handleInput}
400            @setParent=${a=>this.setParent(a.detail.parent)}
401            @close=${this.close}
402          >
403          </ninja-header>
404          <div class="modal-body">
405            <div class="actions-list" part="actions-list">${o}</div>
406          </div>
407          <slot name="footer"> ${hJ} </slot>
408        </div>
409      </div>
410    `}get _selectedIndex(){return this._selected?this._actionMatches.indexOf(this._selected):-1}_actionSelected(t){var e;if(this.dispatchEvent(new CustomEvent("selected",{detail:{search:this._search,action:t},bubbles:!0,composed:!0})),!!t){if(t.children&&((e=t.children)===null||e===void 0?void 0:e.length)>0&&(this._currentRoot=t.id,this._search=""),this._headerRef.value.setSearch(""),this._headerRef.value.focusSearch(),t.handler){let n=t.handler(t);n?.keepOpen||this.close()}this._bump=!0}}async _handleInput(t){this._search=t.detail.search,await this.updateComplete,this.dispatchEvent(new CustomEvent("change",{detail:{search:this._search,actions:this._actionMatches},bubbles:!0,composed:!0}))}_overlayClick(t){var e;!((e=t.target)===null||e===void 0)&&e.classList.contains("modal")&&this.close()}};Rs.styles=[fJ];er([ks({type:String})],Rs.prototype,"placeholder",void 0);er([ks({type:Boolean})],Rs.prototype,"disableHotkeys",void 0);er([ks({type:Boolean})],Rs.prototype,"hideBreadcrumbs",void 0);er([ks()],Rs.prototype,"openHotkey",void 0);er([ks()],Rs.prototype,"navigationUpHotkey",void 0);er([ks()],Rs.prototype,"navigationDownHotkey",void 0);er([ks()],Rs.prototype,"closeHotkey",void 0);er([ks()],Rs.prototype,"goBackHotkey",void 0);er([ks()],Rs.prototype,"selectHotkey",void 0);er([ks({type:Boolean})],Rs.prototype,"hotKeysJoinedView",void 0);er([ks({type:Boolean})],Rs.prototype,"noAutoLoadMdIcons",void 0);er([ks({type:Array,hasChanged(){return!0}})],Rs.prototype,"data",void 0);er([Xu()],Rs.prototype,"visible",void 0);er([Xu()],Rs.prototype,"_bump",void 0);er([Xu()],Rs.prototype,"_actionMatches",void 0);er([Xu()],Rs.prototype,"_search",void 0);er([Xu()],Rs.prototype,"_currentRoot",void 0);er([Xu()],Rs.prototype,"_flatData",void 0);er([Xu()],Rs.prototype,"breadcrumbs",null);er([Xu()],Rs.prototype,"_selected",void 0);Rs=er([Ld("ninja-keys")],Rs)});var bJ=uo((nF,iF)=>{(function(i,t){typeof nF=="object"&&typeof iF<"u"?iF.exports=t():typeof define=="function"&&define.amd?define(t):(i=i||self).Tribute=t()})(nF,(function(){"use strict";function i(c,u){if(!(c instanceof u))throw new TypeError("Cannot call a class as a function")}function t(c,u){for(var h=0;h<u.length;h++){var d=u[h];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(c,d.key,d)}}function e(c,u,h){return u&&t(c.prototype,u),h&&t(c,h),c}function n(c,u){return(function(h){if(Array.isArray(h))return h})(c)||(function(h,d){if(Symbol.iterator in Object(h)||Object.prototype.toString.call(h)==="[object Arguments]"){var p=[],g=!0,y=!1,x=void 0;try{for(var w,M=h[Symbol.iterator]();!(g=(w=M.next()).done)&&(p.push(w.value),!d||p.length!==d);g=!0);}catch(A){y=!0,x=A}finally{try{g||M.return==null||M.return()}finally{if(y)throw x}}return p}}
410)(c,u)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")})()}if(Array.prototype.find||(Array.prototype.find=function(c){if(this===null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof c!="function")throw new TypeError("predicate must be a function");for(var u,h=Object(this),d=h.length>>>0,p=arguments[1],g=0;g<d;g++)if(u=h[g],c.call(p,u,g,h))return u}),window&&typeof window.CustomEvent!="function"){var s=function(c,u){u=u||{bubbles:!1,cancelable:!1,detail:void 0};var h=document.createEvent("CustomEvent");return h.initCustomEvent(c,u.bubbles,u.cancelable,u.detail),h};window.Event!==void 0&&(s.prototype=window.Event.prototype),window.CustomEvent=s}var r=(function(){function c(u){i(this,c),this.tribute=u,this.tribute.events=this}return e(c,[{key:"bind",value:function(u){u.boundKeydown=this.keydown.bind(u,this),u.boundKeyup=this.keyup.bind(u,this),u.boundInput=this.input.bind(u,this),u.addEventListener("keydown",u.boundKeydown,!1),u.addEventListener("keyup",u.boundKeyup,!1),u.addEventListener("input",u.boundInput,!1)}},{key:"unbind",value:function(u){u.removeEventListener("keydown",u.boundKeydown,!1),u.removeEventListener("keyup",u.boundKeyup,!1),u.removeEventListener("input",u.boundInput,!1),delete u.boundKeydown,delete u.boundKeyup,delete u.boundInput}},{key:"keydown",value:function(u,h){u.shouldDeactivate(h)&&(u.tribute.isActive=!1,u.tribute.hideMenu());var d=this;u.commandEvent=!1,c.keys().forEach((function(p){p.key===h.keyCode&&(u.commandEvent=!0,u.callbacks()[p.value.toLowerCase()](h,d))}))}},{key:"input",value:function(u,h){u.inputEvent=!0,u.keyup.call(this,u,h)}},{key:"click",value:function(u,h){var d=u.tribute;if(d.menu&&d.menu.contains(h.target)){var p=h.target;for(h.preventDefault(),h.stopPropagation();p.nodeName.toLowerCase()!=="li";)if(!(p=p.parentNode)||p===d.menu)throw new Error("cannot find the <li> container for the click");d.selectItemAtIndex(p.getAttribute("data-index"),h),d.hideMenu()}else d.current.element&&!d.current.externalTrigger&&(d.current.externalTrigger=!1,setTimeout((function(){return d.hideMenu()})))}},{key:"keyup",value:function(u,h){if(u.inputEvent&&(u.inputEvent=!1),u.updateSelection(this),h.keyCode!==27){if(!u.tribute.allowSpaces&&u.tribute.hasTrailingSpace)return u.tribute.hasTrailingSpace=!1,u.commandEvent=!0,void u.callbacks().space(h,this);if(!u.tribute.isActive)if(u.tribute.autocompleteMode)u.callbacks().triggerChar(h,this,"");else{var d=u.getKeyCode(u,this,h);if(isNaN(d)||!d)return;var p=u.tribute.triggers().find((function(g){return g.charCodeAt(0)===d}));p!==void 0&&u.callbacks().triggerChar(h,this,p)}u.tribute.current.mentionText.length<u.tribute.current.collection.menuShowMinLength||((u.tribute.current.trigger||u.tribute.autocompleteMode)&&u.commandEvent===!1||u.tribute.isActive&&h.keyCode===8)&&u.tribute.showMenuFor(this,!0)}}},{key:"shouldDeactivate",value:function(u){if(!this.tribute.isActive)return!1;if(this.tribute.current.mentionText.length===0){var h=!1;return c.keys().forEach((function(d){u.keyCode===d.key&&(h=!0)})),!h}return!1}},{key:"getKeyCode",value:function(u,h,d){var p=u.tribute,g=p.range.getTriggerInfo(!1,p.hasTrailingSpace,!0,p.allowSpaces,p.autocompleteMode);return!!g&&g.mentionTriggerChar.charCodeAt(0)}},{key:"updateSelection",value:function(u){this.tribute.current.element=u;var h=this.tribute.range.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);h&&(this.tribute.current.selectedPath=h.mentionSelectedPath,this.tribute.current.mentionText=h.mentionText,this.tribute.current.selectedOffset=h.mentionSelectedOffset)}},{key:"callbacks",value:function(){var u=this;return{triggerChar:function(h,d,p){var g=u.tribute;g.current.trigger=p;var y=g.collection.find((function(x){return x.trigger===p}));g.current.collection=y,g.current.mentionText.length>=g.current.collection.menuShowMinLength&&g.inputEvent&&g.showMenuFor(d,!0)},enter:function(h,d){u.tribute.isActive&&u.tribute.current.filteredItems&&(h.preventDefault(),h.stopPropagation(),setTimeout((function(){u.tribute.selectItemAtIndex(u.tribute.menuSelected,h),u.tribute.hideMenu()}),0))},escape:function(h,d){u.tribute.isActive&&(h.preventDefault(),h.stopPropagation(),u.tribute.isActive=!1,u.tribute.hideMenu())},tab:function(h,d){u.callbacks().enter(h,d)},space:function(h,d){u.tribute.isActive&&(u.tribute.spaceSelectsMat
vendor: 5,121 bytes, lines 410-415
410ch?u.callbacks().enter(h,d):u.tribute.allowSpaces||(h.stopPropagation(),setTimeout((function(){u.tribute.hideMenu(),u.tribute.isActive=!1}),0)))},up:function(h,d){if(u.tribute.isActive&&u.tribute.current.filteredItems){h.preventDefault(),h.stopPropagation();var p=u.tribute.current.filteredItems.length,g=u.tribute.menuSelected;p>g&&g>0?(u.tribute.menuSelected--,u.setActiveLi()):g===0&&(u.tribute.menuSelected=p-1,u.setActiveLi(),u.tribute.menu.scrollTop=u.tribute.menu.scrollHeight)}},down:function(h,d){if(u.tribute.isActive&&u.tribute.current.filteredItems){h.preventDefault(),h.stopPropagation();var p=u.tribute.current.filteredItems.length-1,g=u.tribute.menuSelected;p>g?(u.tribute.menuSelected++,u.setActiveLi()):p===g&&(u.tribute.menuSelected=0,u.setActiveLi(),u.tribute.menu.scrollTop=0)}},delete:function(h,d){u.tribute.isActive&&u.tribute.current.mentionText.length<1?u.tribute.hideMenu():u.tribute.isActive&&u.tribute.showMenuFor(d)}}}},{key:"setActiveLi",value:function(u){var h=this.tribute.menu.querySelectorAll("li"),d=h.length>>>0;u&&(this.tribute.menuSelected=parseInt(u));for(var p=0;p<d;p++){var g=h[p];if(p===this.tribute.menuSelected){g.classList.add(this.tribute.current.collection.selectClass);var y=g.getBoundingClientRect(),x=this.tribute.menu.getBoundingClientRect();if(y.bottom>x.bottom){var w=y.bottom-x.bottom;this.tribute.menu.scrollTop+=w}else if(y.top<x.top){var M=x.top-y.top;this.tribute.menu.scrollTop-=M}}else g.classList.remove(this.tribute.current.collection.selectClass)}}},{key:"getFullHeight",value:function(u,h){var d=u.getBoundingClientRect().height;if(h){var p=u.currentStyle||window.getComputedStyle(u);return d+parseFloat(p.marginTop)+parseFloat(p.marginBottom)}return d}}],[{key:"keys",value:function(){return[{key:9,value:"TAB"},{key:8,value:"DELETE"},{key:13,value:"ENTER"},{key:27,value:"ESCAPE"},{key:32,value:"SPACE"},{key:38,value:"UP"},{key:40,value:"DOWN"}]}}]),c})(),o=(function(){function c(u){i(this,c),this.tribute=u,this.tribute.menuEvents=this,this.menu=this.tribute.menu}return e(c,[{key:"bind",value:function(u){var h=this;this.menuClickEvent=this.tribute.events.click.bind(null,this),this.menuContainerScrollEvent=this.debounce((function(){h.tribute.isActive&&h.tribute.showMenuFor(h.tribute.current.element,!1)}),300,!1),this.windowResizeEvent=this.debounce((function(){h.tribute.isActive&&h.tribute.range.positionMenuAtCaret(!0)}),300,!1),this.tribute.range.getDocument().addEventListener("MSPointerDown",this.menuClickEvent,!1),this.tribute.range.getDocument().addEventListener("mousedown",this.menuClickEvent,!1),window.addEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.addEventListener("scroll",this.menuContainerScrollEvent,!1):window.addEventListener("scroll",this.menuContainerScrollEvent)}},{key:"unbind",value:function(u){this.tribute.range.getDocument().removeEventListener("mousedown",this.menuClickEvent,!1),this.tribute.range.getDocument().removeEventListener("MSPointerDown",this.menuClickEvent,!1),window.removeEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.removeEventListener("scroll",this.menuContainerScrollEvent,!1):window.removeEventListener("scroll",this.menuContainerScrollEvent)}},{key:"debounce",value:function(u,h,d){var p,g=arguments,y=this;return function(){var x=y,w=g,M=d&&!p;clearTimeout(p),p=setTimeout((function(){p=null,d||u.apply(x,w)}),h),M&&u.apply(x,w)}}}]),c})(),a=(function(){function c(u){i(this,c),this.tribute=u,this.tribute.range=this}return e(c,[{key:"getDocument",value:function(){var u;return this.tribute.current.collection&&(u=this.tribute.current.collection.iframe),u?u.contentWindow.document:document}},{key:"positionMenuAtCaret",value:function(u){var h,d=this,p=this.tribute.current,g=this.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(g!==void 0){if(!this.tribute.positionMenu)return void(this.tribute.menu.style.cssText="display: block;");h=this.isContentEditable(p.element)?this.getContentEditableCaretPosition(g.mentionPosition):this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,g.mentionPosition),this.tribute.menu.style.cssText="top: ".concat(h.top,`px;
411                                     left: `).concat(h.left,`px;
412                                     right: `).concat(h.right,`px;
413                                     bottom: `).concat(h.bottom,`px;
414                                     position: absolute;
415                                     display: block;`),h.left==="auto"&&(this.tribute.menu.style.left="auto"),h.top==="auto"&&(this.tribute.menu.style.top="auto"),u&&this.scrollIntoView(),window.setTimeout((function(){var y={width:d.tribute.menu.offsetWidth,height:d.tribute.menu.offsetHeight},x=d.isMenuOffScreen(h,y),w=window.innerWidth>y.width&&(x.left||x.right),M=window.innerHeight>y.height&&(x.top||x.bottom);(w||M)&&(d.tribute.menu.style.cssText="display: none",d.positionMenuAtCaret(u))}),0)}else this.tribute.menu.style.cssText="display: none"}},{key:"selectElement",value:function(u,h,d){var p,g=u;if(h)for(var y=0;
415y<h.length;y++){if((g=g.childNodes[h[y]])===void 0)return;for(;g.length<d;)d-=g.length,g=g.nextSibling;g.childNodes.length!==0||g.length||(g=g.previousSibling)}var x=this.getWindowSelection();(p=this.getDocument().createRange()).setStart(g,d),p.setEnd(g,d),p.collapse(!0);try{x.removeAllRanges()}catch{}x.addRange(p),u.focus()}},{key:"replaceTriggerText",value:function(u,h,d,p,g){var y=this.getTriggerInfo(!0,d,h,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(y!==void 0){var x=this.tribute.current,w=new CustomEvent("tribute-replaced",{detail:{item:g,instance:x,context:y,event:p}});if(this.isContentEditable(x.element)){u+=typeof this.tribute.replaceTextSuffix=="string"?this.tribute.replaceTextSuffix:"\xA0";var M=y.mentionPosition+y.mentionText.length;this.tribute.autocompleteMode||(M+=y.mentionTriggerChar.length),this.pasteHtml(u,y.mentionPosition,M)}else{var A=this.tribute.current.element,C=typeof this.tribute.replaceTextSuffix=="string"?this.tribute.replaceTextSuffix:" ";u+=C;var R=y.mentionPosition,k=y.mentionPosition+y.mentionText.length+C.length;this.tribute.autocompleteMode||(k+=y.mentionTriggerChar.length-1),A.value=A.value.substring(0,R)+u+A.value.substring(k,A.value.length),A.selectionStart=R+u.length,A.selectionEnd=R+u.length}x.element.dispatchEvent(new CustomEvent("input",{bubbles:!0})),x.element.dispatchEvent(w)}}},{key:"pasteHtml",value:function(u,h,d){var p,g;g=this.getWindowSelection(),(p=this.getDocument().createRange()).setStart(g.anchorNode,h),p.setEnd(g.anchorNode,d),p.deleteContents();var y=this.getDocument().createElement("div");y.innerHTML=u;for(var x,w,M=this.getDocument().createDocumentFragment();x=y.firstChild;)w=M.appendChild(x);p.insertNode(M),w&&((p=p.cloneRange()).setStartAfter(w),p.collapse(!0),g.removeAllRanges(),g.addRange(p))}},{key:"getWindowSelection",value:function(){return this.tribute.collection.iframe?this.tribute.collection.iframe.contentWindow.getSelection():window.getSelection()}},{key:"getNodePositionInParent",value:function(u){if(u.parentNode===null)return 0;for(var h=0;h<u.parentNode.childNodes.length;h++)if(u.parentNode.childNodes[h]===u)return h}},{key:"getContentEditableSelectedPath",value:function(u){var h=this.getWindowSelection(),d=h.anchorNode,p=[];if(d!=null){for(var g,y=d.contentEditable;d!==null&&y!=="true";)g=this.getNodePositionInParent(d),p.push(g),(d=d.parentNode)!==null&&(y=d.contentEditable);return p.reverse(),{selected:d,path:p,offset:h.getRangeAt(0).startOffset}}}},{key:"getTextPrecedingCurrentSelection",value:function(){var u=this.tribute.current,h="";if(this.isContentEditable(u.element)){var d=this.getWindowSelection().anchorNode;if(d!=null){var p=d.textContent,g=this.getWindowSelection().getRangeAt(0).startOffset;p&&g>=0&&(h=p.substring(0,g))}}else{var y=this.tribute.current.element;if(y){var x=y.selectionStart;y.value&&x>=0&&(h=y.value.substring(0,x))}}return h}},{key:"getLastWordInText",value:function(u){var h=(u=u.replace(/\u00A0/g," ")).split(/\s+/);return h[h.length-1].trim()}},{key:"getTriggerInfo",value:function(u,h,d,p,g){var y,x,w,M=this,A=this.tribute.current;if(this.isContentEditable(A.element)){var C=this.getContentEditableSelectedPath(A);C&&(y=C.selected,x=C.path,w=C.offset)}else y=this.tribute.current.element;var R=this.getTextPrecedingCurrentSelection(),k=this.getLastWordInText(R);if(g)return{mentionPosition:R.length-k.length,mentionText:k,mentionSelectedElement:y,mentionSelectedPath:x,mentionSelectedOffset:w};if(R!=null){var O,I=-1;if(this.tribute.collection.forEach((function(j){var W=j.trigger,_=j.requireLeadingSpace?M.lastIndexWithLeadingSpace(R,W):R.lastIndexOf(W);_>I&&(I=_,O=W,d=j.requireLeadingSpace)})),I>=0&&(I===0||!d||/[\xA0\s]/g.test(R.substring(I-1,I)))){var U=R.substring(I+O.length,R.length);O=R.substring(I,I+O.length);var V=U.substring(0,1),q=U.length>0&&(V===" "||V==="\xA0");h&&(U=U.trim());var X=p?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=X.test(U),!q&&(u||!X.test(U)))return{mentionPosition:I,mentionText:U,mentionSelectedElement:y,mentionSelectedPath:x,mentionSelectedOffset:w,mentionTriggerChar:O}}}}},{key:"lastIndexWithLeadingSpace",value:function(u,h){for(var d=u.split("").reverse().join(""),p=-1,g=0,y=u.length;g<y;g++){for(var x=g===u.length-1,w=/\s/.test(d[g+1]),M=!0,A=h.length-1;A>=0;A--)if(h[A]!==d[g-A]){M=!1;break}if(M&&(x||w)){p=u.length-1-g;break}}return p}},{key:"isContentEditable",value:function(u){return u.nodeName!=="INPUT"&&u.nodeName!=="TEXTAREA"}},{key:"isMenuOffScreen",value:function(u,h){var d=window.innerWidth,p=window.innerHeight,g=document.documentElement,y=(window.pageXOffset||g.scrollLeft)-(g.clientLeft||0),x=(window.pageYOffset||g.scrollTop)-(g.clientTop||0),w=typeof u.top=="number"?u.top:x+p-u.bottom-h.height,M=typeof u.right=="number"?u.right:u.left+h.width,A=typeof u.bottom=="number"?u.bottom:u.top+h.height,C=typeof u.left=="number"?u.left:y+d-u.right-h.width;return{top:w<Math.floor(x),right:M>Math.ceil(y+d),bottom:A>
415Math.ceil(x+p),left:C<Math.floor(y)}}},{key:"getMenuDimensions",value:function(){var u={width:null,height:null};return this.tribute.menu.style.cssText=`top: 0px;
416                                 left: 0px;
417                                 position: fixed;
418                                 display: block;
419                                 visibility; hidden;`,u.width=this.tribute.menu.offsetWidth,u.height=this.tribute.menu.offsetHeight,this.tribute.menu.style.cssText="display: none;",u}},{key:"getTextAreaOrInputUnderlinePosition",value:function(u,h,d){var p=window.mozInnerScreenX!==null,g=this.getDocument().createElement("div");g.id="input-textarea-caret-position-mirror-div",this.getDocument().body.appendChild(g);var y=g.style,x=window.getComputedStyle?getComputedStyle(u):u.currentStyle;y.whiteSpace="pre-wrap",u.nodeName!=="INPUT"&&(y.wordWrap="break-word"),y.position="absolute",y.visibility="hidden",["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"].forEach((function(_){y[_]=x[_]})),p?(y.width="".concat(parseInt(x.width)-2,"px"),u.scrollHeight>parseInt(x.height)&&(y.overflowY="scroll")):y.overflow="hidden",g.textContent=u.value.substring(0,h),u.nodeName==="INPUT"&&(g.textContent=g.textContent.replace(/\s/g,"\xA0"));var w=this.getDocument().createElement("span");w.textContent=u.value.substring(h)||".",g.appendChild(w);var M=u.getBoundingClientRect(),A=document.documentElement,C=(window.pageXOffset||A.scrollLeft)-(A.clientLeft||0),R=(window.pageYOffset||A.scrollTop)-(A.clientTop||0),k=0,O=0;this.menuContainerIsBody&&(k=M.top,O=M.left);var I={top:k+R+w.offsetTop+parseInt(x.borderTopWidth)+parseInt(x.fontSize)-u.scrollTop,left:O+C+w.offsetLeft+parseInt(x.borderLeftWidth)},U=window.innerWidth,V=window.innerHeight,q=this.getMenuDimensions(),X=this.isMenuOffScreen(I,q);X.right&&(I.right=U-I.left,I.left="auto");var j=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(X.bottom){var W=j-(V-(this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect()).top);I.bottom=W+(V-M.top-w.offsetTop),I.top="auto"}return(X=this.isMenuOffScreen(I,q)).left&&(I.left=U>
419q.width?C+U-q.width:C,delete I.right),X.top&&(I.top=V>q.height?R+V-q.height:R,delete I.bottom),this.getDocument().body.removeChild(g),I}},{key:"getContentEditableCaretPosition",value:function(u){var h,d=this.getWindowSelection();(h=this.getDocument().createRange()).setStart(d.anchorNode,u),h.setEnd(d.anchorNode,u),h.collapse(!1);var p=h.getBoundingClientRect(),g=document.documentElement,y=(window.pageXOffset||g.scrollLeft)-(g.clientLeft||0),x=(window.pageYOffset||g.scrollTop)-(g.clientTop||0),w={left:p.left+y,top:p.top+p.height+x},M=window.innerWidth,A=window.innerHeight,C=this.getMenuDimensions(),R=this.isMenuOffScreen(w,C);R.right&&(w.left="auto",w.right=M-p.left-y);var k=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(R.bottom){var O=k-(A-(this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect()).top);w.top="auto",w.bottom=O+(A-p.top)}return(R=this.isMenuOffScreen(w,C)).left&&(w.left=M>C.width?y+M-C.width:y,delete w.right),R.top&&(w.top=A>C.height?x+A-C.height:x,delete w.bottom),this.menuContainerIsBody||(w.left=w.left?w.left-this.tribute.menuContainer.offsetLeft:w.left,w.top=w.top?w.top-this.tribute.menuContainer.offsetTop:w.top),w}},{key:"scrollIntoView",value:function(u){var h,d=this.menu;if(d!==void 0){for(;h===void 0||h.height===0;)if((h=d.getBoundingClientRect()).height===0&&((d=d.childNodes[0])===void 0||!d.getBoundingClientRect))return;var p=h.top,g=p+h.height;if(p<0)window.scrollTo(0,window.pageYOffset+h.top-20);else if(g>window.innerHeight){var y=window.pageYOffset+h.top-20;y-window.pageYOffset>100&&(y=window.pageYOffset+100);var x=window.pageYOffset-(window.innerHeight-g);x>y&&(x=y),window.scrollTo(0,x)}}}},{key:"menuContainerIsBody",get:function(){return this.tribute.menuContainer===document.body||!this.tribute.menuContainer}}]),c})(),l=(function(){function c(u){i(this,c),this.tribute=u,this.tribute.search=this}return e(c,[{key:"simpleFilter",value:function(u,h){var d=this;return h.filter((function(p){return d.test(u,p)}))}},{key:"test",value:function(u,h){return this.match(u,h)!==null}},{key:"match",value:function(u,h,d){d=d||{},h.length;var p=d.pre||"",g=d.post||"",y=d.caseSensitive&&h||h.toLowerCase();if(d.skip)return{rendered:h,score:0};u=d.caseSensitive&&u||u.toLowerCase();var x=this.traverse(y,u,0,0,[]);return x?{rendered:this.render(h,x.cache,p,g),score:x.score}:null}},{key:"traverse",value:function(u,h,d,p,g){if(h.length===p)return{score:this.calculateScore(g),cache:g.slice()};if(!(u.length===d||h.length-p>u.length-d)){for(var y,x,w=h[p],M=u.indexOf(w,d);M>-1;){if(g.push(M),x=this.traverse(u,h,M+1,p+1,g),g.pop(),!x)return y;(!y||y.score<x.score)&&(y=x),M=u.indexOf(w,M+1)}return y}}},{key:"calculateScore",value:function(u){var h=0,d=1;return u.forEach((function(p,g){g>0&&(u[g-1]+1===p?d+=d+1:d=1),h+=d})),h}},{key:"render",value:function(u,h,d,p){var g=u.substring(0,h[0]);return h.forEach((function(y,x){g+=d+u[y]+p+u.substring(y+1,h[x+1]?h[x+1]:u.length)})),g}},{key:"filter",value:function(u,h,d){var p=this;return d=d||{},h.reduce((function(g,y,x,w){var M=y;d.extract&&((M=d.extract(y))||(M=""));var A=p.match(u,M,d);return A!=null&&(g[g.length]={string:A.rendered,score:A.score,index:x,original:y}),g}),[]).sort((function(g,y){var x=y.score-g.score;return x||g.index-y.index}))}}]),c})();return(function(){function c(u){var h,d=this,p=u.values,g=p===void 0?null:p,y=u.iframe,x=y===void 0?null:y,w=u.selectClass,M=w===void 0?"highlight":w,A=u.containerClass,C=A===void 0?"tribute-container":A,R=u.itemClass,k=R===void 0?"":R,O=u.trigger,I=O===void 0?"@":O,U=u.autocompleteMode,V=U!==void 0&&U,q=u.selectTemplate,X=q===void 0?null:q,j=u.menuItemTemplate,W=j===void 0?null:j,_=u.lookup,at=_===void 0?"key":_,ct=u.fillAttr,pt=ct===void 0?"value":ct,Et=u.collection,vt=Et===void 0?null:Et,yt=u.menuContainer,kt=yt===void 0?null:yt,Wt=u.noMatchTemplate,jt=Wt===void 0?null:Wt,ae=u.requireLeadingSpace,ee=ae===void 0||ae,Bt=u.allowSpaces,Gt=Bt!==void 0&&Bt,Qt=u.replaceTextSuffix,xe=Qt===void 0?null:Qt,Ut=u.positionMenu,zt=Ut===void 0||Ut,St=u.spaceSelectsMat
419ch,it=St!==void 0&&St,gt=u.searchOpts,ft=gt===void 0?{}:gt,de=u.menuItemLimit,ve=de===void 0?null:de,we=u.menuShowMinLength,Ae=we===void 0?0:we;if(i(this,c),this.autocompleteMode=V,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=kt,this.allowSpaces=Gt,this.replaceTextSuffix=xe,this.positionMenu=zt,this.hasTrailingSpace=!1,this.spaceSelectsMatch=it,this.autocompleteMode&&(I="",Gt=!1),g)this.collection=[{trigger:I,iframe:x,selectClass:M,containerClass:C,itemClass:k,selectTemplate:(X||c.defaultSelectTemplate).bind(this),menuItemTemplate:(W||c.defaultMenuItemTemplate).bind(this),noMatchTemplate:(h=jt,typeof h=="string"?h.trim()===""?null:h:typeof h=="function"?h.bind(d):jt||function(){return"<li>No Match Found!</li>"}.bind(d)),lookup:at,fillAttr:pt,values:g,requireLeadingSpace:ee,searchOpts:ft,menuItemLimit:ve,menuShowMinLength:Ae}];else{if(!vt)throw new Error("[Tribute] No collection specified.");this.autocompleteMode&&console.warn("Tribute in autocomplete mode does not work for collections"),this.collection=vt.map((function(Ue){return{trigger:Ue.trigger||I,iframe:Ue.iframe||x,selectClass:Ue.selectClass||M,containerClass:Ue.containerClass||C,itemClass:Ue.itemClass||k,selectTemplate:(Ue.selectTemplate||c.defaultSelectTemplate).bind(d),menuItemTemplate:(Ue.menuItemTemplate||c.defaultMenuItemTemplate).bind(d),noMatchTemplate:(function(en){return typeof en=="string"?en.trim()===""?null:en:typeof en=="function"?en.bind(d):jt||function(){return"<li>No Match Found!</li>"}.bind(d)})(jt),lookup:Ue.lookup||at,fillAttr:Ue.fillAttr||pt,values:Ue.values,requireLeadingSpace:Ue.requireLeadingSpace,searchOpts:Ue.searchOpts||ft,menuItemLimit:Ue.menuItemLimit||ve,menuShowMinLength:Ue.menuShowMinLength||Ae}}))}new a(this),new r(this),new o(this),new l(this)}return e(c,[{key:"triggers",value:function(){return this.collection.map((function(u){return u.trigger}))}},{key:"attach",value:function(u){if(!u)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if(typeof jQuery<"u"&&u instanceof jQuery&&(u=u.get()),u.constructor===NodeList||u.constructor===HTMLCollection||u.constructor===Array)for(var h=u.length,d=0;d<h;++d)this._attach(u[d]);else this._attach(u)}},{key:"_attach",value:function(u){u.hasAttribute("data-tribute")&&console.warn("Tribute was already bound to "+u.nodeName),this.ensureEditable(u),this.events.bind(u),u.setAttribute("data-tribute",!0)}},{key:"ensureEditable",value:function(u){if(c.inputTypes().indexOf(u.nodeName)===-1){if(!u.contentEditable)throw new Error("[Tribute] Cannot bind to "+u.nodeName);u.contentEditable=!0}}},{key:"createMenu",value:function(u){var h=this.range.getDocument().createElement("div"),d=this.range.getDocument().createElement("ul");return h.className=u,h.appendChild(d),this.menuContainer?this.menuContainer.appendChild(h):this.range.getDocument().body.appendChild(h)}},{key:"showMenuFor",value:function(u,h){var d=this;if(!this.isActive||this.current.element!==u||this.current.mentionText!==this.currentMentionTextSnapshot){this.currentMentionTextSnapshot=this.current.mentionText,this.menu||(this.menu=this.createMenu(this.current.collection.containerClass),u.tributeMenu=this.menu,this.menuEvents.bind(this.menu)),this.isActive=!0,this.menuSelected=0,this.current.mentionText||(this.current.mentionText="");var p=function(g){if(d.isActive){var y=d.search.filter(d.current.mentionText,g,{pre:d.current.collection.searchOpts.pre||"<span>",post:d.current.collection.searchOpts.post||"</span>",skip:d.current.collection.searchOpts.skip,extract:function(A){if(typeof d.current.collection.lookup=="string")return A[d.current.collection.lookup];if(typeof d.current.collection.lookup=="function")return d.current.collection.lookup(A,d.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});d.current.collection.menuItemLimit&&(y=y.slice(0,d.current.collection.menuItemLimit)),d.current.filteredItems=y;var x=d.menu.querySelector("ul");if(d.range.positionMenuAtCaret(h),!y.length){var w=new CustomEvent("tribute-no-match",{detail:d.menu});return d.current.element.dispatchEvent(w),void(typeof d.current.collection.noMatchTemplate=="function"&&!d.current.collection.noMatchTemplate()||!d.current.collection.noMatchTemplate?d.hideMenu():typeof d.current.collection.noMatchTemplate=="function"?x.innerHTML=d.current.collection.noMatchTemplate():x.innerHTML=d.current.collection.noMatchTemplate)}x.innerHTML="";var M=d.range.getDocument().createDocumentFragment();
419y.forEach((function(A,C){var R=d.range.getDocument().createElement("li");R.setAttribute("data-index",C),R.className=d.current.collection.itemClass,R.addEventListener("mousemove",(function(k){var O=n(d._findLiTarget(k.target),2),I=(O[0],O[1]);k.movementY!==0&&d.events.setActiveLi(I)})),d.menuSelected===C&&R.classList.add(d.current.collection.selectClass),R.innerHTML=d.current.collection.menuItemTemplate(A),M.appendChild(R)})),x.appendChild(M)}};typeof this.current.collection.values=="function"?this.current.collection.values(this.current.mentionText,p):p(this.current.collection.values)}}},{key:"_findLiTarget",value:function(u){if(!u)return[];var h=u.getAttribute("data-index");return h?[u,h]:this._findLiTarget(u.parentNode)}},{key:"showMenuForCollection",value:function(u,h){u!==document.activeElement&&this.placeCaretAtEnd(u),this.current.collection=this.collection[h||0],this.current.externalTrigger=!0,this.current.element=u,u.isContentEditable?this.insertTextAtCursor(this.current.collection.trigger):this.insertAtCaret(u,this.current.collection.trigger),this.showMenuFor(u)}},{key:"placeCaretAtEnd",value:function(u){if(u.focus(),window.getSelection!==void 0&&document.createRange!==void 0){var h=document.createRange();h.selectNodeContents(u),h.collapse(!1);var d=window.getSelection();d.removeAllRanges(),d.addRange(h)}else if(document.body.createTextRange!==void 0){var p=document.body.createTextRange();p.moveToElementText(u),p.collapse(!1),p.select()}}},{key:"insertTextAtCursor",value:function(u){var h,d;(d=(h=window.getSelection()).getRangeAt(0)).deleteContents();var p=document.createTextNode(u);d.insertNode(p),d.selectNodeContents(p),d.collapse(!1),h.removeAllRanges(),h.addRange(d)}},{key:"insertAtCaret",value:function(u,h){var d=u.scrollTop,p=u.selectionStart,g=u.value.substring(0,p),y=u.value.substring(u.selectionEnd,u.value.length);u.value=g+h+y,p+=h.length,u.selectionStart=p,u.selectionEnd=p,u.focus(),u.scrollTop=d}},{key:"hideMenu",value:function(){this.menu&&(this.menu.style.cssText="display: none;",this.isActive=!1,this.menuSelected=0,this.current={})}},{key:"selectItemAtIndex",value:function(u,h){if(typeof(u=parseInt(u))=="number"&&!isNaN(u)){var d=this.current.filteredItems[u],p=this.current.collection.selectTemplate(d);p!==null&&this.replaceText(p,h,d)}}},{key:"replaceText",value:function(u,h,d){this.range.replaceTriggerText(u,!0,!0,h,d)}},{key:"_append",value:function(u,h,d){if(typeof u.values=="function")throw new Error("Unable to append to values, as it is a function.");u.values=d?h:u.values.concat(h)}},{key:"append",value:function(u,h,d){var p=parseInt(u);if(typeof p!="number")throw new Error("please provide an index for the collection to update.");var g=this.collection[p];this._append(g,h,d)}},{key:"appendCurrent",value:function(u,h){if(!this.isActive)throw new Error("No active state. Please use append instead and pass an index.");this._append(this.current.collection,u,h)}},{key:"detach",value:function(u){if(!u)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if(typeof jQuery<"u"&&u instanceof jQuery&&(u=u.get()),u.constructor===NodeList||u.constructor===HTMLCollection||u.constructor===Array)for(var h=u.length,d=0;d<h;++d)this._detach(u[d]);else this._detach(u)}},{key:"_detach",value:function(u){var h=this;this.events.unbind(u),u.tributeMenu&&this.menuEvents.unbind(u.tributeMenu),setTimeout((function(){u.removeAttribute("data-tribute"),h.isActive=!1,u.tributeMenu&&u.tributeMenu.remove()}))}},{key:"isActive",get:function(){return this._isActive},set:function(u){if(this._isActive!=u&&(this._isActive=u,this.current.element)){var h=new CustomEvent("tribute-active-".concat(u));this.current.element.dispatchEvent(h)}}}],[{key:"defaultSelectTemplate",value:function(u){return u===void 0?"".concat(this.current.collection.trigger).concat(this.current.mentionText):this.range.isContentEditable(this.current.element)?'<span class="tribute-mention">'+(this.current.collection.trigger+u.original[this.current.collection.fillAttr])+"</span>":this.current.collection.trigger+u.original[this.current.collection.fillAttr]}},{key:"defaultMenuItemTemplate",value:function(u){return u.string}},{key:"inputTypes",value:function(){return["TEXTAREA","INPUT"]}}]),c})()}))});function VEt(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}function Rb(i,t){return new HEt[i](t)}function ktt(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Ob(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function FU(){let i=Ob("canvas");return i.style.display="block",i}function Ptt(i){Qd=i}function Rtt(){return Qd}function Nb(...i){let t="THREE."+i.shift();Qd?Qd("log",t,...i):console.log(t,...i)}function Dtt(i){let t=i[0];if(typeof t=="string"&&t.startsWith("TSL:")){let e=i[1];e&&e.isStackTrace?i[0]+=" "+e.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}
vendor: 5,443 bytes, line 419
419function Ze(...i){i=Dtt(i);let t="THREE."+i.shift();if(Qd)Qd("warn",t,...i);else{let e=i[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...i)}}function Tn(...i){i=Dtt(i);let t="THREE."+i.shift();if(Qd)Qd("error",t,...i);else{let e=i[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...i)}}function su(...i){let t=i.join(" ");t in EZ||(EZ[t]=!0,Ze(...i))}function Ltt(i,t,e){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(t,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,e);break;default:n()}}setTimeout(r,e)})}function Ha(){let i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(mo[i&255]+mo[i>>8&255]+mo[i>>16&255]+mo[i>>24&255]+"-"+mo[t&255]+mo[t>>8&255]+"-"+mo[t>>16&15|64]+mo[t>>24&255]+"-"+mo[e&63|128]+mo[e>>8&255]+"-"+mo[e>>16&255]+mo[e>>24&255]+mo[n&255]+mo[n>>8&255]+mo[n>>16&255]+mo[n>>24&255]).toLowerCase()}function Bn(i,t,e){return Math.max(t,Math.min(e,i))}function UU(i,t){return(i%t+t)%t}function jEt(i,t,e,n,s){return n+(i-t)*(s-n)/(e-t)}function WEt(i,t,e){return i!==t?(e-i)/(t-i):0}function Gw(i,t,e){return(1-e)*i+e*t}function $Et(i,t,e,n){return Gw(i,t,1-Math.exp(-e*n))}function GEt(i,t=1){return t-Math.abs(UU(i,t*2)-t)}function qEt(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function YEt(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function XEt(i,t){return i+Math.floor(Math.random()*(t-i+1))}function KEt(i,t){return i+Math.random()*(t-i)}function JEt(i){return i*(.5-Math.random())}function ZEt(i){i!==void 0&&(kZ=i);let t=kZ+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function QEt(i){return i*gg}function t2t(i){return i*bg}function e2t(i){return i>0&&Number.isInteger(i)&&2**Math.round(Math.log2(i))===i}function n2t(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function i2t(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function s2t(i,t,e,n,s){let r=Math.cos,o=Math.sin,a=r(e/2),l=o(e/2),c=r((t+n)/2),u=o((t+n)/2),h=r((t-n)/2),d=o((t-n)/2),p=r((n-t)/2),g=o((n-t)/2);switch(s){case"XYX":i.set(a*u,l*h,l*d,a*c);break;case"YZY":i.set(l*d,a*u,l*h,a*c);break;case"ZXZ":i.set(l*h,l*d,a*u,a*c);break;case"XZX":i.set(a*u,l*g,l*p,a*c);break;case"YXY":i.set(l*p,a*u,l*g,a*c);break;case"ZYZ":i.set(l*g,l*p,a*u,a*c);break;default:Ze("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function Yo(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:case Uint8ClampedArray:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Jn(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function r2t(){let i={enabled:!0,workingColorSpace:wo,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===Fi&&(s.r=lh(s.r),s.g=lh(s.g),s.b=lh(s.b)),this.spaces[r].primaries!==this.spaces[o].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Fi&&(s.r=Db(s.r),s.g=Db(s.g),s.b=Db(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===fu?Ib:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,o){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return su("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return su("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(s,r)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[wo]:{primaries:t,whitePoint:n,transfer:Ib,toXYZ:RZ,fromXYZ:DZ,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Zn},outputColorSpaceConfig:{drawingBufferColorSpace:Zn}},[Zn]:{primaries:t,whitePoint:n,transfer:Fi,toXYZ:RZ,fromXYZ:DZ,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Zn}}}),i}function lh(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}
vendor: 9,273 bytes, line 419
419function Db(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}function c4(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?i1.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Ze("Texture: Unable to serialize Texture."),{})}function d4(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}function x4(i,t,e,n,s){for(let r=0,o=i.length-3;r<=o;r+=3){sg.fromArray(i,r);let a=s.x*Math.abs(sg.x)+s.y*Math.abs(sg.y)+s.z*Math.abs(sg.z),l=t.dot(sg),c=e.dot(sg),u=n.dot(sg);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}function g2t(){let i=new ArrayBuffer(4),t=new Float32Array(i),e=new Uint32Array(i),n=new Uint32Array(512),s=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,s[l]=24,s[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,s[l]=-c-1,s[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,s[l]=13,s[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,s[l]=24,s[l|256]=24):(n[l]=31744,n[l|256]=64512,s[l]=13,s[l|256]=13)}let r=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,r[l]=c|u}for(let l=1024;l<2048;++l)r[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:t,uint32View:e,baseTable:n,shiftTable:s,mantissaTable:r,exponentTable:o,offsetTable:a}}function va(i){Math.abs(i)>65504&&Ze("DataUtils.toHalfFloat(): Value out of range."),i=Bn(i,-65504,65504),ah.floatView[0]=i;let t=ah.uint32View[0],e=t>>23&511;return ah.baseTable[e]+((t&8388607)>>ah.shiftTable[e])}function Hw(i){let t=i>>10;return ah.uint32View[0]=ah.mantissaTable[ah.offsetTable[t]+(i&1023)]+ah.exponentTable[t],ah.floatView[0]}function NE(i,t,e,n,s,r){Cb.subVectors(i,e).addScalar(.5).multiply(n),s!==void 0?(Ow.x=r*Cb.x-s*Cb.y,Ow.y=s*Cb.x+r*Cb.y):Ow.copy(Cb),i.copy(t),i.x+=Ow.x,i.y+=Ow.y,i.applyMatrix4(Ntt)}function _2t(i,t,e,n,s,r,o,a){let l;if(t.side===Mo?l=n.intersectTriangle(o,r,s,!0,a):l=n.intersectTriangle(s,r,o,t.side===$a,a),l===null)return null;$E.copy(a),$E.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo($E);return c<e.near||c>e.far?null:{distance:c,point:$E.clone(),object:i}}function GE(i,t,e,n,s,r,o,a,l,c){i.getVertexPosition(a,VE),i.getVertexPosition(l,HE),i.getVertexPosition(c,jE);let u=_2t(i,t,e,n,VE,HE,jE,GZ);if(u){let h=new bt;uc.getBarycoord(GZ,VE,HE,jE,h),s&&(u.uv=uc.getInterpolatedAttribute(s,a,l,c,h,new Ce)),r&&(u.uv1=uc.getInterpolatedAttribute(r,a,l,c,h,new Ce)),o&&(u.normal=uc.getInterpolatedAttribute(o,a,l,c,h,new bt),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let d={a,b:l,c,normal:new bt,materialIndex:0};uc.getNormal(VE,HE,jE,d.normal),u.face=d,u.barycoord=h}return u}function k4(i,t){return i-t}function A2t(i,t){return i.z-t.z}function E2t(i,t){return t.z-i.z}function L2t(i,t,e=0){let n=t.itemSize;if(i.isInterleavedBufferAttribute||i.array.constructor!==t.array.constructor){let s=i.count;for(let r=0;r<s;r++)for(let o=0;o<n;o++)t.setComponent(r+e,o,i.getComponent(r,o))}else t.array.set(i.array,e*n);t.needsUpdate=!0}function lg(i,t){if(i.constructor!==t.constructor){let e=Math.min(i.length,t.length);for(let n=0;n<e;n++)t[n]=i[n]}else{let e=Math.min(i.length,t.length);t.set(new i.constructor(i.buffer,0,e))}}function QE(i,t,e,n,s,r,o){let a=i.geometry.attributes.position;if(E2.fromBufferAttribute(a,s),k2.fromBufferAttribute(a,r),e.distanceSqToSegment(E2,k2,R4,iQ)>n)return;R4.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(R4);if(!(c<t.near||c>t.far))return{distance:c,point:iQ.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}function aQ(i,t,e,n,s,r,o){let a=W4.distanceSqToPoint(i);if(a<e){let l=new bt;W4.closestPointToPoint(i,l),l.applyMatrix4(n);let c=s.ray.origin.distanceTo(l);if(c<s.near||c>s.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}function zU(){let i=0,t=0,e=0,n=0;function s(r,o,a,l){i=r,t=a,e=-3*r+3*o-2*a-l,n=2*r-2*o+a+l}return{initCatmullRom:function(r,o,a,l,c){s(o,a,c*(a-r),c*(l-o))},initNonuniformCatmullRom:function(r,o,a,l,c,u,h){let d=(o-r)/c-(a-r)/(c+u)+(a-o)/u,p=(a-o)/u-(l-o)/(u+h)+(l-a)/h;d*=u,p*=u,s(o,a,d,p)},calc:function(r){let o=r*r,a=o*r;return i+t*r+e*o+n*a}}}function uQ(i,t,e,n,s){let r=(n-t)*.5,o=(s-e)*.5,a=i*i,l=i*a;return(2*e-2*n+r+o)*l+(-3*e+3*n-2*r-o)*a+r*i+e}function I2t(i,t){let e=1-i;return e*e*t}function O2t(i,t){return 2*(1-i)*i*t}function N2t(i,t){return i*i*t}function qw(i,t,e,n){return I2t(i,t)+O2t(i,e)+N2t(i,n)}function B2t(i,t){let e=1-i;return e*e*e*t}function F2t(i,t){let e=1-i;return 3*e*e*i*t}function U2t(i,t){return 3*(1-i)*i*i*t}function z2t(i,t){return i*i*i*t}function Yw(i,t,e,n,s){return B2t(i,t)+F2t(i,e)+U2t(i,n)+z2t(i,s)}function V2t(i,t,e=2){let n=t&&t.length,s=n?t[0]*e:i.length,r=Btt(i,0,s,e,!0),o=[];if(!r||r.next===r.prev)return o;let a,l,c;if(n&&(r=G2t(i,t,r,e)),i.length>80*e){a=i[0],l=i[1];let u=a,h=l;for(let d=e;d<s;d+=e){let p=i[d],g=i[d+1];p<a&&(a=p),g<l&&(l=g),p>u&&(u=p),g>h&&(h=g)}c=Math.max(u-a,h-l),c=c!==0?32767/c:0}return _1(r,o,e,a,l,c,0),o}function Btt(i,t,e,n,s){let r;if(s===ikt(i,t,e,n)>0)for(let o=t;o<e;o+=n)r=hQ(o/n|0,i[o],i[o+1],r);else for(let o=e-n;o>=t;o-=n)r=hQ(o/n|0,i[o],i[o+1],r);return r&&Yb(r,r.next)&&(C1(r),r=r.next),r}function Tg(i,t){if(!i)return i;t||(t=i);let e=i,n;do if(n=!1,!e.steiner&&(Yb(e,e.next)||Bs(e.prev,e,e.next)===0)){if(C1(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function _1(i,t,e,n,s,r,o){if(!i)return;!o&&r&&J2t(i,n,s,r);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(r?j2t(i,n,s,r):H2t(i)){t.push(l.i,i.i,c.i),C1(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=W2t(Tg(i),t),_1(i,t,e,n,s,r,2)):o===2&&$2t(i,t,e,n,s,r):_1(Tg(i),t,e,n,s,r,1);break}}}function H2t(i){let t=i.prev,e=i,n=i.next;if(Bs(t,e,n)>=0)return!1;let s=t.x,r=e.x,o=n.x,a=t.y,l=e.y,c=n.y,u=Math.min(s,r,o),h=Math.min(a,l,c),d=Math.max(s,r,o),p=Math.max(a,l,c),g=n.next;for(;g!==t;){if(g.x>=u&&g.x<=d&&g.y>=h&&g.y<=p&&jw(s,a,r,l,o,c,g.x,g.y)&&Bs(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function j2t(i,t,e,n){let s=i.prev,r=i,o=i.next;if(Bs(s,r,o)>=0)return!1;let a=s.x,l=r.x,c=o.x,u=s.y,h=r.y,d=o.y,p=Math.min(a,l,c),g=Math.min(u,h,d),y=Math.max(a,l,c),x=Math.max(u,h,d),w=$4(p,g,t,e,n),M=$4(y,x,t,e,n),A=i.prevZ,C=i.nextZ;for(;A&&A.z>=w&&C&&C.z<=M;){if(A.x>=p&&A.x<=y&&A.y>=g&&A.y<=x&&A!==s&&A!==o&&jw(a,u,l,h,c,d,A.x,A.y)&&Bs(A.prev,A,A.next)>=0||(A=A.prevZ,C.x>=p&&C.x<=y&&C.y>=g&&C.y<=x&&C!==s&&C!==o&&jw(a,u,l,h,c,d,C.x,C.y)&&Bs(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;A&&A.z>=w;){if(A.x>=p&&A.x<=y&&A.y>=g&&A.y<=x&&A!==s&&A!==o&&jw(a,u,l,h,c,d,A.x,A.y)&&Bs(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;C&&C.z<=M;){if(C.x>=p&&C.x<=y&&C.y>=g&&C.y<=x&&C!==s&&C!==o&&jw(a,u,l,h,c,d,C.x,C.y)&&Bs(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function W2t(i,t){let e=i;do{let n=e.prev,s=e.next.next;!Yb(n,s)&&Utt(n,e,e.next,s)&&S1(n,s)&&S1(s,n)&&(t.push(n.i,e.i,s.i),C1(e),C1(e.next),e=i=s),e=e.next}while(e!==i);return Tg(e)}function $2t(i,t,e,n,s,r){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&tkt(o,a)){let l=ztt(o,a);o=Tg(o,o.next),l=Tg(l,l.next),_1(o,t,e,n,s,r,0),_1(l,t,e,n,s,r,0);return}a=a.next}o=o.next}while(o!==i)}function G2t(i,t,e,n){let s=[];for(let r=0,o=t.length;r<o;r++){let a=t[r]*n,l=r<o-1?t[r+1]*n:i.length,c=Btt(i,a,l,n,!1);c===c.next&&(c.steiner=!0),s.push(Q2t(c))}s.sort(q2t);for(let r=0;r<s.length;r++)e=Y2t(s[r],e);return e}function q2t(i,t){let e=i.x-t.x;if(e===0&&(e=i.y-t.y,e===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),s=(t.next.y-t.y)/(t.next.x-t.x);e=n-s}return e}function Y2t(i,t){let e=X2t(i,t);if(!e)return t;let n=ztt(e,i);return Tg(n,n.next),Tg(e,e.next)}function X2t(i,t){let e=t,n=i.x,s=i.y,r=-1/0,o;if(Yb(i,e))return e;do{if(Yb(i,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let h=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=n&&h>r&&(r=h,o=e.x<e.next.x?e:e.next,h===n))return o}e=e.next}while(e!==t);if(!o)return null;let a=o,l=o.x,c=o.y,u=1/0;e=o;do{if(n>=e.x&&e.x>=l&&n!==e.x&&Ftt(s<c?n:r,s,l,c,s<c?r:n,s,e.x,e.y)){let h=Math.abs(s-e.y)/(n-e.x);S1(e,i)&&(h<u||h===u&&(e.x>o.x||e.x===o.x&&K2t(o,e)))&&(o=e,u=h)}e=e.next}while(e!==a);return o}function K2t(i,t){return Bs(i.prev,i,t.prev)<0&&Bs(t.next,i,i.next)<0}function J2t(i,t,e,n){let s=i;do s.z===0&&(s.z=$4(s.x,s.y,t,e,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,Z2t(s)}function Z2t(i){let t,e=1;do{let n=i,s;i=null;let r=null;for(t=0;n;){t++;let o=n,a=0;for(let c=0;c<e&&(a++,o=o.nextZ,!!o);c++);let l=e;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(s=n,n=n.nextZ,a--):(s=o,o=o.nextZ,l--),r?r.nextZ=s:i=s,s.prevZ=r,r=s;n=o}r.nextZ=null,e*=2}while(t>1);return i}function $4(i,t,e,n,s){return i=(i-e)*s|0,t=(t-n)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|
419i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function Q2t(i){let t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function Ftt(i,t,e,n,s,r,o,a){return(s-o)*(t-a)>=(i-o)*(r-a)&&(i-o)*(n-a)>=(e-o)*(t-a)&&(e-o)*(r-a)>=(s-o)*(n-a)}function jw(i,t,e,n,s,r,o,a){return!(i===o&&t===a)&&Ftt(i,t,e,n,s,r,o,a)}function tkt(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!ekt(i,t)&&(S1(i,t)&&S1(t,i)&&nkt(i,t)&&(Bs(i.prev,i,t.prev)||Bs(i,t.prev,t))||Yb(i,t)&&Bs(i.prev,i,i.next)>0&&Bs(t.prev,t,t.next)>0)}function Bs(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Yb(i,t){return i.x===t.x&&i.y===t.y}function Utt(i,t,e,n){let s=o2(Bs(i,t,e)),r=o2(Bs(i,t,n)),o=o2(Bs(e,n,i)),a=o2(Bs(e,n,t));return!!(s!==r&&o!==a||s===0&&r2(i,e,t)||r===0&&r2(i,n,t)||o===0&&r2(e,i,n)||a===0&&r2(e,t,n))}function r2(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function o2(i){return i>0?1:i<0?-1:0}function ekt(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Utt(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function S1(i,t){return Bs(i.prev,i,i.next)<0?Bs(i,t,i.next)>=0&&Bs(i,i.prev,t)>=0:Bs(i,t,i.prev)<0||Bs(i,i.next,t)<0}function nkt(i,t){let e=i,n=!1,s=(i.x+t.x)/2,r=(i.y+t.y)/2;do e.y>r!=e.next.y>r&&e.next.y!==e.y&&s<(e.next.x-e.x)*(r-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==i);return n}function ztt(i,t){let e=G4(i.i,i.x,i.y),n=G4(t.i,t.x,t.y),s=i.next,r=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,n.next=e,e.prev=n,r.next=n,n.prev=r,n}function hQ(i,t,e,n){let s=G4(i,t,e);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function C1(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function G4(i,t,e){return{i,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ikt(i,t,e,n){let s=0;for(let r=t,o=e-n;r<e;r+=n)s+=(i[o]-i[r])*(i[r+1]+i[o+1]),o=r;return s}function dQ(i){let t=i.length;t>2&&i[t-1].equals(i[0])&&i.pop()}function fQ(i,t){for(let e=0;e<t.length;e++)i.push(t[e].x),i.push(t[e].y)}function rkt(i,t,e){if(e.shapes=[],Array.isArray(i))for(let n=0,s=i.length;n<s;n++){let r=i[n];e.shapes.push(r.uuid)}else e.shapes.push(i.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}function okt(i,t){if(t.shapes=[],Array.isArray(i))for(let e=0,n=i.length;e<n;e++){let s=i[e];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t}function pQ(i,t,e){let n=`${i.x},${i.y},${i.z}-${t.x},${t.y},${t.z}`,s=`${t.x},${t.y},${t.z}-${i.x},${i.y},${i.z}`;return e.has(n)===!0||e.has(s)===!0?!1:(e.add(n),e.add(s),!0)}function Fg(i){let t={};for(let e in i){t[e]={};for(let n in i[e]){let s=i[e][n];if(mQ(s))s.isRenderTargetTexture?(Ze("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=s.clone();else if(Array.isArray(s))if(mQ(s[0])){let r=[];for(let o=0,a=s.length;o<a;o++)r[o]=s[o].clone();t[e][n]=r}else t[e][n]=s.slice();else t[e][n]=s}}return t}function To(i){let t={};for(let e=0;e<i.length;e++){let n=Fg(i[e]);for(let s in n)t[s]=n[s]}return t}function mQ(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function akt(i){let t=[];for(let e=0;e<i.length;e++)t.push(i[e].clone());return t}function VU(i){let t=i.getRenderTarget();return t===null?i.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:Rn.workingColorSpace}function cc(i,t){return!i||i.constructor===t?i:typeof t.BYTES_PER_ELEMENT=="number"?new t(i):Array.prototype.slice.call(i)}function Xw(i){return i!==void 0&&i.inTangents!==void 0&&i.outTangents!==void 0}function Vtt(i){function t(s,r){return i[s]-i[r]}let e=i.length,n=new Array(e);for(let s=0;s!==e;++s)n[s]=s;return n.sort(t),n}function Y4(i,t,e){let n=i.length,s=new i.constructor(n);for(let r=0,o=0;o!==n;++r){let a=e[r]*t;for(let l=0;l!==t;++l)s[o++]=i[a+l]}return s}function Htt(i,t,e,n){let s=1,r=i[0];for(;r!==void 0&&r[n]===void 0;)r=i[s++];if(r===void 0)return;let o=r[n];if(o!==void 0)if(Array.isArray(o))do o=r[n],o!==void 0&&(t.push(r.time),e.push(...o)),r=i[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[n],o!==void 0&&(t.push(r.time),o.toArray(e,e.length)),r=i[s++];while(r!==void 0);else do o=r[n],o!==void 0&&(t.push(r.time),e.push(o)),r=i[s++];while(r!==void 0)}function ukt(i,t,e,n,s=30){let r=i.clone();r.name=t;let o=[];for(let l=0;l<r.tracks.length;++l){let c=r.tracks[l],u=c.getValueSize(),h=[],d=[];for(let p=0;p<c.times.length;++p){let g=c.times[p]*s;if(!(g<e||g>=n)){h.push(c.times[p]);for(let y=0;y<u;++y)d.push(c.values[p*u+y])}}h.length!==0&&(c.times=cc(h,c.times.constructor),c.values=cc(d,c.values.constructor),o.push(c))}r.tracks=o;let a=1/0;for(let l=0;l<r.tracks.length;++l)a>r.tracks[l].times[0]&&(a=r.tracks[l].times[0]);for(let l=0;l<r.tracks.length;++l)r.tracks[l].shift(-1*a);return r.resetDuration(),r}function hkt(i,t=0,e=i,n=30){n<=0&&(n=30);let s=e.tracks.length,r=t/n;for(let o=0;o<s;++o){let a=e.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;let c=i.tracks.find(function(w){return w.name===a.name&&w.ValueTypeName===l});if(c===void 0)continue;let u=0,h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let d=0,p=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=p/3);let g=a.times.length-1,y;if(r<=a.times[0]){let w=u,M=h-u;y=a.values.slice(w,M)}else if(r>=a.times[g]){let w=g*h+u,M=w+h-u;y=a.values.slice(w,M)}else{let w=a.createInterpolant(),M=u,A=h-u;w.evaluate(r),y=w.resultBuffer.slice(M,A)}l==="quaternion"&&new Gi().fromArray(y).normalize().conjugate().toArray(y);let x=c.times.length;for(let w=0;w<x;++w){let M=w*p+d;if(l==="quaternion")Gi.multiplyQuaternionsFlat(c.values,M,y,0,c.values,M);else{let A=p-d*2;for(let C=0;C<A;++C)c.values[M+C]-=y[C]}}}return i.blendMode=Hk,i}function jtt(i,t,e,n,s){let r=1-i;return r*r*r*t+3*r*r*i*e+3*r*i*i*n+i*i*i*s}function dkt(i,t,e,n,s){let r=1-i;return 3*r*r*(e-t)+6*r*i*(n-e)+3*i*i*(s-n)}function fkt(i,t,e,n,s){let r=(i-t)/(s-t);for(let o=0;o<8;o++){let a=jtt(r,t,e,n,s)-i;if(Math.abs(a)<1e-10)break;let l=dkt(r,t,e,n,s);if(Math.abs(l)<1e-10)break;r=Math.max(0,Math.min(1,r-a/l))}return r}function bQ(i,t){for(let e=0,n=i.length;e!==n;e+=2)i[e]*=t}function pkt(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return _l;
419case"vector":case"vector2":case"vector3":case"vector4":return bc;case"color":return ev;case"quaternion":return Sl;case"bool":case"boolean":return au;case"string":return lu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function gkt(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=pkt(i.type);if(i.times===void 0){let n=[],s=[];Htt(i.keys,n,s,"value"),i.times=n,i.values=s}let e;return t.parse!==void 0?e=t.parse(i):e=new t(i.name,i.times,i.values,i.interpolation),Xw(i.settings)&&(e.settings={inTangents:cc(i.settings.inTangents,Float32Array),outTangents:cc(i.settings.outTangents,Float32Array)}),e}function vQ(i){try{let t=i.slice(i.indexOf(":")+1);return new URL(t).protocol==="blob:"}catch{return!1}}function bkt(){this._document.hidden===!1&&this.reset()}function PQ(i,t){return i.distance-t.distance}function tU(i,t,e,n){let s=!0;if(i.layers.test(t.layers)&&i.raycast(t,e)===!1&&(s=!1),s===!0&&n===!0){let r=i.children;for(let o=0,a=r.length;o<a;o++)tU(r[o],t,e,!0)}}function Wtt(i){let t=[];i.isBone===!0&&t.push(i);for(let e=0;e<i.children.length;e++)t.push(...Wtt(i.children[e]));return t}function sr(i,t,e,n,s,r,o){f2.set(s,r,o).unproject(n);let a=t[i];if(a!==void 0){let l=e.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],f2.x,f2.y,f2.z)}}function Lkt(i,t){let e=i.image&&i.image.width?i.image.width/i.image.height:1;return e>t?(i.repeat.x=1,i.repeat.y=e/t,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2):(i.repeat.x=t/e,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0),i}function Ikt(i,t){let e=i.image&&i.image.width?i.image.width/i.image.height:1;return e>t?(i.repeat.x=t/e,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0):(i.repeat.x=1,i.repeat.y=e/t,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2),i}function Okt(i){return i.repeat.x=1,i.repeat.y=1,i.offset.x=0,i.offset.y=0,i}function $k(i,t,e,n){let s=Nkt(n);switch(e){case zk:return i*t;case a_:return i*t/s.components*s.byteLength;case uv:return i*t/s.components*s.byteLength;case xh:return i*t*2/s.components*s.byteLength;case l_:return i*t*2/s.components*s.byteLength;case Vk:return i*t*3/s.components*s.byteLength;case xo:return i*t*4/s.components*s.byteLength;case c_:return i*t*4/s.components*s.byteLength;case hv:case dv:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case fv:case pv:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case h_:case f_:return Math.max(i,16)*Math.max(t,8)/4;case u_:case d_:return Math.max(i,8)*Math.max(t,8)/2;case p_:case g_:case b_:case v_:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case m_:case gv:case y_:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case x_:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case w_:return Math.floor((i+4)/5)*Math.floor((t+3)/4)*16;case __:return Math.floor((i+4)/5)*Math.floor((t+4)/5)*16;case S_:return Math.floor((i+5)/6)*Math.floor((t+4)/5)*16;case C_:return Math.floor((i+5)/6)*Math.floor((t+5)/6)*16;case M_:return Math.floor((i+7)/8)*Math.floor((t+4)/5)*16;case T_:return Math.floor((i+7)/8)*Math.floor((t+5)/6)*16;case A_:return Math.floor((i+7)/8)*Math.floor((t+7)/8)*16;case E_:return Math.floor((i+9)/10)*Math.floor((t+4)/5)*16;case k_:return Math.floor((i+9)/10)*Math.floor((t+5)/6)*16;case P_:return Math.floor((i+9)/10)*Math.floor((t+7)/8)*16;case R_:return Math.floor((i+9)/10)*Math.floor((t+9)/10)*16;case D_:return Math.floor((i+11)/12)*Math.floor((t+9)/10)*16;case L_:return Math.floor((i+11)/12)*Math.floor((t+11)/12)*16;case I_:case O_:case N_:return Math.ceil(i/4)*Math.ceil(t/4)*16;case B_:case F_:return Math.ceil(i/4)*Math.ceil(t/4)*8;case mv:case U_:return Math.ceil(i/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function Nkt(i){switch(i){case ta:case Nk:return{byteLength:1,components:1};case Og:case Bk:case Tl:return{byteLength:2,components:1};case r_:case o_:return{byteLength:2,components:4};case qa:case s_:case yo:return{byteLength:4,components:1};case Fk:case Uk:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}var eU,UQ,zQ,nU,Sk,iU,VQ,HQ,ov,sU,Dg,$a,Mo,Ga,yc,Lg,Ck,Mk,Tk,rU,jQ,af,oU,aU,lU,cU,uU,hU,dU,fU,Ak,Ek,pU,gU,mU,bU,vU,yU,xU,wU,_U,Kw,Jw,Zw,mg,Qw,t1,e1,n1,av,SU,CU,Ml,kk,Pk,Rk,Dk,Lk,Ik,Ok,m2,MU,i_,xc,bh,lf,lv,Ig,K
vendor: 5,093 bytes, line 419
419o,pr,Xd,xs,cv,WQ,vh,$Q,$i,cf,GQ,Sa,qQ,ta,Nk,Bk,Og,s_,qa,yo,Tl,r_,o_,Ng,Fk,Uk,zk,Vk,xo,dc,yh,a_,uv,xh,l_,YQ,c_,hv,dv,fv,pv,u_,h_,d_,f_,p_,g_,m_,b_,v_,gv,y_,x_,w_,__,S_,C_,M_,T_,A_,E_,k_,P_,R_,D_,L_,I_,O_,N_,B_,F_,mv,U_,TU,AU,EU,Kd,Jd,Ww,b2,qd,Yd,Lb,z_,Hk,jk,bv,Bg,kU,XQ,KQ,JQ,du,PU,fu,Zn,wo,Ib,Fi,ZQ,QQ,ttt,ett,$w,ntt,itt,stt,rtt,ott,att,ltt,ctt,utt,htt,dtt,ftt,ptt,RU,DU,LU,IU,V_,OU,NU,H_,BU,j_,gtt,mtt,btt,vtt,ytt,xtt,wtt,_tt,Stt,Wk,ya,Zd,Ctt,Mtt,Ttt,Att,Ett,HEt,EZ,Qd,Itt,wa,mo,kZ,gg,bg,mr,Ce,Gi,bt,a4,PZ,Vn,l4,RZ,DZ,Rn,hb,i1,o2t,wl,v2,a2t,u4,is,pi,Bb,no,vg,y2,yg,x2,tn,db,oc,l2t,c2t,Vd,AE,za,LZ,IZ,gr,xg,u2t,OZ,fb,eh,EE,Pw,h2t,d2t,NZ,BZ,FZ,UZ,f2t,pb,h4,ai,jr,p2t,wg,Ott,Hd,kE,Be,bo,s1,r1,o1,ac,nh,f4,ih,gb,mb,zZ,p4,g4,m4,b4,v4,y4,uc,rr,sh,lc,PE,bb,vb,yb,jd,Wd,ig,Rw,RE,DE,sg,ah,w2,fr,LE,m2t,Mi,_2,S2,C2,M2,tf,T2,Fb,A2,Ge,b2t,Dw,w4,Gs,v2t,yl,_4,xb,Va,Lw,Hr,kn,ru,qo,fc,S4,y2t,x2t,xl,w2t,ss,Ub,wb,Iw,_b,Sb,Cb,Ow,Ntt,IE,Nw,OE,VZ,C4,HZ,a1,BE,jZ,l1,rh,M4,FE,UE,ch,io,WZ,rg,zE,$Z,VE,HE,jE,T4,WE,GZ,$E,qi,Bw,qZ,YZ,S2t,XZ,qE,A4,KZ,E4,uh,pc,Xo,JZ,C2t,hh,ja,Mb,ZZ,YE,QZ,M2t,Fw,Uw,_g,og,T2t,XE,ou,tQ,c1,j4,ba,k2t,P2t,R2t,KE,ag,zw,eQ,D2t,P4,vo,JE,u1,fs,E2,k2,nQ,Vw,ZE,R4,iQ,Jo,sQ,rQ,Wr,Sg,Wa,oQ,W4,t2,e2,gc,h1,P2,R2,Cg,D2,L2,ef,I2,O2,dh,d1,zb,nf,f1,p1,Vb,Hb,fh,g1,n2,i2,D4,s2,m1,_o,Mg,b1,lQ,cQ,L4,I4,O4,v1,jb,y1,Wb,x1,$b,Gb,qb,N2,w1,sf,rf,q4,xa,M1,skt,T1,A1,Xb,Ag,E1,k1,Kb,P1,R1,D1,L1,I1,gQ,O1,HU,lkt,ckt,Zo,Jb,ph,So,_a,N1,B1,Eg,Zb,Qb,F1,U1,B2,mc,z1,tv,V1,H1,Qo,au,ev,_l,j1,Sl,lu,bc,Cl,hc,nv,W_,rs,oh,X4,or,F2,U2,Tb,of,z2,V2,cu,vc,W1,N4,yQ,xQ,kg,a2,l2,iu,Pg,$d,wQ,_Q,Ds,K4,gh,J4,uu,hu,Z4,mh,Rg,$1,iv,G1,SQ,q1,Co,Y1,X1,B4,H2,mkt,CQ,MQ,F4,sv,c2,rv,j2,TQ,AQ,cg,W2,Ab,Eb,K1,J1,Z1,ug,U4,vkt,hg,dg,$2,Q1,fg,EQ,ykt,pg,G2,q2,t_,jU,xkt,WU,wkt,_kt,Skt,Ckt,Mkt,Tkt,Akt,Q4,yi,Y2,e_,Ekt,X2,K2,J2,kkt,Z2,Q2,tk,kQ,ek,nk,ik,sk,rk,RQ,n_,DQ,u2,kb,Pb,z4,Pkt,Rkt,ok,LQ,ak,Gd,h2,V4,lk,ck,Dkt,IQ,OQ,uk,hk,dk,NQ,d2,BQ,fk,f2,$s,pk,p2,gk,mk,bk,FQ,g2,H4,vk,yk,xk,wk,_k,$U=_n(()=>{eU="186",UQ={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},zQ={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},nU=0,Sk=1,iU=2,VQ=3,HQ=0,ov=1,sU=2,Dg=3,$a=0,Mo=1,Ga=2,yc=0,Lg=1,Ck=2,Mk=3,Tk=4,rU=5,jQ=6,af=100,oU=101,aU=102,lU=103,cU=104,uU=200,hU=201,dU=202,fU=203,Ak=204,Ek=205,pU=206,gU=207,mU=208,bU=209,vU=210,yU=211,xU=212,wU=213,_U=214,Kw=0,Jw=1,Zw=2,mg=3,Qw=4,t1=5,e1=6,n1=7,av=0,SU=1,CU=2,Ml=0,kk=1,Pk=2,Rk=3,Dk=4,Lk=5,Ik=6,Ok=7,m2="attached",MU="detached",i_=300,xc=301,bh=302,lf=303,lv=304,Ig=306,Ko=1e3,pr=1001,Xd=1002,xs=1003,cv=1004,WQ=1004,vh=1005,$Q=1005,$i=1006,cf=1007,GQ=1007,Sa=1008,qQ=1008,ta=1009,Nk=1010,Bk=1011,Og=1012,s_=1013,qa=1014,yo=1015,Tl=1016,r_=1017,o_=1018,Ng=1020,Fk=35902,Uk=35899,zk=1021,Vk=1022,xo=1023,dc=1026,yh=1027,a_=1028,uv=1029,xh=1030,l_=1031,YQ=1032,c_=1033,hv=33776,dv=33777,fv=33778,pv=33779,u_=35840,h_=35841,d_=35842,f_=35843,p_=36196,g_=37492,m_=37496,b_=37488,v_=37489,gv=37490,y_=37491,x_=37808,w_=37809,__=37810,S_=37811,C_=37812,M_=37813,T_=37814,A_=37815,E_=37816,k_=37817,P_=37818,R_=37819,D_=37820,L_=37821,I_=36492,O_=36494,N_=36495,B_=36283,F_=36284,mv=36285,U_=36286,TU=2200,AU=2201,EU=2202,Kd=2300,Jd=2301,Ww=2302,b2=2303,qd=2400,Yd=2401,Lb=2402,z_=2500,Hk=2501,jk=0,bv=1,Bg=2,kU=3200,XQ=3201,KQ=3202,JQ=3203,du=0,PU=1,fu="",Zn="srgb",wo="srgb-linear",Ib="linear",Fi="srgb",ZQ="",QQ="rg",ttt="ga",ett=0,$w=7680,ntt=7681,itt=7682,stt=7683,rtt=34055,ott=34056,att=5386,ltt=512,ctt=513,utt=514,htt=515,dtt=516,ftt=517,ptt=518,RU=519,DU=512,LU=513,IU=514,V_=515,OU=516,NU=517,H_=518,BU=519,j_=35044,gtt=35048,mtt=35040,btt=35045,vtt=35049,ytt=35041,xtt=35046,wtt=35050,_tt=35042,Stt="100",Wk="300 es",ya=2e3,Zd=2001,Ctt={COMPUTE:"compute",RENDER:"render"},Mtt={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},Ttt={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},Att={TEXTURE_COMPARE:"depthTextureCompare"},Ett={NONE:0,SHARED:1,FULL:2};HEt={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};EZ={},Qd=null;Itt={[Kw]:Jw,[Zw]:e1,[Qw]:n1,[mg]:t1,[Jw]:Kw,[e1]:Zw,[n1]:Qw,[t1]:mg},wa=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){let n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){let n=this._listeners;if(n===void 0)return;let s=n[t];if(s!==void 0){let r=s.indexOf(e);r!==-1&&s.splice(r,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let n=e[t.type];if(n!==void 0){t.target=this;let s=n.slice(0);for(let r=0,o=s.length;r<o;r++)s[r].call(this,t);t.target=null}}},mo=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","5
4195","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],kZ=1234567,gg=Math.PI/180,bg=180/Math.PI;mr={DEG2RAD:gg,RAD2DEG:bg,generateUUID:Ha,clamp:Bn,euclideanModulo:UU,mapLinear:jEt,inverseLerp:WEt,lerp:Gw,damp:$Et,pingpong:GEt,smoothstep:qEt,smootherstep:YEt,randInt:XEt,randFloat:KEt,randFloatSpread:JEt,seededRandom:ZEt,degToRad:QEt,radToDeg:t2t,isPowerOfTwo:e2t,ceilPowerOfTwo:n2t,floorPowerOfTwo:i2t,setQuaternionFromProperEuler:s2t,normalize:Jn,denormalize:Yo},Ce=class i{static{i.prototype.isVector2=!0}constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6],this.y=s[1]*e+s[4]*n+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Bn(this.x,t.x,e.x),this.y=Bn(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Bn(this.x,t,e),this.y=Bn(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Bn(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(Bn(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}
vendor: 5,534 bytes, line 419
419rotateAround(t,e){let n=Math.cos(e),s=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*s+t.x,this.y=r*s+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Gi=class{constructor(t=0,e=0,n=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=s}static slerpFlat(t,e,n,s,r,o,a){let l=n[s+0],c=n[s+1],u=n[s+2],h=n[s+3],d=r[o+0],p=r[o+1],g=r[o+2],y=r[o+3];if(h!==y||l!==d||c!==p||u!==g){let x=l*d+c*p+u*g+h*y;x<0&&(d=-d,p=-p,g=-g,y=-y,x=-x);let w=1-a;if(x<.9995){let M=Math.acos(x),A=Math.sin(M);w=Math.sin(w*M)/A,a=Math.sin(a*M)/A,l=l*w+d*a,c=c*w+p*a,u=u*w+g*a,h=h*w+y*a}else{l=l*w+d*a,c=c*w+p*a,u=u*w+g*a,h=h*w+y*a;let M=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=M,c*=M,u*=M,h*=M}}t[e]=l,t[e+1]=c,t[e+2]=u,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,s,r,o){let a=n[s],l=n[s+1],c=n[s+2],u=n[s+3],h=r[o],d=r[o+1],p=r[o+2],g=r[o+3];return t[e]=a*g+u*h+l*p-c*d,t[e+1]=l*g+u*d+c*h-a*p,t[e+2]=c*g+u*p+a*d-l*h,t[e+3]=u*g-a*h-l*d-c*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,s){return this._x=t,this._y=e,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,s=t._y,r=t._z,o=t._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(s/2),h=a(r/2),d=l(n/2),p=l(s/2),g=l(r/2);switch(o){case"XYZ":this._x=d*u*h+c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h-d*p*g;break;case"YXZ":this._x=d*u*h+c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h+d*p*g;break;case"ZXY":this._x=d*u*h-c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h-d*p*g;break;case"ZYX":this._x=d*u*h-c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h+d*p*g;break;case"YZX":this._x=d*u*h+c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h-d*p*g;break;case"XZY":this._x=d*u*h-c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h+d*p*g;break;default:Ze("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,s=Math.sin(n);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],s=e[4],r=e[8],o=e[1],a=e[5],l=e[9],c=e[2],u=e[6],h=e[10],d=n+a+h;if(d>0){let p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(u-l)*p,this._y=(r-c)*p,this._z=(o-s)*p}else if(n>a&&n>h){let p=2*Math.sqrt(1+n-a-h);this._w=(u-l)/p,this._x=.25*p,this._y=(s+o)/p,this._z=(r+c)/p}else if(a>h){let p=2*Math.sqrt(1+a-n-h);this._w=(r-c)/p,this._x=(s+o)/p,this._y=.25*p,this._z=(l+u)/p}else{let p=2*Math.sqrt(1+h-n-a);this._w=(o-s)/p,this._x=(r+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Bn(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let s=Math.min(1,e/n);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,s=t._y,r=t._z,o=t._w,a=e._x,l=e._y,c=e._z,u=e._w;return this._x=n*u+o*a+s*c-r*l,this._y=s*u+o*l+r*a-n*c,this._z=r*u+o*c+n*l-s*a,this._w=o*u-n*a-s*l-r*c,this._onChangeCallback(),this}slerp(t,e){let n=t._x,s=t._y,r=t._z,o=t._w,a=this.dot(t);a<0&&(n=-n,s=-s,r=-r,o=-o,a=-a);let l=1-e;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,e=Math.sin(e*c)/u,this._x=this._x*l+n*e,this._y=this._y*l+s*e,this._z=this._z*l+r*e,this._w=this._w*l+o*e,this._onChangeCallback()}else this._x=this._x*l+n*e,this._y=this._y*l+s*e,this._z=this._z*l+r*e,this._w=this._w*l+o*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}
vendor: 4,320 bytes, line 419
419_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},bt=class i{static{i.prototype.isVector3=!0}constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(PZ.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(PZ.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*s,this.y=r[1]*e+r[4]*n+r[7]*s,this.z=r[2]*e+r[5]*n+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,s=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*s+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*s+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*s+r[14])*o,this}applyQuaternion(t){let e=this.x,n=this.y,s=this.z,r=t.x,o=t.y,a=t.z,l=t.w,c=2*(o*s-a*n),u=2*(a*e-r*s),h=2*(r*n-o*e);return this.x=e+l*c+o*h-a*u,this.y=n+l*u+a*c-r*h,this.z=s+l*h+r*u-o*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*s,this.y=r[1]*e+r[5]*n+r[9]*s,this.z=r[2]*e+r[6]*n+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Bn(this.x,t.x,e.x),this.y=Bn(this.y,t.y,e.y),this.z=Bn(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Bn(this.x,t,e),this.y=Bn(this.y,t,e),this.z=Bn(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Bn(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}
vendor: 41,225 bytes, line 419
419crossVectors(t,e){let n=t.x,s=t.y,r=t.z,o=e.x,a=e.y,l=e.z;return this.x=s*l-r*a,this.y=r*o-n*l,this.z=n*a-s*o,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return a4.copy(this).projectOnVector(t),this.sub(a4)}reflect(t){return this.sub(a4.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(Bn(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,s=this.z-t.z;return e*e+n*n+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let s=Math.sin(e)*t;return this.x=s*Math.sin(n),this.y=Math.cos(e)*t,this.z=s*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},a4=new bt,PZ=new Gi,Vn=class i{static{i.prototype.isMatrix3=!0}constructor(t,e,n,s,r,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,o,a,l,c)}set(t,e,n,s,r,o,a,l,c){let u=this.elements;return u[0]=t,u[1]=s,u[2]=a,u[3]=e,u[4]=r,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,s=e.elements,r=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],d=n[2],p=n[5],g=n[8],y=s[0],x=s[3],w=s[6],M=s[1],A=s[4],C=s[7],R=s[2],k=s[5],O=s[8];return r[0]=o*y+a*M+l*R,r[3]=o*x+a*A+l*k,r[6]=o*w+a*C+l*O,r[1]=c*y+u*M+h*R,r[4]=c*x+u*A+h*k,r[7]=c*w+u*C+h*O,r[2]=d*y+p*M+g*R,r[5]=d*x+p*A+g*k,r[8]=d*w+p*C+g*O,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8];return e*o*u-e*a*c-n*r*u+n*a*l+s*r*c-s*o*l}invert(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=u*o-a*c,d=a*l-u*r,p=c*r-o*l,g=e*h+n*d+s*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let y=1/g;return t[0]=h*y,t[1]=(s*c-u*n)*y,t[2]=(a*n-s*o)*y,t[3]=d*y,t[4]=(u*e-s*l)*y,t[5]=(s*r-a*e)*y,t[6]=p*y,t[7]=(n*l-c*e)*y,t[8]=(o*e-n*r)*y,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,s,r,o,a){let l=Math.cos(r),c=Math.sin(r);return this.set(n*l,n*c,-n*(l*o+c*a)+o+t,-s*c,s*l,-s*(-c*o+l*a)+a+e,0,0,1),this}scale(t,e){return su("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(l4.makeScale(t,e)),this}rotate(t){return su("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(l4.makeRotation(-t)),this}translate(t,e){return su("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(l4.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let s=0;s<9;s++)if(e[s]!==n[s])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},l4=new Vn,RZ=new Vn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),DZ=new Vn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Rn=r2t();i1=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{hb===void 0&&(hb=Ob("canvas")),hb.width=t.width,hb.height=t.height;let s=hb.getContext("2d");t instanceof ImageData?s.putImageData(t,0,0):s.drawImage(t,0,0,t.width,t.height),n=hb}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Ob("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let s=n.getImageData(0,0,t.width,t.height),r=s.data;for(let o=0;o<r.length;o++)r[o]=lh(r[o]/255)*255;return n.putImageData(s,0,0),e}else if(t.data){let e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(lh(e[n]/255)*255):e[n]=lh(e[n]);return{data:e,width:t.width,height:t.height}}else return Ze("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},o2t=0,wl=class{constructor(t=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:o2t++}),this.uuid=Ha(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let n={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let o=0,a=s.length;o<a;o++)s[o].isDataTexture?r.push(c4(s[o].image)):r.push(c4(s[o]))}else r=c4(s);n.url=r}return e||(t.images[this.uuid]=n),n}};v2=class extends wl{constructor(t=null){su('Source: "Source" has been renamed to "TextureSource". Please update your code to use "THREE.TextureSource" instead.'),super(t),this.isSource=!0}},a2t=0,u4=new bt,is=class i extends wa{constructor(t=i.DEFAULT_IMAGE,e=i.DEFAULT_MAPPING,n=pr,s=pr,r=$i,o=Sa,a=xo,l=ta,c=i.DEFAULT_ANISOTROPY,u=fu){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:a2t++}),this.uuid=Ha(),this.name="",this.source=new wl(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=r,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Ce(0,0),this.repeat=new Ce(1,1),this.center=new Ce(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Vn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(u4).x}get height(){return this.source.getSize(u4).y}get depth(){return this.source.getSize(u4).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let n=t[e];if(n===void 0){Ze(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){Ze(`Texture.setValues(): property '${e}' does not exist.`);continue}s&&n&&s.isVector2&&n.isVector2||s&&n&&s.isVector3&&n.isVector3||s&&n&&s.isMatrix3&&n.isMatrix3?s.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==i_)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Ko:t.x=t.x-Math.floor(t.x);break;case pr:t.x=t.x<0?0:1;break;case Xd:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Ko:t.y=t.y-Math.floor(t.y);break;case pr:t.y=t.y<0?0:1;break;case Xd:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};is.DEFAULT_IMAGE=null;is.DEFAULT_MAPPING=i_;is.DEFAULT_ANISOTROPY=1;pi=class i{static{i.prototype.isVector4=!0}constructor(t=0,e=0,n=0,s=1){this.x=t,this.y=e,this.z=n,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,s){return this.x=t,this.y=e,this.z=n,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,s=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*s+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*s+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*s+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*s+o[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,s,r,l=t.elements,c=l[0],u=l[4],h=l[8],d=l[1],p=l[5],g=l[9],y=l[2],x=l[6],w=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-y)<.01&&Math.abs(g-x)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+y)<.1&&Math.abs(g+x)<.1&&Math.abs(c+p+w-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let A=(c+1)/2,C=(p+1)/2,R=(w+1)/2,k=(u+d)/4,O=(h+y)/4,I=(g+x)/4;return A>C&&A>R?A<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(A),s=k/n,r=O/n):C>R?C<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(C),n=k/s,r=I/s):R<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(R),n=O/r,s=I/r),this.set(n,s,r,e),this}let M=Math.sqrt((x-g)*(x-g)+(h-y)*(h-y)+(d-u)*(d-u));return Math.abs(M)<.001&&(M=1),this.x=(x-g)/M,this.y=(h-y)/M,this.z=(d-u)/M,this.w=Math.acos((c+p+w-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Bn(this.x,t.x,e.x),this.y=Bn(this.y,t.y,e.y),this.z=Bn(this.z,t.z,e.z),this.w=Bn(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Bn(this.x,t,e),this.y=Bn(this.y,t,e),this.z=Bn(this.z,t,e),this.w=Bn(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Bn(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Bb=class extends wa{constructor(t=1,e=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:$i,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth,this.scissor=new pi(0,0,t,e),this.scissorTest=!1,this.viewport=new pi(0,0,t,e),this.textures=[];let s={width:t,height:e,depth:n.depth},r=new is(s),o=n.count;for(let a=0;a<o;a++)this.textures[a]=r.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveColorBuffer=n.resolveColorBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.storeMultisampledColorBuffer=n.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=n.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=n.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(t={}){let e={minFilter:$i,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(e.mapping=t.mapping),t.wrapS!==void 0&&(e.wrapS=t.wrapS),t.wrapT!==void 0&&(e.wrapT=t.wrapT),t.wrapR!==void 0&&(e.wrapR=t.wrapR),t.magFilter!==void 0&&(e.magFilter=t.magFilter),t.minFilter!==void 0&&(e.minFilter=t.minFilter),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),t.internalFormat!==void 0&&(e.internalFormat=t.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),t!==null&&t.renderTarget===null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=n,this.textures[s].isData3DTexture!==!0&&(this.textures[s].isArrayTexture=this.textures[s].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;let s=Object.assign({},t.textures[e].image);this.textures[e].source=new wl(s)}if(this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveColorBuffer=t.resolveColorBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,this.storeMultisampledColorBuffer=t.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=t.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=t.storeMultisampledStencilBuffer,t.depthTexture!==null)if(t.depthTexture.renderTarget===t){let e=t.depthTexture.clone();e.renderTarget=null,this.depthTexture=e}else this.depthTexture=t.depthTexture;return this.samples=t.samples,this.multiview=t.multiview,this.useArrayDepthTexture=t.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},no=class extends Bb{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}},vg=class extends is{constructor(t=null,e=1,n=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:s},this.magFilter=xs,this.minFilter=xs,this.wrapR=pr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}copy(t){return super.copy(t),this.wrapR=t.wrapR,this}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},y2=class extends no{constructor(t=1,e=1,n=1,s={}){super(t,e,s),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new vg(null,t,e,n),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}},yg=class extends is{constructor(t=null,e=1,n=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:s},this.magFilter=xs,this.minFilter=xs,this.wrapR=pr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(t){return super.copy(t),this.wrapR=t.wrapR,this}},x2=class extends no{constructor(t=1,e=1,n=1,s={}){super(t,e,s),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new yg(null,t,e,n),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}},tn=class i{static{i.prototype.isMatrix4=!0}constructor(t,e,n,s,r,o,a,l,c,u,h,d,p,g,y,x){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,o,a,l,c,u,h,d,p,g,y,x)}set(t,e,n,s,r,o,a,l,c,u,h,d,p,g,y,x){let w=this.elements;return w[0]=t,w[4]=e,w[8]=n,w[12]=s,w[1]=r,w[5]=o,w[9]=a,w[13]=l,w[2]=c,w[6]=u,w[10]=h,w[14]=d,w[3]=p,w[7]=g,w[11]=y,w[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new i().fromArray(this.elements)}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return this.determinantAffine()===0?(t.set(1,0,0),e.set(0,1,0),n.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){if(t.determinantAffine()===0)return this.identity();let e=this.elements,n=t.elements,s=1/db.setFromMatrixColumn(t,0).length(),r=1/db.setFromMatrixColumn(t,1).length(),o=1/db.setFromMatrixColumn(t,2).length();return e[0]=n[0]*s,e[1]=n[1]*s,e[2]=n[2]*s,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,n=t.x,s=t.y,r=t.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(s),c=Math.sin(s),u=Math.cos(r),h=Math.sin(r);if(t.order==="XYZ"){let d=o*u,p=o*h,g=a*u,y=a*h;e[0]=l*u,e[4]=-l*h,e[8]=c,e[1]=p+g*c,e[5]=d-y*c,e[9]=-a*l,e[2]=y-d*c,e[6]=g+p*c,e[10]=o*l}else if(t.order==="YXZ"){let d=l*u,p=l*h,g=c*u,y=c*h;e[0]=d+y*a,e[4]=g*a-p,e[8]=o*c,e[1]=o*h,e[5]=o*u,e[9]=-a,e[2]=p*a-g,e[6]=y+d*a,e[10]=o*l}else if(t.order==="ZXY"){let d=l*u,p=l*h,g=c*u,y=c*h;e[0]=d-y*a,e[4]=-o*h,e[8]=g+p*a,e[1]=p+g*a,e[5]=o*u,e[9]=y-d*a,e[2]=-o*c,e[6]=a,e[10]=o*l}else if(t.order==="ZYX"){let d=o*u,p=o*h,g=a*u,y=a*h;e[0]=l*u,e[4]=g*c-p,e[8]=d*c+y,e[1]=l*h,e[5]=y*c+d,e[9]=p*c-g,e[2]=-c,e[6]=a*l,e[10]=o*l}else if(t.order==="YZX"){let d=o*l,p=o*c,g=a*l,y=a*c;e[0]=l*u,e[4]=y-d*h,e[8]=g*h+p,e[1]=h,e[5]=o*u,e[9]=-a*u,e[2]=-c*u,e[6]=p*h+g,e[10]=d-y*h}else if(t.order==="XZY"){let d=o*l,p=o*c,g=a*l,y=a*c;e[0]=l*u,e[4]=-h,e[8]=c*u,e[1]=d*h+y,e[5]=o*u,e[9]=p*h-g,e[2]=g*h-p,e[6]=a*u,e[10]=y*h+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(l2t,t,c2t)}lookAt(t,e,n){let s=this.elements;return za.subVectors(t,e),za.lengthSq()===0&&(za.z=1),za.normalize(),Vd.crossVectors(n,za),Vd.lengthSq()===0&&(Math.abs(n.z)===1?za.x+=1e-4:za.z+=1e-4,za.normalize(),Vd.crossVectors(n,za)),Vd.normalize(),AE.crossVectors(za,Vd),s[0]=Vd.x,s[4]=AE.x,s[8]=za.x,s[1]=Vd.y,s[5]=AE.y,s[9]=za.y,s[2]=Vd.z,s[6]=AE.z,s[10]=za.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,s=e.elements,r=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],h=n[5],d=n[9],p=n[13],g=n[2],y=n[6],x=n[10],w=n[14],M=n[3],A=n[7],C=n[11],R=n[15],k=s[0],O=s[4],I=s[8],U=s[12],V=s[1],q=s[5],X=s[9],j=s[13],W=s[2],_=s[6],at=s[10],ct=s[14],pt=s[3],Et=s[7],vt=s[11],yt=s[15];return r[0]=o*k+a*V+l*W+c*pt,r[4]=o*O+a*q+l*_+c*Et,r[8]=o*I+a*X+l*at+c*vt,r[12]=o*U+a*j+l*ct+c*yt,r[1]=u*k+h*V+d*W+p*pt,r[5]=u*O+h*q+d*_+p*Et,r[9]=u*I+h*X+d*at+p*vt,r[13]=u*U+h*j+d*ct+p*yt,r[2]=g*k+y*V+x*W+w*pt,r[6]=g*O+y*q+x*_+w*Et,r[10]=g*I+y*X+x*at+w*vt,r[14]=g*U+y*j+x*ct+w*yt,r[3]=M*k+A*V+C*W+R*pt,r[7]=M*O+A*q+C*_+R*Et,r[11]=M*I+A*X+C*at+R*vt,r[15]=M*U+A*j+C*ct+R*yt,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[4],s=t[8],r=t[12],o=t[1],a=t[5],l=t[9],c=t[13],u=t[2],h=t[6],d=t[10],p=t[14],g=t[3],y=t[7],x=t[11],w=t[15],M=l*p-c*d,A=a*p-c*h,C=a*d-l*h,R=o*p-c*u,k=o*d-l*u,O=o*h-a*u;return e*(y*M-x*A+w*C)-n*(g*M-x*R+w*k)+s*(g*A-y*R+w*O)-r*(g*C-y*k+x*O)}determinantAffine(){let t=this.elements,e=t[0],n=t[4],s=t[8],r=t[1],o=t[5],a=t[9],l=t[2],c=t[6],u=t[10];return e*(o*u-a*c)-n*(r*u-a*l)+s*(r*c-o*l)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=n),this}invert(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],g=t[12],y=t[13],x=t[14],w=t[15],M=e*a-n*o,A=e*l-s*o,C=e*c-r*o,R=n*l-s*a,k=n*c-r*a,O=s*c-r*l,I=u*y-h*g,U=u*x-d*g,V=u*w-p*g,q=h*x-d*y,X=h*w-p*y,j=d*w-p*x,W=M*j-A*X+C*q+R*V-k*U+O*I;if(W===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let _=1/W;return t[0]=(a*j-l*X+c*q)*_,t[1]=(s*X-n*j-r*q)*_,t[2]=(y*O-x*k+w*R)*_,t[3]=(d*k-h*O-p*R)*_,t[4]=(l*V-o*j-c*U)*_,t[5]=(e*j-s*V+r*U)*_,t[6]=(x*C-g*O-w*A)*_,t[7]=(u*O-d*C+p*A)*_,t[8]=(o*X-a*V+c*I)*_,t[9]=(n*V-e*X-r*I)*_,t[10]=(g*k-y*C+w*M)*_,t[11]=(h*C-u*k-p*M)*_,t[12]=(a*U-o*q-l*I)*_,t[13]=(e*q-n*U+s*I)*_,t[14]=(y*A-g*R-x*M)*_,t[15]=(u*R-h*A+d*M)*_,this}scale(t){let e=this.elements,n=t.x,s=t.y,r=t.z;return e[0]*=n,e[4]*=s,e[8]*=r,e[1]*=n,e[5]*=s,e[9]*=r,e[2]*=n,e[6]*=s,e[10]*=r,e[3]*=n,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,s))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let n=Math.cos(e),s=Math.sin(e),r=1-n,o=t.x,a=t.y,l=t.z,c=r*o,u=r*a;return this.set(c*o+n,c*a-s*l,c*l+s*a,0,c*a+s*l,u*a+n,u*l-s*o,0,c*l-s*a,u*l+s*o,r*l*l+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,s,r,o){return this.set(1,n,r,0,t,1,o,0,e,s,1,0,0,0,0,1),this}compose(t,e,n){let s=this.elements,r=e._x,o=e._y,a=e._z,l=e._w,c=r+r,u=o+o,h=a+a,d=r*c,p=r*u,g=r*h,y=o*u,x=o*h,w=a*h,M=l*c,A=l*u,C=l*h,R=n.x,k=n.y,O=n.z;return s[0]=(1-(y+w))*R,s[1]=(p+C)*R,s[2]=(g-A)*R,s[3]=0,s[4]=(p-C)*k,s[5]=(1-(d+w))*k,s[6]=(x+M)*k,s[7]=0,s[8]=(g+A)*O,s[9]=(x-M)*O,s[10]=(1-(d+y))*O,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,n){let s=this.elements;t.x=s[12],t.y=s[13],t.z=s[14];let r=this.determinantAffine();if(r===0)return n.set(1,1,1),e.identity(),this;let o=db.set(s[0],s[1],s[2]).length(),a=db.set(s[4],s[5],s[6]).length(),l=db.set(s[8],s[9],s[10]).length();r<0&&(o=-o),oc.copy(this);let c=1/o,u=1/a,h=1/l;return oc.elements[0]*=c,oc.elements[1]*=c,oc.elements[2]*=c,oc.elements[4]*=u,oc.elements[5]*=u,oc.elements[6]*=u,oc.elements[8]*=h,oc.elements[9]*=h,oc.elements[10]*=h,e.setFromRotationMatrix(oc),n.x=o,n.y=a,n.z=l,this}makePerspective(t,e,n,s,r,o,a=ya,l=!1){let c=this.elements,u=2*r/(e-t),h=2*r/(n-s),d=(e+t)/(e-t),p=(n+s)/(n-s),g,y;if(l)g=r/(o-r),y=o*r/(o-r);else if(a===ya)g=-(o+r)/(o-r),y=-2*o*r/(o-r);else if(a===Zd)g=-o/(o-r),y=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=h,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=g,c[14]=y,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(t,e,n,s,r,o,a=ya,l=!1){let c=this.elements,u=2/(e-t),h=2/(n-s),d=-(e+t)/(e-t),p=-(n+s)/(n-s),g,y;if(l)g=1/(o-r),y=o/(o-r);else if(a===ya)g=-2/(o-r),y=-(o+r)/(o-r);else if(a===Zd)g=-1/(o-r),y=-r/(o-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=h,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=g,c[14]=y,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(t){let e=this.elements,n=t.elements;for(let s=0;s<16;s++)if(e[s]!==n[s])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},db=new bt,oc=new tn,l2t=new bt(0,0,0),c2t=new bt(1,1,1),Vd=new bt,AE=new bt,za=new bt,LZ=new tn,IZ=new Gi,gr=class i{constructor(t=0,e=0,n=0,s=i.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,s=this._order){return this._x=t,this._y=e,this._z=n,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){let s=t.elements,r=s[0],o=s[4],a=s[8],l=s[1],c=s[5],u=s[9],h=s[2],d=s[6],p=s[10];switch(e){case"XYZ":this._y=Math.asin(Bn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Bn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Bn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-Bn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Bn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-Bn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,p),this._y=0);break;default:Ze("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return LZ.makeRotationFromQuaternion(t),this.setFromRotationMatrix(LZ,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return IZ.setFromEuler(this),this.setFromQuaternion(IZ,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};gr.DEFAULT_ORDER="XYZ";xg=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},u2t=0,OZ=new bt,fb=new Gi,eh=new tn,EE=new bt,Pw=new bt,h2t=new bt,d2t=new Gi,NZ=new bt(1,0,0),BZ=new bt(0,1,0),FZ=new bt(0,0,1),UZ={type:"added"},f2t={type:"removed"},pb={type:"childadded",child:null},h4={type:"childremoved",child:null},ai=class i extends wa{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:u2t++}),this.uuid=Ha(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let t=new bt,e=new gr,n=new Gi,s=new bt(1,1,1);function r(){n.setFromEuler(e,!1)}function o(){e.setFromQuaternion(n,void 0,!1)}e._onChange(r),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new tn},normalMatrix:{value:new Vn}}),this.matrix=new tn,this.matrixWorld=new tn,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xg,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return fb.setFromAxisAngle(t,e),this.quaternion.multiply(fb),this}rotateOnWorldAxis(t,e){return fb.setFromAxisAngle(t,e),this.quaternion.premultiply(fb),this}rotateX(t){return this.rotateOnAxis(NZ,t)}rotateY(t){return this.rotateOnAxis(BZ,t)}rotateZ(t){return this.rotateOnAxis(FZ,t)}translateOnAxis(t,e){return OZ.copy(t).applyQuaternion(this.quaternion),this.position.add(OZ.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(NZ,t)}translateY(t){return this.translateOnAxis(BZ,t)}translateZ(t){return this.translateOnAxis(FZ,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(eh.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?EE.copy(t):EE.set(t,e,n);let s=this.parent;this.updateWorldMatrix(!0,!1),Pw.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?eh.lookAt(Pw,EE,this.up):eh.lookAt(EE,Pw,this.up),this.quaternion.setFromRotationMatrix(eh),s&&(eh.extractRotation(s.matrixWorld),fb.setFromRotationMatrix(eh),this.quaternion.premultiply(fb.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(Tn("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(UZ),pb.child=t,this.dispatchEvent(pb),pb.child=null):Tn("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(f2t),h4.child=t,this.dispatchEvent(h4),h4.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),eh.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),eh.multiply(t.parent.matrixWorld)),t.applyMatrix4(eh),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(UZ),pb.child=t,this.dispatchEvent(pb),pb.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,s=this.children.length;n<s;n++){let o=this.children[n].getObjectByProperty(t,e);if(o!==void 0)return o}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);let s=this.children;for(let r=0,o=s.length;r<o;r++)s[r].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Pw,t,h2t),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Pw,d2t,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(t){t(this);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let e=t.x,n=t.y,s=t.z,r=this.matrix.elements;r[12]+=e-r[0]*e-r[4]*n-r[8]*s,r[13]+=n-r[1]*e-r[5]*n-r[9]*s,r[14]+=s-r[2]*e-r[6]*n-r[10]*s}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e,n=!1){let s=this.parent;if(t===!0&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),e===!0){let r=this.children;for(let o=0,a=r.length;o<a;o++)r[o].updateWorldMatrix(!1,!0,n)}}toJSON(t){let e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let s={};
vendor: 20,489 bytes, line 419
419s.uuid=this.uuid,s.type=this.type,s.name=this.name,s.castShadow=this.castShadow,s.receiveShadow=this.receiveShadow,s.visible=this.visible,s.frustumCulled=this.frustumCulled,s.renderOrder=this.renderOrder,s.static=this.static,s.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.pivot!==null&&(s.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let h=l[c];r(t.shapes,h)}else r(t.shapes,l)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(r(t.materials,this.material[l]));s.material=a}else s.material=r(t.materials,this.material);if(this.children.length>0){s.children=[];for(let a=0;a<this.children.length;a++)s.children.push(this.children[a].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];s.animations.push(r(t.animations,l))}}if(e){let a=o(t.geometries),l=o(t.materials),c=o(t.textures),u=o(t.images),h=o(t.shapes),d=o(t.skeletons),p=o(t.animations),g=o(t.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),p.length>0&&(n.animations=p),g.length>0&&(n.nodes=g)}return n.object=s,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}};ai.DEFAULT_UP=new bt(0,1,0);ai.DEFAULT_MATRIX_AUTO_UPDATE=!0;ai.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;jr=class extends ai{constructor(){super(),this.isGroup=!0,this.type="Group"}},p2t={type:"move"},wg=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new jr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new jr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new bt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new bt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new jr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new bt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new bt,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let s=null,r=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(c&&t.hand){o=!0;for(let y of t.hand.values()){let x=e.getJointPose(y,n),w=this._getHandJoint(c,y);x!==null&&(w.matrix.fromArray(x.transform.matrix),w.matrix.decompose(w.position,w.rotation,w.scale),w.matrixWorldNeedsUpdate=!0,w.jointRadius=x.radius),w.visible=x!==null}let u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),p=.02,g=.005;c.inputState.pinching&&d>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&d<=p-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:t,target:this})));a!==null&&(s=e.getPose(t.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(p2t)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let n=new jr;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}},Ott={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Hd={h:0,s:0,l:0},kE={h:0,s:0,l:0};Be=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Zn){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Rn.colorSpaceToWorking(this,e),this}setRGB(t,e,n,s=Rn.workingColorSpace){return this.r=t,this.g=e,this.b=n,Rn.colorSpaceToWorking(this,s),this}setHSL(t,e,n,s=Rn.workingColorSpace){if(t=UU(t,1),e=Bn(e,0,1),n=Bn(n,0,1),e===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+e):n+e-n*e,o=2*n-r;this.r=d4(o,r,t+1/3),this.g=d4(o,r,t),this.b=d4(o,r,t-1/3)}return Rn.colorSpaceToWorking(this,s),this}setStyle(t,e=Zn){function n(r){r!==void 0&&parseFloat(r)<1&&Ze("Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:Ze("Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){let r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(o===6)return this.setHex(parseInt(r,16),e);Ze("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Zn){let n=Ott[t.toLowerCase()];return n!==void 0?this.setHex(n,e):Ze("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=lh(t.r),this.g=lh(t.g),this.b=lh(t.b),this}copyLinearToSRGB(t){return this.r=Db(t.r),this.g=Db(t.g),this.b=Db(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Zn){return Rn.workingToColorSpace(bo.copy(this),t),Math.round(Bn(bo.r*255,0,255))*65536+Math.round(Bn(bo.g*255,0,255))*256+Math.round(Bn(bo.b*255,0,255))}getHexString(t=Zn){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Rn.workingColorSpace){Rn.workingToColorSpace(bo.copy(this),e);let n=bo.r,s=bo.g,r=bo.b,o=Math.max(n,s,r),a=Math.min(n,s,r),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case n:l=(s-r)/h+(s<r?6:0);break;case s:l=(r-n)/h+2;break;case r:l=(n-s)/h+4;break}l/=6}return t.h=l,t.s=c,t.l=u,t}getRGB(t,e=Rn.workingColorSpace){return Rn.workingToColorSpace(bo.copy(this),e),t.r=bo.r,t.g=bo.g,t.b=bo.b,t}getStyle(t=Zn){Rn.workingToColorSpace(bo.copy(this),t);let e=bo.r,n=bo.g,s=bo.b;return t!==Zn?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(n*255)},${Math.round(s*255)})`}offsetHSL(t,e,n){return this.getHSL(Hd),this.setHSL(Hd.h+t,Hd.s+e,Hd.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Hd),t.getHSL(kE);let n=Gw(Hd.h,kE.h,e),s=Gw(Hd.s,kE.s,e),r=Gw(Hd.l,kE.l,e);return this.setHSL(n,s,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,n=this.g,s=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*s,this.g=r[1]*e+r[4]*n+r[7]*s,this.b=r[2]*e+r[5]*n+r[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},bo=new Be;Be.NAMES=Ott;s1=class i{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Be(t),this.density=e}clone(){return new i(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}},r1=class i{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new Be(t),this.near=e,this.far=n}clone(){return new i(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},o1=class extends ai{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new gr,this.environmentIntensity=1,this.environmentRotation=new gr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),e.object.backgroundBlurriness=this.backgroundBlurriness,e.object.backgroundIntensity=this.backgroundIntensity,e.object.backgroundRotation=this.backgroundRotation.toArray(),e.object.environmentIntensity=this.environmentIntensity,e.object.environmentRotation=this.environmentRotation.toArray(),e}},ac=new bt,nh=new bt,f4=new bt,ih=new bt,gb=new bt,mb=new bt,zZ=new bt,p4=new bt,g4=new bt,m4=new bt,b4=new pi,v4=new pi,y4=new pi,uc=class i{constructor(t=new bt,e=new bt,n=new bt){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,s){s.subVectors(n,e),ac.subVectors(t,e),s.cross(ac);let r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,n,s,r){ac.subVectors(s,e),nh.subVectors(n,e),f4.subVectors(t,e);let o=ac.dot(ac),a=ac.dot(nh),l=ac.dot(f4),c=nh.dot(nh),u=nh.dot(f4),h=o*c-a*a;if(h===0)return r.set(0,0,0),null;let d=1/h,p=(c*l-a*u)*d,g=(o*u-a*l)*d;return r.set(1-p-g,g,p)}static containsPoint(t,e,n,s){return this.getBarycoord(t,e,n,s,ih)===null?!1:ih.x>=0&&ih.y>=0&&ih.x+ih.y<=1}static getInterpolation(t,e,n,s,r,o,a,l){return this.getBarycoord(t,e,n,s,ih)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,ih.x),l.addScaledVector(o,ih.y),l.addScaledVector(a,ih.z),l)}static getInterpolatedAttribute(t,e,n,s,r,o){return b4.setScalar(0),v4.setScalar(0),y4.setScalar(0),b4.fromBufferAttribute(t,e),v4.fromBufferAttribute(t,n),y4.fromBufferAttribute(t,s),o.setScalar(0),o.addScaledVector(b4,r.x),o.addScaledVector(v4,r.y),o.addScaledVector(y4,r.z),o}static isFrontFacing(t,e,n,s){return ac.subVectors(n,e),nh.subVectors(t,e),ac.cross(nh).dot(s)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,s){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,n,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ac.subVectors(this.c,this.b),nh.subVectors(this.a,this.b),ac.cross(nh).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return i.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return i.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,s,r){return i.getInterpolation(t,this.a,this.b,this.c,e,n,s,r)}containsPoint(t){return i.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return i.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,s=this.b,r=this.c,o,a;gb.subVectors(s,n),mb.subVectors(r,n),p4.subVectors(t,n);let l=gb.dot(p4),c=mb.dot(p4);if(l<=0&&c<=0)return e.copy(n);g4.subVectors(t,s);let u=gb.dot(g4),h=mb.dot(g4);if(u>=0&&h<=u)return e.copy(s);let d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),e.copy(n).addScaledVector(gb,o);m4.subVectors(t,r);
vendor: 8,699 bytes, line 419
419let p=gb.dot(m4),g=mb.dot(m4);if(g>=0&&p<=g)return e.copy(r);let y=p*c-l*g;if(y<=0&&c>=0&&g<=0)return a=c/(c-g),e.copy(n).addScaledVector(mb,a);let x=u*g-p*h;if(x<=0&&h-u>=0&&p-g>=0)return zZ.subVectors(r,s),a=(h-u)/(h-u+(p-g)),e.copy(s).addScaledVector(zZ,a);let w=1/(x+y+d);return o=y*w,a=d*w,e.copy(n).addScaledVector(gb,o).addScaledVector(mb,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},rr=class{constructor(t=new bt(1/0,1/0,1/0),e=new bt(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(lc.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(lc.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=lc.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let n=t.geometry;if(n!==void 0){let r=n.getAttribute("position");if(e===!0&&r!==void 0&&t.isInstancedMesh!==!0)for(let o=0,a=r.count;o<a;o++)t.isMesh===!0?t.getVertexPosition(o,lc):lc.fromBufferAttribute(r,o),lc.applyMatrix4(t.matrixWorld),this.expandByPoint(lc);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),PE.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),PE.copy(n.boundingBox)),PE.applyMatrix4(t.matrixWorld),this.union(PE)}let s=t.children;for(let r=0,o=s.length;r<o;r++)this.expandByObject(s[r],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,lc),lc.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Rw),RE.subVectors(this.max,Rw),bb.subVectors(t.a,Rw),vb.subVectors(t.b,Rw),yb.subVectors(t.c,Rw),jd.subVectors(vb,bb),Wd.subVectors(yb,vb),ig.subVectors(bb,yb);let e=[0,-jd.z,jd.y,0,-Wd.z,Wd.y,0,-ig.z,ig.y,jd.z,0,-jd.x,Wd.z,0,-Wd.x,ig.z,0,-ig.x,-jd.y,jd.x,0,-Wd.y,Wd.x,0,-ig.y,ig.x,0];return!x4(e,bb,vb,yb,RE)||(e=[1,0,0,0,1,0,0,0,1],!x4(e,bb,vb,yb,RE))?!1:(DE.crossVectors(jd,Wd),e=[DE.x,DE.y,DE.z],x4(e,bb,vb,yb,RE))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,lc).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(lc).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(sh[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),sh[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),sh[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),sh[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),sh[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),sh[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),sh[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),sh[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(sh),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},sh=[new bt,new bt,new bt,new bt,new bt,new bt,new bt,new bt],lc=new bt,PE=new rr,bb=new bt,vb=new bt,yb=new bt,jd=new bt,Wd=new bt,ig=new bt,Rw=new bt,RE=new bt,DE=new bt,sg=new bt;ah=g2t();w2=class{static toHalfFloat(t){return va(t)}static fromHalfFloat(t){return Hw(t)}},fr=new bt,LE=new Ce,m2t=0,Mi=class extends wa{constructor(t,e,n=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:m2t++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=j_,this.updateRanges=[],this.gpuType=yo,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[t+s]=e.array[n+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)LE.fromBufferAttribute(this,e),LE.applyMatrix3(t),this.setXY(e,LE.x,LE.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)fr.fromBufferAttribute(this,e),fr.applyMatrix3(t),this.setXYZ(e,fr.x,fr.y,fr.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)fr.fromBufferAttribute(this,e),fr.applyMatrix4(t),this.setXYZ(e,fr.x,fr.y,fr.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)fr.fromBufferAttribute(this,e),fr.applyNormalMatrix(t),this.setXYZ(e,fr.x,fr.y,fr.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)fr.fromBufferAttribute(this,e),fr.transformDirection(t),this.setXYZ(e,fr.x,fr.y,fr.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Yo(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Jn(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Yo(e,this.array)),e}setX(t,e){return this.normalized&&(e=Jn(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Yo(e,this.array)),e}setY(t,e){return this.normalized&&(e=Jn(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Yo(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Jn(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Yo(e,this.array)),e}setW(t,e){return this.normalized&&(e=Jn(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Jn(e,this.array),n=Jn(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,s){return t*=this.itemSize,this.normalized&&(e=Jn(e,this.array),n=Jn(n,this.array),s=Jn(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=s,this}setXYZW(t,e,n,s,r){return t*=this.itemSize,this.normalized&&(e=Jn(e,this.array),n=Jn(n,this.array),s=Jn(s,this.array),r=Jn(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=s,this.array[t+3]=r,this}
vendor: 4,128 bytes, line 419
419onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return t.name=this.name,t.usage=this.usage,t.gpuType=this.gpuType,t}dispose(){this.dispatchEvent({type:"dispose"})}},_2=class extends Mi{constructor(t,e,n){super(new Int8Array(t),e,n)}},S2=class extends Mi{constructor(t,e,n){super(new Uint8Array(t),e,n)}},C2=class extends Mi{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}},M2=class extends Mi{constructor(t,e,n){super(new Int16Array(t),e,n)}},tf=class extends Mi{constructor(t,e,n){super(new Uint16Array(t),e,n)}},T2=class extends Mi{constructor(t,e,n){super(new Int32Array(t),e,n)}},Fb=class extends Mi{constructor(t,e,n){super(new Uint32Array(t),e,n)}},A2=class extends Mi{constructor(t,e,n){super(new Uint16Array(t),e,n),this.isFloat16BufferAttribute=!0}getX(t){let e=Hw(this.array[t*this.itemSize]);return this.normalized&&(e=Yo(e,this.array)),e}setX(t,e){return this.normalized&&(e=Jn(e,this.array)),this.array[t*this.itemSize]=va(e),this}getY(t){let e=Hw(this.array[t*this.itemSize+1]);return this.normalized&&(e=Yo(e,this.array)),e}setY(t,e){return this.normalized&&(e=Jn(e,this.array)),this.array[t*this.itemSize+1]=va(e),this}getZ(t){let e=Hw(this.array[t*this.itemSize+2]);return this.normalized&&(e=Yo(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Jn(e,this.array)),this.array[t*this.itemSize+2]=va(e),this}getW(t){let e=Hw(this.array[t*this.itemSize+3]);return this.normalized&&(e=Yo(e,this.array)),e}setW(t,e){return this.normalized&&(e=Jn(e,this.array)),this.array[t*this.itemSize+3]=va(e),this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Jn(e,this.array),n=Jn(n,this.array)),this.array[t+0]=va(e),this.array[t+1]=va(n),this}setXYZ(t,e,n,s){return t*=this.itemSize,this.normalized&&(e=Jn(e,this.array),n=Jn(n,this.array),s=Jn(s,this.array)),this.array[t+0]=va(e),this.array[t+1]=va(n),this.array[t+2]=va(s),this}setXYZW(t,e,n,s,r){return t*=this.itemSize,this.normalized&&(e=Jn(e,this.array),n=Jn(n,this.array),s=Jn(s,this.array),r=Jn(r,this.array)),this.array[t+0]=va(e),this.array[t+1]=va(n),this.array[t+2]=va(s),this.array[t+3]=va(r),this}},Ge=class extends Mi{constructor(t,e,n){super(new Float32Array(t),e,n)}},b2t=new rr,Dw=new bt,w4=new bt,Gs=class{constructor(t=new bt,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let n=this.center;e!==void 0?n.copy(e):b2t.setFromPoints(t).getCenter(n);let s=0;for(let r=0,o=t.length;r<o;r++)s=Math.max(s,n.distanceToSquared(t[r]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Dw.subVectors(t,this.center);let e=Dw.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),s=(n-this.radius)*.5;this.center.addScaledVector(Dw,s/n),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radiu
vendor: 19,800 bytes, line 419
419s):(w4.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Dw.copy(t.center).add(w4)),this.expandByPoint(Dw.copy(t.center).sub(w4))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},v2t=0,yl=new tn,_4=new ai,xb=new bt,Va=new rr,Lw=new rr,Hr=new bt,kn=class i extends wa{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:v2t++}),this.uuid=Ha(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(VEt(t)?Fb:tf)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new Vn().getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return yl.makeRotationFromQuaternion(t),this.applyMatrix4(yl),this}rotateX(t){return yl.makeRotationX(t),this.applyMatrix4(yl),this}rotateY(t){return yl.makeRotationY(t),this.applyMatrix4(yl),this}rotateZ(t){return yl.makeRotationZ(t),this.applyMatrix4(yl),this}translate(t,e,n){return yl.makeTranslation(t,e,n),this.applyMatrix4(yl),this}scale(t,e,n){return yl.makeScale(t,e,n),this.applyMatrix4(yl),this}lookAt(t){return _4.lookAt(t),_4.updateMatrix(),this.applyMatrix4(_4.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(xb).negate(),this.translate(xb.x,xb.y,xb.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let n=[];for(let s=0,r=t.length;s<r;s++){let o=t[s];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Ge(n,3))}else{let n=Math.min(t.length,e.count);for(let s=0;s<n;s++){let r=t[s];e.setXYZ(s,r.x,r.y,r.z||0)}t.length>e.count&&Ze("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new rr);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Tn("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new bt(-1/0,-1/0,-1/0),new bt(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,s=e.length;n<s;n++){let r=e[n];Va.setFromBufferAttribute(r),this.morphTargetsRelative?(Hr.addVectors(this.boundingBox.min,Va.min),this.boundingBox.expandByPoint(Hr),Hr.addVectors(this.boundingBox.max,Va.max),this.boundingBox.expandByPoint(Hr)):(this.boundingBox.expandByPoint(Va.min),this.boundingBox.expandByPoint(Va.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Tn('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Gs);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Tn("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new bt,1/0);return}if(t){let n=this.boundingSphere.center;if(Va.setFromBufferAttribute(t),e)for(let r=0,o=e.length;r<o;r++){let a=e[r];Lw.setFromBufferAttribute(a),this.morphTargetsRelative?(Hr.addVectors(Va.min,Lw.min),Va.expandByPoint(Hr),Hr.addVectors(Va.max,Lw.max),Va.expandByPoint(Hr)):(Va.expandByPoint(Lw.min),Va.expandByPoint(Lw.max))}Va.getCenter(n);let s=0;for(let r=0,o=t.count;r<o;r++)Hr.fromBufferAttribute(t,r),s=Math.max(s,n.distanceToSquared(Hr));if(e)for(let r=0,o=e.length;r<o;r++){let a=e[r],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Hr.fromBufferAttribute(a,c),l&&(xb.fromBufferAttribute(t,c),Hr.add(xb)),s=Math.max(s,n.distanceToSquared(Hr))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&Tn('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){Tn("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.position,s=e.normal,r=e.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Mi(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let I=0;I<n.count;I++)a[I]=new bt,l[I]=new bt;let c=new bt,u=new bt,h=new bt,d=new Ce,p=new Ce,g=new Ce,y=new bt,x=new bt;function w(I,U,V){c.fromBufferAttribute(n,I),u.fromBufferAttribute(n,U),h.fromBufferAttribute(n,V),d.fromBufferAttribute(r,I),p.fromBufferAttribute(r,U),g.fromBufferAttribute(r,V),u.sub(c),h.sub(c),p.sub(d),g.sub(d);let q=1/(p.x*g.y-g.x*p.y);isFinite(q)&&(y.copy(u).multiplyScalar(g.y).addScaledVector(h,-p.y).multiplyScalar(q),x.copy(h).multiplyScalar(p.x).addScaledVector(u,-g.x).multiplyScalar(q),a[I].add(y),a[U].add(y),a[V].add(y),l[I].add(x),l[U].add(x),l[V].add(x))}let M=this.groups;M.length===0&&(M=[{start:0,count:t.count}]);for(let I=0,U=M.length;I<U;++I){let V=M[I],q=V.start,X=V.count;for(let j=q,W=q+X;j<W;j+=3)w(t.getX(j+0),t.getX(j+1),t.getX(j+2))}let A=new bt,C=new bt,R=new bt,k=new bt;function O(I){R.fromBufferAttribute(s,I),k.copy(R);let U=a[I];A.copy(U),A.sub(R.multiplyScalar(R.dot(U))).normalize(),C.crossVectors(k,U);let q=C.dot(l[I])<0?-1:1;o.setXYZW(I,A.x,A.y,A.z,q)}for(let I=0,U=M.length;I<U;++I){let V=M[I],q=V.start,X=V.count;for(let j=q,W=q+X;j<W;j+=3)O(t.getX(j+0)),O(t.getX(j+1)),O(t.getX(j+2))}this._transformed=!0}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==e.count)n=new Mi(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let d=0,p=n.count;d<p;d++)n.setXYZ(d,0,0,0);let s=new bt,r=new bt,o=new bt,a=new bt,l=new bt,c=new bt,u=new bt,h=new bt;if(t)for(let d=0,p=t.count;d<p;d+=3){let g=t.getX(d+0),y=t.getX(d+1),x=t.getX(d+2);s.fromBufferAttribute(e,g),r.fromBufferAttribute(e,y),o.fromBufferAttribute(e,x),u.subVectors(o,r),h.subVectors(s,r),u.cross(h),a.fromBufferAttribute(n,g),l.fromBufferAttribute(n,y),c.fromBufferAttribute(n,x),a.add(u),l.add(u),c.add(u),n.setXYZ(g,a.x,a.y,a.z),n.setXYZ(y,l.x,l.y,l.z),n.setXYZ(x,c.x,c.y,c.z)}else for(let d=0,p=e.count;d<p;d+=3)s.fromBufferAttribute(e,d+0),r.fromBufferAttribute(e,d+1),o.fromBufferAttribute(e,d+2),u.subVectors(o,r),h.subVectors(s,r),u.cross(h),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Hr.fromBufferAttribute(t,e),Hr.normalize(),t.setXYZ(e,Hr.x,Hr.y,Hr.z)}toNonIndexed(){function t(a,l){let c=a.array,u=a.itemSize,h=a.normalized,d=new c.constructor(l.length*u),p=0,g=0;for(let y=0,x=l.length;y<x;y++){a.isInterleavedBufferAttribute?p=l[y]*a.data.stride+a.offset:p=l[y]*u;for(let w=0;w<u;w++)d[g++]=c[p++]}return new Mi(d,u,h)}if(this.index===null)return Ze("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new i,n=this.index.array,s=this.attributes;for(let a in s){let l=s[a],c=t(l,n);e.setAttribute(a,c)}let r=this.morphAttributes;for(let a in r){let l=[],c=r[a];for(let u=0,h=c.length;u<h;u++){let d=c[u],p=t(d,n);l.push(p)}e.morphAttributes[a]=l}e.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,t.name=this.name,Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let l in n){let c=n[l];t.data.attributes[l]=c.toJSON(t.data)}let s={},r=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h<d;h++){let p=c[h];u.push(p.toJSON(t.data))}u.length>0&&(s[l]=u,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(t.data.boundingSphere=a.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone());let s=t.attributes;for(let c in s){let u=s[c];this.setAttribute(c,u.clone(e))}let r=t.morphAttributes;for(let c in r){let u=[],h=r[c];for(let d=0,p=h.length;d<p;d++)u.push(h[d].clone(e));this.morphAttributes[c]=u}this.morphTargetsRelative=t.morphTargetsRelative;let o=t.groups;for(let c=0,u=o.length;c<u;c++){let h=o[c];this.addGroup(h.start,h.count,h.materialIndex)}let a=t.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this._transformed=t._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},ru=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=j_,this.updateRanges=[],this.version=0,this.uuid=Ha()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let s=0,r=this.stride;s<r;s++)this.array[t+s]=e.array[n+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ha()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ha()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer)));let e={uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride};return e.usage=this.usage,e}},qo=new bt,fc=class i{constructor(t,e,n,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)qo.fromBufferAttribute(this,e),qo.applyMatrix4(t),this.setXYZ(e,qo.x,qo.y,qo.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)qo.fromBufferAttribute(this,e),qo.applyNormalMatrix(t),this.setXYZ(e,qo.x,qo.y,qo.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)qo.fromBufferAttribute(this,e),qo.transformDirection(t),this.setXYZ(e,qo.x,qo.y,qo.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=Yo(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Jn(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=Jn(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Jn(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Jn(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Jn(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Yo(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Yo(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Yo(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Yo(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=Jn(e,this.array),n=Jn(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=Jn(e,this.array),n=Jn(n,this.array),s=Jn(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=s,this}setXYZW(t,e,n,s,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=Jn(e,this.array),n=Jn(n,this.array),s=Jn(s,this.array),r=Jn(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=s,this.data.array[t+3]=r,this}clone(t){if(t===void 0){Nb("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[s+r])}return new Mi(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new i(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){Nb("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[s+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},S4=new bt,y2t=new bt,x2t=new Vn,xl=class{constructor(t=new bt(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,s){return this.normal.set(t,e,n),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){let s=S4.subVectors(n,e).cross(y2t.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e,n=!0){let s=t.delta(S4),r=this.normal.dot(s);if(r===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let o=-(t.start.dot(this.normal)+this.constant)/r;return n===!0&&(o<0||o>1)?null:e.copy(t.start).addScaledVector(s,o)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||x2t.getNormalMatrix(t),s=this.coplanarPoint(S4).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(t){return this.normal.fromArray(t.normal),this.constant=t.constant,this}},w2t=0,ss=class extends wa{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:w2t++}),this.uuid=Ha(),this.name="",this.type="Material",this.blending=Lg,this.side=$a,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ak,this.blendDst=Ek,this.blendEquation=af,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Be(0,0,0),this.blendAlpha=0,this.depthFunc=mg,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=RU,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=$w,this.stencilZFail=$w,this.stencilZPass=$w,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let n=t[e];if(n===void 0){Ze(`Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){Ze(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector2&&n&&n.isVector2||s&&s.isEuler&&n&&n.isEuler||s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
419n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(r=>r.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe
vendor: 3,211 bytes, line 419
419!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(r){let o=[];for(let a in r){let l=r[a];delete l.metadata,o.push(l)}return o}if(e){let r=s(t.textures),o=s(t.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n}fromJSON(t,e){if(t.uuid!==void 0&&(this.uuid=t.uuid),t.name!==void 0&&(this.name=t.name),t.color!==void 0&&this.color!==void 0&&this.color.setHex(t.color),t.roughness!==void 0&&(this.roughness=t.roughness),t.metalness!==void 0&&(this.metalness=t.metalness),t.sheen!==void 0&&(this.sheen=t.sheen),t.sheenColor!==void 0&&(this.sheenColor=new Be().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(this.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(t.emissive),t.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(t.specular),t.specularIntensity!==void 0&&(this.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(this.shininess=t.shininess),t.clearcoat!==void 0&&(this.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(this.dispersion=t.dispersion),t.retroreflectivity!==void 0&&(this.retroreflectivity=t.retroreflectivity),t.iridescence!==void 0&&(this.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(this.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(this.transmission=t.transmission),t.thickness!==void 0&&(this.thickness=t.thickness),t.attenuationDistance!==void 0&&(this.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(this.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(this.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(this.fog=t.fog),t.flatShading!==void 0&&(this.flatShading=t.flatShading),t.blending!==void 0&&(this.blending=t.blending),t.combine!==void 0&&(this.combine=t.combine),t.side!==void 0&&(this.side=t.side),t.shadowSide!==void 0&&(this.shadowSide=t.shadowSide),t.opacity!==void 0&&(this.opacity=t.opacity),t.transparent!==void 0&&(this.transparent=t.transparent),t.alphaTest!==void 0&&(this.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(this.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(this.depthFunc=t.depthFunc),t.depthTest!==void 0&&(this.depthTest=t.depthTest),t.depthWrite!==void 0&&(this.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(this.colorWrite=t.colorWrite),t.clippingPlanes!==void 0&&(this.clippingPlanes=t.clippingPlanes.map(n=>new xl().fromJSON(n))),t.clipIntersection!==void 0&&(this.clipIntersection=t.clipIntersection),t.clipSh
vendor: 10,505 bytes, line 419
419adows!==void 0&&(this.clipShadows=t.clipShadows),t.depthPacking!==void 0&&(this.depthPacking=t.depthPacking),t.blendSrc!==void 0&&(this.blendSrc=t.blendSrc),t.blendDst!==void 0&&(this.blendDst=t.blendDst),t.blendEquation!==void 0&&(this.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(this.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(this.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(this.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(this.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(this.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(this.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(this.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(this.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(this.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(this.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(this.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(this.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(this.rotation=t.rotation),t.linewidth!==void 0&&(this.linewidth=t.linewidth),t.linecap!==void 0&&(this.linecap=t.linecap),t.linejoin!==void 0&&(this.linejoin=t.linejoin),t.dashSize!==void 0&&(this.dashSize=t.dashSize),t.gapSize!==void 0&&(this.gapSize=t.gapSize),t.scale!==void 0&&(this.scale=t.scale),t.polygonOffset!==void 0&&(this.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(this.dithering=t.dithering),t.alphaToCoverage!==void 0&&(this.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(this.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(this.allowOverride=t.allowOverride),t.visible!==void 0&&(this.visible=t.visible),t.toneMapped!==void 0&&(this.toneMapped=t.toneMapped),t.userData!==void 0&&(this.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?this.vertexColors=t.vertexColors>0:this.vertexColors=t.vertexColors),t.size!==void 0&&(this.size=t.size),t.sizeAttenuation!==void 0&&(this.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(this.map=e[t.map]||null),t.matcap!==void 0&&(this.matcap=e[t.matcap]||null),t.alphaMap!==void 0&&(this.alphaMap=e[t.alphaMap]||null),t.bumpMap!==void 0&&(this.bumpMap=e[t.bumpMap]||null),t.bumpScale!==void 0&&(this.bumpScale=t.bumpScale),t.normalMap!==void 0&&(this.normalMap=e[t.normalMap]||null),t.normalMapType!==void 0&&(this.normalMapType=t.normalMapType),t.normalScale!==void 0){let n=t.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Ce().fromArray(n)}return t.displacementMap!==void 0&&(this.displacementMap=e[t.displacementMap]||null),t.displacementScale!==void 0&&(this.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(this.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(this.roughnessMap=e[t.roughnessMap]||null),t.metalnessMap!==void 0&&(this.metalnessMap=e[t.metalnessMap]||null),t.emissiveMap!==void 0&&(this.emissiveMap=e[t.emissiveMap]||null),t.emissiveIntensity!==void 0&&(this.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(this.specularMap=e[t.specularMap]||null),t.specularIntensityMap!==void 0&&(this.specularIntensityMap=e[t.specularIntensityMap]||null),t.specularColorMap!==void 0&&(this.specularColorMap=e[t.specularColorMap]||null),t.envMap!==void 0&&(this.envMap=e[t.envMap]||null),t.envMapRotation!==void 0&&this.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(this.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(this.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(this.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(this.lightMap=e[t.lightMap]||null),t.lightMapIntensity!==void 0&&(this.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(this.aoMap=e[t.aoMap]||null),t.aoMapIntensity!==void 0&&(this.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(this.gradientMap=e[t.gradientMap]||null),t.clearcoatMap!==void 0&&(this.clearcoatMap=e[t.clearcoatMap]||null),t.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=e[t.clearcoatRoughnessMap]||null),t.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=e[t.clearcoatNormalMap]||null),t.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Ce().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(this.iridescenceMap=e[t.iridescenceMap]||null),t.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=e[t.iridescenceThicknessMap]||null),t.transmissionMap!==void 0&&(this.transmissionMap=e[t.transmissionMap]||null),t.thicknessMap!==void 0&&(this.thicknessMap=e[t.thicknessMap]||null),t.anisotropyMap!==void 0&&(this.anisotropyMap=e[t.anisotropyMap]||null),t.sheenColorMap!==void 0&&(this.sheenColorMap=e[t.sheenColorMap]||null),t.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=e[t.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,n=null;if(e!==null){let s=e.length;n=new Array(s);for(let r=0;r!==s;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},Ub=class extends ss{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Be(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},Iw=new bt,_b=new bt,Sb=new bt,Cb=new Ce,Ow=new Ce,Ntt=new tn,IE=new bt,Nw=new bt,OE=new bt,VZ=new Ce,C4=new Ce,HZ=new Ce,a1=class extends ai{constructor(t=new Ub){if(super(),this.isSprite=!0,this.type="Sprite",wb===void 0){wb=new kn;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new ru(e,5);wb.setIndex([0,1,2,0,2,3]),wb.setAttribute("position",new fc(n,3,0,!1)),wb.setAttribute("uv",new fc(n,2,3,!1))}this.geometry=wb,this.material=t,this.center=new Ce(.5,.5),this.count=1}intersectsFrustum(t){return t.intersectsSprite(this)}raycast(t,e){t.camera===null&&Tn('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),_b.setFromMatrixScale(this.matrixWorld),Ntt.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Sb.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&_b.multiplyScalar(-Sb.z);let n=this.material.rotation,s,r;n!==0&&(r=Math.cos(n),s=Math.sin(n));let o=this.center;NE(IE.set(-.5,-.5,0),Sb,o,_b,s,r),NE(Nw.set(.5,-.5,0),Sb,o,_b,s,r),NE(OE.set(.5,.5,0),Sb,o,_b,s,r),VZ.set(0,0),C4.set(1,0),HZ.set(1,1);let a=t.ray.intersectTriangle(IE,Nw,OE,!1,Iw);if(a===null&&(NE(Nw.set(-.5,.5,0),Sb,o,_b,s,r),C4.set(0,1),a=t.ray.intersectTriangle(IE,OE,Nw,!1,Iw),a===null))return;let l=t.ray.origin.distanceTo(Iw);l<t.near||l>t.far||e.push({distance:l,point:Iw.clone(),uv:uc.getInterpolation(Iw,IE,Nw,OE,VZ,C4,HZ,new Ce),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}};BE=new bt,jZ=new bt,l1=class extends ai{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);let e=t.levels;for(let n=0,s=e.length;n<s;n++){let r=e[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,n=0){e=Math.abs(e);let s=this.levels,r;for(r=0;r<s.length&&!(e<s[r].distance);r++);return s.splice(r,0,{distance:e,hysteresis:n,object:t}),this.add(t),this}removeLevel(t){let e=this.levels;for(let n=0;n<e.length;n++)if(e[n].distance===t){let s=e.splice(n,1);return this.remove(s[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){let e=this.levels;if(e.length>0){let n,s;for(n=1,s=e.length;n<s;n++){let r=e[n].distance;if(e[n].object.visible&&(r-=r*e[n].hysteresis),t<r)break}return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){BE.setFromMatrixPosition(this.matrixWorld);let s=t.ray.origin.distanceTo(BE);this.getObjectForDistance(s).raycast(t,e)}}update(t){let e=this.levels;if(e.length>1){BE.setFromMatrixPosition(t.matrixWorld),jZ.setFromMatrixPosition(this.matrixWorld);let n=BE.distanceTo(jZ)/t.zoom;e[0].object.visible=!0;let s,r;for(s=1,r=e.length;s<r;s++){let o=e[s].distance;
419if(e[s].object.visible&&(o-=o*e[s].hysteresis),n>=o)e[s-1].object.visible=!1,e[s].object.visible=!0;else break}for(this._currentLevel=s-1;s<r;s++)e[s].object.visible=!1}}toJSON(t){let e=super.toJSON(t);e.object.autoUpdate=this.autoUpdate,e.object.levels=[];let n=this.levels;for(let s=0,r=n.length;s<r;s++){let o=n[s];e.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return e}},rh=new bt,M4=new bt,FE=new bt,UE=new bt,ch=class{constructor(t=new bt,e=new bt(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,rh)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=rh.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(rh.copy(this.origin).addScaledVector(this.direction,e),rh.distanceToSquared(t))}distanceSqToSegment(t,e,n,s){M4.copy(t).add(e).multiplyScalar(.5),FE.copy(e).sub(t).normalize(),UE.copy(this.origin).sub(M4);let r=t.distanceTo(e)*.5,o=-this.direction.dot(FE),a=UE.dot(this.direction),l=-UE.dot(FE),c=UE.lengthSq(),u=Math.abs(1-o*o),h,d,p,g;if(u>0)if(h=o*l-a,d=o*a-l,g=r*u,h>=0)if(d>=-g)if(d<=g){let y=1/u;h*=y,d*=y,p=h*(h+o*d+2*a)+d*(o*h+d+2*l)+c}else d=r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d=-r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d<=-g?(h=Math.max(0,-(-o*r+a)),d=h>0?-r:Math.min(Math.max(-r,-l),r),p=-h*h+d*(d+2*l)+c):d<=g?(h=0,d=Math.min(Math.max(-r,-l),r),p=d*(d+2*l)+c):(h=Math.max(0,-(o*r+a)),d=h>0?r:Math.min(Math.max(-r,-l),r),p=-h*h+d*(d+2*l)+c);else d=o>0?-r:r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),s&&s.copy(M4).addScaledVector(FE,d),p}intersectSphere(t,e){if(t.radius<0)return null;rh.subVectors(t.center,this.origin);let n=rh.dot(this.direction),s=rh.dot(rh)-n*n,r=t.radius*t.radius;if(s>r)return null;let o=Math.sqrt(r-s),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,e):this.at(a,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){let n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,s,r,o,a,l,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(n=(t.min.x-d.x)*c,s=(t.max.x-d.x)*c):(n=(t.max.x-d.x)*c,s=(t.min.x-d.x)*c),u>=0?(r=(t.min.y-d.y)*u,o=(t.max.y-d.y)*u):(r=(t.max.y-d.y)*u,o=(t.min.y-d.y)*u),n>o||r>s||((r>n||isNaN(n))&&(n=r),(o<s||isNaN(s))&&(s=o),h>=0?(a=(t.min.z-d.z)*h,l=(t.max.z-d.z)*h):(a=(t.max.z-d.z)*h,l=(t.min.z-d.z)*h),n>l||a>s)||((a>n||n!==n)&&(n=a),(l<s||s!==s)&&(s=l),s<0)?null:this.at(n>=0?n:s,e)}intersectsBox(t){return this.intersectBox(t,rh)!==null}intersectTriangle(t,e,n,s,r){let o=this.origin,a=this.direction,l=a.x,c=a.y,u=a.z,h=t.x-o.x,d=t.y-o.y,p=t.z-o.z,g=e.x-o.x,y=e.y-o.y,x=e.z-o.z,w=n.x-o.x,M=n.y-o.y,A=n.z-o.z,C=Math.abs(l),R=Math.abs(c),k=Math.abs(u),O,I,U,V,q,X,j,W,_,at,ct,pt;if(C>=R&&C>=k?(U=l,X=h,_=g,pt=w,l>=0?(O=c,I=u,V=d,q=p,j=y,W=x,at=M,ct=A):(O=u,I=c,V=p,q=d,j=x,W=y,at=A,ct=M)):R>=k?(U=c,X=d,_=y,pt=M,c>=0?(O=u,I=l,V=p,q=h,j=x,W=g,at=A,ct=w):(O=l,I=u,V=h,q=p,j=g,W=x,at=w,ct=A)):(U=u,X=p,_=x,pt=A,u>=0?(O=l,I=c,V=h,q=d,j=g,W=y,at=w,ct=M):(O=c,I=l,V=d,q=h,j=y,W=g,at=M,ct=w)),U===0)return null;let Et=O/U,vt=I/U,yt=1/U,kt=V-Et*X,Wt=q-vt*X,jt=j-Et*_,ae=W-vt*_,ee=at-Et*pt,Bt=ct-vt*pt,Gt=ee*ae-Bt*jt,Qt=kt*Bt-Wt*ee,xe=jt*Wt
419-ae*kt;if(s){if(Gt<0||Qt<0||xe<0)return null}else if((Gt<0||Qt<0||xe<0)&&(Gt>0||Qt>0||xe>0))return null;let Ut=Gt+Qt+xe;if(Ut===0)return null;let zt=yt*(Gt*X+Qt*_+xe*pt);return(Ut>0?zt<0:zt>0)?null:this.at(zt/Ut,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},io=class extends ss{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Be(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new gr,this.combine=av,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},WZ=new tn,rg=new ch,zE=new Gs,$Z=new bt,VE=new bt,HE=new bt,jE=new bt,T4=new bt,WE=new bt,GZ=new bt,$E=new bt,qi=class extends ai{constructor(t=new kn,e=new io){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(t,e){let n=this.geometry,s=n.attributes.position,r=n.morphAttributes.position,o=n.morphTargetsRelative;e.fromBufferAttribute(s,t);let a=this.morphTargetInfluences;if(r&&a){WE.set(0,0,0);for(let l=0,c=r.length;l<c;l++){let u=a[l],h=r[l];u!==0&&(T4.fromBufferAttribute(h,t),o?WE.addScaledVector(T4,u):WE.addScaledVector(T4.sub(e),u))}e.add(WE)}return e}intersectsFrustum(t){return t.intersectsObject(this)}raycast(t,e){let n=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),zE.copy(n.boundingSphere),zE.applyMatrix4(r),rg.copy(t.ray).recast(t.near),!(zE.containsPoint(rg.origin)===!1&&(rg.intersectSphere(zE,$Z)===null||rg.origin.distanceToSquared($Z)>
vendor: 5,435 bytes, line 419
419(t.far-t.near)**2))&&(WZ.copy(r).invert(),rg.copy(t.ray).applyMatrix4(WZ),!(n.boundingBox!==null&&rg.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,rg)))}_computeIntersections(t,e,n){let s,r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,c=r.attributes.uv,u=r.attributes.uv1,h=r.attributes.normal,d=r.groups,p=r.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,y=d.length;g<y;g++){let x=d[g],w=o[x.materialIndex],M=Math.max(x.start,p.start),A=Math.min(a.count,Math.min(x.start+x.count,p.start+p.count));for(let C=M,R=A;C<R;C+=3){let k=a.getX(C),O=a.getX(C+1),I=a.getX(C+2);s=GE(this,w,t,n,c,u,h,k,O,I),s&&(s.faceIndex=Math.floor(C/3),s.face.materialIndex=x.materialIndex,e.push(s))}}else{let g=Math.max(0,p.start),y=Math.min(a.count,p.start+p.count);for(let x=g,w=y;x<w;x+=3){let M=a.getX(x),A=a.getX(x+1),C=a.getX(x+2);s=GE(this,o,t,n,c,u,h,M,A,C),s&&(s.faceIndex=Math.floor(x/3),e.push(s))}}else if(l!==void 0)if(Array.isArray(o))for(let g=0,y=d.length;g<y;g++){let x=d[g],w=o[x.materialIndex],M=Math.max(x.start,p.start),A=Math.min(l.count,Math.min(x.start+x.count,p.start+p.count));for(let C=M,R=A;C<R;C+=3){let k=C,O=C+1,I=C+2;s=GE(this,w,t,n,c,u,h,k,O,I),s&&(s.faceIndex=Math.floor(C/3),s.face.materialIndex=x.materialIndex,e.push(s))}}else{let g=Math.max(0,p.start),y=Math.min(l.count,p.start+p.count);for(let x=g,w=y;x<w;x+=3){let M=x,A=x+1,C=x+2;s=GE(this,o,t,n,c,u,h,M,A,C),s&&(s.faceIndex=Math.floor(x/3),e.push(s))}}}};Bw=new pi,qZ=new pi,YZ=new pi,S2t=new pi,XZ=new tn,qE=new bt,A4=new Gs,KZ=new tn,E4=new ch,uh=class extends qi{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=m2,this.bindMatrix=new tn,this.bindMatrixInverse=new tn,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let t=this.geometry;this.boundingBox===null&&(this.boundingBox=new rr),this.boundingBox.makeEmpty();let e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,qE),this.boundingBox.expandByPoint(qE)}computeBoundingSphere(){let t=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Gs),this.boundingSphere.makeEmpty();let e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,qE),this.boundingSphere.expandByPoint(qE)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){let n=this.material,s=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),A4.copy(this.boundingSphere),A4.applyMatrix4(s),t.ray.intersectsSphere(A4)!==!1&&(KZ.copy(s).invert(),E4.copy(t.ray).applyMatrix4(KZ),!(this.boundingBox!==null&&E4.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(t,e,E4)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let t=new pi,e=this.geometry.attributes.skinWeight;for(let n=0,s=e.count;n<s;n++){t.fromBufferAttribute(e,n);let r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===m2?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===MU?this.bindMatrixInverse.copy(this.bindMatrix).invert():Ze("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){let n=this.skeleton,s=this.geometry;qZ.fromBufferAttribute(s.attributes.skinIndex,t),YZ.fromBufferAttribute(s.attributes.skinWeight,t),e.isVector4?(Bw.copy(e),e.set(0,0,0,0)):(Bw.set(...e,1),e.set(0,0,0)),Bw.applyMatrix4(this.bindMatrix);for(let r=0;r<4;r++){let o=YZ.getComponent(r);if(o!==0){let a=qZ.getComponent(r);XZ.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),e.addScaledVector(S2t.copy(Bw).applyMatrix4(XZ),o)}}return e.isVector4&&(e.w=Bw.w),e.applyMatrix4(this.bindMatrixInverse)}},pc=class extends ai{constructor(){super(),this.isBone=!0,this.type="Bone"}},Xo=class extends is{constructor(t=null,e=1,n=1,s,r,o,a,l,c=xs,u=xs,h,d){super(null,o,a,l,c,u,s,r,h,d),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},JZ=new tn,C2t=new tn,hh=class i{constructor(t=[],e=[]){this.uuid=Ha(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(t.length*16),e.length===0)this.calculateInverses();else if(t.length!==e.length){Ze("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,s=this.bones.length;n<s;n++)this.boneInverses.push(new tn)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){let n=new tn;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){let n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){let n=this.bones[t];
vendor: 5,826 bytes, line 419
419n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let t=this.bones,e=this.boneInverses,n=this.boneMatrices,s=this.boneTexture;for(let r=0,o=t.length;r<o;r++){let a=t[r]?t[r].matrixWorld:C2t;JZ.multiplyMatrices(a,e[r]),JZ.toArray(n,r*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new i(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(this.bones.length*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);let e=new Float32Array(t*t*4);e.set(this.boneMatrices);let n=new Xo(e,t,t,xo,yo);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){let s=this.bones[e];if(s.name===t)return s}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,s=t.bones.length;n<s;n++){let r=t.bones[n],o=e[r];o===void 0&&(Ze("Skeleton: No bone found with UUID:",r),o=new pc),this.bones.push(o),this.boneInverses.push(new tn().fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){let t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;let e=this.bones,n=this.boneInverses;for(let s=0,r=e.length;s<r;s++){let o=e[s];t.bones.push(o.uuid);let a=n[s];t.boneInverses.push(a.toArray())}return t}},ja=class extends Mi{constructor(t,e,n,s=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}},Mb=new tn,ZZ=new tn,YE=[],QZ=new rr,M2t=new tn,Fw=new qi,Uw=new Gs,_g=class extends qi{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new ja(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<n;s++)this.setMatrixAt(s,M2t)}computeBoundingBox(){let t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new rr),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Mb),QZ.copy(t.boundingBox).applyMatrix4(Mb),this.boundingBox.union(QZ)}computeBoundingSphere(){let t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new Gs),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Mb),Uw.copy(t.boundingSphere).applyMatrix4(Mb),this.boundingSphere.union(Uw)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){return this.instanceColor===null?e.setRGB(1,1,1):e.fromArray(this.instanceColor.array,t*3)}getMatrixAt(t,e){return e.fromArray(this.instanceMatrix.array,t*16)}getMorphAt(t,e){let n=e.morphTargetInfluences,s=this.morphTexture.source.data.data,r=n.length+1,o=t*r+1;for(let a=0;a<n.length;a++)n[a]=s[o+a]}raycast(t,e){let n=this.matrixWorld,s=this.count;if(Fw.geometry=this.geometry,Fw.material=this.material,Fw.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Uw.copy(this.boundingSphere),Uw.applyMatrix4(n),t.ray.intersectsSphere(Uw)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,Mb),ZZ.multiplyMatrices(n,Mb),Fw.matrixWorld=ZZ,Fw.raycast(t,YE);for(let o=0,a=YE.length;o<a;o++){let l=YE[o];l.instanceId=r,l.object=this,e.push(l)}YE.length=0}}setColorAt(t,e){return this.instanceColor===null&&(this.instanceColor=new ja(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),e.toArray(this.instanceColor.array,t*3),this}setMatrixAt(t,e){return e.toArray(this.instanceMatrix.array,t*16),this}setMorphAt(t,e){let n=e.morphTargetInfluences,s=n.length+1;this.morphTexture===null&&(this.morphTexture=new Xo(new Float32Array(s*this.count),s,this.count,a_,yo));let r=this.morphTexture.source.data.data,o=0;for(let c=0;c<n.length;c++)o+=n[c];let a=this.geometry.morphTargetsRelative?1:1-o,l=s*t;return r[l]=a,r.set(n,l+1),this}updateMorphTargets(){}dispose(){super.dispose(),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},og=new Gs,T2t=new Ce(.5,.5),XE=new bt,ou=class{constructor(t=new xl,e=new xl,n=new xl,s=new xl,r=new xl,o=new xl){this.planes=[t,e,n,s,r,o]}set(t,e,n,s,r,o){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(t){let e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=ya,n=!1){let s=this.planes,r=t.elements,o=r[0],a=r[1],l=r[2],c=r[3],u=r[4],h=r[5],d=r[6],p=r[7],g=r[8],y=r[9],x=r[10],w=r[11],M=r[12],A=r[13],C=r[14],R=r[15];if(s[0].setComponents(c-o,p-u,w-g,R-M).normalize(),s[1].setComponents(c+o,p+u,w+g,R+M).normalize(),s[2].setComponents(c+a,p+h,w+y,R+A).normalize(),s[3].setComponents(c-a,p-h,w-y,R-A).normalize(),n)s[4].setComponents(l,d,x,C).normalize(),s[5].setComponents(c-l,p-d,w-x,R-C).normalize();else if(s[4].setComponents(c-l,p-d,w-x,R-C).normalize(),e===ya)s[5].setComponents(c+l,p+d,w+x,R+C).normalize();else if(e===Zd)s[5].setComponents(l,d,x,C).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),og.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;
419e.boundingSphere===null&&e.computeBoundingSphere(),og.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(og)}intersectsSprite(t){og.center.set(0,0,0);let e=T2t.distanceTo(t.center);return og.radius=.7071067811865476+e,og.applyMatrix4(t.matrixWorld),this.intersectsSphere(og)}intersectsSphere(t){let e=this.planes,n=t.center,s=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(n)<s)return!1;return!0}intersectsBox(t){let e=this.planes;for(let n=0;n<6;n++){let s=e[n];if(XE.x=s.normal.x>0?t.max.x:t.min.x,XE.y=s.normal.y>0?t.max.y:t.min.y,XE.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(XE)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},tQ=new tn,c1=class i{constructor(){this.coordinateSystem=ya,this._frustums=[],this._count=0}setFromArrayCamera(t){let e=t.cameras,n=this._frustums;for(let s=0;s<e.length;s++){let r=e[s];tQ.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),n[s]===void 0&&(n[s]=new ou),n[s].setFromProjectionMatrix(tQ,r.coordinateSystem,r.reversedDepth)}return this._count=e.length,this}intersectsObject(t){let e=this._frustums;for(let n=0;n<this._count;n++)if(e[n].intersectsObject(t))return!0;return!1}intersectsSprite(t){let e=this._frustums;for(let n=0;n<this._count;n++)if(e[n].intersectsSprite(t))return!0;return!1}intersectsSphere(t){let e=this._frustums;for(let n=0;n<this._count;n++)if(e[n].intersectsSphere(t))return!0;return!1}intersectsBox(t){let e=this._frustums;for(let n=0;n<this._count;n++)if(e[n].intersectsBox(t))return!0;return!1}containsPoint(t){let e=this._frustums;for(let n=0;n<this._count;n++)if(e[n].containsPoint(t))return!0;return!1}copy(t){this.coordinateSystem=t.coordinateSystem;let e=this._frustums,n=t._frustums;for(let s=0;s<t._count;s++)e[s]===void 0&&(e[s]=new ou),e[s].copy(n[s]);return this._count=t._count,this}clone(){return new i().copy(this)}};j4=class{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,n,s){let r=this.pool,o=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let a=r[this.index];o.push(a),this.index++,a.start=t,a.count=e,a.z=n,a.index=s}reset(){this.list.length=0,this.index=0}},ba=new tn,k2t=new Be(1,1,1),P2t=new ou,R2t=new c1,KE=new rr,ag=new Gs,zw=new bt,eQ=new bt,D2t=new bt,P4=new j4,vo=new qi,JE=[];u1=class extends qi{constructor(t,e,n=e*2,s){super(new kn,s),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=t,this._maxVertexCount=e,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._multiDrawBytesPerElement=1,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let t=Math.sqrt(this._maxInstanceCount*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);let e=new Float32Array(t*t*4),n=new Xo(e,t,t,xo,yo);this._matricesTexture=n}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);let e=new Uint32Array(t*t),n=new Xo(e,t,t,uv,qa);this._indirectTexture=n}_initColorsTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);let e=new Float32Array(t*t*4).fill(1),n=new Xo(e,t,t,xo,yo);
vendor: 9,123 bytes, line 419
419n.colorSpace=Rn.workingColorSpace,this._colorsTexture=n}_initializeGeometry(t){let e=this.geometry,n=this._maxVertexCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(let r in t.attributes){let o=t.getAttribute(r),{array:a,itemSize:l,normalized:c}=o,u=new a.constructor(n*l),h=new Mi(u,l,c);e.setAttribute(r,h)}if(t.getIndex()!==null){let r=n>65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new Mi(r,1))}this._geometryInitialized=!0}}_validateGeometry(t){let e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let n in e.attributes){if(!t.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);let s=t.getAttribute(n),r=e.getAttribute(n);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){let e=this._instanceInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){let e=this._geometryInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new rr);let t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let n=0,s=e.length;n<s;n++){if(e[n].active===!1)continue;let r=e[n].geometryIndex;this.getMatrixAt(n,ba),this.getBoundingBoxAt(r,KE).applyMatrix4(ba),t.union(KE)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Gs);let t=this.boundingSphere,e=this._instanceInfo;t.makeEmpty();for(let n=0,s=e.length;n<s;n++){if(e[n].active===!1)continue;let r=e[n].geometryIndex;this.getMatrixAt(n,ba),this.getBoundingSphereAt(r,ag).applyMatrix4(ba),t.union(ag)}}addInstance(t){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");let n={visible:!0,active:!0,geometryIndex:t},s=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(k4),s=this._availableInstanceIds.shift(),this._instanceInfo[s]=n):(s=this._instanceInfo.length,this._instanceInfo.push(n));let r=this._matricesTexture;ba.identity().toArray(r.image.data,s*16),r.needsUpdate=!0;let o=this._colorsTexture;return o&&(k2t.toArray(o.image.data,s*4),o.needsUpdate=!0),this._visibilityChanged=!0,s}addGeometry(t,e=-1,n=-1){this._initializeGeometry(t),this._validateGeometry(t);let s={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;s.vertexStart=this._nextVertexStart,s.reservedVertexCount=e===-1?t.getAttribute("position").count:e;let o=t.getIndex();if(o!==null&&(s.indexStart=this._nextIndexStart,s.reservedIndexCount=n===-1?o.count:n),s.indexStart!==-1&&s.indexStart+s.reservedIndexCount>this._maxIndexCount||s.vertexStart+s.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(k4),l=this._availableGeometryIds.shift(),r[l]=s):(l=this._geometryCount,this._geometryCount++,r.push(s)),this.setGeometryAt(l,t),this._nextIndexStart=s.indexStart+s.reservedIndexCount,this._nextVertexStart=s.vertexStart+s.reservedVertexCount,l}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);let n=this.geometry,s=n.getIndex()!==null,r=n.getIndex(),o=e.getIndex(),a=this._geometryInfo[t];if(s&&o.count>a.reservedIndexCount||e.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let l=a.vertexStart,c=a.reservedVertexCount;a.vertexCount=e.getAttribute("position").count;for(let u in n.attributes){let h=e.getAttribute(u),d=n.getAttribute(u);L2t(h,d,l);let p=h.itemSize;for(let g=h.count,y=c;g<y;g++){let x=l+g;for(let w=0;w<p;w++)d.setComponent(x,w,0)}d.needsUpdate=!0,d.addUpdateRange(l*p,c*p)}if(s){let u=a.indexStart,h=a.reservedIndexCount;a.indexCount=e.getIndex().count;for(let d=0;d<o.count;d++)r.setX(u+d,l+o.getX(d));for(let d=o.count,p=h;d<p;d++)r.setX(u+d,l);r.needsUpdate=!0,r.addUpdateRange(u,a.reservedIndexCount)}return a.start=s?a.indexStart:a.vertexStart,a.count=s?a.indexCount:a.vertexCount,a.boundingBox=null,e.boundingBox!==null&&(a.boundingBox=e.boundingBox.clone()),a.boundingSphere=null,e.boundingSphere!==null&&(a.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,t}deleteGeometry(t){let e=this._geometryInfo;if(t>=e.length||e[t].active===!1)return this;let n=this._instanceInfo;for(let s=0,r=n.length;s<r;s++)n[s].active&&n[s].geometryIndex===t&&this.deleteInstance(s);return e[t].active=!1,this._availableGeometryIds.push(t),this._visibilityChanged=!0,this}deleteInstance(t){return this.validateInstanceId(t),this._instanceInfo[t].active=!1,this._availableInstanceIds.push(t),this._visibilityChanged=!0,this}optimize(){let t=0,e=0,n=this._geometryInfo,s=n.map((o,a)=>a).sort((o,a)=>n[o].vertexStart-n[a].vertexStart),r=this.geometry;for(let o=0,a=n.length;o<a;o++){let l=s[o],c=n[l];if(c.active!==!1){if(r.index!==null){if(c.indexStart!==e){let{indexStart:u,vertexStart:h,reservedIndexCount:d}=c,p=r.index,g=p.array,y=t-h;for(let x=u;x<u+d;x++)g[x]=g[x]+y;p.array.copyWithin(e,u,u+d),p.addUpdateRange(e,d),p.needsUpdate=!0,c.indexStart=e}e+=c.reservedIndexCount}if(c.vertexStart!==t){let{vertexStart:u,reservedVertexCount:h}=c,d=r.attributes;for(let p in d){let g=d[p],{array:y,itemSize:x}=g;y.copyWithin(t*x,u*x,(u+h)*x),g.addUpdateRange(t*x,h*x),g.needsUpdate=!0}c.vertexStart=t}t+=c.reservedVertexCount,c.start=r.index?c.indexStart:c.vertexStart}}return this._nextIndexStart=e,this._nextVertexStart=t,this._visibilityChanged=!0,this}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;let n=this.geometry,s=this._geometryInfo[t];if(s.boundingBox===null){let r=new rr,o=n.index,a=n.attributes.position;for(let l=s.start,c=s.start+s.count;l<c;l++){let u=l;o&&(u=o.getX(u)),r.expandByPoint(zw.fromBufferAttribute(a,u))}s.boundingBox=r}return e.copy(s.boundingBox),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;let n=this.geometry,s=this._geometryInfo[t];if(s.boundingSphere===null){let r=new Gs;this.getBoundingBoxAt(t,KE),KE.getCenter(r.center);let o=n.index,a=n.attributes.position,l=0;for(let c=s.start,u=s.start+s.count;c<u;c++){let h=c;o&&(h=o.getX(h)),zw.fromBufferAttribute(a,h),l=Math.max(l,r.center.distanceToSquared(zw))}r.radius=Math.sqrt(l),s.boundingSphere=r}return e.copy(s.boundingSphere),e}setMatrixAt(t,e){this.validateInstanceId(t);let n=this._matricesTexture,s=this._matricesTexture.image.data;return e.toArray(s,t*16),n.needsUpdate=!0,this}getMatrixAt(t,e){return this.validateInstanceId(t),e.fromArray(this._matricesTexture.image.data,t*16)}setColorAt(t,e){return this.validateInstanceId(t),this._colorsTexture===null&&this._initColorsTexture(),e.toArray(this._colorsTexture.image.data,t*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(t,e){return this.validateInstanceId(t),this._colorsTexture===null?e.isVector4?e.set(1,1,1,1):e.setRGB(1,1,1):e.fromArray(this._colorsTexture.image.data,t*4)}setVisibleAt(t,e){return this.validateInstanceId(t),this._instanceInfo[t].visible===e?this:(this._instanceInfo[t].visible=e,this._visibilityChanged=!0,this)}getVisibleAt(t){return this.validateInstanceId(t),this._instanceInfo[t].visible}setGeometryIdAt(t,e){return this.validateInstanceId(t),this.validateGeometryId(e),this._instanceInfo[t].geometryIndex=e,this._visibilityChanged=!0,this}getGeometryIdAt(t){return this.validateInstanceId(t),this._instanceInfo[t].geometryIndex}getGeometryRangeAt(t,e={}){this.validateGeometryId(t);let n=this._geometryInfo[t];return e.vertexStart=n.vertexStart,e.vertexCount=n.vertexCount,e.reservedVertexCount=n.reservedVertexCount,e.indexStart=n.indexStart,e.indexCount=n.indexCount,e.reservedIndexCount=n.reservedIndexCount,e.start=n.start,e.count=n.count,e}setInstanceCount(t){let e=this._availableInstanceIds,n=this._instanceInfo;for(e.sort(k4);e[e.length-1]===n.length-1;)n.pop(),e.pop();if(t<n.length)throw new Error(`THREE.BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`);let s=new Int32Array(t),r=new Int32Array(t);lg(this._multiDrawCounts,s),lg(this._multiDrawStarts,r),this._multiDrawCounts=s,this._multiDrawStarts=r,this._maxInstanceCount=t;let o=this._indirectTexture,a=this._matricesTexture,l=this._colorsTexture;o.dispose(),this._initIndirectTexture(),lg(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),lg(a.image.data,this._matricesTexture.image.data),l&&(l.dis
419pose(),this._initColorsTexture(),lg(l.image.data,this._colorsTexture.image.data))}setGeometrySize(t,e){let n=[...this._geometryInfo].filter(a=>a.active);if(Math.max(...n.map(a=>a.vertexStart+a.reservedVertexCount))>t)throw new Error(`THREE.BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(l=>l.indexStart+l.reservedIndexCount))>e)throw new Error(`THREE.BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);let r=this.geometry;r.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new kn,this._initializeGeometry(r));let o=this.geometry;r.index&&lg(r.index.array,o.index.array);for(let a in r.attributes)lg(r.attributes[a].array,o.attributes[a].array)}raycast(t,e){let n=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,o=this.geometry;vo.material=this.material,vo.geometry.index=o.index,vo.geometry.attributes=o.attributes,vo.geometry.boundingBox===null&&(vo.geometry.boundingBox=new rr),vo.geometry.boundingSphere===null&&(vo.geometry.boundingSphere=new Gs);for(let a=0,l=n.length;a<l;a++){if(!n[a].visible||!n[a].active)continue;let c=n[a].geometryIndex,u=s[c];vo.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(a,vo.matrixWorld).premultiply(r),this.getBoundingBoxAt(c,vo.geometry.boundingBox),this.getBoundingSphereAt(c,vo.geometry.boundingSphere),vo.raycast(t,JE);for(let h=0,d=JE.length;h<d;h++){let p=JE[h];p.object=this,p.batchId=a,e.push(p)}JE.length=0}vo.material=null,vo.geometry.index=null,vo.geometry.attributes={},vo.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=t.boundingBox!==null?t.boundingBox.clone():null,this.boundingSphere=t.boundingSphere!==null?t.boundingSphere.clone():null,this._geometryInfo=t._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox!==null?e.boundingBox.clone():null,boundingSphere:e.boundingSphere!==null?e.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(e=>({...e})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._multiDrawBytesPerElement=t._multiDrawBytesPerElement,this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){super.dispose(),this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,n,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let o=s.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=1;r.wireframe&&(l=2,a=s.attributes.position.count>65535?4:2);let c=this._instanceInfo,u=this._multiDrawStarts,h=this._multiDrawCounts,d=this._geometryInfo,p=this.perObjectFrustumCulled,g=this._indirectTexture,y=g.image.data,x=n.isArrayCamera?R2t:P2t;p&&(n.isArrayCamera?x.setFromArrayCamera(n):(ba.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),x.setFromProjectionMatrix(ba,n.coordinateSystem,n.reversedDepth)));let w=0;if(this.sortObjects){ba.copy(this.matrixWorld).invert(),zw.setFromMatrixPosition(n.matrixWorld).applyMatrix4(ba),eQ.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(ba);for(let C=0,R=c.length;C<R;C++)if(c[C].visible&&c[C].active){let k=c[C].geometryIndex;this.getMatrixAt(C,ba),this.getBoundingSphereAt(k,ag).applyMatrix4(ba);let O=!1;if(p&&(O=!x.intersectsSphere(ag)),!O){let I=d[k],U=D2t.subVectors(ag.center,zw).dot(eQ);
vendor: 22,857 bytes, line 419
419P4.push(I.start,I.count,U,C)}}let M=P4.list,A=this.customSort;A===null?M.sort(r.transparent?E2t:A2t):A.call(this,M,n);for(let C=0,R=M.length;C<R;C++){let k=M[C];u[w]=k.start*a*l,h[w]=k.count*l,y[w]=k.index,w++}P4.reset()}else for(let M=0,A=c.length;M<A;M++)if(c[M].visible&&c[M].active){let C=c[M].geometryIndex,R=!1;if(p&&(this.getMatrixAt(M,ba),this.getBoundingSphereAt(C,ag).applyMatrix4(ba),R=!x.intersectsSphere(ag)),!R){let k=d[C];u[w]=k.start*a*l,h[w]=k.count*l,y[w]=M,w++}}g.needsUpdate=!0,this._multiDrawCount=w,this._multiDrawBytesPerElement=a,this._visibilityChanged=!1}onBeforeShadow(t,e,n,s,r,o){this.onBeforeRender(t,null,s,r,o)}},fs=class extends ss{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Be(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}},E2=new bt,k2=new bt,nQ=new tn,Vw=new ch,ZE=new Gs,R4=new bt,iQ=new bt,Jo=class extends ai{constructor(t=new kn,e=new fs){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[0];for(let s=1,r=e.count;s<r;s++)E2.fromBufferAttribute(e,s-1),k2.fromBufferAttribute(e,s),n[s]=n[s-1],n[s]+=E2.distanceTo(k2);t.setAttribute("lineDistance",new Ge(n,1))}else Ze("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}intersectsFrustum(t){return t.intersectsObject(this)}raycast(t,e){let n=this.geometry,s=this.matrixWorld,r=t.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ZE.copy(n.boundingSphere),ZE.applyMatrix4(s),ZE.radius+=r,t.ray.intersectsSphere(ZE)===!1)return;nQ.copy(s).invert(),Vw.copy(t.ray).applyMatrix4(nQ);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){let p=Math.max(0,o.start),g=Math.min(u.count,o.start+o.count);for(let y=p,x=g-1;y<x;y+=c){let w=u.getX(y),M=u.getX(y+1),A=QE(this,t,Vw,l,w,M,y);A&&e.push(A)}if(this.isLineLoop){let y=u.getX(g-1),x=u.getX(p),w=QE(this,t,Vw,l,y,x,g-1);w&&e.push(w)}}else{let p=Math.max(0,o.start),g=Math.min(d.count,o.start+o.count);for(let y=p,x=g-1;y<x;y+=c){let w=QE(this,t,Vw,l,y,y+1,y);w&&e.push(w)}if(this.isLineLoop){let y=QE(this,t,Vw,l,g-1,p,g-1);y&&e.push(y)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}};sQ=new bt,rQ=new bt,Wr=class extends Jo{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[];for(let s=0,r=e.count;s<r;s+=2)sQ.fromBufferAttribute(e,s),rQ.fromBufferAttribute(e,s+1),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+sQ.distanceTo(rQ);t.setAttribute("lineDistance",new Ge(n,1))}else Ze("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},Sg=class extends Jo{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}},Wa=class extends ss{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Be(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},oQ=new tn,W4=new ch,t2=new Gs,e2=new bt,gc=class extends ai{constructor(t=new kn,e=new Wa){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}intersectsFrustum(t){return t.intersectsObject(this)}raycast(t,e){let n=this.geometry,s=this.matrixWorld,r=t.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),t2.copy(n.boundingSphere),t2.applyMatrix4(s),t2.radius+=r,t.ray.intersectsSphere(t2)===!1)return;oQ.copy(s).invert(),W4.copy(t.ray).applyMatrix4(oQ);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,h=n.attributes.position;if(c!==null){let d=Math.max(0,o.start),p=Math.min(c.count,o.start+o.count);for(let g=d,y=p;g<y;g++){let x=c.getX(g);e2.fromBufferAttribute(h,x),aQ(e2,x,l,s,t,e,this)}}else{let d=Math.max(0,o.start),p=Math.min(h.count,o.start+o.count);for(let g=d,y=p;g<y;g++)e2.fromBufferAttribute(h,g),aQ(e2,g,l,s,t,e,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}};h1=class extends is{constructor(t,e,n,s,r=$i,o=$i,a,l,c){super(t,e,n,s,r,o,a,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let u=this;function h(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=t.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(h))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;"requestVideoFrameCallback"in t===!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},P2=class extends h1{constructor(t,e,n,s,r,o,a,l){super({},t,e,n,s,r,o,a,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}},R2=class extends is{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=xs,this.minFilter=xs,this.generateMipmaps=!1,this.needsUpdate=!0}},Cg=class extends is{constructor(t,e,n,s,r,o,a,l,c,u,h,d){super(null,o,a,l,c,u,s,r,h,d),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}},D2=class extends Cg{constructor(t,e,n,s,r,o){super(t,e,n,r,o),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=pr,this.layerUpdates=new Set}copy(t){return super.copy(t),this.wrapR=t.wrapR,this}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},L2=class extends Cg{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,xc),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}},ef=class extends is{constructor(t=[],e=xc,n,s,r,o,a,l,c,u){super(t,e,n,s,r,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},I2=class extends is{constructor(t,e,n,s,r,o,a,l,c){super(t,e,n,s,r,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},O2=class extends is{constructor(t,e,n,s,r,o,a,l,c){super(t,e,n,s,r,o,a,l,c),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;let u=t?t.parentNode:null;u!==null&&"requestPaint"in u&&(u.onpaint=()=>{this.needsUpdate=!0},u.requestPaint())}dispose(){let t=this.image?this.image.parentNode:null;t!==null&&"onpaint"in t&&(t.onpaint=null),super.dispose()}},dh=class extends is{constructor(t,e,n=qa,s,r,o,a=xs,l=xs,c,u=dc,h=1){if(u!==dc&&u!==yh)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:t,height:e,depth:h};super(d,s,r,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new wl(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return e.compareFunction=this.compareFunction,e}},d1=class extends dh{constructor(t,e=qa,n=xc,s,r,o=xs,a=xs,l,c=dc){let u={width:t,height:t,depth:1},h=[u,u,u,u,u,u];super(t,t,e,n,s,r,o,a,l,c),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}},zb=class extends is{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}},nf=class i extends kn{constructor(t=1,e=1,n=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:s,heightSegments:r,depthSegments:o};let a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);let l=[],c=[],u=[],h=[],d=0,p=0;g("z","y","x",-1,-1,n,e,t,o,r,0),g("z","y","x",1,-1,n,e,-t,o,r,1),g("x","z","y",1,1,t,n,e,s,o,2),g("x","z","y",1,-1,t,n,-e,s,o,3),g("x","y","z",1,-1,t,e,n,s,r,4),g("x","y","z",-1,-1,t,e,-n,s,r,5),this.setIndex(l),this.setAttribute("position",new Ge(c,3)),this.setAttribute("normal",new Ge(u,3)),this.setAttribute("uv",new Ge(h,2));function g(y,x,w,M,A,C,R,k,O,I,U){let V=C/O,q=R/I,X=C/2,j=R/2,W=k/2,_=O+1,at=I+1,ct=0,pt=0,Et=new bt;for(let vt=0;vt<at;vt++){let yt=vt*q-j;for(let kt=0;kt<_;kt++){let Wt=kt*V-X;Et[y]=Wt*M,Et[x]=yt*A,Et[w]=W,c.push(Et.x,Et.y,Et.z),Et[y]=0,Et[x]=0,Et[w]=k>0?1:-1,u.push(Et.x,Et.y,Et.z),h.push(kt/O),h.push(1-vt/I),ct+=1}}for(let vt=0;vt<I;vt++)for(let yt=0;yt<O;yt++){let kt=d+yt+_*vt,Wt=d+yt+_*(vt+1),jt=d+(yt+1)+_*(vt+1),ae=d+(yt+1)+_*vt;l.push(kt,Wt,ae),l.push(Wt,jt,ae),pt+=6}a.addGroup(p,pt,U),p+=pt,d+=ct}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},f1=class i extends kn{constructor(t=1,e=1,n=4,s=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:n,radialSegments:s,heightSegments:r},e=Math.max(0,e),n=Math.max(1,Math.floor(n)),s=Math.max(3,Math.floor(s)),r=Math.max(1,Math.floor(r));let o=[],a=[],l=[],c=[],u=e/2,h=Math.PI/2*t,d=e,p=2*h+d,g=n*2+r,y=s+1,x=new bt,w=new bt;for(let M=0;M<=g;M++){let A=0,C=0,R=0,k=0;if(M<=n){let U=M/n,V=U*Math.PI/2;C=-u-t*Math.cos(V),R=t*Math.sin(V),k=-t*Math.cos(V),A=U*h}else if(M<=n+r){let U=(M-n)/r;C=-u+U*e,R=t,k=0,A=h+U*d}else{let U=(M-n-r)/n,V=U*Math.PI/2;C=u+t*Math.sin(V),R=t*Math.cos(V),k=t*Math.sin(V),A=h+d+U*h}let O=Math.max(0,Math.min(1,A/p)),I=0;M===0?I=.5/s:M===g&&(I=-.5/s);for(let U=0;U<=s;U++){let V=U/s,q=V*Math.PI*2,X=Math.sin(q),j=Math.cos(q);w.x=-R*j,w.y=C,w.z=R*X,a.push(w.x,w.y,w.z),x.set(-R*j,k,R*X),x.normalize(),l.push(x.x,x.y,x.z),c.push(V+I,O)}if(M>0){let U=(M-1)*y;for(let V=0;V<s;V++){let q=U+V,X=U+V+1,j=M*y+V,W=M*y+V+1;o.push(q,X,j),o.push(X,W,j)}}}this.setIndex(o),this.setAttribute("position",new Ge(a,3)),this.setAttribute("normal",new Ge(l,3)),this.setAttribute("uv",new Ge(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}},p1=class i extends kn{constructor(t=1,e=32,n=0,s=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:s},e=Math.max(3,e);let r=[],o=[],a=[],l=[],c=new bt,u=new Ce;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,d=3;h<=e;h++,d+=3){let p=n+h/e*s;c.x=t*Math.cos(p),c.y=t*Math.sin(p),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/t+1)/2,u.y=(o[d+1]/t+1)/2,l.push(u.x,u.y)}for(let h=1;h<=e;h++)r.push(h,h+1,0);this.setIndex(r),this.setAttribute("position",new Ge(o,3)),this.setAttribute("normal",new Ge(a,3)),this.setAttribute("uv",new Ge(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.segments,t.thetaStart,t.thetaLength)}},Vb=class i extends kn{constructor(t=1,e=1,n=1,s=32,r=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:s,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:l};let c=this;s=Math.floor(s),r=Math.floor(r);let u=[],h=[],d=[],p=[],g=0,y=[],x=n/2,w=0;M(),o===!1&&(t>0&&A(!0),e>0&&A(!1)),this.setIndex(u),this.setAttribute("position",new Ge(h,3)),this.setAttribute("normal",new Ge(d,3)),this.setAttribute("uv",new Ge(p,2));function M(){let C=new bt,R=new bt,k=0,O=(e-t)/n;for(let I=0;I<=r;I++){let U=[],V=I/r,q=V*(e-t)+t;for(let X=0;X<=s;X++){let j=X/s,W=j*l+a,_=Math.sin(W),at=Math.cos(W);R.x=q*_,R.y=-V*n+x,R.z=q*at,h.push(R.x,R.y,R.z),C.set(_,O,at).normalize(),d.push(C.x,C.y,C.z),p.push(j,1-V),U.push(g++)}y.push(U)}for(let I=0;I<s;I++)for(let U=0;U<r;U++){let V=y[U][I],q=y[U+1][I],X=y[U+1][I+1],j=y[U][I+1];(t>0||U!==0)&&(u.push(V,q,j),k+=3),(e>0||U!==r-1)&&(u.push(q,X,j),k+=3)}c.addGroup(w,k,0),w+=k}function A(C){let R=g,k=new Ce,O=new bt,I=0,U=C===!0?t:e,V=C===!0?1:-1;for(let X=1;X<=s;X++)h.push(0,x*V,0),d.push(0,V,0),p.push(.5,.5),g++;let q=g;for(let X=0;X<=s;X++){let W=X/s*l+a,_=Math.cos(W),at=Math.sin(W);O.x=U*at,O.y=x*V,O.z=U*_,h.push(O.x,O.y,O.z),d.push(0,V,0),k.x=_*.5+.5,k.y=at*.5*V+.5,p.push(k.x,k.y),g++}for(let X=0;X<s;X++){let j=R+X,W=q+X;C===!0?u.push(W,W+1,j):u.push(W+1,W,j),I+=3}c.addGroup(w,I,C===!0?1:2),w+=I}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},Hb=class i extends Vb{constructor(t=1,e=1,n=32,s=1,r=!1,o=0,a=Math.PI*2){super(0,t,e,n,s,r,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:s,openEnded:r,thetaStart:o,thetaLength:a}}static fromJSON(t){return new i(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},fh=class i extends kn{constructor(t=[],e=[],n=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:s};let r=[],o=[];a(s),c(n),u(),this.setAttribute("position",new Ge(r,3)),this.setAttribute("normal",new Ge(r.slice(),3)),this.setAttribute("uv",new Ge(o,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function a(M){let A=new bt,C=new bt,R=new bt;for(let k=0;k<e.length;k+=3)p(e[k+0],A),p(e[k+1],C),p(e[k+2],R),l(A,C,R,M)}function l(M,A,C,R){let k=R+1,O=[];for(let I=0;I<=k;I++){O[I]=[];let U=M.clone().lerp(C,I/k),V=A.clone().lerp(C,I/k),q=k-I;for(let X=0;X<=q;X++)X===0&&I===k?O[I][X]=U:O[I][X]=U.clone().lerp(V,X/q)}for(let I=0;I<k;I++)for(let U=0;U<2*(k-I)-1;U++){let V=Math.floor(U/2);U%2===0?(d(O[I][V+1]),d(O[I+1][V]),d(O[I][V])):(d(O[I][V+1]),d(O[I+1][V+1]),d(O[I+1][V]))}}function c(M){let A=new bt;for(let C=0;C<r.length;C+=3)A.x=r[C+0],A.y=r[C+1],A.z=r[C+2],A.normalize().multiplyScalar(M),r[C+0]=A.x,r[C+1]=A.y,r[C+2]=A.z}function u(){let M=new bt;for(let A=0;A<r.length;A+=3){M.x=r[A+0],M.y=r[A+1],M.z=r[A+2];let C=x(M)/2/Math.PI+.5,R=w(M)/Math.PI+.5;o.push(C,1-R)}g(),h()}function h(){for(let M=0;M<o.length;M+=6){let A=o[M+0],C=o[M+2],R=o[M+4],k=Math.max(A,C,R),O=Math.min(A,C,R);k>.9&&O<.1&&(A<.2&&(o[M+0]+=1),C<.2&&(o[M+2]+=1),R<.2&&(o[M+4]+=1))}}function d(M){r.push(M.x,M.y,M.z)}function p(M,A){let C=M*3;A.x=t[C+0],A.y=t[C+1],A.z=t[C+2]}function g(){let M=new bt,A=new bt,C=new bt,R=new bt,k=new Ce,O=new Ce,I=new Ce;for(let U=0,V=0;U<r.length;U+=9,V+=6){M.set(r[U+0],r[U+1],r[U+2]),A.set(r[U+3],r[U+4],r[U+5]),C.set(r[U+6],r[U+7],r[U+8]),k.set(o[V+0],o[V+1]),O.set(o[V+2],o[V+3]),I.set(o[V+4],o[V+5]),R.copy(M).add(A).add(C).divideScalar(3);let q=x(R);y(k,V+0,M,q),y(O,V+2,A,q),y(I,V+4,C,q)}}function y(M,A,C,R){R<0&&M.x===1&&(o[A]=M.x-1),C.x===0&&C.z===0&&(o[A]=R/2/Math.PI+.5)}function x(M){return Math.atan2(M.z,-M.x)}function w(M){return Math.atan2(-M.y,Math.sqrt(M.x*M.x+M.z*M.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.vertices,t.indices,t.radius,t.detail)}},g1=class i extends fh{constructor(t=1,e=0){let n=(1+Math.sqrt(5))/2,s=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-n,0,-s,n,0,s,-n,0,s,n,-s,-n,0,-s,n,0,s,-n,0,s,n,0,-n,0,-s,n,0,-s,-n,0,s,n,0,s],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(r,o,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},n2=new bt,i2=new bt,D4=new bt,s2=new uc,m1=class extends kn{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},t!==null){let s=Math.pow(10,4),r=Math.cos(gg*e),o=t.getIndex(),a=t.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),d={},p=[];for(let g=0;g<l;g+=3){o?(c[0]=o.getX(g),c[1]=o.getX(g+1),c[2]=o.getX(g+2)):(c[0]=g,c[1]=g+1,c[2]=g+2);let{a:y,b:x,c:w}=s2;if(y.fromBufferAttribute(a,c[0]),x.fromBufferAttribute(a,c[1]),w.fromBufferAttribute(a,c[2]),s2.getNormal(D4),h[0]=`${Math.round(y.x*s)},${Math.round(y.y*s)},${Math.round(y.z*s)}`,h[1]=`${Math.round(x.x*s)},${Math.round(x.y*s)},${Math.round(x.z*s)}`,h[2]=`${Math.round(w.x*s)},${Math.round(w.y*s)},${Math.round(w.z*s)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let M=0;M<3;M++){let A=(M+1)%3,C=h[M],R=h[A],k=s2[u[M]],O=s2[u[A]],I=`${C}_${R}`,U=`${R}_${C}`;U in d&&d[U]?(D4.dot(d[U].normal)<=r&&(p.push(k.x,k.y,k.z),p.push(O.x,O.y,O.z)),d[U]=null):I in d||(d[I]={index0:c[M],index1:c[A],normal:D4.clone()})}}for(let g in d)if(d[g]){let{index0:y,index1:x}=d[g];n2.fromBufferAttribute(a,y),i2.fromBufferAttribute(a,x),p.push(n2.x,n2.y,n2.z),p.push(i2.x,i2.y,i2.z)}this.setAttribute("position",new Ge(p,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}},_o=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Ze("Curve: .getPoint() not implemented.")}getPointAt(t,e){let n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){let e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){let e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e=[],n,s=this.getPoint(0),r=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),r+=n.distanceTo(s),e.push(r),s=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){let n=this.getLengths(),s=0,r=n.length,o;e?o=e:o=t*n[r-1];let a=0,l=r-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=n[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,n[s]===o)return s/(r-1);let u=n[s],d=n[s+1]-u,p=(o-u)/d;return(s+p)/(r-1)}getTangent(t,e){let s=t-1e-4,r=t+1e-4;s<0&&(s=0),r>1&&(r=1);let o=this.getPoint(s),a=this.getPoint(r),l=e||(o.isVector2?new Ce:new bt);return l.copy(a).sub(o).normalize(),l}getTangentAt(t,e){let n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e=!1){let n=new bt,s=[],r=[],o=[],a=new bt,l=new tn;for(let p=0;p<=t;p++){let g=p/t;s[p]=this.getTangentAt(g,new bt)}r[0]=new bt,o[0]=new bt;let c=Number.MAX_VALUE,u=Math.abs(s[0].x),h=Math.abs(s[0].y),d=Math.abs(s[0].z);u<=c&&(c=u,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(s[0],n).normalize(),r[0].crossVectors(s[0],a),o[0].crossVectors(s[0],r[0]);for(let p=1;p<=t;p++){if(r[p]=r[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(s[p-1],s[p]),a.length()>Number.EPSILON){a.normalize();let g=Math.acos(Bn(s[p-1].dot(s[p]),-1,1));r[p].applyMatrix4(l.makeRotationAxis(a,g))}o[p].crossVectors(s[p],r[p])}if(e===!0){let p=Math.acos(Bn(r[0].dot(r[t]),-1,1));p/=t,s[0].dot(a.crossVectors(r[0],r[t]))>0&&(p=-p);for(let g=1;g<=t;g++)r[g].applyMatrix4(l.makeRotationAxis(s[g],p*g)),o[g].crossVectors(s[g],r[g])}return{tangents:s,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},Mg=class extends _o{constructor(t=0,e=0,n=1,s=1,r=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(t,e=new Ce){let n=e,s=Math.PI*2,r=this.aEndAngle-this.aStartAngle,o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=s;for(;r>s;)r-=s;r<Number.EPSILON&&(o?r=0:r=s),this.aClockwise===!0&&!o&&(r===s?r=-s:r=r-s);let a=this.aStartAngle+t*r,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=l-this.aX,p=c-this.aY;l=d*u-p*h+this.aX,c=d*h+p*u+this.aY}return n.set(l,c)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}},b1=class extends Mg{constructor(t,e,n,s,r,o){super(t,e,n,n,s,r,o),this.isArcCurve=!0,this.type="ArcCurve"}};lQ=new bt,cQ=new bt,L4=new zU,I4=new zU,O4=new zU,v1=class extends _o{constructor(t=[],e=!1,n="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=s}getPoint(t,e=new bt){let n=e,s=this.points,r=s.length,o=(r-(this.closed?0:1))*t,a=Math.floor(o),l=o-a;this.closed?a+=a>
vendor: 6,267 bytes, line 419
4190?0:(Math.floor(Math.abs(a)/r)+1)*r:l===0&&a===r-1&&(a=r-2,l=1);let c,u;this.closed||a>0?c=s[(a-1)%r]:(cQ.subVectors(s[0],s[1]).add(s[0]),c=cQ);let h=s[a%r],d=s[(a+1)%r];if(this.closed||a+2<r?u=s[(a+2)%r]:(lQ.subVectors(s[r-1],s[r-2]).add(s[r-1]),u=lQ),this.curveType==="centripetal"||this.curveType==="chordal"){let p=this.curveType==="chordal"?.5:.25,g=Math.pow(c.distanceToSquared(h),p),y=Math.pow(h.distanceToSquared(d),p),x=Math.pow(d.distanceToSquared(u),p);y<1e-4&&(y=1),g<1e-4&&(g=y),x<1e-4&&(x=y),L4.initNonuniformCatmullRom(c.x,h.x,d.x,u.x,g,y,x),I4.initNonuniformCatmullRom(c.y,h.y,d.y,u.y,g,y,x),O4.initNonuniformCatmullRom(c.z,h.z,d.z,u.z,g,y,x)}else this.curveType==="catmullrom"&&(L4.initCatmullRom(c.x,h.x,d.x,u.x,this.tension),I4.initCatmullRom(c.y,h.y,d.y,u.y,this.tension),O4.initCatmullRom(c.z,h.z,d.z,u.z,this.tension));return n.set(L4.calc(l),I4.calc(l),O4.calc(l)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){let s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(new bt().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}};jb=class extends _o{constructor(t=new Ce,e=new Ce,n=new Ce,s=new Ce){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=s}getPoint(t,e=new Ce){let n=e,s=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(Yw(t,s.x,r.x,o.x,a.x),Yw(t,s.y,r.y,o.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},y1=class extends _o{constructor(t=new bt,e=new bt,n=new bt,s=new bt){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=s}getPoint(t,e=new bt){let n=e,s=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(Yw(t,s.x,r.x,o.x,a.x),Yw(t,s.y,r.y,o.y,a.y),Yw(t,s.z,r.z,o.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},Wb=class extends _o{constructor(t=new Ce,e=new Ce){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Ce){let n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Ce){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},x1=class extends _o{constructor(t=new bt,e=new bt){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new bt){let n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new bt){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},$b=class extends _o{constructor(t=new Ce,e=new Ce,n=new Ce){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Ce){let n=e,s=this.v0,r=this.v1,o=this.v2;return n.set(qw(t,s.x,r.x,o.x),qw(t,s.y,r.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Gb=class extends _o{constructor(t=new bt,e=new bt,n=new bt){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new bt){let n=e,s=this.v0,r=this.v1,o=this.v2;return n.set(qw(t,s.x,r.x,o.x),qw(t,s.y,r.y,o.y),qw(t,s.z,r.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},qb=class extends _o{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Ce){let n=e,s=this.points,r=(s.length-1)*t,o=Math.floor(r),a=r-o,l=s[o===0?o:o-1],c=s[o],u=s[o>s.length-2?s.length-1:o+1],h=s[o>s.length-3?s.length-1:o+2];return n.set(uQ(a,l.x,c.x,u.x,h.x),uQ(a,l.y,c.y,u.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){let s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(new Ce().fromArray(s))}return this}},N2=Object.freeze({__proto__:null,ArcCurve:b1,CatmullRomCurve3:v1,Cub
vendor: 42,322 bytes, lines 419-423
419icBezierCurve:jb,CubicBezierCurve3:y1,EllipseCurve:Mg,LineCurve:Wb,LineCurve3:x1,QuadraticBezierCurve:$b,QuadraticBezierCurve3:Gb,SplineCurve:qb}),w1=class extends _o{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let n=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new N2[n](e,t))}return this}getPoint(t,e){let n=t*this.getLength(),s=this.getCurveLengths(),r=0;for(;r<s.length;){if(s[r]>=n){let o=s[r]-n,a=this.curves[r],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let n=0,s=this.curves.length;n<s;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e=[],n;for(let s=0,r=this.curves;s<r.length;s++){let o=r[s],a=o.isEllipseCurve?t*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?t*o.points.length:t,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];n&&n.equals(u)||(e.push(u),n=u)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){let s=t.curves[e];this.curves.push(s.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){let s=this.curves[e];t.curves.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){let s=t.curves[e];this.curves.push(new N2[s.type]().fromJSON(s))}return this}},sf=class extends w1{constructor(t){super(),this.type="Path",this.currentPoint=new Ce,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let n=new Wb(this.currentPoint.clone(),new Ce(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,s){let r=new $b(this.currentPoint.clone(),new Ce(t,e),new Ce(n,s));return this.curves.push(r),this.currentPoint.set(n,s),this}bezierCurveTo(t,e,n,s,r,o){let a=new jb(this.currentPoint.clone(),new Ce(t,e),new Ce(n,s),new Ce(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),n=new qb(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,s,r,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(t+a,e+l,n,s,r,o),this}absarc(t,e,n,s,r,o){return this.absellipse(t,e,n,n,s,r,o),this}ellipse(t,e,n,s,r,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(t+c,e+u,n,s,r,o,a,l),this}absellipse(t,e,n,s,r,o,a,l){let c=new Mg(t,e,n,s,r,o,a,l);if(this.curves.length>0){let h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}},rf=class extends sf{constructor(t){super(t),this.uuid=Ha(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let n=0,s=this.holes.length;n<s;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){let s=t.holes[e];this.holes.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){let s=this.holes[e];t.holes.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){let s=t.holes[e];this.holes.push(new sf().fromJSON(s))}return this}};q4=class{static triangulate(t,e,n=2){return V2t(t,e,n)}},xa=class i{static area(t){let e=t.length,n=0;for(let s=e-1,r=0;r<e;s=r++)n+=t[s].x*t[r].y-t[r].x*t[s].y;return n*.5}static isClockWise(t){return i.area(t)<0}static triangulateShape(t,e){let n=[],s=[],r=[];dQ(t),fQ(n,t);let o=t.length;e.forEach(dQ);for(let l=0;l<e.length;l++)s.push(o),o+=e[l].length,fQ(n,e[l]);let a=q4.triangulate(n,s);for(let l=0;l<a.length;l+=3)r.push(a.slice(l,l+3));return r}};M1=class i extends kn{constructor(t=new rf([new Ce(.5,.5),new Ce(-.5,.5),new Ce(-.5,-.5),new Ce(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];let n=this,s=[],r=[];for(let a=0,l=t.length;a<l;a++){let c=t[a];o(c)}this.setAttribute("position",new Ge(s,3)),this.setAttribute("uv",new Ge(r,2)),this.computeVertexNormals();function o(a){let l=[],c=e.curveSegments!==void 0?e.curveSegments:12,u=e.steps!==void 0?e.steps:1,h=e.depth!==void 0?e.depth:1,d=e.bevelEnabled!==void 0?e.bevelEnabled:!0,p=e.bevelThickness!==void 0?e.bevelThickness:.2,g=e.bevelSize!==void 0?e.bevelSize:p-.1,y=e.bevelOffset!==void 0?e.bevelOffset:0,x=e.bevelSegments!==void 0?e.bevelSegments:3,w=e.extrudePath,M=e.UVGenerator!==void 0?e.UVGenerator:skt,A,C=!1,R,k,O,I;if(w){A=w.getSpacedPoints(u),C=!0,d=!1;let it=w.isCatmullRomCurve3?w.closed:!1;R=w.computeFrenetFrames(u,it),k=new bt,O=new bt,I=new bt}d||(x=0,p=0,g=0,y=0);let U=a.extractPoints(c),V=U.shape,q=U.holes;if(!xa.isClockWise(V)){V=V.reverse();for(let it=0,gt=q.length;it<gt;it++){let ft=q[it];xa.isClockWise(ft)&&(q[it]=ft.reverse())}}function j(it){let ft=10000000000000001e-36,de=it[0];for(let ve=1;ve<=it.length;ve++){let we=ve%it.length,Ae=it[we],Ue=Ae.x-de.x,en=Ae.y-de.y,It=Ue*Ue+en*en,Cn=Math.max(Math.abs(Ae.x),Math.abs(Ae.y),Math.abs(de.x),Math.abs(de.y)),mn=ft*Cn*Cn;if(It<=mn){it.splice(we,1),ve--;continue}de=Ae}}j(V),q.forEach(j);let W=q.length,_=V;for(let it=0;it<W;it++){let gt=q[it];V=V.concat(gt)}function at(it,gt,ft){return gt||Tn("ExtrudeGeometry: vec does not exist"),it.clone().addScaledVector(gt,ft)}let ct=V.length;function pt(it,gt,ft){let de,ve,we,Ae=it.x-gt.x,Ue=it.y-gt.y,en=ft.x-it.x,It=ft.y-it.y,Cn=Ae*Ae+Ue*Ue,mn=Ae*It-Ue*en;if(Math.abs(mn)>Number.EPSILON){let mt=Math.sqrt(Cn),K=Math.sqrt(en*en+It*It),Vt=gt.x-Ue/mt,te=gt.y+Ae/mt,Nt=ft.x-It/K,Se=ft.y+en/K,Me=((Nt-Vt)*It-(Se-te)*en)/(Ae*It-Ue*en);de=Vt+Ae*Me-it.x,ve=te+Ue*Me-it.y;let ie=de*de+ve*ve;if(ie<=2)return new Ce(de,ve);we=Math.sqrt(ie/2)}else{let mt=!1;Ae>Number.EPSILON?en>Number.EPSILON&&(mt=!0):Ae<-Number.EPSILON?en<-Number.EPSILON&&(mt=!0):Math.sign(Ue)===Math.sign(It)&&(mt=!0),mt?(de=-Ue,ve=Ae,we=Math.sqrt(Cn)):(de=Ae,ve=Ue,we=Math.sqrt(Cn/2))}return new Ce(de/we,ve/we)}let Et=[];for(let it=0,gt=_.length,ft=gt-1,de=it+1;it<gt;it++,ft++,de++)ft===gt&&(ft=0),de===gt&&(de=0),Et[it]=pt(_[it],_[ft],_[de]);let vt=[],yt,kt=Et.concat();for(let it=0,gt=W;it<gt;it++){let ft=q[it];yt=[];for(let de=0,ve=ft.length,we=ve-1,Ae=de+1;de<ve;de++,we++,Ae++)we===ve&&(we=0),Ae===ve&&(Ae=0),yt[de]=pt(ft[de],ft[we],ft[Ae]);vt.push(yt),kt=kt.concat(yt)}let Wt;if(x===0)Wt=xa.triangulateShape(_,q);else{let it=[],gt=[];for(let ft=0;ft<x;ft++){let de=ft/x,ve=p*Math.cos(de*Math.PI/2),we=g*Math.sin(de*Math.PI/2)+y;for(let Ae=0,Ue=_.length;Ae<Ue;Ae++){let en=at(_[Ae],Et[Ae],we);Qt(en.x,en.y,-ve),de===0&&it.push(en)}for(let Ae=0,Ue=W;Ae<Ue;Ae++){let en=q[Ae];yt=vt[Ae];let It=[];for(let Cn=0,mn=en.length;Cn<mn;Cn++){let mt=at(en[Cn],yt[Cn],we);Qt(mt.x,mt.y,-ve),de===0&&It.push(mt)}de===0&&gt.push(It)}}Wt=xa.triangulateShape(it,gt)}let jt=Wt.length,ae=g+y;for(let it=0;it<ct;it++){let gt=d?at(V[it],kt[it],ae):V[it];C?(O.copy(R.normals[0]).multiplyScalar(gt.x),k.copy(R.binormals[0]).multiplyScalar(gt.y),I.copy(A[0]).add(O).add(k),Qt(I.x,I.y,I.z)):Qt(gt.x,gt.y,0)}for(let it=1;it<=u;it++)for(let gt=0;gt<ct;gt++){let ft=d?at(V[gt],kt[gt],ae):V[gt];C?(O.copy(R.normals[it]).multiplyScalar(ft.x),k.copy(R.binormals[it]).multiplyScalar(ft.y),I.copy(A[it]).add(O).add(k),Qt(I.x,I.y,I.z)):Qt(ft.x,ft.y,h/u*it)}for(let it=x-1;it>=0;it--){let gt=it/x,ft=p*Math.cos(gt*Math.PI/2),de=g*Math.sin(gt*Math.PI/2)+y;for(let ve=0,we=_.length;ve<we;ve++){let Ae=at(_[ve],Et[ve],de);Qt(Ae.x,Ae.y,h+ft)}for(let ve=0,we=q.length;ve<we;ve++){let Ae=q[ve];yt=vt[ve];for(let Ue=0,en=Ae.length;Ue<en;Ue++){let It=at(Ae[Ue],yt[Ue],de);C?Qt(It.x,It.y+A[u-1].y,A[u-1].x+ft):Qt(It.x,It.y,h+ft)}}}ee(),Bt();function ee(){let it=s.length/3;if(d){let gt=0,ft=ct*gt;for(let de=0;de<jt;de++){let ve=Wt[de];xe(ve[2]+ft,ve[1]+ft,ve[0]+ft)}gt=u+x*2,ft=ct*gt;for(let de=0;de<jt;de++){let ve=Wt[de];xe(ve[0]+ft,ve[1]+ft,ve[2]+ft)}}else{for(let gt=0;gt<jt;gt++){let ft=Wt[gt];xe(ft[2],ft[1],ft[0])}for(let gt=0;gt<jt;gt++){let ft=Wt[gt];xe(ft[0]+ct*u,ft[1]+ct*u,ft[2]+ct*u)}}n.addGroup(it,s.length/3-it,0)}function Bt(){let it=s.length/3,gt=0;Gt(_,gt),gt+=_.length;for(let ft=0,de=q.length;ft<de;ft++){let ve=q[ft];Gt(ve,gt),gt+=ve.length}n.addGroup(it,s.length/3-it,1)}function Gt(it,gt){let ft=it.length;for(;--ft>=0;){let de=ft,ve=ft-1;ve<0&&(ve=it.length-1);for(let we=0,Ae=u+x*2;we<Ae;we++){let Ue=ct*we,en=ct*(we+1),It=gt+de+Ue,Cn=gt+ve+Ue,mn=gt+ve+en,mt=gt+de+en;Ut(It,Cn,mn,mt)}}}function Qt(it,gt,ft){l.push(it),l.push(gt),l.push(ft)}function xe(it,gt,ft){zt(it),zt(gt),zt(ft);let de=s.length/3,ve=M.generateTopUV(n,s,de-3,de-2,de-1);St(ve[0]),St(ve[1]),St(ve[2])}function Ut(it,gt,ft,de){zt(it),zt(gt),zt(de),zt(gt),zt(ft),zt(de);let ve=s.length/3,we=M.generateSideWallUV(n,s,ve-6,ve-3,ve-2,ve-1);St(we[0]),St(we[1]),St(we[3]),St(we[1]),St(we[2]),St(we[3])}function zt(it){s.push(l[it*3+0]),s.push(l[it*3+1]),s.push(l[it*3+2])}function St(it){r.push(it.x),r.push(it.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes,n=this.parameters.options;return rkt(e,n,t)}static fromJSON(t,e){let n=[];for(let r=0,o=t.shapes.length;r<o;r++){let a=e[t.shapes[r]];n.push(a)}let s=t.options.extrudePath;return s!==void 0&&(t.options.extrudePath=new N2[s.type]().fromJSON(s)),new i(n,t.options)}},skt={generateTopUV:function(i,t,e,n,s){let r=t[e*3],o=t[e*3+1],a=t[n*3],l=t[n*3+1],c=t[s*3],u=t[s*3+1];return[new Ce(r,o),new Ce(a,l),new Ce(c,u)]},generateSideWallUV:function(i,t,e,n,s,r){let o=t[e*3],a=t[e*3+1],l=t[e*3+2],c=t[n*3],u=t[n*3+1],h=t[n*3+2],d=t[s*3],p=t[s*3+1],g=t[s*3+2],y=t[r*3],x=t[r*3+1],w=t[r*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Ce(o,1-l),new Ce(c,1-h),new Ce(d,1-g),new Ce(y,1-w)]:[new Ce(a,1-l),new Ce(u,1-h),new Ce(p,1-g),new Ce(x,1-w)]}};T1=class i extends fh{constructor(t=1,e=0){let n=(1+Math.sqrt(5))/2,s=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(s,r,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},A1=class i extends kn{constructor(t=[new Ce(0,-.5),new Ce(.5,0),new Ce(0,.5)],e=12,n=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:s},e=Math.floor(e),s=Bn(s,0,Math.PI*2);let r=[],o=[],a=[],l=[],c=[],u=1/e,h=new bt,d=new Ce,p=new bt,g=new bt,y=new bt,x=0,w=0;for(let M=0;M<=t.length-1;M++)switch(M){case 0:x=t[M+1].x-t[M].x,w=t[M+1].y-t[M].y,p.x=w*1,p.y=-x,p.z=w*0,y.copy(p),p.normalize(),l.push(p.x,p.y,p.z);break;case t.length-1:l.push(y.x,y.y,y.z);break;default:x=t[M+1].x-t[M].x,w=t[M+1].y-t[M].y,p.x=w*1,p.y=-x,p.z=w*0,g.copy(p),p.x+=y.x,p.y+=y.y,p.z+=y.z,p.normalize(),l.push(p.x,p.y,p.z),y.copy(g)}for(let M=0;M<=e;M++){let A=n+M*u*s,C=Math.sin(A),R=Math.cos(A);for(let k=0;k<=t.length-1;k++){h.x=t[k].x*C,h.y=t[k].y,h.z=t[k].x*R,o.push(h.x,h.y,h.z),d.x=M/e,d.y=k/(t.length-1),a.push(d.x,d.y);let O=l[3*k+0]*C,I=l[3*k+1],U=l[3*k+0]*R;c.push(O,I,U)}}for(let M=0;M<e;M++)for(let A=0;A<t.length-1;A++){let C=A+M*t.length,R=C,k=C+t.length,O=C+t.length+1,I=C+1;r.push(R,k,I),r.push(O,I,k)}this.setIndex(r),this.setAttribute("position",new Ge(o,3)),this.setAttribute("uv",new Ge(a,2)),this.setAttribute("normal",new Ge(c,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.points,t.segments,t.phiStart,t.phiLength)}},Xb=class i extends fh{constructor(t=1,e=0){let n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,s,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},Ag=class i extends kn{constructor(t=1,e=1,n=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:s};let r=t/2,o=e/2,a=Math.floor(n),l=Math.floor(s),c=a+1,u=l+1,h=t/a,d=e/l,p=[],g=[],y=[],x=[];for(let w=0;w<u;w++){let M=w*d-o;for(let A=0;A<c;A++){let C=A*h-r;g.push(C,-M,0),y.push(0,0,1),x.push(A/a),x.push(1-w/l)}}for(let w=0;w<l;w++)for(let M=0;M<a;M++){let A=M+c*w,C=M+c*(w+1),R=M+1+c*(w+1),k=M+1+c*w;p.push(A,C,k),p.push(C,R,k)}this.setIndex(p),this.setAttribute("position",new Ge(g,3)),this.setAttribute("normal",new Ge(y,3)),this.setAttribute("uv",new Ge(x,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.width,t.height,t.widthSegments,t.heightSegments)}},E1=class i extends kn{constructor(t=.5,e=1,n=32,s=1,r=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:s,thetaStart:r,thetaLength:o},n=Math.max(3,n),s=Math.max(1,s);let a=[],l=[],c=[],u=[],h=t,d=(e-t)/s,p=new bt,g=new Ce;for(let y=0;y<=s;y++){for(let x=0;x<=n;x++){let w=r+x/n*o;p.x=h*Math.cos(w),p.y=h*Math.sin(w),l.push(p.x,p.y,p.z),c.push(0,0,1),g.x=(p.x/e+1)/2,g.y=(p.y/e+1)/2,u.push(g.x,g.y)}h+=d}for(let y=0;y<s;y++){let x=y*(n+1);for(let w=0;w<n;w++){let M=w+x,A=M,C=M+n+1,R=M+n+2,k=M+1;a.push(A,C,k),a.push(C,R,k)}}this.setIndex(a),this.setAttribute("position",new Ge(l,3)),this.setAttribute("normal",new Ge(c,3)),this.setAttribute("uv",new Ge(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},k1=class i extends kn{constructor(t=new rf([new Ce(0,.5),new Ce(-.5,-.5),new Ce(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};let n=[],s=[],r=[],o=[],a=0,l=0;if(Array.isArray(t)===!1)c(t);else for(let u=0;u<t.length;u++)c(t[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(n),this.setAttribute("position",new Ge(s,3)),this.setAttribute("normal",new Ge(r,3)),this.setAttribute("uv",new Ge(o,2));function c(u){let h=s.length/3,d=u.extractPoints(e),p=d.shape,g=d.holes;xa.isClockWise(p)===!1&&(p=p.reverse());for(let x=0,w=g.length;x<w;x++){let M=g[x];xa.isClockWise(M)===!0&&(g[x]=M.reverse())}let y=xa.triangulateShape(p,g);for(let x=0,w=g.length;x<w;x++){let M=g[x];p=p.concat(M)}for(let x=0,w=p.length;x<w;x++){let M=p[x];s.push(M.x,M.y,0),r.push(0,0,1),o.push(M.x,M.y)}for(let x=0,w=y.length;x<w;x++){let M=y[x],A=M[0]+h,C=M[1]+h,R=M[2]+h;n.push(A,C,R),l+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes;return okt(e,t)}static fromJSON(t,e){let n=[];for(let s=0,r=t.shapes.length;s<r;s++){let o=e[t.shapes[s]];n.push(o)}return new i(n,t.curveSegments)}};Kb=class i extends kn{constructor(t=1,e=32,n=16,s=0,r=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:s,phiLength:r,thetaStart:o,thetaLength:a},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],h=new bt,d=new bt,p=[],g=[],y=[],x=[];for(let w=0;w<=n;w++){let M=[],A=w/n,C=o+A*a,R=t*Math.cos(C),k=Math.sqrt(t*t-R*R),O=0;w===0&&o===0?O=.5/e:w===n&&l===Math.PI&&(O=-.5/e);for(let I=0;I<=e;I++){let U=I/e,V=s+U*r;h.x=-k*Math.cos(V),h.y=R,h.z=k*Math.sin(V),g.push(h.x,h.y,h.z),d.copy(h).normalize(),y.push(d.x,d.y,d.z),x.push(U+O,1-A),M.push(c++)}u.push(M)}for(let w=0;w<n;w++)for(let M=0;M<e;M++){let A=u[w][M+1],C=u[w][M],R=u[w+1][M],k=u[w+1][M+1];(w!==0||o>0)&&p.push(A,C,k),(w!==n-1||l<Math.PI)&&p.push(C,R,k)}this.setIndex(p),this.setAttribute("position",new Ge(g,3)),this.setAttribute("normal",new Ge(y,3)),this.setAttribute("uv",new Ge(x,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},P1=class i extends fh{constructor(t=1,e=0){let n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],s=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,s,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},R1=class i extends kn{constructor(t=1,e=.4,n=12,s=48,r=Math.PI*2,o=0,a=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:s,arc:r,thetaStart:o,thetaLength:a},n=Math.floor(n),s=Math.floor(s);let l=[],c=[],u=[],h=[],d=new bt,p=new bt,g=new bt;for(let y=0;y<=n;y++){let x=o+y/n*a;for(let w=0;w<=s;w++){let M=w/s*r;p.x=(t+e*Math.cos(x))*Math.cos(M),p.y=(t+e*Math.cos(x))*Math.sin(M),p.z=e*Math.sin(x),c.push(p.x,p.y,p.z),d.x=t*Math.cos(M),d.y=t*Math.sin(M),g.subVectors(p,d).normalize(),u.push(g.x,g.y,g.z),h.push(w/s),h.push(y/n)}}for(let y=1;y<=n;y++)for(let x=1;x<=s;x++){let w=(s+1)*y+x-1,M=(s+1)*(y-1)+x-1,A=(s+1)*(y-1)+x,C=(s+1)*y+x;l.push(w,M,C),l.push(M,A,C)}this.setIndex(l),this.setAttribute("position",new Ge(c,3)),this.setAttribute("normal",new Ge(u,3)),this.setAttribute("uv",new Ge(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc,t.thetaStart,t.thetaLength)}},D1=class i extends kn{constructor(t=1,e=.4,n=64,s=8,r=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:s,p:r,q:o},n=Math.floor(n),s=Math.floor(s);let a=[],l=[],c=[],u=[],h=new bt,d=new bt,p=new bt,g=new bt,y=new bt,x=new bt,w=new bt;for(let A=0;A<=n;++A){let C=A/n*r*Math.PI*2;M(C,r,o,t,p),M(C+.01,r,o,t,g),x.subVectors(g,p),w.addVectors(g,p),y.crossVectors(x,w),w.crossVectors(y,x),y.normalize(),w.normalize();for(let R=0;R<=s;++R){let k=R/s*Math.PI*2,O=-e*Math.cos(k),I=e*Math.sin(k);h.x=p.x+(O*w.x+I*y.x),h.y=p.y+(O*w.y+I*y.y),h.z=p.z+(O*w.z+I*y.z),l.push(h.x,h.y,h.z),d.subVectors(h,p).normalize(),c.push(d.x,d.y,d.z),u.push(A/n),u.push(R/s)}}for(let A=1;A<=n;A++)for(let C=1;C<=s;C++){let R=(s+1)*(A-1)+(C-1),k=(s+1)*A+(C-1),O=(s+1)*A+C,I=(s+1)*(A-1)+C;a.push(R,k,I),a.push(k,O,I)}this.setIndex(a),this.setAttribute("position",new Ge(l,3)),this.setAttribute("normal",new Ge(c,3)),this.setAttribute("uv",new Ge(u,2));function M(A,C,R,k,O){let I=Math.cos(A),U=Math.sin(A),V=R/C*A,q=Math.cos(V);O.x=k*(2+q)*.5*I,O.y=k*(2+q)*U*.5,O.z=k*Math.sin(V)*.5}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},L1=class i extends kn{constructor(t=new Gb(new bt(-1,-1,0),new bt(-1,1,0),new bt(1,1,0)),e=64,n=1,s=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:s,closed:r};let o=t.computeFrenetFrames(e,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new bt,l=new bt,c=new Ce,u=new bt,h=[],d=[],p=[],g=[];y(),this.setIndex(g),this.setAttribute("position",new Ge(h,3)),this.setAttribute("normal",new Ge(d,3)),this.setAttribute("uv",new Ge(p,2));function y(){for(let A=0;A<e;A++)x(A);x(r===!1?e:0),M(),w()}function x(A){u=t.getPointAt(A/e,u);let C=o.normals[A],R=o.binormals[A];for(let k=0;k<=s;k++){let O=k/s*Math.PI*2,I=Math.sin(O),U=-Math.cos(O);l.x=U*C.x+I*R.x,l.y=U*C.y+I*R.y,l.z=U*C.z+I*R.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,h.push(a.x,a.y,a.z)}}function w(){for(let A=1;A<=e;A++)for(let C=1;C<=s;C++){let R=(s+1)*(A-1)+(C-1),k=(s+1)*A+(C-1),O=(s+1)*A+C,I=(s+1)*(A-1)+C;g.push(R,k,I),g.push(k,O,I)}}function M(){for(let A=0;A<=e;A++)for(let C=0;C<=s;C++)c.x=A/e,c.y=C/s,p.push(c.x,c.y)}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new i(new N2[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},I1=class extends kn{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},t!==null){let e=[],n=new Set,s=new bt,r=new bt;if(t.index!==null){let o=t.attributes.position,a=t.index,l=t.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let h=l[c],d=h.start,p=h.count;for(let g=d,y=d+p;g<y;g+=3)for(let x=0;x<3;x++){let w=a.getX(g+x),M=a.getX(g+(x+1)%3);s.fromBufferAttribute(o,w),r.fromBufferAttribute(o,M),pQ(s,r,n)===!0&&(e.push(s.x,s.y,s.z),e.push(r.x,r.y,r.z))}}}else{let o=t.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){let u=3*a+c,h=3*a+(c+1)%3;s.fromBufferAttribute(o,u),r.fromBufferAttribute(o,h),pQ(s,r,n)===!0&&(e.push(s.x,s.y,s.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new Ge(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}};gQ=Object.freeze({__proto__:null,BoxGeometry:nf,CapsuleGeometry:f1,CircleGeometry:p1,ConeGeometry:Hb,CylinderGeometry:Vb,DodecahedronGeometry:g1,EdgesGeometry:m1,ExtrudeGeometry:M1,IcosahedronGeometry:T1,LatheGeometry:A1,OctahedronGeometry:Xb,PlaneGeometry:Ag,PolyhedronGeometry:fh,RingGeometry:E1,ShapeGeometry:k1,SphereGeometry:Kb,TetrahedronGeometry:P1,TorusGeometry:R1,TorusKnotGeometry:D1,TubeGeometry:L1,WireframeGeometry:I1}),O1=class extends ss{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Be(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}};HU={clone:Fg,merge:To},lkt=`void main() {
420	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
421}`,ckt=`void main() {
422	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
423}`,Zo=class extends ss{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=lkt,this.fragmentShader=ckt,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Fg(t.uniforms),this.uniformsGroups=akt(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let s in this.uniforms){let o=this.uniforms[s].value;o&&o.isTexture?e.uniforms[s]={type:"t",value:o.toJSON(t).uuid}:o&&o.isColor?e.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?e.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?e.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?e.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?e.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?e.uniforms[s]={type:"m4",value:o.toArray()}:e.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let n={};for(let s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}fromJSON(t,e){if(super.fromJSON(t,e),t.uniforms!==void 0)for(let n in t.uniforms){let s=t.uniforms[n];switch(this.uniforms[n]={},s.type){case"t":this.uniforms[n].value=e[s.value]||null;break;case"c":this.uniforms[n].value=new Be().setHex(s.value);break;case"v2":this.uniforms[n].value=new Ce().fromArray(s.value);break;case"v3":this.uniforms[n].value=new bt().fromArray(s.value);break;case"v4":this.uniforms[n].value=new pi().fromArray(s.value);break;case"m3":this.uniforms[n].value=new Vn().fromArray(s.value);break;case"m4":this.uniforms[n].value=new tn().fromArray(s.value);break;default:this.uniforms[n].value=s.value}}if(t.defines!==void 0&&(this.defines=t.defines),t.vertexShader!==void 0&&(this.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(this.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(this.glslVersion=t.glslVersion),t.extensions!==void 0)for(let n in t.extensions)this.extensions[n]=t.extensions[n];return t.lights!==void 0&&(this.lights=t.lights),t.clipping!==void 0&&(this.clipping=t.clipping),this}},Jb=class extends Zo{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},ph=class extends ss{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Be(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=du,this.normalScale=new Ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new gr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},So=class extends ph{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ce(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Bn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Be(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Be(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Be(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._retroreflectivity=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get retroreflectivity(){return this._retroreflectivity}set retroreflectivity(t){this._retroreflectivity>0!=t>0&&this.version++,this._retroreflectivity=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.retroreflectivity=t.retroreflectivity,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}},_a=class extends ss{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Be(16777215),this.specular=new Be(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=du,this.normalScale=new Ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new gr,this.combine=av,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},N1=class extends ss{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Be(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=du,this.normalScale=new Ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},B1=class extends ss{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=du,this.normalScale=new Ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}},Eg=class extends ss{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Be(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=du,this.normalScale=new Ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new gr,this.combine=av,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},Zb=class extends ss{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=kU,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Qb=class extends ss{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},F1=class extends ss{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Be(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=du,this.normalScale=new Ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}},U1=class extends fs{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}};B2=class{static convertArray(t,e){return cc(t,e)}static isTypedArray(t){return ktt(t)}static hasTangents(t){return Xw(t)}static getKeyframeOrder(t){return Vtt(t)}static sortedArray(t,e,n){return Y4(t,e,n)}static flattenJSON(t,e,n,s){Htt(t,e,n,s)}static subclip(t,e,n,s,r=30){return ukt(t,e,n,s,r)}static makeClipAdditive(t,e=0,n=t,s=30){return hkt(t,e,n,s)}},mc=class{constructor(t,e,n,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,s=e[n],r=e[n-1];t:{e:{let o;n:{i:if(!(t<s)){for(let a=n+2;;){if(s===void 0){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=s,s=e[++n],t<s)break e}o=e.length;break n}if(!(t>=r)){let a=e[1];t<a&&(n=2,r=a);for(let l=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(s=r,r=e[--n-1],t>=r)break e}o=n,n=0;break n}break t}for(;n<o;){let a=n+o>>>1;t<e[a]?o=a:n=a+1}if(s=e[n],r=e[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,s)}return this.interpolate_(n,r,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=t*s;for(let o=0;o!==s;++o)e[o]=n[r+o];return e}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},z1=class extends mc{constructor(t,e,n,s){super(t,e,n,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:qd,endingEnd:qd}}intervalChanged_(t,e,n){let s=this.parameterPositions,r=t-2,o=t+1,a=s[r],l=s[o];if(a===void 0)switch(this.getSettings_().endingStart){case Yd:r=t,a=2*e-n;break;case Lb:r=s.length-2,a=e+s[r]-s[r+1];break;default:r=t,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case Yd:o=t,l=2*n-e;break;case Lb:o=1,l=n+s[1]-s[0];break;default:o=t-1,l=e}let c=(n-e)*.5,u=this.valueSize;this._weightPrev=c/(e-a),this._weightNext=c/(l-n),this._offsetPrev=r*u,this._offsetNext=o*u}interpolate_(t,e,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=t*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,p=this._weightNext,g=(n-e)/(s-e),y=g*g,x=y*g,w=-d*x+2*d*y-d*g,M=(1+d)*x+(-1.5-2*d)*y+(-.5+d)*g+1,A=(-1-p)*x+(1.5+p)*y+.5*g,C=p*x-p*y;for(let R=0;R!==a;++R)r[R]=w*o[u+R]+M*o[c+R]+A*o[l+R]+C*o[h+R];return r}},tv=class extends mc{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=t*a,c=l-a,u=(n-e)/(s-e),h=1-u;for(let d=0;d!==a;
423++d)r[d]=o[c+d]*h+o[l+d]*u;return r}},V1=class extends mc{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t){return this.copySampleValue_(t-1)}},H1=class extends mc{interpolate_(t,e,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=t*a,c=l-a,u=this.inTangents,h=this.outTangents;if(!u||!h){let g=(n-e)/(s-e),y=1-g;for(let x=0;x!==a;++x)r[x]=o[c+x]*y+o[l+x]*g;return r}let d=a*2,p=t-1;for(let g=0;g!==a;++g){let y=o[c+g],x=o[l+g],w=p*d+g*2,M=h[w],A=h[w+1],C=t*d+g*2,R=u[C],k=u[C+1],O=fkt(n,e,M,R,s);r[g]=jtt(O,y,A,k,x)}return r}};Qo=class{constructor(t,e,n,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=cc(e,this.TimeBufferType),this.values=cc(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:cc(t.times,Array),values:cc(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(n.interpolation=s),Xw(t.settings)&&(n.settings={inTangents:cc(t.settings.inTangents,Array),outTangents:cc(t.settings.outTangents,Array)})}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new V1(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new tv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new z1(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodBezier(t){let e=new H1(this.times,this.values,this.getValueSize(),t);return this.settings&&(e.inTangents=this.settings.inTangents,e.outTangents=this.settings.outTangents),e}setInterpolation(t){let e;switch(t){case Kd:e=this.InterpolantFactoryMethodDiscrete;break;case Jd:e=this.InterpolantFactoryMethodLinear;break;case Ww:e=this.InterpolantFactoryMethodSmooth;break;case b2:e=this.InterpolantFactoryMethodBezier;break}if(e===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Ze("KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Kd;case this.InterpolantFactoryMethodLinear:return Jd;case this.InterpolantFactoryMethodSmooth:return Ww;case this.InterpolantFactoryMethodBezier:return b2}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]*=t;Xw(this.settings)&&(bQ(this.settings.inTangents,t),bQ(this.settings.outTangents,t))}return this}trim(t,e){let n=this.times,s=n.length,r=0,o=s-1;for(;r!==s&&n[r]<t;)++r;for(;o!==-1&&n[o]>e;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);let a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(Tn("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,s=this.values,r=n.length;r===0&&(Tn("KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let a=0;a!==r;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){Tn("KeyframeTrack: Time is not a valid number.",this,a,l),t=!1;break}if(o!==null&&o>l){Tn("KeyframeTrack: Out of order keys.",this,a,l,o),t=!1;break}o=l}if(s!==void 0&&ktt(s))for(let a=0,l=s.length;a!==l;++a){let c=s[a];if(isNaN(c)){Tn("KeyframeTrack: Value is not a valid number.",this,a,c),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===Ww,r=t.length-1,o=1;for(let a=1;a<r;++a){let l=!1,c=t[a],u=t[a+1];if(c!==u&&(a!==1||c!==t[0]))if(s)l=!0;else{let h=a*n,d=h-n,p=h+n;for(let g=0;g!==n;++g){let y=e[h+g];if(y!==e[d+g]||y!==e[p+g]){l=!0;break}}}if(l){if(a!==o){t[o]=t[a];let h=a*n,d=o*n;for(let p=0;p!==n;++p)e[d+p]=e[h+p]}++o}}if(r>0){t[o]=t[r];for(let a=r*n,l=o*n,c=0;c!==n;++c)e[l+c]=e[a+c];++o}return o!==t.length?(this.times=t.slice(0,o),this.values=e.slice(0,o*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,s=new n(this.name,t,e);return s.createInterpolant=this.createInterpolant,Xw(this.settings)&&(s.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),s}};Qo.prototype.ValueTypeName="";Qo.prototype.TimeBufferType=Float32Array;Qo.prototype.ValueBufferType=Float32Array;Qo.prototype.DefaultInterpolation=Jd;au=class extends Qo{constructor(t,e,n){super(t,e,n)}};au.prototype.ValueTypeName="bool";au.prototype.ValueBufferType=Array;au.prototype.DefaultInterpolation=Kd;au.prototype.InterpolantFactoryMethodLinear=void 0;au.prototype.InterpolantFactoryMethodSmooth=void 0;ev=class extends Qo{constructor(t,e,n,s){super(t,e,n,s)}};ev.prototype.ValueTypeName="color";_l=class extends Qo{constructor(t,e,n,s){super(t,e,n,s)}};_l.prototype.ValueTypeName="number";
vendor: 6,314 bytes, line 423
423j1=class extends mc{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-e)/(s-e),c=t*a;for(let u=c+a;c!==u;c+=4)Gi.slerpFlat(r,0,o,c-a,o,c,l);return r}},Sl=class extends Qo{constructor(t,e,n,s){super(t,e,n,s)}InterpolantFactoryMethodLinear(t){return new j1(this.times,this.values,this.getValueSize(),t)}};Sl.prototype.ValueTypeName="quaternion";Sl.prototype.InterpolantFactoryMethodSmooth=void 0;lu=class extends Qo{constructor(t,e,n){super(t,e,n)}};lu.prototype.ValueTypeName="string";lu.prototype.ValueBufferType=Array;lu.prototype.DefaultInterpolation=Kd;lu.prototype.InterpolantFactoryMethodLinear=void 0;lu.prototype.InterpolantFactoryMethodSmooth=void 0;bc=class extends Qo{constructor(t,e,n,s){super(t,e,n,s)}};bc.prototype.ValueTypeName="vector";Cl=class{constructor(t="",e=-1,n=[],s=z_){this.name=t,this.tracks=n,this.duration=e,this.blendMode=s,this.uuid=Ha(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){let e=[],n=t.tracks,s=1/(t.fps||1);for(let o=0,a=n.length;o!==a;++o)e.push(gkt(n[o]).scale(s));let r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){let e=[],n=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let r=0,o=n.length;r!==o;++r)e.push(Qo.toJSON(n[r]));return s}static CreateFromMorphTargetSequence(t,e,n,s){let r=e.length,o=[];for(let a=0;a<r;a++){let l=[],c=[];l.push((a+r-1)%r,a,(a+1)%r),c.push(0,1,0);let u=Vtt(l);l=Y4(l,1,u),c=Y4(c,1,u),!s&&l[0]===0&&(l.push(r),c.push(c[0])),o.push(new _l(".morphTargetInfluences["+e[a].name+"]",l,c).scale(1/n))}return new this(t,-1,o)}static findByName(t,e){let n=t;if(!Array.isArray(t)){let s=t;n=s.geometry&&s.geometry.animations||s.animations}for(let s=0;s<n.length;s++)if(n[s].name===e)return n[s];return null}static CreateClipsFromMorphTargetSequences(t,e,n){let s={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,l=t.length;a<l;a++){let c=t[a],u=c.name.match(r);if(u&&u.length>1){let h=u[1],d=s[h];d||(s[h]=d=[]),d.push(c)}}let o=[];for(let a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],e,n));return o}resetDuration(){let t=this.tracks,e=0;for(let n=0,s=t.length;n!==s;++n){let r=this.tracks[n];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){let t=[];for(let n=0;n<this.tracks.length;n++)t.push(this.tracks[n].clone());let e=new this.constructor(this.name,this.duration,t,this.blendMode);return e.userData=JSON.parse(JSON.stringify(this.userData)),e}toJSON(){return this.constructor.toJSON(this)}};hc={enabled:!1,files:{},add:function(i,t){this.enabled!==!1&&(vQ(i)||(this.files[i]=t))},get:function(i){if(this.enabled!==!1&&!vQ(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};nv=class{constructor(t,e,n){let s=this,r=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,r===!1&&s.onStart!==void 0&&s.onStart(u,o,a),r=!0},this.itemEnd=function(u){o++,s.onProgress!==void 0&&s.onProgress(u,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(u){s.onError!==void 0&&s.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){let h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=c.length;h<d;h+=2){let p=c[h],g=c[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return g}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},W_=new nv,rs=class{constructor(t){this.manager=t!==void 0?t:W_,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(t,e){let n=this;return new Promise(function(s,r){n.load(t,s,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}};rs.DEFAULT_MATERIAL_NAME="__DEFAULT";oh={},X4=class extends Error{constructor(t,e){super(t),this.response=e}},or=class extends rs{constructor(t){super(t),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(t,e,n,s){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let r=hc.get(`file:${t}`);if(r!==void 0){this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0);return}if(oh[t]!==void 0){oh[t].push({onLoad:e,onProgress:n,onError:s});return}oh[t]=[],oh[t].push({onLoad:e,onProgress:n,onError:s});let o=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&Ze("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let u=oh[t],h=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=d?parseInt(d):0,g=p!==0,y=0,x=new ReadableStream({start(w){M();function M(){h.read().then(({done:A,value:C})=>{if(A)w.close();else{y+=C.byteLength;let R=new ProgressEvent("progress",{lengthComputable:g,loaded:y,total:p});for(let k=0,O=u.length;k<O;k++){let I=u[k];I.onProgress&&I.onProgress(R)}w.enqueue(C),M()}},A=>
vendor: 4,121 bytes, line 423
423{w.error(A)})}}});return new Response(x)}else throw new X4(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a==="")return c.text();{let h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(d);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{hc.add(`file:${t}`,c);let u=oh[t];delete oh[t];for(let h=0,d=u.length;h<d;h++){let p=u[h];p.onLoad&&p.onLoad(c)}}).catch(c=>{let u=oh[t];if(u===void 0)throw this.manager.itemError(t),c;delete oh[t];for(let h=0,d=u.length;h<d;h++){let p=u[h];p.onError&&p.onError(c)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},F2=class extends rs{constructor(t){super(t)}load(t,e,n,s){let r=this,o=new or(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(a){try{e(r.parse(JSON.parse(a)))}catch(l){s?s(l):Tn(l),r.manager.itemError(t)}},n,s)}parse(t){let e=[];for(let n=0;n<t.length;n++){let s=Cl.parse(t[n]);e.push(s)}return e}},U2=class extends rs{constructor(t){super(t)}load(t,e,n,s){let r=this,o=[],a=new Cg,l=new or(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(r.withCredentials);let c=0;function u(h){l.load(t[h],function(d){let p=r.parse(d,!0);o[h]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},c+=1,c===6&&(p.mipmapCount===1&&(a.minFilter=$i),a.image=o,a.format=p.format,a.needsUpdate=!0,e&&e(a))},n,s)}if(Array.isArray(t))for(let h=0,d=t.length;h<d;++h)u(h);else l.load(t,function(h){let d=r.parse(h,!0);if(d.isCubemap){let p=d.mipmaps.length/d.mipmapCount;for(let g=0;g<p;g++){o[g]={mipmaps:[]};for(let y=0;y<d.mipmapCount;y++)o[g].mipmaps.push(d.mipmaps[g*d.mipmapCount+y]),o[g].format=d.format,o[g].width=d.width,o[g].height=d.height}a.image=o}else a.image.width=d.width,a.image.height=d.height,a.mipmaps=d.mipmaps;d.mipmapCount===1&&(a.minFilter=$i),a.format=d.format,a.needsUpdate=!0,e&&e(a)},n,s);return a}},Tb=new WeakMap,of=class extends rs{constructor(t){super(t)}load(t,e,n,s){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let r=this,o=hc.get(`image:${t}`);if(o!==void 0){if(o.complete===!0)r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0);else{let h=Tb.get(o);h===void 0&&(h=[],Tb.set(o,h)),h.push({onLoad:e,onError:s})}return o}let a=Ob("img");function l(){u(),e&&e(this);let h=Tb.get(this)||[];for(let d=0;d<h.length;d++){let p=h[d];p.onLoad&&p.onLoad(this)}Tb.delete(this),r.manager.itemEnd(t)}function c(h){u(),s&&s(h),hc.remove(`image:${t}`);let d=Tb.get(this)||[];for(let p=0;p<d.length;p++){let g=d[p];g.onError&&g.onError(h)}Tb.delete(this),r.manager.itemError(t),r.manager.itemEnd(t)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),hc.add(`image:${t}`,a),r.manager.itemStart(t),a.src=t,a}},z2=class extends rs{constructor(t){super(t)}load(t,e,n,s){let r=new ef;r.colorSpace=Zn;let o=new of(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(t[c],function(u){r.images[c]=u,a++,a===6&&(r.needsUpdate=!0,e&&e(r))},void 0,s)}for(let c=0;c<t.length;++c)l(c);return r}},V2=class extends rs{constructor(t){super(t)}load(t,e,n,s){let r=this,o=new Xo,a=new or(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(t,function(l){let c;try{c=r.parse(l)}catch(u){s!==void 0?s(u):Tn(u);return}
vendor: 10,526 bytes, line 423
423r._applyTexData(o,c),e&&e(o,c)},n,s),o}createDataTexture(t){let e=new Xo;return this._applyTexData(e,this.parse(t)),e}_applyTexData(t,e){e.image!==void 0?t.image=e.image:e.data!==void 0&&(t.image.width=e.width,t.image.height=e.height,t.image.data=e.data),t.wrapS=e.wrapS!==void 0?e.wrapS:pr,t.wrapT=e.wrapT!==void 0?e.wrapT:pr,t.magFilter=e.magFilter!==void 0?e.magFilter:$i,t.minFilter=e.minFilter!==void 0?e.minFilter:$i,t.anisotropy=e.anisotropy!==void 0?e.anisotropy:1,e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.mipmaps!==void 0&&(t.mipmaps=e.mipmaps,t.minFilter=Sa),e.mipmapCount===1&&(t.minFilter=$i),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),t.needsUpdate=!0}},cu=class extends rs{constructor(t){super(t)}load(t,e,n,s){let r=new is,o=new of(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(a){r.image=a,r.needsUpdate=!0,e!==void 0&&e(r)},n,s),r}},vc=class extends ai{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Be(t),this.intensity=e}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){let e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,e}},W1=class extends vc{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ai.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Be(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}toJSON(t){let e=super.toJSON(t);return e.object.groundColor=this.groundColor.getHex(),e}},N4=new tn,yQ=new bt,xQ=new bt,kg=class{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ce(512,512),this.mapType=ta,this.map=null,this.mapPass=null,this.matrix=new tn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ou,this._frameExtents=new Ce(1,1),this._viewportCount=1,this._viewports=[new pi(0,0,1,1)]}getViewportCount(){return this._viewportCount}getCamera(){return this.camera}getFrustum(){return this._frustum}updateMatrices(t){let e=this.camera;yQ.setFromMatrixPosition(t.matrixWorld),e.position.copy(yQ),xQ.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(xQ),e.updateMatrixWorld(),this._updateMatrix(e,this.matrix,this._frustum)}_updateMatrix(t,e,n,s){N4.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),n.setFromProjectionMatrix(N4,t.coordinateSystem,t.reversedDepth);let r=this._frameExtents,o=s?s.z/r.x:1,a=s?s.w/r.y:1,l=s?s.x/r.x:0,c=s?s.y/r.y:0;t.coordinateSystem===Zd||t.reversedDepth?e.set(.5*o,0,0,.5*o+l,0,.5*a,0,.5*a+c,0,0,1,0,0,0,0,1):e.set(.5*o,0,0,.5*o+l,0,.5*a,0,.5*a+c,0,0,.5,.5,0,0,0,1),e.multiply(N4)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this.biasNode=t.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let t={};return t.intensity=this.intensity,t.bias=this.bias,t.normalBias=this.normalBias,t.radius=this.radius,t.blurSamples=this.blurSamples,t.mapSize=this.mapSize.toArray(),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}},a2=new bt,l2=new Gi,iu=new bt,Pg=class extends ai{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new tn,this.projectionMatrix=new tn,this.projectionMatrixInverse=new tn,this.coordinateSystem=ya,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorld.decompose(a2,l2,iu),iu.x===1&&iu.y===1&&iu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(a2,l2,iu.set(1,1,1)).invert()}updateWorldMatrix(t,e,n=!1){super.updateWorldMatrix(t,e,n),this.matrixWorld.decompose(a2,l2,iu),iu.x===1&&iu.y===1&&iu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(a2,l2,iu.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},$d=new bt,wQ=new Ce,_Q=new Ce,Ds=class extends Pg{constructor(t=50,e=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=bg*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(gg*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return bg*2*Math.atan(Math.tan(gg*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){$d.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set($d.x,$d.y).multiplyScalar(-t/$d.z),$d.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set($d.x,$d.y).multiplyScalar(-t/$d.z)}getViewSize(t,e){return this.getViewBounds(t,wQ,_Q),e.subVectors(_Q,wQ)}setViewOffset(t,e,n,s,r,o){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(gg*.5*this.fov)/this.zoom,n=2*e,s=this.aspect*n,r=-.5*s,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*s/l,e-=o.offsetY*n/c,s*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-n,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},K4=class extends kg{constructor(){super(new Ds(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(t){let e=this.camera,n=bg*2*t.angle*this.focus,s=this.mapSize.width/this.mapSize.height*this.aspect,r=t.distance||e.far;(n!==e.fov||s!==e.aspect||r!==e.far)&&(e.fov=n,e.aspect=s,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this.aspect=t.aspect,this}toJSON(){let t=super.toJSON();return t.focus=this.focus,t.aspect=this.aspect,t}},gh=class extends vc{constructor(t,e,n=0,s=Math.PI/3,r=0,o=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ai.DEFAULT_UP),this.updateMatrix(),this.target=new ai,this.distance=n,this.angle=s,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new K4}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.map=t.map,this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.distance=this.distance,e.object.angle=this.angle,e.object.decay=this.decay,e.object.penumbra=this.penumbra,e.object.target=this.target.uuid,this.map&&this.map.isTexture&&(e.object.map=this.map.toJSON(t).uuid),e.object.shadow=this.shadow.toJSON(),e}},J4=class extends kg{constructor(){super(new Ds(90,1,.5,500)),this.isPointLightShadow=!0}},uu=class extends vc{constructor(t,e,n=0,s=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=s,this.shadow=new J4}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.distance=this.distance,e.object.decay=this.decay,e.object.shadow=this.shadow.toJSON(),e}},hu=class extends Pg{constructor(t=-1,e=1,n=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=n-t,o=n+t,a=s+e,l=s-e;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,o=r+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}
vendor: 38,070 bytes, line 423
423this.projectionMatrix.makeOrthographic(r,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},Z4=class extends kg{constructor(){super(new hu(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},mh=class extends vc{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ai.DEFAULT_UP),this.updateMatrix(),this.target=new ai,this.shadow=new Z4}dispose(){super.dispose(),this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.shadow=this.shadow.toJSON(),e.object.target=this.target.uuid,e}},Rg=class extends vc{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}},$1=class extends vc{constructor(t,e,n=10,s=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=s}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){let e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}},iv=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new bt)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){let n=t.x,s=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScaledVector(o[1],.488603*s),e.addScaledVector(o[2],.488603*r),e.addScaledVector(o[3],.488603*n),e.addScaledVector(o[4],1.092548*(n*s)),e.addScaledVector(o[5],1.092548*(s*r)),e.addScaledVector(o[6],.315392*(3*r*r-1)),e.addScaledVector(o[7],1.092548*(n*r)),e.addScaledVector(o[8],.546274*(n*n-s*s)),e}getIrradianceAt(t,e){let n=t.x,s=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScaledVector(o[1],2*.511664*s),e.addScaledVector(o[2],2*.511664*r),e.addScaledVector(o[3],2*.511664*n),e.addScaledVector(o[4],2*.429043*n*s),e.addScaledVector(o[5],2*.429043*s*r),e.addScaledVector(o[6],.743125*r*r-.247708),e.addScaledVector(o[7],2*.429043*n*r),e.addScaledVector(o[8],.429043*(n*n-s*s)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,e=0){let n=this.coefficients;for(let s=0;s<9;s++)n[s].fromArray(t,e+s*3);return this}toArray(t=[],e=0){let n=this.coefficients;for(let s=0;s<9;s++)n[s].toArray(t,e+s*3);return t}static getBasisAt(t,e){let n=t.x,s=t.y,r=t.z;e[0]=.282095,e[1]=.488603*s,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*s,e[5]=1.092548*s*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-s*s)}},G1=class extends vc{constructor(t=new iv,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}toJSON(t){let e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}},SQ={},q1=class i extends rs{constructor(t){super(t),this.textures={}}load(t,e,n,s){let r=this,o=new or(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,function(a){try{e(r.parse(JSON.parse(a)))}catch(l){s?s(l):Tn(l),r.manager.itemError(t)}},n,s)}parse(t){let e=this.createMaterialFromType(t.type);return e.fromJSON(t,this.textures),e}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return i.createMaterialFromType(t)}static createMaterialFromType(t){let n={ShadowMaterial:O1,SpriteMaterial:Ub,RawShaderMaterial:Jb,ShaderMaterial:Zo,PointsMaterial:Wa,MeshPhysicalMaterial:So,MeshStandardMaterial:ph,MeshPhongMaterial:_a,MeshToonMaterial:N1,MeshNormalMaterial:B1,MeshLambertMaterial:Eg,MeshDepthMaterial:Zb,MeshDistanceMaterial:Qb,MeshBasicMaterial:io,MeshMatcapMaterial:F1,LineDashedMaterial:U1,LineBasicMaterial:fs,Material:ss,...SQ}[t],s;return n===void 0?(su(`MaterialLoader: Unknown material type "${t}". Use .registerMaterial() before starting the deserialization process.`),s=new ss):s=new n,s}static registerMaterial(t,e){SQ[t]=e}},Co=class{static extractUrlBase(t){let e=t.lastIndexOf("/");return e===-1?"./":t.slice(0,e+1)}static resolveURL(t,e){return typeof t!="string"||t===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}},Y1=class extends kn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}},X1=class extends rs{constructor(t){super(t)}load(t,e,n,s){let r=this,o=new or(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,function(a){try{e(r.parse(JSON.parse(a)))}catch(l){s?s(l):Tn(l),r.manager.itemError(t)}},n,s)}parse(t){let e={},n={};function s(p,g){if(e[g]!==void 0)return e[g];let x=p.interleavedBuffers[g],w=r(p,x.buffer),M=Rb(x.type,w),A=new ru(M,x.stride);return A.uuid=x.uuid,x.usage!==void 0&&A.setUsage(x.usage),e[g]=A,A}function r(p,g){if(n[g]!==void 0)return n[g];let x=p.arrayBuffers[g],w=new Uint32Array(x).buffer;return n[g]=w,w}let o=t.isInstancedBufferGeometry?new Y1:new kn,a=t.data.index;if(a!==void 0){let p=Rb(a.type,a.array);o.setIndex(new Mi(p,1))}let l=t.data.attributes;for(let p in l){let g=l[p],y;if(g.isInterleavedBufferAttribute){let x=s(t.data,g.data);y=new fc(x,g.itemSize,g.offset,g.normalized)}else{let x=Rb(g.type,g.array),w=g.isInstancedBufferAttribute?ja:Mi;y=new w(x,g.itemSize,g.normalized)}g.name!==void 0&&(y.name=g.name),g.usage!==void 0&&y.setUsage(g.usage),g.gpuType!==void 0&&(y.gpuType=g.gpuType),o.setAttribute(p,y)}let c=t.data.morphAttributes;if(c)for(let p in c){let g=c[p],y=[];for(let x=0,w=g.length;x<w;x++){let M=g[x],A;if(M.isInterleavedBufferAttribute){let C=s(t.data,M.data);A=new fc(C,M.itemSize,M.offset,M.normalized)}else{let C=Rb(M.type,M.array);A=new Mi(C,M.itemSize,M.normalized)}M.name!==void 0&&(A.name=M.name),M.usage!==void 0&&A.setUsage(M.usage),M.gpuType!==void 0&&(A.gpuType=M.gpuType),y.push(A)}o.morphAttributes[p]=y}t.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);let h=t.data.groups||t.data.drawcalls||t.data.offsets;if(h!==void 0)for(let p=0,g=h.length;p!==g;++p){let y=h[p];o.addGroup(y.start,y.count,y.materialIndex)}let d=t.data.boundingSphere;return d!==void 0&&(o.boundingSphere=new Gs().fromJSON(d)),t.name&&(o.name=t.name),t.userData&&(o.userData=t.userData),o}},B4={},H2=class extends rs{constructor(t){super(t)}load(t,e,n,s){let r=this,o=this.path===""?Co.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||o;let a=new or(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(l){let c=null;try{c=JSON.parse(l)}catch(h){s!==void 0&&s(h),Tn("ObjectLoader: Can't parse "+t+".",h.message);return}let u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){s!==void 0&&s(new Error("THREE.ObjectLoader: Can't load "+t)),Tn("ObjectLoader: Can't load "+t);return}r.parse(c,e)},n,s)}async loadAsync(t,e){let n=this,s=this.path===""?Co.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;let r=new or(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);let o=await r.loadAsync(t,e),a;try{a=JSON.parse(o)}catch(c){throw new Error("THREE.ObjectLoader: Can't parse "+t+". "+c.message)}let l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+t);return await n.parseAsync(a)}parse(t,e){let n=this.parseAnimations(t.animations),s=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,s),o=this.parseImages(t.images,function(){e!==void 0&&e(c)}),a=this.parseTextures(t.textures,o),l=this.parseMaterials(t.materials,a),c=this.parseObject(t.object,r,l,a,n),u=this.parseSkeletons(t.skeletons,c);if(this.bindSkeletons(c,u),this.bindLightTargets(c),e!==void 0){let h=!1;for(let d in o)if(o[d].data instanceof HTMLImageElement){h=!0;break}h===!1&&e(c)}return c}async parseAsync(t){let e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),s=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),o=this.parseTextures(t.textures,r),a=this.parseMaterials(t.materials,o),l=this.parseObject(t.object,s,a,o,e),c=this.parseSkeletons(t.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}static registerGeometry(t,e){B4[t]=e}parseShapes(t){let e={};if(t!==void 0)for(let n=0,s=t.length;n<s;n++){let r=new rf().fromJSON(t[n]);e[r.uuid]=r}return e}parseSkeletons(t,e){let n={},s={};if(e.traverse(function(r){r.isBone&&(s[r.uuid]=r)}),t!==void 0)for(let r=0,o=t.length;r<o;r++){let a=new hh().fromJSON(t[r],s);n[a.uuid]=a}return n}parseGeometries(t,e){let n={};if(t!==void 0){let s=new X1;for(let r=0,o=t.length;r<o;r++){let a,l=t[r];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=s.parse(l);break;default:l.type in gQ?a=gQ[l.type].fromJSON(l,e):l.type in B4?a=B4[l.type].fromJSON(l,e):Ze(`ObjectLoader: Unknown geometry type "${l.type}". Use .registerGeometry() before starting the deserialization process.`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),n[l.uuid]=a}}return n}parseMaterials(t,e){let n={},s={};if(t!==void 0){let r=new q1;r.setTextures(e);for(let o=0,a=t.length;o<a;o++){let l=t[o];n[l.uuid]===void 0&&(n[l.uuid]=r.parse(l)),s[l.uuid]=n[l.uuid]}}return s}parseAnimations(t){let e={};if(t!==void 0)for(let n=0;n<t.length;n++){let s=t[n],r=Cl.parse(s);e[r.uuid]=r}return e}parseImages(t,e){let n=this,s={},r;function o(l){return l=n.manager.resolveURL(l),n.manager.itemStart(l),r.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){let c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return o(u)}else return l.data?{data:Rb(l.type,l.data),width:l.width,height:l.height}:null}if(t!==void 0&&t.length>0){let l=new nv(e);r=new of(l),r.setCrossOrigin(this.crossOrigin);for(let c=0,u=t.length;c<u;c++){let h=t[c],d=h.url;if(Array.isArray(d)){let p=[];for(let g=0,y=d.length;g<y;g++){let x=d[g],w=a(x);w!==null&&(w instanceof HTMLImageElement?p.push(w):p.push(new Xo(w.data,w.width,w.height)))}s[h.uuid]=new wl(p)}else{let p=a(h.url);s[h.uuid]=new wl(p)}}}return s}async parseImagesAsync(t){let e=this,n={},s;async function r(o){if(typeof o=="string"){let a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:e.resourcePath+a;return await s.loadAsync(l)}else return o.data?{data:Rb(o.type,o.data),width:o.width,height:o.height}:null}if(t!==void 0&&t.length>0){s=new of(this.manager),s.setCrossOrigin(this.crossOrigin);for(let o=0,a=t.length;o<a;o++){let l=t[o],c=l.url;if(Array.isArray(c)){let u=[];for(let h=0,d=c.length;h<d;h++){let p=c[h],g=await r(p);g!==null&&(g instanceof HTMLImageElement?u.push(g):u.push(new Xo(g.data,g.width,g.height)))}n[l.uuid]=new wl(u)}else{let u=await r(l.url);n[l.uuid]=new wl(u)}}}return n}parseTextures(t,e){function n(r,o){return typeof r=="number"?r:(Ze("ObjectLoader.parseTexture: Constant should be in numeric form.",r),o[r])}let s={};if(t!==void 0)for(let r=0,o=t.length;r<o;r++){let a=t[r];a.image===void 0&&Ze('ObjectLoader: No "image" specified for',a.uuid),e[a.image]===void 0&&Ze("ObjectLoader: Undefined image",a.image);let l=e[a.image],c=l.data,u;Array.isArray(c)?(u=new ef,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new Xo:u=new is,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=n(a.mapping,mkt)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=n(a.wrap[0],CQ),u.wrapT=n(a.wrap[1],CQ)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=n(a.minFilter,MQ)),a.magFilter!==void 0&&(u.magFilter=n(a.magFilter,MQ)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.normalized!==void 0&&(u.normalized=a.normalized),a.userData!==void 0&&(u.userData=a.userData),s[a.uuid]=u}return s}parseObject(t,e,n,s,r){let o;function a(d){return e[d]===void 0&&Ze("ObjectLoader: Undefined geometry",d),e[d]}function l(d){if(d!==void 0){if(Array.isArray(d)){let p=[];for(let g=0,y=d.length;g<y;g++){let x=d[g];n[x]===void 0&&Ze("ObjectLoader: Undefined material",x),p.push(n[x])}return p}return n[d]===void 0&&Ze("ObjectLoader: Undefined material",d),n[d]}}function c(d){return s[d]===void 0&&Ze("ObjectLoader: Undefined texture",d),s[d]}let u,h;switch(t.type){case"Scene":o=new o1,t.background!==void 0&&(Number.isInteger(t.background)?o.background=new Be(t.background):o.background=c(t.background)),t.environment!==void 0&&(o.environment=c(t.environment)),t.fog!==void 0&&(t.fog.type==="Fog"?o.fog=new r1(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(o.fog=new s1(t.fog.color,t.fog.density)),t.fog.name!==""&&(o.fog.name=t.fog.name)),t.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=t.backgroundBlurriness),t.backgroundIntensity!==void 0&&(o.backgroundIntensity=t.backgroundIntensity),t.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(t.backgroundRotation),t.environmentIntensity!==void 0&&(o.environmentIntensity=t.environmentIntensity),t.environmentRotation!==void 0&&o.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":o=new Ds(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(o.focus=t.focus),t.zoom!==void 0&&(o.zoom=t.zoom),t.filmGauge!==void 0&&(o.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(o.filmOffset=t.filmOffset),t.view!==void 0&&(o.view=Object.assign({},t.view));break;case"OrthographicCamera":o=new hu(t.left,t.right,t.top,t.bottom,t.near,t.far),t.zoom!==void 0&&(o.zoom=t.zoom),t.view!==void 0&&(o.view=Object.assign({},t.view));break;case"AmbientLight":o=new Rg(t.color,t.intensity);break;case"DirectionalLight":o=new mh(t.color,t.intensity),o.target=t.target||"";break;case"PointLight":o=new uu(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":o=new $1(t.color,t.intensity,t.width,t.height);break;case"SpotLight":o=new gh(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),o.target=t.target||"";break;case"HemisphereLight":o=new W1(t.color,t.groundColor,t.intensity);break;case"LightProbe":let d=new iv().fromArray(t.sh);o=new G1(d,t.intensity);break;case"SkinnedMesh":u=a(t.geometry),h=l(t.material),o=new uh(u,h),t.bindMode!==void 0&&(o.bindMode=t.bindMode),t.bindMatrix!==void 0&&o.bindMatrix.fromArray(t.bindMatrix),t.skeleton!==void 0&&(o.skeleton=t.skeleton);break;case"Mesh":u=a(t.geometry),h=l(t.material),o=new qi(u,h);break;case"InstancedMesh":u=a(t.geometry),h=l(t.material);let p=t.count,g=t.instanceMatrix,y=t.instanceColor;o=new _g(u,h,p),o.instanceMatrix=new ja(new Float32Array(g.array),16),y!==void 0&&(o.instanceColor=new ja(new Float32Array(y.array),y.itemSize));break;case"BatchedMesh":u=a(t.geometry),h=l(t.material),o=new u1(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,h),o.geometry=u,o.perObjectFrustumCulled=t.perObjectFrustumCulled,o.sortObjects=t.sortObjects,o._drawRanges=t.drawRanges,o._reservedRanges=t.reservedRanges,o._geometryInfo=t.geometryInfo.map(x=>{let w=null,M=null;return x.boundingBox!==void 0&&(w=new rr().fromJSON(x.boundingBox)),x.boundingSphere!==void 0&&(M=new Gs().fromJSON(x.boundingSphere)),{...x,boundingBox:w,boundingSphere:M}}),o._instanceInfo=t.instanceInfo,o._availableInstanceIds=t._availableInstanceIds,o._availableGeometryIds=t._availableGeometryIds,o._nextIndexStart=t.nextIndexStart,o._nextVertexStart=t.nextVertexStart,o._geometryCount=t.geometryCount,o._maxInstanceCount=t.maxInstanceCount,o._maxVertexCount=t.maxVertexCount,o._maxIndexCount=t.maxIndexCount,o._geometryInitialized=t.geometryInitialized,o._matricesTexture=c(t.matricesTexture.uuid),o._indirectTexture=c(t.indirectTexture.uuid),t.colorsTexture!==void 0&&(o._colorsTexture=c(t.colorsTexture.uuid)),t.boundingSphere!==void 0&&(o.boundingSphere=new Gs().fromJSON(t.boundingSphere)),t.boundingBox!==void 0&&(o.boundingBox=new rr().fromJSON(t.boundingBox));break;case"LOD":o=new l1;break;case"Line":o=new Jo(a(t.geometry),l(t.material));break;case"LineLoop":o=new Sg(a(t.geometry),l(t.material));break;case"LineSegments":o=new Wr(a(t.geometry),l(t.material));break;case"PointCloud":case"Points":o=new gc(a(t.geometry),l(t.material));break;case"Sprite":o=new a1(l(t.material));break;case"Group":o=new jr;break;case"Bone":o=new pc;break;default:o=new ai}if(o.uuid=t.uuid,t.name!==void 0&&(o.name=t.name),t.matrix!==void 0?(o.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=t.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(t.position!==void 0&&o.position.fromArray(t.position),t.rotation!==void 0&&o.rotation.fromArray(t.rotation),t.quaternion!==void 0&&o.quaternion.fromArray(t.quaternion),t.scale!==void 0&&o.scale.fromArray(t.scale)),t.up!==void 0&&o.up.fromArray(t.up),t.pivot!==void 0&&(o.pivot=new bt().fromArray(t.pivot)),t.morphTargetDictionary!==void 0&&(o.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),t.morphTargetInfluences!==void 0&&(o.morphTargetInfluences=t.morphTargetInfluences.slice()),t.castShadow!==void 0&&(o.castShadow=t.castShadow),t.receiveShadow!==void 0&&(o.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.intensity!==void 0&&(o.shadow.intensity=t.shadow.intensity),t.shadow.bias!==void 0&&(o.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(o.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(o.shadow.radius=t.shadow.radius),t.shadow.blurSamples!==void 0&&(o.shadow.blurSamples=t.shadow.blurSamples),t.shadow.focus!==void 0&&(o.shadow.focus=t.shadow.focus),t.shadow.aspect!==void 0&&(o.shadow.aspect=t.shadow.aspect),t.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(o.visible=t.visible),t.frustumCulled!==void 0&&(o.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(o.renderOrder=t.renderOrder),t.static!==void 0&&(o.static=t.static),t.userData!==void 0&&(o.userData=t.userData),t.layers!==void 0&&(o.layers.mask=t.layers),t.children!==void 0){let d=t.children;for(let p=0;p<d.length;p++)o.add(this.parseObject(d[p],e,n,s,r))}if(t.animations!==void 0){let d=t.animations;for(let p=0;p<d.length;p++){let g=d[p];o.animations.push(r[g])}}if(t.type==="LOD"){t.autoUpdate!==void 0&&(o.autoUpdate=t.autoUpdate);let d=t.levels;for(let p=0;p<d.length;p++){let g=d[p],y=o.getObjectByProperty("uuid",g.object);y!==void 0&&o.addLevel(y,g.distance,g.hysteresis)}}return o}bindSkeletons(t,e){Object.keys(e).length!==0&&t.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){let s=e[n.skeleton];s===void 0?Ze("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(s,n.bindMatrix)}})}bindLightTargets(t){t.traverse(function(e){if(e.isDirectionalLight||e.isSpotLight){let n=e.target,s=t.getObjectByProperty("uuid",n);s!==void 0?e.target=s:e.target=new ai}})}},mkt={UVMapping:i_,CubeReflectionMapping:xc,CubeRefractionMapping:bh,EquirectangularReflectionMapping:lf,EquirectangularRefractionMapping:lv,CubeUVReflectionMapping:Ig},CQ={RepeatWrapping:Ko,ClampToEdgeWrapping:pr,MirroredRepeatWrapping:Xd},MQ={NearestFilter:xs,NearestMipmapNearestFilter:cv,NearestMipmapLinearFilter:vh,LinearFilter:$i,LinearMipmapNearestFilter:cf,LinearMipmapLinearFilter:Sa},F4=new WeakMap,sv=class extends rs{constructor(t){super(t),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&Ze("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Ze("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,n,s){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let r=this,o=hc.get(`image-bitmap:${t}`);if(o!==void 0){if(r.manager.itemStart(t),o.then){o.then(c=>{F4.has(o)===!0?(s&&s(F4.get(o)),r.manager.itemError(t),r.manager.itemEnd(t)):(e&&e(c),r.manager.itemEnd(t))});return}setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0);return}let a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,a.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let l=fetch(t,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign({},r.options,{colorSpaceConversion:"none"}))}).then(function(c){return hc.add(`image-bitmap:${t}`,c),e&&e(c),r.manager.itemEnd(t),c}).catch(function(c){s&&s(c),F4.set(l,c),hc.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});hc.add(`image-bitmap:${t}`,l),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},rv=class{static getContext(){return c2===void 0&&(c2=new(window.AudioContext||window.webkitAudioContext)),c2}static setContext(t){c2=t}},j2=class extends rs{constructor(t){super(t)}load(t,e,n,s){let r=this,o=new or(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(l){try{let c=l.slice(0),u=rv.getContext(),h=t+"#decode";r.manager.itemStart(h),u.decodeAudioData(c,function(d){e(d),r.manager.itemEnd(h)}).catch(function(d){a(d),r.manager.itemEnd(h)})}catch(c){a(c)}},n,s);function a(l){s?s(l):Tn(l),r.manager.itemError(t)}}},TQ=new tn,AQ=new tn,cg=new tn,W2=class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ds,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ds,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){let e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,cg.copy(t.projectionMatrix);let s=e.eyeSep/2,r=s*e.near/e.focus,o=e.near*Math.tan(gg*e.fov*.5)/e.zoom,a,l;AQ.elements[12]=-s,TQ.elements[12]=s,a=-o*e.aspect+r,l=o*e.aspect+r,cg.elements[0]=2*e.near/(l-a),cg.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(cg),a=-o*e.aspect-r,l=o*e.aspect-r,cg.elements[0]=2*e.near/(l-a),cg.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(cg)}this.cameraL.matrix.copy(t.matrixWorld).multiply(AQ),this.cameraL.matrixWorldNeedsUpdate=!0,this.cameraR.matrix.copy(t.matrixWorld).multiply(TQ),this.cameraR.matrixWorldNeedsUpdate=!0}},Ab=-90,Eb=1,K1=class extends ai{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new Ds(Ab,Eb,t,e);s.layers=this.layers,this.add(s);let r=new Ds(Ab,Eb,t,e);r.layers=this.layers,this.add(r);let o=new Ds(Ab,Eb,t,e);o.layers=this.layers,this.add(o);let a=new Ds(Ab,Eb,t,e);a.layers=this.layers,this.add(a);let l=new Ds(Ab,Eb,t,e);l.layers=this.layers,this.add(l);let c=new Ds(Ab,Eb,t,e);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[n,s,r,o,a,l]=e;for(let c of e)this.remove(c);if(t===ya)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(t===Zd)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let c of e)this.add(c),c.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[r,o,a,l,c,u]=this.children,h=t.getRenderTarget(),d=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),g=t.xr.enabled;t.xr.enabled=!1;let y=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let x=!1;t.isWebGLRenderer===!0?x=t.state.buffers.depth.getReversed():x=t.reversedDepthBuffer,t.setRenderTarget(n,0,s),x&&t.autoClear===!1&&t.clearDepth(),t.render(e,r),t.setRenderTarget(n,1,s),x&&t.autoClear===!1&&t.clearDepth(),t.render(e,o),t.setRenderTarget(n,2,s),x&&t.autoClear===!1&&t.clearDepth(),t.render(e,a),t.setRenderTarget(n,3,s),x&&t.autoClear===!1&&t.clearDepth(),t.render(e,l),t.setRenderTarget(n,4,s),x&&t.autoClear===!1&&t.clearDepth(),t.render(e,c),n.texture.generateMipmaps=y,t.setRenderTarget(n,5,s),x&&t.autoClear===!1&&t.clearDepth(),t.render(e,u),t.setRenderTarget(h,d,p),t.xr.enabled=g,n.texture.needsPMREMUpdate=!0}},J1=class extends Ds{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}},Z1=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(t){this._document=t,t.hidden!==void 0&&(this._pageVisibilityHandler=bkt.bind(this),t.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(t){return this._timescale=t,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(t){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(t!==void 0?t:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};ug=new bt,U4=new Gi,vkt=new bt,hg=new bt,dg=new bt,$2=class extends ai{constructor(){super(),this.type="AudioListener",this.context=rv.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Z1}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t),this._timer.update();let e=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(ug,U4,vkt),hg.set(0,0,-1).applyQuaternion(U4),dg.set(0,1,0).applyQuaternion(U4),e.positionX){let n=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(ug.x,n),e.positionY.linearRampToValueAtTime(ug.y,n),e.positionZ.linearRampToValueAtTime(ug.z,n),e.forwardX.linearRampToValueAtTime(hg.x,n),e.forwardY.linearRampToValueAtTime(hg.y,n),e.forwardZ.linearRampToValueAtTime(hg.z,n),e.upX.linearRampToValueAtTime(dg.x,n),e.upY.linearRampToValueAtTime(dg.y,n),e.upZ.linearRampToValueAtTime(dg.z,n)}else e.setPosition(ug.x,ug.y,ug.z),e.setOrientation(hg.x,hg.y,hg.z,dg.x,dg.y,dg.z)}},Q1=class extends ai{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0){Ze("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Ze("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+t;let e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){Ze("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(t=0){if(this.hasPlaybackControl===!1){Ze("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(t){return t||(t=[]),this._connected===!0?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(this.hasPlaybackControl===!1){Ze("Audio: this Audio has no playback control.");return}return this.playbackRate=t,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(Ze("Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(this.hasPlaybackControl===!1){Ze("Audio: this Audio has no playback control.");return}return this.loop=t,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}copy(t,e){return super.copy(t,e),t.sourceType!=="buffer"?(Ze("Audio: Audio source type cannot be copied."),this):(this.autoplay=t.autoplay,this.buffer=t.buffer,this.detune=t.detune,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.offset=t.offset,this.duration=t.duration,this.playbackRate=t.playbackRate,this.hasPlaybackControl=t.hasPlaybackControl,this.sourceType=t.sourceType,this.filters=t.filters.slice(),this)}clone(t){return new this.constructor(this.listener).copy(this,t)}},fg=new bt,EQ=new Gi,ykt=new bt,pg=new bt,G2=class extends Q1{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(fg,EQ,ykt),pg.set(0,0,1).applyQuaternion(EQ);let e=this.panner;if(e.positionX){let n=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(fg.x,n),e.positionY.linearRampToValueAtTime(fg.y,n),e.positionZ.linearRampToValueAtTime(fg.z,n),e.orientationX.linearRampToValueAtTime(pg.x,n),e.orientationY.linearRampToValueAtTime(pg.y,n),e.orientationZ.linearRampToValueAtTime(pg.z,n)}else e.setPosition(fg.x,fg.y,fg.z),e.setOrientation(pg.x,pg.y,pg.z)}},q2=class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0,e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}},t_=class{constructor(t,e,n){this.binding=t,this.valueSize=n;let s,r,o;switch(e){case"quaternion":s=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":s=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:s=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=s,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){let n=this.buffer,s=this.valueSize,r=t*s+s,o=this.cumulativeWeight;if(o===0){for(let a=0;a!==s;++a)n[r+a]=n[a];o=e}else{o+=e;let a=e/o;this._mixBufferRegion(n,r,0,a,s)}this.cumulativeWeight=o}accumulateAdditive(t){let e=this.buffer,n=this.valueSize,s=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(e,s,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){let e=this.valueSize,n=this.buffer,s=t*e+e,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let l=e*this._origIndex;this._mixBufferRegion(n,s,l,1-r,e)}o>0&&this._mixBufferRegionAdditive(n,s,this._addIndex*e,1,e);for(let l=e,c=e+e;l!==c;++l)if(n[l]!==n[l+e]){a.setValue(n,s);break}}saveOriginalState(){let t=this.binding,e=this.buffer,n=this.valueSize,s=n*this._origIndex;t.getValue(e,s);for(let r=n,o=s;r!==o;++r)e[r]=e[s+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=this.valueSize*3;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;
vendor: 4,488 bytes, line 423
423for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,s,r){if(s>=.5)for(let o=0;o!==r;++o)t[e+o]=t[n+o]}_slerp(t,e,n,s){Gi.slerpFlat(t,e,t,e,t,n,s)}_slerpAdditive(t,e,n,s,r){let o=this._workIndex*r;Gi.multiplyQuaternionsFlat(t,o,t,e,t,n),Gi.slerpFlat(t,e,t,e,t,o,s)}_lerp(t,e,n,s,r){let o=1-s;for(let a=0;a!==r;++a){let l=e+a;t[l]=t[l]*o+t[n+a]*s}}_lerpAdditive(t,e,n,s,r){for(let o=0;o!==r;++o){let a=e+o;t[a]=t[a]+t[n+o]*s}}},jU="\\[\\]\\.:\\/",xkt=new RegExp("["+jU+"]","g"),WU="[^"+jU+"]",wkt="[^"+jU.replace("\\.","")+"]",_kt=/((?:WC+[\/:])*)/.source.replace("WC",WU),Skt=/(WCOD+)?/.source.replace("WCOD",wkt),Ckt=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",WU),Mkt=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",WU),Tkt=new RegExp("^"+_kt+Skt+Ckt+Mkt+"$"),Akt=["material","materials","bones","map"],Q4=class{constructor(t,e,n){let s=n||yi.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=n.length;s!==r;++s)n[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},yi=class i{constructor(t,e,n){this.path=e,this.parsedPath=n||i.parseTrackName(e),this.node=i.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new i.Composite(t,e,n):new i(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(xkt,"")}static parseTrackName(t){let e=Tkt.exec(t);if(e===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=n.nodeName&&n.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let r=n.nodeName.substring(s+1);Akt.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,s),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(r){for(let o=0;o<r.length;o++){let a=r[o];if(a.name===e||a.uuid===e)return a;let l=n(a.children);if(l)return l}return null},s=n(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)t[e++]=n[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}
vendor: 4,902 bytes, line 423
423_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,n=e.objectName,s=e.propertyName,r=e.propertyIndex;if(t||(t=i.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){Ze("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=e.objectIndex;switch(n){case"materials":if(!t.material){Tn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){Tn("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){Tn("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let u=0;u<t.length;u++)if(t[u].name===c){c=u;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){Tn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){Tn("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){Tn("PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(c!==void 0){if(t[c]===void 0){Tn("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}let o=t[s];if(o===void 0){let c=e.nodeName;Tn("PropertyBinding: Trying to update property for track: "+c+"."+s+" but it wasn't found.",t);return}let a=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?a=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(r!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){Tn("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){Tn("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[r]!==void 0&&(r=t.morphTargetDictionary[r])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=s;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};yi.Composite=Q4;yi.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};yi.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};yi.prototype.GetterByBindingType=[yi.prototype._getValue_direct,yi.prototype._getValue_array,yi.prototype._getValue_arrayElement,yi.prototype._getValue_toArray];yi.prototype.SetterByBindingTypeAndVersioning=[[yi.prototype._setValue_direct,yi.prototype._setValue_direct_setNeedsUpdate,yi.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[yi.prototype._setValue_array,yi.prototype._setValue_array_setNeedsUpdate,yi.prototype._setValue_array_setMatrixWorldNeedsUpdate],[yi.prototype._setValue_arrayElement,yi.prototype._setValue_arrayElement_setNeedsUpdate,yi.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[yi.prototype._setValue_fromArray,yi.prototype._setValue_fromArray_setNeedsUpdate,yi.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];Y2=class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Ha(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let t={};this._indicesByUUID=t;for(let n=0,s=arguments.length;n!==s;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){let t=this._objects,e=this._indicesByUUID,n=this._paths,s=this._parsedPaths,r=this._bindings,o=r.length,a,l=t.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){let d=arguments[u],p=d.uuid,g=e[p];if(g===void 0){g=l++,e[p]=g,t.push(d);for(let y=0,x=o;y!==x;++y)r[y].push(new yi(d,n[y],s[y]))}else if(g<c){a=t[g];let y=--c,x=t[y];e[x.uuid]=g,t[g]=x,e[p]=y,t[y]=d;for(let w=0,M=o;w!==M;++w){let A=r[w],C=A[y],R=A[g];A[g]=C,R===void 0&&(R=new yi(d,n[w],s[w])),A[y]=R}}else t[g]!==a&&Tn("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastru
423cture when reloading scenes.")}this.nCachedObjects_=c}remove(){let t=this._objects,e=this._indicesByUUID,n=this._bindings,s=n.length,r=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){let l=arguments[o],c=l.uuid,u=e[c];if(u!==void 0&&u>=r){let h=r++,d=t[h];e[d.uuid]=u,t[u]=d,e[c]=h,t[h]=l;for(let p=0,g=s;p!==g;++p){let y=n[p],x=y[h],w=y[u];y[u]=x,y[h]=w}}}this.nCachedObjects_=r}uncache(){let t=this._objects,e=this._indicesByUUID,n=this._bindings,s=n.length,r=this.nCachedObjects_,o=t.length;for(let a=0,l=arguments.length;a!==l;++a){let c=arguments[a],u=c.uuid,h=e[u];if(h!==void 0)if(delete e[u],h<r){let d=--r,p=t[d],g=--o,y=t[g];h!==d&&(e[p.uuid]=h),t[h]=p,d!==g&&(e[y.uuid]=d),t[d]=y,t.pop();for(let x=0,w=s;x!==w;++x){let M=n[x],A=M[d],C=M[g];M[h]=A,M[d]=C,M.pop()}}else{let d=--o,p=t[d];h!==d&&(e[p.uuid]=h),t[h]=p,t.pop();for(let g=0,y=s;g!==y;++g){let x=n[g];x[h]=x[d],x.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){let n=this._bindingsIndicesByPath,s=n[t],r=this._bindings;if(s!==void 0)return r[s];let o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);s=r.length,n[t]=s,o.push(t),a.push(e),r.push(h);for(let d=u,p=l.length;d!==p;++d){let g=l[d];h[d]=new yi(g,t,e)}return h}unsubscribe_(t){let e=this._bindingsIndicesByPath,n=e[t];if(n!==void 0){let s=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=s[a];e[c]=n,o[n]=l,o.pop(),r[n]=r[a],r.pop(),s[n]=s[a],s.pop()}}},e_=class{constructor(t,e,n=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=s;let r=e.tracks,o=r.length,a=new Array(o),l={endingStart:qd,endingEnd:qd};for(let c=0;c!==o;++c){let u=r[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._restoreTimeScale=null,this._weightInterpolant=null,this.loop=AU,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n=!1){if(t.fadeOut(e),this.fadeIn(e),n===!0){let s=this._clip.duration,r=t._clip.duration,o=r/s,a=s/r;t._restoreTimeScale=t.timeScale,this._restoreTimeScale=this.timeScale,t.warp(1,o,e),this.warp(a,1,e)}return this}crossFadeTo(t,e,n=!1){return t.crossFadeFrom(this,e,n)}stopFading(){let t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){let s=this._mixer,r=s.time,o=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);let l=a.parameterPositions,c=a.sampleValues;return l[0]=r,l[1]=r+n,c[0]=t/o,c[1]=e/o,this}stopWarping(){let t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this._restoreTimeScale=null,this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,s){if(!this.enabled){this._updateWeight(t);return}let r=this._startTime;if(r!==null){let l=(t-r)*n;l<0||n===0?e=0:(this._startTime=null,e=n*l)}e*=this._updateTimeScale(t);let o=this._updateTime(e),a=this._updateWeight(t);if(a>0){let l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Hk:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case z_:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(s,a)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let n=this._weightInterpolant;if(n!==null){let s=n.evaluate(t)[0];e*=s,t>n.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let s=n.evaluate(t)[0];e*=s,t>n.parameterPositions[1]&&(e===0?this.paused=!0:(this._restoreTimeScale!==null&&(e=this._restoreTimeScale),this.timeScale=e),this.stopWarping())}}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,n=this.loop,s=this.time+t,r=this._loopCount,o=n===EU;if(t===0)return r===-1?s:o&&(r&1)===1?e-s:s;if(n===TU){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(s>=e)s=e;else if(s<0)s=0;else{this.time=s;break t}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(r===-1&&(t>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),s>=e||s<0){let a=Math.floor(s/e);s-=e*a,r+=Math.abs(a);let l=this.repetitions-r;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(l===1){let c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this._loopCount=r,this.time=s;if(o&&(r&1)===1)return e-s}return s}_setEndings(t,e,n){let s=this._interpolantSettings;n?(s.endingStart=Yd,s.endingEnd=Yd):(t?s.endingStart=this.zeroSlopeAtStart?Yd:qd:s.endingStart=Lb,e?s.endingEnd=this.zeroSlopeAtEnd?Yd:qd:s.endingEnd=Lb)}_scheduleFading(t,e,n){let s=this._mixer,r=s.time,o=this._weightInterpolant;o===null&&(o=s._lendControlInterpolant(),this._weightInterpolant=o);let a=o.parameterPositions,l=o.sampleValues;return a[0]=r,l[0]=e,a[1]=r+t,l[1]=n,this}},Ekt=new Float32Array(1),X2=class extends wa{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(t,e){let n=t._localRoot||this._root,s=t._clip.tracks,r=s.length,o=t._propertyBindings,a=t._interpolants,l=n.uuid,c=this._bindingsByRootAndName,u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==r;++h){let d=s[h],p=d.name,g=u[p];if(g!==void 0)++g.referenceCount,o[h]=g;else{if(g=o[h],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,l,p));continue}let y=e&&e._propertyBindings[h].binding.parsedPath;g=new t_(yi.create(n,p,y),d.ValueTypeName,d.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,l,p),o[h]=g}a[h].resultBuffer=g.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){let n=(t._localRoot||this._root).uuid,s=t._clip.uuid,r
vendor: 3,572 bytes, line 423
423=this._actionsByClip[s];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,s,n)}let e=t._propertyBindings;for(let n=0,s=e.length;n!==s;++n){let r=e[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let n=0,s=e.length;n!==s;++n){let r=e[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return e!==null&&e<this._nActiveActions}_addInactiveAction(t,e,n){let s=this._actions,r=this._actionsByClip,o=r[e];if(o===void 0)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o;else{let a=o.knownActions;t._byClipCacheIndex=a.length,a.push(t)}t._cacheIndex=s.length,s.push(t),o.actionByRoot[n]=t}_removeInactiveAction(t){let e=this._actions,n=e[e.length-1],s=t._cacheIndex;n._cacheIndex=s,e[s]=n,e.pop(),t._cacheIndex=null;let r=t._clip.uuid,o=this._actionsByClip,a=o[r],l=a.knownActions,c=l[l.length-1],u=t._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),t._byClipCacheIndex=null;let h=a.actionByRoot,d=(t._localRoot||this._root).uuid;delete h[d],l.length===0&&delete o[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){let e=t._propertyBindings;for(let n=0,s=e.length;n!==s;++n){let r=e[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(t){let e=this._actions,n=t._cacheIndex,s=this._nActiveActions++,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){let e=this._actions,n=t._cacheIndex,s=--this._nActiveActions,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){let s=this._bindingsByRootAndName,r=this._bindings,o=s[e];o===void 0&&(o={},s[e]=o),o[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){let e=this._bindings,n=t.binding,s=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[s],l=e[e.length-1],c=t._cacheIndex;l._cacheIndex=c,e[c]=l,e.pop(),delete a[r],Object.keys(a).length===0&&delete o[s]}_lendBinding(t){let e=this._bindings,n=t._cacheIndex,s=this._nActiveBindings++,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){let e=this._bindings,n=t._cacheIndex,s=--this._nActiveBindings,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){let t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return n===void 0&&(n=new tv(new Float32Array(2),new Float32Array(2),1,Ekt),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){let e=this._controlInterpolants,n=t.__cacheIndex,s=--this._nActiveControlInterpolants,r=e[s];t.__cacheIndex=s,e[s]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){let s=e||this._root,r=s.uuid,o=typeof t=="string"?Cl.findByName(s,t):t,a=o!==null?o.uuid:t,l=this._actionsByClip[a],c=null;if(n===void 0&&(o!==null?n=o.blendMode:n=z_),l!==void 0){let h=l.actionByRoot[r];if(h!==void 0&&h.blendMode===n)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;
vendor: 18,804 bytes, line 423
423let u=new e_(this,o,e,n);return this._bindAction(u,c),this._addInactiveAction(u,a,r),u}existingAction(t,e){let n=e||this._root,s=n.uuid,r=typeof t=="string"?Cl.findByName(n,t):t,o=r?r.uuid:t,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[s]||null}stopAllAction(){let t=this._actions,e=this._nActiveActions;for(let n=e-1;n>=0;--n)t[n].stop();return this}update(t){t*=this.timeScale;let e=this._actions,n=this._nActiveActions,s=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1;for(let c=0;c!==n;++c)e[c]._update(s,t,r,o);let a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){let e=this._actions,n=t.uuid,s=this._actionsByClip,r=s[n];if(r!==void 0){let o=r.knownActions;for(let a=0,l=o.length;a!==l;++a){let c=o[a];this._deactivateAction(c);let u=c._cacheIndex,h=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,e[u]=h,e.pop(),this._removeInactiveBindingsForAction(c)}delete s[n]}}uncacheRoot(t){let e=t.uuid,n=this._actionsByClip;for(let o in n){let a=n[o].actionByRoot,l=a[e];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}let s=this._bindingsByRootAndName,r=s[e];if(r!==void 0)for(let o in r){let a=r[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(t,e){let n=this.existingAction(t,e);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}},K2=class extends Bb{constructor(t=1,e=1,n=1,s={}){super(t,e,s),this.isRenderTarget3D=!0,this.depth=n;for(let r=0;r<this.textures.length;r++){let o=new yg(null,t,e,n);o.isRenderTargetTexture=!0,o.renderTarget=this,this.textures[r]=o}this._setTextureOptions(s)}},J2=class i{constructor(t){this.value=t}clone(){return new i(this.value.clone===void 0?this.value:this.value.clone())}},kkt=0,Z2=class extends wa{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:kkt++}),this.name="",this.usage=j_,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){let e=this.uniforms.indexOf(t);return e!==-1&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(t){this.name=t.name,this.usage=t.usage;let e=t.uniforms;this.uniforms.length=0;for(let n=0,s=e.length;n<s;n++){let r=Array.isArray(e[n])?e[n]:[e[n]];for(let o=0;o<r.length;o++)this.uniforms.push(r[o].clone())}return this}clone(){return new this.constructor().copy(this)}},Q2=class extends ru{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){let e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){let e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}},tk=class{constructor(t,e,n,s,r,o=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=s,this.count=r,this.normalized=o,this.version=0}set needsUpdate(t){t===!0&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}},kQ=new tn,ek=class{constructor(t,e,n=0,s=1/0){this.ray=new ch(t,e),this.near=n,this.far=s,this.camera=null,this.layers=new xg,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,e.projectionMatrix.elements[14]).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):Tn("Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return kQ.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(kQ),this}intersectObject(t,e=!0,n=[]){return tU(t,this,n,e),n.sort(PQ),n}intersectObjects(t,e=!0,n=[]){for(let s=0,r=t.length;s<r;s++)tU(t[s],this,n,e);return n.sort(PQ),n}};nk=class{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,Ze("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}},ik=class{constructor(t=1,e=0,n=0){this.radius=t,this.phi=e,this.theta=n}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Bn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Bn(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},sk=class{constructor(t=1,e=0,n=0){this.radius=t,this.theta=e,this.y=n}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return new this.constructor().copy(this)}},rk=class i{static{i.prototype.isMatrix2=!0}constructor(t,e,n,s){this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,s)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,s){let r=this.elements;return r[0]=t,r[2]=e,r[1]=n,r[3]=s,this}},RQ=new Ce,n_=class{constructor(t=new Ce(1/0,1/0),e=new Ce(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=RQ.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,RQ).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},DQ=new bt,u2=new bt,kb=new bt,Pb=new bt,z4=new bt,Pkt=new bt,Rkt=new bt,ok=class{constructor(t=new bt,e=new bt){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){DQ.subVectors(t,this.start),u2.subVectors(this.end,this.start);let n=u2.dot(u2);if(n===0)return 0;let r=u2.dot(DQ)/n;return e&&(r=Bn(r,0,1)),r}closestPointToPoint(t,e,n){let s=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=Pkt,n=Rkt){let s=10000000000000001e-32,r,o,a=this.start,l=t.start,c=this.end,u=t.end;kb.subVectors(c,a),Pb.subVectors(u,l),z4.subVectors(a,l);let h=kb.dot(kb),d=Pb.dot(Pb),p=Pb.dot(z4);if(h<=s&&d<=s)return e.copy(a),n.copy(l),e.sub(n),e.dot(e);if(h<=s)r=0,o=p/d,o=Bn(o,0,1);else{let g=kb.dot(z4);if(d<=s)o=0,r=Bn(-g/h,0,1);else{let y=kb.dot(Pb),x=h*d-y*y;x!==0?r=Bn((y*p-g*d)/x,0,1):r=0,o=(y*r+p)/d,o<0?(o=0,r=Bn(-g/h,0,1)):o>1&&(o=1,r=Bn((y-g)/h,0,1))}}return e.copy(a).addScaledVector(kb,r),n.copy(l).addScaledVector(Pb,o),e.distanceToSquared(n)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},LQ=new bt,ak=class extends ai{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";let n=new kn,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){let c=o/l*Math.PI*2,u=a/l*Math.PI*2;s.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new Ge(s,3));let r=new fs({fog:!1,toneMapped:!1});this.cone=new Wr(n,r),this.add(this.cone),this.update()}dispose(){super.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorldNeedsUpdate=!0;let t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),LQ.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(LQ),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Gd=new bt,h2=new tn,V4=new tn,lk=class extends Wr{constructor(t){let e=Wtt(t),n=new kn,s=[],r=[];for(let c=0;c<e.length;c++){let u=e[c];u.parent&&u.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),r.push(0,0,0),r.push(0,0,0))}n.setAttribute("position",new Ge(s,3)),n.setAttribute("color",new Ge(r,3));let o=new fs({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,o),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;let a=new Be(255),l=new Be(65280);this.setColors(a,l)}updateMatrixWorld(t){let e=this.bones,n=this.geometry,s=n.getAttribute("position");V4.copy(this.root.matrixWorld).invert();for(let r=0,o=0;r<e.length;r++){let a=e[r];a.parent&&a.parent.isBone&&(h2.multiplyMatrices(V4,a.matrixWorld),Gd.setFromMatrixPosition(h2),s.setXYZ(o,Gd.x,Gd.y,Gd.z),h2.multiplyMatrices(V4,a.parent.matrixWorld),Gd.setFromMatrixPosition(h2),s.setXYZ(o+1,Gd.x,Gd.y,Gd.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}setColors(t,e){let s=this.geometry.getAttribute("color");for(let r=0;r<s.count;r+=2)s.setXYZ(r,t.r,t.g,t.b),s.setXYZ(r+1,e.r,e.g,e.b);return s.needsUpdate=!0,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}};ck=class extends qi{constructor(t,e,n){let s=new Kb(e,4,2),r=new io({wireframe:!0,fog:!1,toneMapped:!1});super(s,r),this.light=t,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}update(){this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},Dkt=new bt,IQ=new Be,OQ=new Be,uk=class extends ai{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";let s=new Xb(e);s.rotateY(Math.PI*.5),this.material=new io({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);let r=s.getAttribute("position"),o=new Float32Array(r.count*3);s.setAttribute("color",new Mi(o,3)),this.add(new qi(s,this.material)),this.update()}dispose(){super.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let t=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{let e=t.geometry.getAttribute("color");IQ.copy(this.light.color),OQ.copy(this.light.groundColor);for(let n=0,s=e.count;n<s;n++){let r=n<s/2?IQ:OQ;e.setXYZ(n,r.r,r.g,r.b)}e.needsUpdate=!0}this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),t.lookAt(Dkt.setFromMatrixPosition(this.light.matrixWorld).negate())}},hk=class extends Wr{constructor(t=10,e=10,n=4473924,s=8947848){n=new Be(n),s=new Be(s);let r=e/2,o=t/e,a=t/2,l=[],c=[];for(let d=0,p=0,g=-a;d<=e;d++,g+=o){l.push(-a,0,g,a,0,g),l.push(g,0,-a,g,0,a);let y=d===r?n:s;y.toArray(c,p),p+=3,y.toArray(c,p),p+=3,y.toArray(c,p),p+=3,y.toArray(c,p),p+=3}let u=new kn;u.setAttribute("position",new Ge(l,3)),u.setAttribute("color",new Ge(c,3));let h=new fs({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}},dk=class extends Wr{constructor(t=10,e=16,n=8,s=64,r=4473924,o=8947848){r=new Be(r),o=new Be(o);let a=[],l=[];if(e>1)for(let h=0;h<e;h++){let d=h/e*(Math.PI*2),p=Math.sin(d)*t,g=Math.cos(d)*t;a.push(0,0,0),a.push(p,0,g);let y=h&1?r:o;l.push(y.r,y.g,y.b),l.push(y.r,y.g,y.b)}for(let h=0;h<n;h++){let d=h&1?r:o,p=t-t/n*h;for(let g=0;g<s;g++){let y=g/s*(Math.PI*2),x=Math.sin(y)*p,w=Math.cos(y)*p;a.push(x,0,w),l.push(d.r,d.g,d.b),y=(g+1)/s*(Math.PI*2),x=Math.sin(y)*p,w=Math.cos(y)*p,a.push(x,0,w),l.push(d.r,d.g,d.b)}}let c=new kn;c.setAttribute("position",new Ge(a,3)),c.setAttribute("color",new Ge(l,3));let u=new fs({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}},NQ=new bt,d2=new bt,BQ=new bt,fk=class extends ai{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",e===void 0&&(e=1);let s=new kn;s.setAttribute("position",new Ge([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));let r=new fs({fog:!1,toneMapped:!1});this.lightPlane=new Jo(s,r),this.add(this.lightPlane),s=new kn,s.setAttribute("position",new Ge([0,0,0,0,0,1],3)),this.targetLine=new Jo(s,r),this.add(this.targetLine),this.update()}dispose(){super.dispose(),this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),NQ.setFromMatrixPosition(this.light.matrixWorld),d2.setFromMatrixPosition(this.light.target.matrixWorld),BQ.subVectors(d2,NQ),this.lightPlane.lookAt(d2),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(d2),this.targetLine.scale.z=BQ.length()}},f2=new bt,$s=new Pg,pk=class extends Wr{constructor(t){let e=new kn,n=new fs({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],r=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(g,y){l(g),l(y)}function l(g){s.push(0,0,0),r.push(0,0,0),o[g]===void 0&&(o[g]=[]),o[g].push(s.length/3-1)}e.setAttribute("position",new Ge(s,3)),e.setAttribute("color",new Ge(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();let c=new Be(16755200),u=new Be(16711680),h=new Be(43775),d=new Be(16777215),p=new Be(3355443);this.setColors(c,u,h,d,p)}setColors(t,e,n,s,r){let a=this.geometry.getAttribute("color");return a.setXYZ(0,t.r,t.g,t.b),a.setXYZ(1,t.r,t.g,t.b),a.setXYZ(2,t.r,t.g,t.b),a.setXYZ(3,t.r,t.g,t.b),a.setXYZ(4,t.r,t.g,t.b),a.setXYZ(5,t.r,t.g,t.b),a.setXYZ(6,t.r,t.g,t.b),a.setXYZ(7,t.r,t.g,t.b),a.setXYZ(8,t.r,t.g,t.b),a.setXYZ(9,t.r,t.g,t.b),a.setXYZ(10,t.r,t.g,t.b),a.setXYZ(11,t.r,t.g,t.b),a.setXYZ(12,t.r,t.g,t.b),a.setXYZ(13,t.r,t.g,t.b),a.setXYZ(14,t.r,t.g,t.b),a.setXYZ(15,t.r,t.g,t.b),a.setXYZ(16,t.r,t.g,t.b),a.setXYZ(17,t.r,t.g,t.b),a.setXYZ(18,t.r,t.g,t.b),a.setXYZ(19,t.r,t.g,t.b),a.setXYZ(20,t.r,t.g,t.b),a.setXYZ(21,t.r,t.g,t.b),a.setXYZ(22,t.r,t.g,t.b),a.setXYZ(23,t.r,t.g,t.b),a.setXYZ(24,e.r,e.g,e.b),a.setXYZ(25,e.r,e.g,e.b),a.setXYZ(26,e.r,e.g,e.b),a.setXYZ(27,e.r,e.g,e.b),a.setXYZ(28,e.r,e.g,e.b),a.setXYZ(29,e.r,e.g,e.b),a.setXYZ(30,e.r,e.g,e.b),a.setXYZ(31,e.r,e.g,e.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,s.r,s.g,s.b),a.setXYZ(39,s.r,s.g,s.b),a.setXYZ(40,r.r,r.g,r.b),a.setXYZ(41,r.r,r.g,r.b),a.setXYZ(42,r.r,r.g,r.b),a.setXYZ(43,r.r,r.g,r.b),a.setXYZ(44,r.r,r.g,r.b),a.setXYZ(45,r.r,r.g,r.b),a.setXYZ(46,r.r,r.g,r.b),a.setXYZ(47,r.r,r.g,r.b),a.setXYZ(48,r.r,r.g,r.b),a.setXYZ(49,r.r,r.g,r.b),a.needsUpdate=!0,this}update(){let t=this.geometry,e=this.pointMap,n=1,s=1,r,o;if($s.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)r=1,o=0;else if(this.camera.coordinateSystem===ya)r=-1,o=1;else if(this.camera.coordinateSystem===Zd)r=0,o=1;
423else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);sr("c",e,t,$s,0,0,r),sr("t",e,t,$s,0,0,o),sr("n1",e,t,$s,-n,-s,r),sr("n2",e,t,$s,n,-s,r),sr("n3",e,t,$s,-n,s,r),sr("n4",e,t,$s,n,s,r),sr("f1",e,t,$s,-n,-s,o),sr("f2",e,t,$s,n,-s,o),sr("f3",e,t,$s,-n,s,o),sr("f4",e,t,$s,n,s,o),sr("u1",e,t,$s,n*.7,s*1.1,r),sr("u2",e,t,$s,-n*.7,s*1.1,r),sr("u3",e,t,$s,0,s*2,r),sr("cf1",e,t,$s,-n,0,o),sr("cf2",e,t,$s,n,0,o),sr("cf3",e,t,$s,0,-s,o),sr("cf4",e,t,$s,0,s,o),sr("cn1",e,t,$s,-n,0,r),sr("cn2",e,t,$s,n,0,r),sr("cn3",e,t,$s,0,-s,r),sr("cn4",e,t,$s,0,s,r),t.getAttribute("position").needsUpdate=!0}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}};p2=new rr,gk=class extends Wr{constructor(t,e=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=new Float32Array(24),r=new kn;r.setIndex(new Mi(n,1)),r.setAttribute("position",new Mi(s,3)),super(r,new fs({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&p2.setFromObject(this.object),p2.isEmpty())return;let t=p2.min,e=p2.max,n=this.geometry.attributes.position,s=n.array;s[0]=e.x,s[1]=e.y,s[2]=e.z,s[3]=t.x,s[4]=e.y,s[5]=e.z,s[6]=t.x,s[7]=t.y,s[8]=e.z,s[9]=e.x,s[10]=t.y,s[11]=e.z,s[12]=e.x,s[13]=e.y,s[14]=t.z,s[15]=t.x,s[16]=e.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=e.x,s[22]=t.y,s[23]=t.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}},mk=class extends Wr{constructor(t,e=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new kn;r.setIndex(new Mi(n,1)),r.setAttribute("position",new Ge(s,3)),super(r,new fs({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){let e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}},bk=class extends Jo{constructor(t,e=1,n=16776960){let s=n,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new kn;o.setAttribute("position",new Ge(r,3)),o.computeBoundingSphere(),super(o,new fs({color:s,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;let a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new kn;l.setAttribute("position",new Ge(a,3)),l.computeBoundingSphere(),this.add(new qi(l,new io({color:s,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},FQ=new bt,vk=class extends ai{constructor(t=new bt(0,0,1),e=new bt(0,0,0),n=1,s=16776960,r=n*.2,o=r*.2){super(),this.type="ArrowHelper",g2===void 0&&(g2=new kn,g2.setAttribute("position",new Ge([0,0,0,0,1,0],3)),H4=new Hb(.5,1,5,1),H4.translate(0,-.5,0)),this.position.copy(e),this.line=new Jo(g2,new fs({color:s,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new qi(H4,new io({color:s,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,o)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{FQ.set(t.z,0,-t.x).normalize();let e=Math.acos(t.y);this.quaternion.setFromAxisAngle(FQ,e)}}setLength(t,e=t*.2,n=e*.2){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){super.dispose(),this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},yk=class extends Wr{constructor(t=1){let e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new kn;s.setAttribute("position",new Ge(e,3)),s.setAttribute("color",new Ge(n,3));let r=new fs({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(t,e,n){let s=new Be,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(n),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}},xk=class{constructor(){this.type="ShapePath",this.color=new Be,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(t,e){return this.currentPath=new sf,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,s){return this.currentPath.quadraticCurveTo(t,e,n,s),this}bezierCurveTo(t,e,n,s,r,o){return this.currentPath.bezierCurveTo(t,e,n,s,r,o),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(){function t(l,c){let u=!1,h=c.length;for(let d=0,p=h-1;d<h;p=d++){let g=c[d],y=c[p];g.y>l.y!=y.y>l.y&&l.x<(y.x-g.x)*(l.y-g.y)/(y.y-g.y)+g.x&&(u=!u)}return u}function e(l,c){let u=c.getCenter(new Ce);if(t(u,l))return u;let h=u.y,d=[],p=l.length;for(let g=0;g<p;g++){let y=l[g],x=l[(g+1)%p];if(y.y>h!=x.y>h){let w=y.x+(h-y.y)*(x.x-y.x)/(x.y-y.y);d.push(w)}}return d.length>1&&(d.sort((g,y)=>g-y),u.x=(d[0]+d[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(Ze('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let s=n==="nonzero"?(l=>l!==0):(l=>
423(l&1)!==0),r=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=xa.area(c);if(u===0)continue;let h=new n_;for(let d=0;d<c.length;d++)h.expandByPoint(c[d]);r.push({subPath:l,points:c,boundingBox:h,interiorPoint:e(c,h),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}r.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<r.length;l++){let c=r[l],u=0;for(let h=l-1;h>=0;h--){let d=r[h];if(d.boundingBox.containsBox(c.boundingBox)&&t(c.interiorPoint,d.points)){c.container=d.exclude?d.container:d,u=d.winding,c.winding+=u;break}}s(c.winding)===s(u)&&(c.exclude=!0)}for(let l of r)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of r){if(l.exclude||l.role!=="outer")continue;let c=new rf;c.curves=l.subPath.curves,o.push(c),a.set(l,c)}for(let l of r){if(l.exclude||l.role!=="hole")continue;let c=a.get(l.container);if(!c)continue;let u=new sf;u.curves=l.subPath.curves,c.holes.push(u)}return o}},wk=class extends wa{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(t){this.domElement!==null&&this.disconnect(),this.domElement=t}disconnect(){}dispose(){}update(){}};_k=class{static contain(t,e){return Lkt(t,e)}static cover(t,e){return Ikt(t,e)}static fill(t){return Okt(t)}static getByteLength(t,e,n,s){return $k(t,e,n,s)}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"186"}}));typeof window<"u"&&(window.__THREE__?Ze("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="186")});var wet={};Le(wet,{ACESFilmicToneMapping:()=>Dk,AddEquation:()=>af,AddOperation:()=>CU,AdditiveAnimationBlendMode:()=>Hk,AdditiveBlending:()=>Ck,AgXToneMapping:()=>Ik,AlphaFormat:()=>zk,AlwaysCompare:()=>BU,AlwaysDepth:()=>Jw,AlwaysStencilFunc:()=>RU,AmbientLight:()=>Rg,AnimationAction:()=>e_,AnimationClip:()=>Cl,AnimationLoader:()=>F2,AnimationMixer:()=>X2,AnimationObjectGroup:()=>Y2,AnimationUtils:()=>B2,ArcCurve:()=>b1,ArrayCamera:()=>J1,ArrowHelper:()=>vk,AttachedBindMode:()=>m2,Audio:()=>Q1,AudioAnalyser:()=>q2,AudioContext:()=>rv,AudioListener:()=>$2,AudioLoader:()=>j2,AxesHelper:()=>yk,BackSide:()=>Mo,BasicDepthPacking:()=>kU,BasicShadowMap:()=>HQ,BatchedMesh:()=>u1,BezierInterpolant:()=>H1,Bone:()=>pc,BooleanKeyframeTrack:()=>au,Box2:()=>n_,Box3:()=>rr,Box3Helper:()=>mk,BoxGeometry:()=>nf,BoxHelper:()=>gk,BufferAttribute:()=>Mi,BufferGeometry:()=>kn,BufferGeometryLoader:()=>X1,ByteType:()=>Nk,Cache:()=>hc,Camera:()=>Pg,CameraHelper:()=>pk,CanvasTexture:()=>I2,CapsuleGeometry:()=>f1,CatmullRomCurve3:()=>v1,CineonToneMapping:()=>Rk,CircleGeometry:()=>p1,ClampToEdgeWrapping:()=>pr,Clock:()=>nk,Color:()=>Be,ColorKeyframeTrack:()=>ev,ColorManagement:()=>Rn,Compatibility:()=>Att,CompressedArrayTexture:()=>D2,CompressedCubeTexture:()=>L2,CompressedTexture:()=>Cg,CompressedTextureLoader:()=>U2,ConeGeometry:()=>Hb,ConstantAlphaFactor:()=>wU,ConstantColorFactor:()=>yU,Controls:()=>wk,CubeCamera:()=>K1,CubeDepthTexture:()=>d1,CubeReflectionMapping:()=>xc,CubeRefractionMapping:()=>bh,CubeTexture:()=>ef,CubeTextureLoader:()=>z2,CubeUVReflectionMapping:()=>Ig,CubicBezierCurve:()=>jb,CubicBezierCurve3:()=>y1,CubicInterpolant:()=>z1,CullFaceBack:()=>Sk,CullFaceFront:()=>iU,CullFaceFrontBack:()=>VQ,CullFaceNone:()=>nU,Curve:()=>_o,CurvePath:()=>w1,CustomBlending:()=>rU,CustomToneMapping:()=>Lk,CylinderGeometry:()=>Vb,Cylindrical:()=>sk,Data3DTexture:()=>yg,DataArrayTexture:()=>vg,DataTexture:()=>Xo,DataTextureLoader:()=>V2,DataUtils:()=>w2,DecrementStencilOp:()=>stt,DecrementWrapStencilOp:()=>ott,DefaultLoadingManager:()=>W_,DepthFormat:()=>dc,DepthStencilFormat:()=>yh,DepthTexture:()=>dh,DetachedBindMode:()=>MU,DirectionalLight:()=>mh,DirectionalLightHelper:()=>fk,DiscreteInterpolant:()=>V1,DodecahedronGeometry:()=>g1,DoubleSide:()=>Ga,DstAlphaFactor:()=>pU,DstColorFactor:()=>mU,DynamicCopyUsage:()=>wtt,DynamicDrawUsage:()=>gtt,DynamicReadUsage:()=>vtt,EdgesGeometry:()=>m1,EllipseCurve:()=>Mg,EqualCompare:()=>IU,EqualDepth:()=>Qw,EqualStencilFunc:()=>utt,EquirectangularReflectionMapping:()=>lf,EquirectangularRefractionMapping:()=>lv,Euler:()=>gr,EventDispatcher:()=>wa,ExternalTexture:()=>zb,ExtrudeGeometry:()=>M1,FileLoader:()=>or,Float16BufferAttribute:()=>A2,Float32BufferAttribute:()=>Ge,FloatType:()=>yo,Fog:()=>r1,FogExp2:()=>s1,FramebufferTexture:()=>R2,FrontSide:()=>$a,Frustum:()=>
423ou,FrustumArray:()=>c1,GLBufferAttribute:()=>tk,GLSL1:()=>Stt,GLSL3:()=>Wk,GreaterCompare:()=>OU,GreaterDepth:()=>e1,GreaterEqualCompare:()=>H_,GreaterEqualDepth:()=>t1,GreaterEqualStencilFunc:()=>ptt,GreaterStencilFunc:()=>dtt,GridHelper:()=>hk,Group:()=>jr,HTMLTexture:()=>O2,HalfFloatType:()=>Tl,HemisphereLight:()=>W1,HemisphereLightHelper:()=>uk,IcosahedronGeometry:()=>T1,ImageBitmapLoader:()=>sv,ImageLoader:()=>of,ImageUtils:()=>i1,IncrementStencilOp:()=>itt,IncrementWrapStencilOp:()=>rtt,InstancedBufferAttribute:()=>ja,InstancedBufferGeometry:()=>Y1,InstancedInterleavedBuffer:()=>Q2,InstancedMesh:()=>_g,Int16BufferAttribute:()=>M2,Int32BufferAttribute:()=>T2,Int8BufferAttribute:()=>_2,IntType:()=>s_,InterleavedBuffer:()=>ru,InterleavedBufferAttribute:()=>fc,Interpolant:()=>mc,InterpolateBezier:()=>b2,InterpolateDiscrete:()=>Kd,InterpolateLinear:()=>Jd,InterpolateSmooth:()=>Ww,InterpolationSamplingMode:()=>Ttt,InterpolationSamplingType:()=>Mtt,InvertStencilOp:()=>att,KeepStencilOp:()=>$w,KeyframeTrack:()=>Qo,LOD:()=>l1,LatheGeometry:()=>A1,Layers:()=>xg,LessCompare:()=>LU,LessDepth:()=>Zw,LessEqualCompare:()=>V_,LessEqualDepth:()=>mg,LessEqualStencilFunc:()=>htt,LessStencilFunc:()=>ctt,Light:()=>vc,LightProbe:()=>G1,LightShadow:()=>kg,Line:()=>Jo,Line3:()=>ok,LineBasicMaterial:()=>fs,LineCurve:()=>Wb,LineCurve3:()=>x1,LineDashedMaterial:()=>U1,LineLoop:()=>Sg,LineSegments:()=>Wr,LinearFilter:()=>$i,LinearInterpolant:()=>tv,LinearMipMapLinearFilter:()=>qQ,LinearMipMapNearestFilter:()=>GQ,LinearMipmapLinearFilter:()=>Sa,LinearMipmapNearestFilter:()=>cf,LinearSRGBColorSpace:()=>wo,LinearToneMapping:()=>kk,LinearTransfer:()=>Ib,Loader:()=>rs,LoaderUtils:()=>Co,LoadingManager:()=>nv,LoopOnce:()=>TU,LoopPingPong:()=>EU,LoopRepeat:()=>AU,MOUSE:()=>UQ,Material:()=>ss,MaterialBlending:()=>jQ,MaterialLoader:()=>q1,MathUtils:()=>mr,Matrix2:()=>rk,Matrix3:()=>Vn,Matrix4:()=>tn,MaxEquation:()=>cU,Mesh:()=>qi,MeshBasicMaterial:()=>io,MeshDepthMaterial:()=>Zb,MeshDistanceMaterial:()=>Qb,MeshLambertMaterial:()=>Eg,MeshMatcapMaterial:()=>F1,MeshNormalMaterial:()=>B1,MeshPhongMaterial:()=>_a,MeshPhysicalMaterial:()=>So,MeshStandardMaterial:()=>ph,MeshToonMaterial:()=>N1,MinEquation:()=>lU,MirroredRepeatWrapping:()=>Xd,MixOperation:()=>SU,MultiplyBlending:()=>Tk,MultiplyOperation:()=>av,NearestFilter:()=>xs,NearestMipMapLinearFilter:()=>$Q,NearestMipMapNearestFilter:()=>WQ,NearestMipmapLinearFilter:()=>vh,NearestMipmapNearestFilter:()=>cv,NeutralToneMapping:()=>Ok,NeverCompare:()=>DU,NeverDepth:()=>Kw,NeverStencilFunc:()=>ltt,NoBlending:()=>yc,NoColorSpace:()=>fu,NoNormalPacking:()=>ZQ,NoToneMapping:()=>Ml,NormalAnimationBlendMode:()=>z_,NormalBlending:()=>Lg,NormalGAPacking:()=>ttt,NormalRGPacking:()=>QQ,NotEqualCompare:()=>NU,NotEqualDepth:()=>n1,NotEqualStencilFunc:()=>ftt,NumberKeyframeTrack:()=>_l,Object3D:()=>ai,ObjectLoader:()=>H2,ObjectSpaceNormalMap:()=>PU,OctahedronGeometry:()=>Xb,OneFactor:()=>hU,OneMinusConstantAlphaFactor:()=>_U,OneMinusConstantColorFactor:()=>xU,OneMinusDstAlphaFactor:()=>gU,OneMinusDstColorFactor:()=>bU,OneMinusSrcAlphaFactor:()=>Ek,OneMinusSrcColorFactor:()=>fU,OrthographicCamera:()=>hu,PCFShadowMap:()=>ov,PCFSoftShadowMap:()=>sU,PMREMGenerator:()=>Y_,Path:()=>sf,PerspectiveCamera:()=>Ds,Plane:()=>xl,PlaneGeometry:()=>Ag,PlaneHelper:()=>bk,PointLight:()=>uu,PointLightHelper:()=>ck,Points:()=>gc,PointsMaterial:()=>Wa,PolarGridHelper:()=>dk,PolyhedronGeometry:()=>fh,PositionalAudio:()=>G2,PropertyBinding:()=>yi,PropertyMixer:()=>t_,QuadraticBezierCurve:()=>$b,QuadraticBezierCurve3:()=>Gb,Quaternion:()=>Gi,QuaternionKeyframeTrack:()=>Sl,QuaternionLinearInterpolant:()=>j1,R11_EAC_Format:()=>b_,RED_GREEN_RGTC2_Format:()=>mv,RED_RGTC1_Format:()=>B_,REVISION:()=>eU,RG11_EAC_Format:()=>gv,RGBADepthPacking:()=>XQ,RGBAFormat:()=>xo,RGBAIntegerFormat:()=>c_,RGBA_ASTC_10x10_Format:()=>R_,RGBA_ASTC_10x5_Format:()=>E_,RGBA_ASTC_10x6_Format:()=>k_,RGBA_ASTC_10x8_Format:()=>P_,RGBA_ASTC_12x10_Format:()=>D_,RGBA_ASTC_12x12_Format:()=>L_,RGBA_ASTC_4x4_Format:()=>x_,RGBA_ASTC_5x4_Format:()=>w_,RGBA_ASTC_5x5_Format:()=>__,RGBA_ASTC_6x5_Format:()=>S_,RGBA_ASTC_6x6_Format:()=>C_,RGBA_ASTC_8x5_Format:()=>M_,RGBA_ASTC_8x6_Format:()=>T_,RGBA_ASTC_8x8_Format:()=>A_,RGBA_BPTC_Format:()=>I_,RGBA_ETC2_EAC_Format:()=>m_,RGBA_PVRTC_2BPPV1_Format:()=>f_,RGBA_PVRTC_4BPPV1_Format:()=>d_,RGBA_S3TC_DXT1_Format:()=>dv,RGBA_S3TC_DXT3_Format:()=>fv,RGBA_S3TC_DXT5_Format:()=>pv,RGBDepthPacking:()=>KQ,RGBFormat:()=>Vk,RGBIntegerFormat:()=>YQ,RGB_BPTC_SIGNED_Format:()=>O_,RGB_BPTC_UNSIGNED_Format:()=>N_,RGB_ETC1_Format:()=>p_,RGB_ETC2_Format:()=>g_,RGB_PVRTC_2BPPV1_Format:()=>h_,RGB_PVRTC_4BPPV1_Format:()=>u_,RGB_S3TC_DXT1_Format:()=>hv,RGDepthPacking:()=>JQ,RGFormat:()=>xh,RGIntegerFormat:()=>l_,RawShaderMaterial:()=>Jb,Ray:()=>ch,Raycaster:()=>ek,RectAreaLight:()=>$1,RedFormat:()=>a_,RedIntegerFormat:()=>uv,ReinhardToneMapping:()=>Pk,RenderObjectRefreshType:()=>Ett,RenderTarget:()=>Bb,RenderTarget3D:()=>K2,RepeatWrapping:()=>Ko,ReplaceStencilOp:()=>ntt,ReverseSubtractEquation:()=>aU,RingGeometry:()=>E1,SIGNED_R11_EAC_Format:()=>v_,SIGNED_RED_GREEN_RGTC2_Format:()=>
vendor: 5,304 bytes, line 423
423U_,SIGNED_RED_RGTC1_Format:()=>F_,SIGNED_RG11_EAC_Format:()=>y_,SRGBColorSpace:()=>Zn,SRGBTransfer:()=>Fi,Scene:()=>o1,ShaderChunk:()=>ii,ShaderLib:()=>wc,ShaderMaterial:()=>Zo,ShadowMaterial:()=>O1,Shape:()=>rf,ShapeGeometry:()=>k1,ShapePath:()=>xk,ShapeUtils:()=>xa,ShortType:()=>Bk,Skeleton:()=>hh,SkeletonHelper:()=>lk,SkinnedMesh:()=>uh,Source:()=>v2,Sphere:()=>Gs,SphereGeometry:()=>Kb,Spherical:()=>ik,SphericalHarmonics3:()=>iv,SplineCurve:()=>qb,SpotLight:()=>gh,SpotLightHelper:()=>ak,Sprite:()=>a1,SpriteMaterial:()=>Ub,SrcAlphaFactor:()=>Ak,SrcAlphaSaturateFactor:()=>vU,SrcColorFactor:()=>dU,StaticCopyUsage:()=>xtt,StaticDrawUsage:()=>j_,StaticReadUsage:()=>btt,StereoCamera:()=>W2,StreamCopyUsage:()=>_tt,StreamDrawUsage:()=>mtt,StreamReadUsage:()=>ytt,StringKeyframeTrack:()=>lu,SubtractEquation:()=>oU,SubtractiveBlending:()=>Mk,TOUCH:()=>zQ,TangentSpaceNormalMap:()=>du,TetrahedronGeometry:()=>P1,Texture:()=>is,TextureLoader:()=>cu,TextureSource:()=>wl,TextureUtils:()=>_k,Timer:()=>Z1,TimestampQuery:()=>Ctt,TorusGeometry:()=>R1,TorusKnotGeometry:()=>D1,Triangle:()=>uc,TriangleFanDrawMode:()=>Bg,TriangleStripDrawMode:()=>bv,TrianglesDrawMode:()=>jk,TubeGeometry:()=>L1,UVMapping:()=>i_,Uint16BufferAttribute:()=>tf,Uint32BufferAttribute:()=>Fb,Uint8BufferAttribute:()=>S2,Uint8ClampedBufferAttribute:()=>C2,Uniform:()=>J2,UniformsGroup:()=>Z2,UniformsLib:()=>on,UniformsUtils:()=>HU,UnsignedByteType:()=>ta,UnsignedInt101111Type:()=>Uk,UnsignedInt248Type:()=>Ng,UnsignedInt5999Type:()=>Fk,UnsignedIntType:()=>qa,UnsignedShort4444Type:()=>r_,UnsignedShort5551Type:()=>o_,UnsignedShortType:()=>Og,VSMShadowMap:()=>Dg,Vector2:()=>Ce,Vector3:()=>bt,Vector4:()=>pi,VectorKeyframeTrack:()=>bc,VideoFrameTexture:()=>P2,VideoTexture:()=>h1,WebGL3DRenderTarget:()=>x2,WebGLArrayRenderTarget:()=>y2,WebGLCoordinateSystem:()=>ya,WebGLCubeRenderTarget:()=>X_,WebGLRenderTarget:()=>no,WebGLRenderer:()=>az,WebGLUtils:()=>yet,WebGPUCoordinateSystem:()=>Zd,WebXRController:()=>wg,WireframeGeometry:()=>I1,WrapAroundEnding:()=>Lb,ZeroCurvatureEnding:()=>qd,ZeroFactor:()=>uU,ZeroSlopeEnding:()=>Yd,ZeroStencilOp:()=>ett,createCanvasElement:()=>FU,error:()=>Tn,getConsoleFunction:()=>Rtt,log:()=>Nb,setConsoleFunction:()=>Ptt,warn:()=>Ze,warnOnce:()=>su});function fet(){let i=null,t=!1,e=null,n=null;function s(r,o){n=i.requestAnimationFrame(s),e(r,o)}return{start:function(){t!==!0&&e!==null&&i!==null&&(n=i.requestAnimationFrame(s),t=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(r){e=r},setContext:function(r){i=r}}}function Bkt(i){let t=new WeakMap;function e(a,l){let c=a.array,u=a.usage,h=c.byteLength,d=i.createBuffer();i.bindBuffer(l,d),i.bufferData(l,c,u),a.onUploadCallback();let p;if(c instanceof Float32Array)p=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)p=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?p=i.HALF_FLOAT:p=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=i.SHORT;else if(c instanceof Uint32Array)p=i.UNSIGNED_INT;else if(c instanceof Int32Array)p=i.INT;else if(c instanceof Int8Array)p=i.BYTE;else if(c instanceof Uint8Array)p=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:h}}function n(a,l,c){let u=l.array,h=l.updateRanges;if(i.bindBuffer(c,a),h.length===0)i.bufferSubData(c,0,u);else{h.sort((p,g)=>p.start-g.start);let d=0;for(let p=1;p<h.length;p++){let g=h[d],y=h[p];y.start<=g.start+g.count+1?g.count=Math.max(g.count,y.start+y.count-g.start):(++d,h[d]=y)}h.length=d+1;for(let p=0,g=h.length;p<g;p++){let y=h[p];i.bufferSubData(c,y.start*u.BYTES_PER_ELEMENT,u,y.start,y.count)}l.clearUpdateRanges()}l.onUploadCallback()}function s(a){return a.isInterleavedBufferAttribute&&(a=a.data),t.get(a)}function r(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=t.get(a);l&&(i.deleteBuffer(l.buffer),t.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=t.get(a);(!u||u.version<a.version)&&t.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=t.get(a);if(c===void 0)t.set(a,e(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:s,remove:r,update:o}}function yDt(i,t,e,n,s,r){let o=new Be(0),a=s===!0?0:1,l,c,u=null,h=0,d=null;function p(M){let A=M.isScene===!0?M.background:null;if(A&&A.isTexture){let C=M.backgroundBlurriness>0;A=t.get(A,C)}return A}function g(M){let A=!1,C=p(M);C===null?x(o,a):C&&C.isColor&&(x(C,1),A=!0);let R=i.xr.getEnvironmentBlendMode();R==="additive"?e.buffers.color.setClear(0,0,0,1,r):R==="alpha-blend"&&e.buffers.color.setClear(0,0,0,0,r),(i.autoClear||A)&&(e.buffers.depth.setTest(!0),e.buffers.depth.setMask(!0),e.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function y(M,A){let C=p(A);C&&(C.isCubeTexture||C.mapping===Ig)?(c===void 0&&(c=new qi(new nf(1,1,1),new Zo({name:"Backgroun
423dCubeMaterial",uniforms:Fg(wc.backgroundCube.uniforms),vertexShader:wc.backgroundCube.vertexShader,fragmentShader:wc.backgroundCube.fragmentShader,side:Mo,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(R,k,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=C,c.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(vDt.makeRotationFromEuler(A.backgroundRotation)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(pet),c.material.toneMapped=Rn.getTransfer(C.colorSpace)!==Fi,(u!==C||h!==C.version||d!==i.toneMapping)&&(c.material.needsUpdate=!0,u=C,h=C.version,d=i.toneMapping),c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null)):C&&C.isTexture&&(l===void 0&&(l=new qi(new Ag(2,2),new Zo({name:"BackgroundMaterial",uniforms:Fg(wc.background.uniforms),vertexShader:wc.background.vertexShader,fragmentShader:wc.background.fragmentShader,side:$a,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=C,l.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,l.material.toneMapped=Rn.getTransfer(C.colorSpace)!==Fi,C.matrixAutoUpdate===!0&&C.updateMatrix(),l.material.uniforms.uvTransform.value.copy(C.matrix),(u!==C||h!==C.version||d!==i.toneMapping)&&(l.material.needsUpdate=!0,u=C,h=C.version,d=i.toneMapping),l.layers.enableAll(),M.unshift(l,l.geometry,l.material,0,0,null))}function x(M,A){M.getRGB(Gk,VU(i)),e.buffers.color.setClear(Gk.r,Gk.g,Gk.b,A,r)}function w(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(M,A=1){o.set(M),a=A,x(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(M){a=M,x(o,a)},render:g,addToRenderList:y,dispose:w}}function xDt(i,t){let e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=d(null),r=s,o=!1;function a(q,X,j,W,_){let at=!1,ct=h(q,W,j,X);r!==ct&&(r=ct,c(r.object)),at=p(q,W,j,_),at&&g(q,W,j,_),_!==null&&t.update(_,i.ELEMENT_ARRAY_BUFFER),(at||o)&&(o=!1,C(q,X,j,W),_!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(_).buffer))}function l(){return i.createVertexArray()}function c(q){return i.bindVertexArray(q)}function u(q){return i.deleteVertexArray(q)}function h(q,X,j,W){let _=W.wireframe===!0,at=n[X.id];at===void 0&&(at={},n[X.id]=at);let ct=q.isInstancedMesh===!0?q.id:0,pt=at[ct];pt===void 0&&(pt={},at[ct]=pt);let Et=pt[j.id];Et===void 0&&(Et={},pt[j.id]=Et);let vt=Et[_];return vt===void 0&&(vt=d(l()),Et[_]=vt),vt}function d(q){let X=[],j=[],W=[];for(let _=0;_<e;_++)X[_]=0,j[_]=0,W[_]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:X,enabledAttributes:j,attributeDivisors:W,object:q,attributes:{},index:null}}function p(q,X,j,W){let _=r.attributes,at=X.attributes,ct=0,pt=j.getAttributes();for(let Et in pt)if(pt[Et].location>=0){let yt=_[Et],kt=at[Et];if(kt===void 0&&(Et==="instanceMatrix"&&q.instanceMatrix&&(kt=q.instanceMatrix),Et==="instanceColor"&&q.instanceColor&&(kt=q.instanceColor)),yt===void 0||yt.attribute!==kt||kt&&yt.data!==kt.data)return!0;ct++}return r.attributesNum!==ct||r.index!==W}function g(q,X,j,W){let _={},at=X.attributes,ct=0,pt=j.getAttributes();for(let Et in pt)if(pt[Et].location>=0){let yt=at[Et];yt===void 0&&(Et==="instanceMatrix"&&q.instanceMatrix&&(yt=q.instanceMatrix),Et==="instanceColor"&&q.instanceColor&&(yt=q.instanceColor));let kt={};kt.attribute=yt,yt&&yt.data&&(kt.data=yt.data),_[Et]=kt,ct++}r.attributes=_,r.attributesNum=ct,r.index=W}function y(){let q=r.newAttributes;for(let X=0,j=q.length;X<j;X++)q[X]=0}function x(q){w(q,0)}function w(q,X){let j=r.newAttributes,W=r.enabledAttributes,_=r.attributeDivisors;j[q]=1,W[q]===0&&(i.enableVertexAttribArray(q),W[q]=1),_[q]!==X&&(i.vertexAttribDivisor(q,X),_[q]=X)}function M(){let q=r.newAttributes,X=r.enabledAttributes;for(let j=0,W=X.length;j<W;j++)X[j]!==q[j]&&(i.disableVertexAttribArray(j),X[j]=0)}function A(q,X,j,W,_,at,ct){ct===!0?i.vertexAttribIPointer(q,X,j,_,at):i.vertexAttribPointer(q,X,j,W,_,at)}function C(q,X,j,W){y();let _=W.attributes,at=j.getAttributes(),ct=X.defaultAttributeValues;for(let pt in at){let Et=at[pt];if(Et.location>=0){let vt=_[pt];if(vt===void 0&&(pt==="instanceMatrix"&&q.instanceMatrix&&(vt=q.instanceMatrix),pt==="instanceColor"&&q.instanceColor&&(vt=q.instanceColor)),vt!==void 0){let yt=vt.normalized,kt=vt.itemSize,Wt=t.get(vt);if(Wt===void 0)continue;let jt=Wt.buffer,ae=Wt.type,ee=Wt.bytesPerElement,Bt=ae===i.INT||ae===i.UNSIGNED_INT||vt.gpuType===s_;if(vt.isInterleavedBufferAttribute){let Gt=vt.data,Qt=Gt.stride,xe=vt.offset;if(Gt.isInstancedInterleavedBuffer){for(let Ut=0;Ut<Et.locationSize;Ut++)w(Et.location+Ut,Gt.meshPerAttribute);q.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=Gt.meshPerAttribute*Gt.count)}else for(let Ut=0;Ut<Et.locationSize;Ut++)x(Et.location+Ut);i.bindBuffer(i.ARRAY_BUFFER,jt);for(let Ut=0;Ut<Et.locationSize;Ut++)A(Et.location+Ut,kt/Et.locationSize,ae,yt,Qt*ee,(xe+kt/Et.locationSize*Ut)*ee,Bt)}else{if(vt.isInstancedBufferAttribute){for(let Gt=0;Gt<Et.locationSize;Gt++)w(Et.location+Gt,vt.meshPerAttribute);q.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=vt.meshPerAttribute*vt.count)}else for(let Gt=0;Gt<Et.locationSize;Gt++)x(Et.location+Gt);i.bindBuffer(i.ARRAY_BUFFER,jt);for(let Gt=0;Gt<Et.locationSize;Gt++)A(Et.location+Gt,kt/Et.locationSize,ae,yt,kt*ee,kt/Et.locationSize*Gt*ee,Bt)}}else if(ct!==void 0){let yt=ct[pt];if(yt!==void 0)switch(yt.length){case 2:i.vertexAttrib2fv(Et.location,yt);break;case 3:i.vertexAttrib3fv(Et.location,yt);break;case 4:i.vertexAttrib4fv(Et.location,yt);break;default:i.vertexAttrib1fv(Et.location,yt)}}}}M()}function R(){U();for(let q in n){let X=n[q];for(let j in X){let W=X[j];for(let _ in W){let at=W[_];for(let ct in at)u(at[ct].object),delete at[ct];delete W[_]}}delete n[q]}}function k(q){if(n[q.id]===void 0)return;let X=n[q.id];for(let j in X){let W=X[j];for(let _ in W){let at=W[_];for(let ct in at)u(at[ct].object),delete at[ct];delete W[_]}}delete n[q.id]}function O(q){for(let X in n){let j=n[X];for(let W in j){let _=j[W];if(_[q.id]===void 0)continue;let at=_[q.id];for(let ct in at)u(at[ct].object),delete at[ct];delete _[q.id]}}}function I(q){for(let X in n){let j=n[X],W=q.isInstancedMesh===!0?q.
vendor: 4,293 bytes, line 423
423id:0,_=j[W];if(_!==void 0){for(let at in _){let ct=_[at];for(let pt in ct)u(ct[pt].object),delete ct[pt];delete _[at]}delete j[W],Object.keys(j).length===0&&delete n[X]}}}function U(){V(),o=!0,r!==s&&(r=s,c(r.object))}function V(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:a,reset:U,resetDefaultState:V,dispose:R,releaseStatesOfGeometry:k,releaseStatesOfObject:I,releaseStatesOfProgram:O,initAttributes:y,enableAttribute:x,disableUnusedAttributes:M}}function wDt(i,t,e){let n;function s(l){n=l}function r(l,c){i.drawArrays(n,l,c),e.update(c,n,1)}function o(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),e.update(c,n,u))}function a(l,c,u){if(u===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let d=0;for(let p=0;p<u;p++)d+=c[p];e.update(d,n,1)}this.setMode=s,this.render=r,this.renderInstances=o,this.renderMultiDraw=a}function _Dt(i,t,e,n){let s;function r(){if(s!==void 0)return s;if(t.has("EXT_texture_filter_anisotropic")===!0){let O=t.get("EXT_texture_filter_anisotropic");s=i.getParameter(O.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function o(O){return!(O!==xo&&n.convert(O)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(O){let I=O===Tl&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(O!==ta&&O!==yo&&!I&&n.convert(O)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE))}function l(O){if(O==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";O="mediump"}return O==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp",u=l(c);u!==c&&(Ze("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let h=e.logarithmicDepthBuffer===!0,d=e.reversedDepthBuffer===!0&&t.has("EXT_clip_control");e.reversedDepthBuffer===!0&&d===!1&&Ze("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let p=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_TEXTURE_SIZE),x=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),w=i.getParameter(i.MAX_VERTEX_ATTRIBS),M=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),A=i.getParameter(i.MAX_VARYING_VECTORS),C=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),R=i.getParameter(i.MAX_SAMPLES),k=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:h,reversedDepthBuffer:d,maxTextures:p,maxVertexTextures:g,maxTextureSize:y,maxCubemapSize:x,maxAttributes:w,maxVertexUniforms:M,maxVaryings:A,maxFragmentUniforms:C,maxSamples:R,samples:k}}function SDt(i){let t=this,e=null,n=0,s=!1,r=!1,o=new xl,a=new Vn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){let p=h.length!==0||d||n!==0||s;return s=d,n=h.length,p},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(h,d){e=u(h,d,0)},this.setState=function(h,d,p){let g=h.clippingPlanes,y=h.clipIntersection,x=h.clipShadows,w=i.get(h);if(!s||g===null||g.length===0||r&&!x)r?u(null):c();else{let M=r?0:n,A=M*4,C=w.clippingState||null;l.value=C,C=u(g,d,A,p);for(let R=0;R!==A;++R)C[R]=e[R];w.clippingState=C,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=M}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function u(h,d,p,g){let y=h!==null?h.length:0,x=null;if(y!==0){if(x=l.value,g!==!0||x===null){let w=p+y*4,M=d.matrixWorldInverse;a.getNormalMatrix(M),(x===null||x.length<w)&&(x=new Float32Array(w));for(let A=0,C=p;A!==y;++A,C+=4)o.copy(h[A]).applyMatrix4(M,a),o.normal.toArray(x,C),x[C+3]=o.constant}l.value=x,l.needsUpdate=!0}return t.numPlanes=y,t.numIntersection=0,x}}function EDt(i){let t=[],e=[],n=i,s=i-yv+1+CDt;for(let r=0;r<s;r++){let o=Math.pow(2,n);t.push(o);let a=1/(o-2),l=-a,c=1+a,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=6,d=6,p=3,g=new Float32Array(p*d*h),y=new Float32Array(p*d*h);for(let w=0;w<h;w++){let M=w%3*2/3-1,A=w>
4232?0:-1,C=[M,A,0,M+2/3,A,0,M+2/3,A+1,0,M,A,0,M+2/3,A+1,0,M,A+1,0];g.set(C,p*d*w);for(let R=0;R<d;R++){let k=u[R*2]*2-1,O=u[R*2+1]*2-1;w===0?Ug.set(1,O,k):w===1?Ug.set(-k,1,-O):w===2?Ug.set(-k,O,1):w===3?Ug.set(-1,O,-k):w===4?Ug.set(-k,-1,O):Ug.set(k,O,-1),Ug.toArray(y,(w*d+R)*p)}}let x=new kn;x.setAttribute("position",new Mi(g,p)),x.setAttribute("outputDirection",new Mi(y,p)),e.push(new qi(x,null)),n>yv&&n--}return{lodMeshes:e,sizeLods:t}}function Gtt(i,t,e){let n=new no(i,t,e);return n.texture.mapping=Ig,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function vv(i,t,e,n,s){i.viewport.set(t,e,n,s),i.scissor.set(t,e,n,s)}function kDt(i,t,e){return new Zo({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:TDt,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Yk(),fragmentShader:`
424
425			precision highp float;
426			precision highp int;
427
428			varying vec3 vOutputDirection;
429
430			uniform sampler2D envMap;
431			uniform float roughness;
432			uniform float mipInt;
433
434			#define ENVMAP_TYPE_CUBE_UV
435			#include <cube_uv_reflection_fragment>
436
437			#define PI 3.14159265359
438
439			// Van der Corput radical inverse
440			float radicalInverse_VdC(uint bits) {
441				bits = (bits << 16u) | (bits >> 16u);
442				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
443				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
444				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
445				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
446				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
447			}
448
449			// Hammersley sequence
450			vec2 hammersley(uint i, uint N) {
451				return vec2(float(i) / float(N), radicalInverse_VdC(i));
452			}
453
454			// GGX VNDF importance sampling (Eric Heitz 2018)
455			// "Sampling the GGX Distribution of Visible Normals"
456			// https://jcgt.org/published/0007/04/01/
457			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
458				float alpha = roughness * roughness;
459
460				// Section 4.1: Orthonormal basis
461				vec3 T1 = vec3(1.0, 0.0, 0.0);
462				vec3 T2 = cross(V, T1);
463
464				// Section 4.2: Parameterization of projected area
465				float r = sqrt(Xi.x);
466				float phi = 2.0 * PI * Xi.y;
467				float t1 = r * cos(phi);
468				float t2 = r * sin(phi);
469				float s = 0.5 * (1.0 + V.z);
470				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
471
472				// Section 4.3: Reprojection onto hemisphere
473				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
474
475				// Section 3.4: Transform back to ellipsoid configuration
476				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
477			}
478
479			void main() {
480				vec3 N = normalize(vOutputDirection);
481				vec3 V = N; // Assume view direction equals normal for pre-filtering
482
483				vec3 prefilteredColor = vec3(0.0);
484				float totalWeight = 0.0;
485
486				// For very low roughness, just sample the environment directly
487				if (roughness < 0.001) {
488					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
489					return;
490				}
491
492				// Tangent space basis for VNDF sampling
493				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
494				vec3 tangent = normalize(cross(up, N));
495				vec3 bitangent = cross(N, tangent);
496
497				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
498					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
499
500					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
501					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
502
503					// Transform H back to world space
504					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
505					vec3 L = normalize(2.0 * dot(V, H) * H - V);
506
507					float NdotL = max(dot(N, L), 0.0);
508
509					if(NdotL > 0.0) {
510						// Sample environment at fixed mip level
511						// VNDF importance sampling handles the distribution filtering
512						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
513
514						// Weight by NdotL for the split-sum approximation
515						// VNDF PDF naturally accounts for the visible microfacet distribution
516						prefilteredColor += sampleColor * NdotL;
517						totalWeight += NdotL;
518					}
519				}
520
521				if (totalWeight > 0.0) {
522					prefilteredColor = prefilteredColor / totalWeight;
523				}
524
525				gl_FragColor = vec4(prefilteredColor, 1.0);
526			}
527		`,blending:yc,depthTest:!1,depthWrite:!1})}function PDt(i,t,e){return new Zo({name:"SphericalGaussianBlur",defines:{SAMPLES:MDt,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},sigma:{value:0},mipInt:{value:0}},vertexShader:Yk(),fragmentShader:`
528
529			precision highp float;
530			precision highp int;
531
532			varying vec3 vOutputDirection;
533
534			uniform sampler2D envMap;
535			uniform float sigma;
536			uniform float mipInt;
537
538			#define ENVMAP_TYPE_CUBE_UV
539			#include <cube_uv_reflection_fragment>
540
541			#define PI 3.14159265359
542			#define GOLDEN_ANGLE 2.39996322973
543
544			void main() {
545
546				if ( sigma == 0.0 ) {
547
548					gl_FragColor = vec4( bilinearCubeUV( envMap, vOutputDirection, mipInt ), 1.0 );
549					return;
550
551				}
552
553				vec3 outputDirection = normalize( vOutputDirection );
554
555				vec3 up = abs( outputDirection.z ) < 0.999 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 1.0, 0.0, 0.0 );
556				vec3 tangent = normalize( cross( up, outputDirection ) );
557				vec3 bitangent = cross( outputDirection, tangent );
558
559				// Truncate the kernel at three standard deviations or at the antipode.
560				float thetaMax = min( 3.0 * sigma, PI );
561				float truncation = 1.0 - exp( - 0.5 * thetaMax * thetaMax / ( sigma * sigma ) );
562
563				vec3 accumColor = vec3( 0.0 );
564				float accumWeight = 0.0;
565
566				for ( int i = 0; i < SAMPLES; i ++ ) {
567
568					// Stratified inverse-CDF sampling of the Gaussian, placed on a golden-angle spiral.
569					float stratum = ( float( i ) + 0.5 ) / float( SAMPLES );
570					float theta = sigma * sqrt( - 2.0 * log( 1.0 - stratum * truncation ) );
571					float phi = float( i ) * GOLDEN_ANGLE;
572
573					vec3 offset = cos( phi ) * tangent + sin( phi ) * bitangent;
574					vec3 sampleDirection = cos( theta ) * outputDirection + sin( theta ) * offset;
575
576					// Correct the planar sample density to solid angle.
577					float weight = sin( theta ) / theta;
578
579					accumColor += weight * bilinearCubeUV( envMap, sampleDirection, mipInt );
580					accumWeight += weight;
581
582				}
583
584				gl_FragColor = vec4( accumColor / accumWeight, 1.0 );
585
586			}
587		`,blending:yc,depthTest:!1,depthWrite:!1})}function qtt(){return new Zo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Yk(),fragmentShader:`
588
589			precision mediump float;
590			precision mediump int;
591
592			varying vec3 vOutputDirection;
593
594			uniform sampler2D envMap;
595
596			#include <common>
597
598			void main() {
599
600				vec3 outputDirection = normalize( vOutputDirection );
601				vec2 uv = equirectUv( outputDirection );
602
603				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
604
605			}
606		`,blending:yc,depthTest:!1,depthWrite:!1})}function Ytt(){return new Zo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Yk(),fragmentShader:`
607
608			precision mediump float;
609			precision mediump int;
610
611			uniform float flipEnvMap;
612
613			varying vec3 vOutputDirection;
614
615			uniform samplerCube envMap;
616
617			void main() {
618
619				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
620
621			}
622		`,blending:yc,depthTest:!1,depthWrite:!1})}function Yk(){return`
623
624		precision mediump float;
625		precision mediump int;
626
627		attribute vec3 outputDirection;
628
629		varying vec3 vOutputDirection;
630
631		void main() {
632
633			vOutputDirection = outputDirection;
634			gl_Position = vec4( position, 1.0 );
635
636		}
637	`}function RDt(i){let t=new WeakMap,e=new WeakMap,n=null;function s(d,p=!1){return d==null?null:p?o(d):r(d)}function r(d){if(d&&d.isTexture){let p=d.mapping;if(p===lf||p===lv)if(t.has(d)){let g=t.get(d).texture;return a(g,d.mapping)}else{let g=d.image;if(g&&g.height>0){let y=new X_(g.height);return y.fromEquirectangularTexture(i,d),t.set(d,y),d.addEventListener("dispose",c),a(y.texture,d.mapping)}else return null}}return d}function o(d){if(d&&d.isTexture){let p=d.mapping,g=p===lf||p===lv,y=p===xc||p===bh;if(g||y){let x=e.get(d),w=x!==void 0?x.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==w)return n===null&&(n=new Y_(i)),x=g?n.fromEquirectangular(d,x):n.fromCubemap(d,x),x.texture.pmremVersion=d.pmremVersion,e.set(d,x),x.texture;if(x!==void 0)return x.texture;{let M=d.image;return g&&M&&M.height>0||y&&M&&l(M)?(n===null&&(n=new Y_(i)),x=g?n.fromEquirectangular(d):n.fromCubemap(d),x.texture.pmremVersion=d.pmremVersion,e.set(d,x),d.addEventListener("dispose",u),x.texture):null}}}return d}function a(d,p){return p===lf?d.mapping=xc:p===lv&&(d.mapping=bh),d}function l(d){let p=0,g=6;for(let y=0;y<g;y++)d[y]!==void 0&&p++;return p===g}function c(d){let p=d.target;p.removeEventListener("dispose",c);let g=t.get(p);g!==void 0&&(t.delete(p),g.dispose())}function u(d){let p=d.target;p.removeEventListener("dispose",u);let g=e.get(p);g!==void 0&&(e.delete(p),g.dispose())}function h(){t=new WeakMap,e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:s,dispose:h}}function DDt(i){let t={};function e(n){if(t[n]!==void 0)return t[n];let s=i.getExtension(n);return t[n]=s,s}return{has:function(n){return e(n)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(n){let s=e(n);return s===null&&su("WebGLRenderer: "+n+" extension not supported."),s}}}function LDt(i,t,e,n){let s={},r=new WeakMap;function o(h){let d=h.target;d.index!==null&&t.remove(d.index);for(let g in d.attributes)t.remove(d.attributes[g]);d.removeEventListener("dispose",o),delete s[d.id];let p=r.get(d);p&&(t.remove(p),r.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,e.memory.geometries--}function a(h,d){return s[d.id]===!0||(d.addEventListener("dispose",o),s[d.id]=!0,e.memory.geometries++),d}function l(h){let d=h.attributes;for(let p in d)t.update(d[p],i.ARRAY_BUFFER)}function c(h){let d=[],p=h.index,g=h.attributes.position,y=0;if(g===void 0)return;if(p!==null){let M=p.array;y=p.version;for(let A=0,C=M.length;A<C;A+=3){let R=M[A+0],k=M[A+1],O=M[A+2];d.push(R,k,k,O,O,R)}}else{let M=g.array;y=g.version;for(let A=0,C=M.length/3-1;A<C;A+=3){let R=A+0,k=A+1,O=A+2;d.push(R,k,k,O,O,R)}}let x=new(g.count>=65535?Fb:tf)(d,1);x.version=y;let w=r.get(h);w&&t.remove(w),r.set(h,x)}function u(h){let d=r.get(h);if(d){let p=h.index;p!==null&&d.version<p.version&&c(h)}else c(h);return r.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function IDt(i,t,e){let n;function s(h){n=h}let r,o;function a(h){r=h.type,o=h.bytesPerElement}function l(h,d){i.drawElements(n,d,r,h*o),e.update(d,n,1)}function c(h,d,p){p!==0&&(i.drawElementsInstanced(n,d,r,h*o,p),e.update(d,n,p))}function u(h,d,p){if(p===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,r,h,0,p);let y=0;for(let x=0;x<p;x++)y+=d[x];e.update(y,n,1)}this.setMode=s,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function ODt(i){let t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,o,a){switch(e.calls++,o){case i.TRIANGLES:e.triangles+=a*(r/3);break;case i.LINES:e.lines+=a*(r/2);break;case i.LINE_STRIP:e.lines+=a*(r-1);break;case i.LINE_LOOP:e.lines+=a*r;break;case i.POINTS:e.points+=a*r;break;default:Tn("WebGLInfo: Unknown draw mode:",o);break}}function s(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:s,update:n}}function NDt(i,t,e){let n=new WeakMap,s=new pi;function r(o,a,l){let c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=u!==void 0?u.length:0,d=n.get(a);
vendor: 24,564 bytes, lines 637-720
637if(d===void 0||d.count!==h){let U=function(){O.dispose(),n.delete(a),a.removeEventListener("dispose",U)};d!==void 0&&d.texture.dispose();let p=a.morphAttributes.position!==void 0,g=a.morphAttributes.normal!==void 0,y=a.morphAttributes.color!==void 0,x=a.morphAttributes.position||[],w=a.morphAttributes.normal||[],M=a.morphAttributes.color||[],A=0;p===!0&&(A=1),g===!0&&(A=2),y===!0&&(A=3);let C=a.attributes.position.count*A,R=1;C>t.maxTextureSize&&(R=Math.ceil(C/t.maxTextureSize),C=t.maxTextureSize);let k=new Float32Array(C*R*4*h),O=new vg(k,C,R,h);O.type=yo,O.needsUpdate=!0;let I=A*4;for(let V=0;V<h;V++){let q=x[V],X=w[V],j=M[V],W=C*R*4*V;for(let _=0;_<q.count;_++){let at=_*I;p===!0&&(s.fromBufferAttribute(q,_),k[W+at+0]=s.x,k[W+at+1]=s.y,k[W+at+2]=s.z,k[W+at+3]=0),g===!0&&(s.fromBufferAttribute(X,_),k[W+at+4]=s.x,k[W+at+5]=s.y,k[W+at+6]=s.z,k[W+at+7]=0),y===!0&&(s.fromBufferAttribute(j,_),k[W+at+8]=s.x,k[W+at+9]=s.y,k[W+at+10]=s.z,k[W+at+11]=j.itemSize===4?s.w:1)}}d={count:h,texture:O,size:new Ce(C,R)},n.set(a,d),a.addEventListener("dispose",U)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,e);else{let p=0;for(let y=0;y<c.length;y++)p+=c[y];let g=a.morphTargetsRelative?1:1-p;l.getUniforms().setValue(i,"morphTargetBaseInfluence",g),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",d.texture,e),l.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:r}}function BDt(i,t,e,n,s){let r=new WeakMap;function o(c){let u=s.render.frame,h=c.geometry,d=t.get(c,h);if(r.get(d)!==u&&(t.update(d),r.set(d,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),r.get(c)!==u&&(e.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&e.update(c.instanceColor,i.ARRAY_BUFFER),r.set(c,u))),c.isSkinnedMesh){let p=c.skeleton;r.get(p)!==u&&(p.update(),r.set(p,u))}return d}function a(){r=new WeakMap}function l(c){let u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),e.remove(u.instanceMatrix),u.instanceColor!==null&&e.remove(u.instanceColor)}return{update:o,dispose:a}}function UDt(i,t,e,n,s,r){let o=new no(t,e,{type:i,depthBuffer:s,stencilBuffer:r,samples:n?4:0,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),a=null,l=null,c=new kn;c.setAttribute("position",new Ge([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new Ge([0,2,0,0,2,0],2));let u=new Jb({uniforms:{tDiffuse:{value:null}},vertexShader:`
638			precision highp float;
639
640			uniform mat4 modelViewMatrix;
641			uniform mat4 projectionMatrix;
642
643			attribute vec3 position;
644			attribute vec2 uv;
645
646			varying vec2 vUv;
647
648			void main() {
649				vUv = uv;
650				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
651			}`,fragmentShader:`
652			precision highp float;
653
654			uniform sampler2D tDiffuse;
655
656			varying vec2 vUv;
657
658			#include <tonemapping_pars_fragment>
659			#include <colorspace_pars_fragment>
660
661			void main() {
662				gl_FragColor = texture2D( tDiffuse, vUv );
663
664				#ifdef LINEAR_TONE_MAPPING
665					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
666				#elif defined( REINHARD_TONE_MAPPING )
667					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
668				#elif defined( CINEON_TONE_MAPPING )
669					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
670				#elif defined( ACES_FILMIC_TONE_MAPPING )
671					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
672				#elif defined( AGX_TONE_MAPPING )
673					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
674				#elif defined( NEUTRAL_TONE_MAPPING )
675					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
676				#elif defined( CUSTOM_TONE_MAPPING )
677					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
678				#endif
679
680				#ifdef SRGB_TRANSFER
681					gl_FragColor = sRGBTransferOETF( gl_FragColor );
682				#endif
683			}`,depthTest:!1,depthWrite:!1}),h=new qi(c,u),d=new hu(-1,1,1,-1,0,1),p=null,g=null,y=!1,x,w=null,M=[],A=!1;this.setSize=function(C,R){o.setSize(C,R),a!==null&&a.setSize(C,R),l!==null&&l.setSize(C,R);for(let k=0;k<M.length;k++){let O=M[k];O.setSize&&O.setSize(C,R)}},this.setEffects=function(C){M=C,A=M.length>0&&M[0].isRenderPass===!0;let R=o.width,k=o.height;M.length>0&&a===null&&(a=new no(R,k,{type:Tl,depthBuffer:!1,stencilBuffer:!1}),l=new no(R,k,{type:Tl,depthBuffer:!1,stencilBuffer:!1}));for(let O=0;O<M.length;O++){let I=M[O];I.setSize&&I.setSize(R,k)}},this.begin=function(C,R){if(y||C.toneMapping===Ml&&M.length===0)return!1;if(w=R,R!==null){let k=R.width,O=R.height;(o.width!==k||o.height!==O)&&this.setSize(k,O)}return A===!1&&C.setRenderTarget(o),x=C.toneMapping,C.toneMapping=Ml,!0},this.hasRenderPass=function(){return A},this.end=function(C,R){C.toneMapping=x,y=!0;let k=o,O=a;for(let I=0;I<M.length;I++){let U=M[I];U.enabled!==!1&&(U.render(C,O,k,R),U.needsSwap!==!1&&(k=O,O=O===a?l:a))}if(p!==C.outputColorSpace||g!==C.toneMapping){p=C.outputColorSpace,g=C.toneMapping,u.defines={},Rn.getTransfer(p)===Fi&&(u.defines.SRGB_TRANSFER="");let I=FDt[g];I&&(u.defines[I]=""),u.needsUpdate=!0}u.uniforms.tDiffuse.value=k.texture,C.setRenderTarget(w),C.render(h,d),w=null,y=!1},this.isCompositing=function(){return y},this.dispose=function(){o.dispose(),a!==null&&a.dispose(),l!==null&&l.dispose(),c.dispose(),u.dispose()}}function wv(i,t,e){let n=i[0];if(n<=0||n>0)return i;let s=t*e,r=Xtt[s];if(r===void 0&&(r=new Float32Array(s),Xtt[s]=r),t!==0){n.toArray(r,0);for(let o=1,a=0;o!==t;++o)a+=e,i[o].toArray(r,a)}return r}function Ar(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e<n;e++)if(i[e]!==t[e])return!1;return!0}function Er(i,t){for(let e=0,n=t.length;e<n;e++)i[e]=t[e]}function Xk(i,t){let e=Ktt[t];e===void 0&&(e=new Int32Array(t),Ktt[t]=e);for(let n=0;n!==t;++n)e[n]=i.allocateTextureUnit();return e}function zDt(i,t){let e=this.cache;e[0]!==t&&(i.uniform1f(this.addr,t),e[0]=t)}function VDt(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Ar(e,t))return;i.uniform2fv(this.addr,t),Er(e,t)}}function HDt(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(i.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(Ar(e,t))return;i.uniform3fv(this.addr,t),Er(e,t)}}function jDt(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Ar(e,t))return;i.uniform4fv(this.addr,t),Er(e,t)}}function WDt(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Ar(e,t))return;i.uniformMatrix2fv(this.addr,!1,t),Er(e,t)}else{if(Ar(e,n))return;Qtt.set(n),i.uniformMatrix2fv(this.addr,!1,Qtt),Er(e,n)}}function $Dt(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Ar(e,t))return;i.uniformMatrix3fv(this.addr,!1,t),Er(e,t)}else{if(Ar(e,n))return;Ztt.set(n),i.uniformMatrix3fv(this.addr,!1,Ztt),Er(e,n)}}function GDt(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Ar(e,t))return;i.uniformMatrix4fv(this.addr,!1,t),Er(e,t)}else{if(Ar(e,n))return;Jtt.set(n),i.uniformMatrix4fv(this.addr,!1,Jtt),Er(e,n)}}function qDt(i,t){let e=this.cache;e[0]!==t&&(i.uniform1i(this.addr,t),e[0]=t)}function YDt(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Ar(e,t))return;i.uniform2iv(this.addr,t),Er(e,t)}}function XDt(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Ar(e,t))return;i.uniform3iv(this.addr,t),Er(e,t)}}function KDt(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Ar(e,t))return;i.uniform4iv(this.addr,t),Er(e,t)}}function JDt(i,t){let e=this.cache;e[0]!==t&&(i.uniform1ui(this.addr,t),e[0]=t)}function ZDt(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Ar(e,t))return;i.uniform2uiv(this.addr,t),Er(e,t)}}function QDt(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Ar(e,t))return;i.uniform3uiv(this.addr,t),Er(e,t)}}function tLt(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Ar(e,t))return;i.uniform4uiv(this.addr,t),Er(e,t)}}function eLt(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s);let r;this.type===i.SAMPLER_2D_SHADOW?(ZU.compareFunction=e.isReversedDepthBuffer()?H_:V_,r=ZU):r=get,e.setTexture2D(t||r,s)}function nLt(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTexture3D(t||bet,s)}function iLt(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTextureCube(t||vet,s)}function sLt(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTexture2DArray(t||met,s)}function rLt(i){switch(i){case 5126:return zDt;case 35664:return VDt;case 35665:return HDt;case 35666:return jDt;case 35674:return WDt;case 35675:return $Dt;case 35676:return GDt;case 5124:case 35670:return qDt;case 35667:case 35671:return YDt;case 35668:case 35672:return XDt;case 35669:case 35673:return KDt;case 5125:return JDt;case 36294:return ZDt;case 36295:return QDt;case 36296:return tLt;case 35678:case 36198:case 36298:case 36306:case 35682:return eLt;case 35679:case 36299:case 36307:return nLt;case 35680:case 36300:case 36308:case 36293:return iLt;case 36289:case 36303:case 36311:case 36292:return sLt}}function oLt(i,t){i.uniform1fv(this.addr,t)}function aLt(i,t){let e=wv(t,this.size,2);i.uniform2fv(this.addr,e)}function lLt(i,t){let e=wv(t,this.size,3);i.uniform3fv(this.addr,e)}function cLt(i,t){let e=wv(t,this.size,4);i.uniform4fv(this.addr,e)}function uLt(i,t){let e=wv(t,this.size,4);i.uniformMatrix2fv(this.addr,!1,e)}function hLt(i,t){let e=wv(t,this.size,9);i.uniformMatrix3fv(this.addr,!1,e)}function dLt(i,t){let e=wv(t,this.size,16);i.uniformMatrix4fv(this.addr,!1,e)}function fLt(i,t){i.uniform1iv(this.addr,t)}function pLt(i,t){i.uniform2iv(this.addr,t)}function gLt(i,t){i.uniform3iv(this.addr,t)}function mLt(i,t){i.uniform4iv(this.addr,t)}function bLt(i,t){i.uniform1uiv(this.addr,t)}function vLt(i,t){i.uniform2uiv(this.addr,t)}function yLt(i,t){i.uniform3uiv(this.addr,t)}function xLt(i,t){i.uniform4uiv(this.addr,t)}function wLt(i,t,e){let n=this.cache,s=t.length,r=Xk(e,s);Ar(n,r)||(i.uniform1iv(this.addr,r),Er(n,r));let o;this.type===i.SAMPLER_2D_SHADOW?o=ZU:o=get;for(let a=0;a!==s;++a)e.setTexture2D(t[a]||o,r[a])}function _Lt(i,t,e){let n=this.cache,s=t.length,r=Xk(e,s);Ar(n,r)||(i.uniform1iv(this.addr,r),Er(n,r));for(let o=0;o!==s;++o)e.setTexture3D(t[o]||bet,r[o])}function SLt(i,t,e){let n=this.cache,s=t.length,r=Xk(e,s);Ar(n,r)||(i.uniform1iv(this.addr,r),Er(n,r));for(let o=0;o!==s;++o)e.setTextureCube(t[o]||vet,r[o])}function CLt(i,t,e){let n=this.cache,s=t.length,r=Xk(e,s);Ar(n,r)||(i.uniform1iv(this.addr,r),Er(n,r));for(let o=0;o!==s;++o)e.setTexture2DArray(t[o]||met,r[o])}function MLt(i){switch(i){case 5126:return oLt;case 35664:return aLt;case 35665:return lLt;case 35666:return cLt;case 35674:return uLt;case 35675:return hLt;case 35676:return dLt;case 5124:case 35670:return fLt;case 35667:case 35671:return pLt;case 35668:case 35672:return gLt;case 35669:case 35673:return mLt;case 5125:return bLt;case 36294:return vLt;case 36295:return yLt;case 36296:return xLt;case 35678:case 36198:case 36298:case 36306:case 35682:return wLt;case 35679:case 36299:case 36307:return _Lt;case 35680:case 36300:case 36308:case 36293:return SLt;case 36289:case 36303:case 36311:case 36292:return CLt}}function tet(i,t){i.seq.push(t),i.map[t.id]=t}function TLt(i,t,e){let n=i.name,s=n.length;for(KU.lastIndex=0;;){let r=KU.exec(n),o=KU.lastIndex,a=r[1],l=r[2]==="]",c=r[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===s){tet(e,c===void 0?new QU(a,i,t):new tz(a,i,t));break}else{let h=e.map[a];h===void 0&&(h=new ez(a),tet(e,h)),e=h}}}function eet(i,t,e){let n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}function kLt(i,t){let e=i.split(`
684`),n=[],s=Math.max(t-6,0),r=Math.min(t+6,e.length);for(let o=s;o<r;o++){let a=o+1;n.push(`${a===t?">":" "} ${a}: ${e[o]}`)}return n.join(`
685`)}function PLt(i){Rn._getMatrix(net,Rn.workingColorSpace,i);let t=`mat3( ${net.elements.map(e=>e.toFixed(4))} )`;switch(Rn.getTransfer(i)){case Ib:return[t,"LinearTransferOETF"];case Fi:return[t,"sRGBTransferOETF"];default:return Ze("WebGLProgram: Unsupported color space: ",i),[t,"LinearTransferOETF"]}}function iet(i,t,e){let n=i.getShaderParameter(t,i.COMPILE_STATUS),r=(i.getShaderInfoLog(t)||"").trim();if(n&&r==="")return"";let o=/ERROR: 0:(\d+)/.exec(r);if(o){let a=parseInt(o[1]);return e.toUpperCase()+`
686
687`+r+`
688
689`+kLt(i.getShaderSource(t),a)}else return r}function RLt(i,t){let e=PLt(t);return[`vec4 ${i}( vec4 value ) {`,`	return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(`
690`)}function LLt(i,t){let e=DLt[t];return e===void 0?(Ze("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}function ILt(){Rn.getLuminanceCoefficients(qk);let i=qk.x.toFixed(4),t=qk.y.toFixed(4),e=qk.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${i}, ${t}, ${e} );`,"	return dot( weights, rgb );","}"].join(`
691`)}function OLt(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(q_).join(`
692`)}function NLt(i){let t=[];for(let e in i){let n=i[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(`
693`)}function BLt(i,t){let e={},n=i.getProgramParameter(t,i.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){let r=i.getActiveAttrib(t,s),o=r.name,a=1;r.type===i.FLOAT_MAT2&&(a=2),r.type===i.FLOAT_MAT3&&(a=3),r.type===i.FLOAT_MAT4&&(a=4),e[o]={type:r.type,location:i.getAttribLocation(t,o),locationSize:a}}return e}function q_(i){return i!==""}function set(i,t){let e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return i.replace(/NUM_SUN_LIGHTS/g,t.numSunLights).replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g,t.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function ret(i,t){return i.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function nz(i){return i.replace(FLt,zLt)}function zLt(i,t){let e=ii[t];if(e===void 0){let n=ULt.get(t);if(n!==void 0)e=ii[n],Ze('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+t+">")}return nz(e)}function oet(i){return i.replace(VLt,HLt)}function HLt(i,t,e,n){let s="";for(let r=parseInt(t);r<parseInt(e);r++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function aet(i){let t=`precision ${i.precision} float;
694	precision ${i.precision} int;
695	precision ${i.precision} sampler2D;
696	precision ${i.precision} samplerCube;
697	precision ${i.precision} sampler3D;
698	precision ${i.precision} sampler2DArray;
699	precision ${i.precision} sampler2DShadow;
700	precision ${i.precision} samplerCubeShadow;
701	precision ${i.precision} sampler2DArrayShadow;
702	precision ${i.precision} isampler2D;
703	precision ${i.precision} isampler3D;
704	precision ${i.precision} isamplerCube;
705	precision ${i.precision} isampler2DArray;
706	precision ${i.precision} usampler2D;
707	precision ${i.precision} usampler3D;
708	precision ${i.precision} usamplerCube;
709	precision ${i.precision} usampler2DArray;
710	`;return i.precision==="highp"?t+=`
711#define HIGH_PRECISION`:i.precision==="mediump"?t+=`
712#define MEDIUM_PRECISION`:i.precision==="lowp"&&(t+=`
713#define LOW_PRECISION`),t}function WLt(i){return jLt[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}function GLt(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":$Lt[i.envMapMode]||"ENVMAP_TYPE_CUBE"}function YLt(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":qLt[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}function KLt(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":XLt[i.combine]||"ENVMAP_BLENDING_NONE"}function JLt(i){let t=i.envMapCubeUVHeight;if(t===null)return null;let e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:n,maxMip:e}}function ZLt(i,t,e,n){let s=i.getContext(),r=e.defines,o=e.vertexShader,a=e.fragmentShader,l=WLt(e),c=GLt(e),u=YLt(e),h=KLt(e),d=JLt(e),p=OLt(e),g=NLt(r),y=s.createProgram(),x,w,M=e.glslVersion?"#version "+e.glslVersion+`
714`:"";e.isRawShaderMaterial?(x=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(q_).join(`
715`),x.length>0&&(x+=`
716`),w=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(q_).join(`
717`),w.length>0&&(w+=`
718`)):(x=[aet(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+u:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexNormals?"#define HAS_NORMAL":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
719`].filter(q_).join(`
720`),w=[aet(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+u:"",e.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.retroreflection?"#define USE_RETROREFLECTION":"",e.iridescence?"#define USE_IR
720IDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor?"#define USE_COLOR":"",e.vertexAlphas||e.batchingColor?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==Ml?"#define TONE_MAPPING":"",e.toneMapping!==Ml?ii.tonemapping_pars_fragment:"",e.toneMapping!==Ml?LLt("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",ii.colorspace_pars_fragment,RLt("linearToOutputTexel",e.outputColorSpace),ILt(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
721`].filter(q_).join(`
722`)),o=nz(o),o=set(o,e),o=ret(o,e),a=nz(a),a=set(a,e),a=ret(a,e),o=oet(o),a=oet(a),e.isRawShaderMaterial!==!0&&(M=`#version 300 es
723`,x=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
724`)+`
725`+x,w=["#define varying in",e.glslVersion===Wk?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===Wk?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
726`)+`
727`+w);let A=M+x+o,C=M+w+a,R=eet(s,s.VERTEX_SHADER,A),k=eet(s,s.FRAGMENT_SHADER,C);s.attachShader(y,R),s.attachShader(y,k),e.index0AttributeName!==void 0?s.bindAttribLocation(y,0,e.index0AttributeName):e.hasPositionAttribute===!0&&s.bindAttribLocation(y,0,"position"),s.linkProgram(y);function O(q){if(i.debug.checkShaderErrors){let X=s.getProgramInfoLog(y)||"",j=s.getShaderInfoLog(R)||"",W=s.getShaderInfoLog(k)||"",_=X.trim(),at=j.trim(),ct=W.trim(),pt=!0,Et=!0;if(s.getProgramParameter(y,s.LINK_STATUS)===!1)if(pt=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,y,R,k);else{let vt=iet(s,R,"vertex"),yt=iet(s,k,"fragment");Tn("WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(y,s.VALIDATE_STATUS)+`
728
729Material Name: `+q.name+`
730Material Type: `+q.type+`
731
732Program Info Log: `+_+`
733`+vt+`
734`+yt)}else _!==""?Ze("WebGLProgram: Program Info Log:",_):(at===""||ct==="")&&(Et=!1);Et&&(q.diagnostics={runnable:pt,programLog:_,vertexShader:{log:at,prefix:x},fragmentShader:{log:ct,prefix:w}})}s.deleteShader(R),s.deleteShader(k),I=new xv(s,y),U=BLt(s,y)}let I;this.getUniforms=function(){return I===void 0&&O(this),I};let U;this.getAttributes=function(){return U===void 0&&O(this),U};let V=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return V===!1&&(V=s.getProgramParameter(y,ALt)),V},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(y),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=ELt++,this.cacheKey=t,this.usedTimes=1,this.program=y,this.vertexShader=R,this.fragmentShader=k,this}function tIt(i){return i===xh||i===gv||i===mv}function eIt(i,t,e,n,s,r){let o=new xg,a=new iz,l=new Set,c=[],u=new Map,h=n.logarithmicDepthBuffer,d=n.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(I){return l.add(I),I===0?"uv":`uv${I}`}function y(I,U,V,q,X,j){let W=q.fog,_=X.geometry,at=I.isMeshStandardMaterial||I.isMeshLambertMaterial||I.isMeshPhongMaterial?q.environment:null,ct=I.isMeshStandardMaterial||I.isMeshLambertMaterial&&!I.envMap||I.isMeshPhongMaterial&&!I.envMap,pt=t.get(I.envMap||at,ct),Et=pt&&pt.mapping===Ig?pt.image.height:null,vt=p[I.type];I.precision!==null&&(d=n.getMaxPrecision(I.precision),d!==I.precision&&Ze("WebGLProgram.getParameters:",I.precision,"not supported, using",d,"instead."));let yt=_.morphAttributes.position||_.morphAttributes.normal||_.morphAttributes.color,kt=yt!==void 0?yt.length:0,Wt=0;_.morphAttributes.position!==void 0&&(Wt=1),_.morphAttributes.normal!==void 0&&(Wt=2),_.morphAttributes.color!==void 0&&(Wt=3);let jt,ae,ee,Bt;if(vt){let Tt=wc[vt];jt=Tt.vertexShader,ae=Tt.fragmentShader}else{jt=I.vertexShader,ae=I.fragmentShader;let Tt=a.getVertexShaderStage(I),Dt=a.getFragmentShaderStage(I);a.update(I,Tt,Dt),ee=Tt.id,Bt=Dt.id}let Gt=i.getRenderTarget(),Qt=i.state.buffers.depth.getReversed(),xe=X.isInstancedMesh===!0,Ut=X.isBatchedMesh===!0,zt=!!I.map,St=!!I.matcap,it=!!pt,gt=!!I.aoMap,ft=!!I.lightMap,de=!!I.bumpMap&&I.wireframe===!1,ve=!!I.normalMap,we=!!I.displacementMap,Ae=!!I.emissiveMap,Ue=!!I.metalnessMap,en=!!I.roughnessMap,It=I.anisotropy>0,Cn=I.clearcoat>0,mn=I.dispersion>0,mt=I.retroreflectivity>0,K=I.iridescence>0,Vt=I.sheen>0,te=I.transmission>0,Nt=It&&!!I.anisotropyMap,Se=Cn&&!!I.clearcoatMap,Me=Cn&&!!I.clearcoatNormalMap,ie=Cn&&!!I.clearcoatRoughnessMap,_t=K&&!!I.iridescenceMap,Zt=K&&!!I.iridescenceThicknessMap,fe=Vt&&!!I.sheenColorMap,ce=Vt&&!!I.sheenRoughnessMap,pe=!!I.specularMap,Fe=!!I.specularColorMap,je=!!I.specularIntensityMap,Re=te&&!!I.transmissionMap,Ft=te&&!!I.thicknessMap,Ee=!!I.gradientMap,J=!!I.alphaMap,lt=I.alph
vendor: 78,195 bytes, line 734
734aTest>0,xt=!!I.alphaHash,At=!!I.extensions,st=Ml;I.toneMapped&&(Gt===null||Gt.isXRRenderTarget===!0)&&(st=i.toneMapping);let rt={shaderID:vt,shaderType:I.type,shaderName:I.name,vertexShader:jt,fragmentShader:ae,defines:I.defines,customVertexShaderID:ee,customFragmentShaderID:Bt,isRawShaderMaterial:I.isRawShaderMaterial===!0,glslVersion:I.glslVersion,precision:d,batching:Ut,batchingColor:Ut&&X._colorsTexture!==null,instancing:xe,instancingColor:xe&&X.instanceColor!==null,instancingMorph:xe&&X.morphTexture!==null,outputColorSpace:Gt===null?i.outputColorSpace:Gt.isXRRenderTarget===!0?Gt.texture.colorSpace:Rn.workingColorSpace,alphaToCoverage:!!I.alphaToCoverage,map:zt,matcap:St,envMap:it,envMapMode:it&&pt.mapping,envMapCubeUVHeight:Et,aoMap:gt,lightMap:ft,bumpMap:de,normalMap:ve,displacementMap:we,emissiveMap:Ae,normalMapObjectSpace:ve&&I.normalMapType===PU,normalMapTangentSpace:ve&&I.normalMapType===du,packedNormalMap:ve&&I.normalMapType===du&&tIt(I.normalMap.format),metalnessMap:Ue,roughnessMap:en,anisotropy:It,anisotropyMap:Nt,clearcoat:Cn,clearcoatMap:Se,clearcoatNormalMap:Me,clearcoatRoughnessMap:ie,dispersion:mn,retroreflection:mt,iridescence:K,iridescenceMap:_t,iridescenceThicknessMap:Zt,sheen:Vt,sheenColorMap:fe,sheenRoughnessMap:ce,specularMap:pe,specularColorMap:Fe,specularIntensityMap:je,transmission:te,transmissionMap:Re,thicknessMap:Ft,gradientMap:Ee,opaque:I.transparent===!1&&I.blending===Lg&&I.alphaToCoverage===!1,alphaMap:J,alphaTest:lt,alphaHash:xt,combine:I.combine,mapUv:zt&&g(I.map.channel),aoMapUv:gt&&g(I.aoMap.channel),lightMapUv:ft&&g(I.lightMap.channel),bumpMapUv:de&&g(I.bumpMap.channel),normalMapUv:ve&&g(I.normalMap.channel),displacementMapUv:we&&g(I.displacementMap.channel),emissiveMapUv:Ae&&g(I.emissiveMap.channel),metalnessMapUv:Ue&&g(I.metalnessMap.channel),roughnessMapUv:en&&g(I.roughnessMap.channel),anisotropyMapUv:Nt&&g(I.anisotropyMap.channel),clearcoatMapUv:Se&&g(I.clearcoatMap.channel),clearcoatNormalMapUv:Me&&g(I.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ie&&g(I.clearcoatRoughnessMap.channel),iridescenceMapUv:_t&&g(I.iridescenceMap.channel),iridescenceThicknessMapUv:Zt&&g(I.iridescenceThicknessMap.channel),sheenColorMapUv:fe&&g(I.sheenColorMap.channel),sheenRoughnessMapUv:ce&&g(I.sheenRoughnessMap.channel),specularMapUv:pe&&g(I.specularMap.channel),specularColorMapUv:Fe&&g(I.specularColorMap.channel),specularIntensityMapUv:je&&g(I.specularIntensityMap.channel),transmissionMapUv:Re&&g(I.transmissionMap.channel),thicknessMapUv:Ft&&g(I.thicknessMap.channel),alphaMapUv:J&&g(I.alphaMap.channel),vertexTangents:!!_.attributes.tangent&&(ve||It),vertexNormals:!!_.attributes.normal,vertexColors:I.vertexColors,vertexAlphas:I.vertexColors===!0&&!!_.attributes.color&&_.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!_.attributes.uv&&(zt||J),fog:!!W,useFog:I.fog===!0,fogExp2:!!W&&W.isFogExp2,flatShading:I.wireframe===!1&&(I.flatShading===!0||_.attributes.normal===void 0&&ve===!1&&(I.isMeshLambertMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isMeshPhysicalMaterial)),sizeAttenuation:I.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:Qt,skinning:X.isSkinnedMesh===!0,hasPositionAttribute:_.attributes.position!==void 0,morphTargets:_.morphAttributes.position!==void 0,morphNormals:_.morphAttributes.normal!==void 0,morphColors:_.morphAttributes.color!==void 0,morphTargetsCount:kt,morphTextureStride:Wt,numSunLights:U.sun.length,numDirLights:U.directional.length,numPointLights:U.point.length,numSpotLights:U.spot.length,numSpotLightMaps:U.spotLightMap.length,numRectAreaLights:U.rectArea.length,numHemiLights:U.hemi.length,numSunLightShadows:U.sunShadowMap.length,numDirLightShadows:U.directionalShadowMap.length,numPointLightShadows:U.pointShadowMap.length,numSpotLightShadows:U.spotShadowMap.length,numSpotLightShadowsWithMaps:U.numSpotLightShadowsWithMaps,numLightProbes:U.numLightProbes,numLightProbeGrids:j.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:I.dithering,shadowMapEnabled:i.shadowMap.enabled&&V.length>0,shadowMapType:i.shadowMap.type,toneMapping:st,decodeVideoTexture:zt&&I.map.isVideoTexture===!0&&Rn.getTransfer(I.map.colorSpace)===Fi,decodeVideoTextureEmissive:Ae&&I.emissiveMap.isVideoTexture===!0&&Rn.getTransfer(I.emissiveMap.colorSpace)===Fi,premultipliedAlpha:I.premultipliedAlpha,doubleSided:I.side===Ga,flipSided:I.side===Mo,useDepthPacking:I.depthPacking>=0,depthPacking:I.depthPacking||0,index0AttributeName:I.index0AttributeName,extensionClipCullDistance:At&&I.extensions.clipCullDistance===!0&&e.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(At&&I.extensions.multiDraw===!0||Ut)&&e.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:e.has("KHR_parallel_shader_compile"),customProgramCacheKey:I.customProgramCacheKey()};return rt.vertexUv1s=l.has(1),rt.vertexUv2s=l.has(2),rt.vertexUv3s=l.has(3),l.clear(),rt}function x(I){let U=[];if(I.shaderID?U.push(I.shaderID):(U.push(I.customVertexShaderID),U.push(I.customFragmentShaderID)),I.defines!==void 0)for(let V in I.defines)U.push(V),U.push(I.defines[V]);return I.isRawShaderMaterial===!1&&(w(U,I),M(U,I),U.push(i.outputColorSpace)),U.push(I.customProgramCacheKey),U.join()}function w(I,U){I.push(U.precision),I.push(U.outputColorSpace),I.push(U.envMapMode),I.push(U.envMapCubeUVHeight),I.push(U.mapUv),I.push(U.alphaMapUv),I.push(U.lightMapUv),I.push(U.aoMapUv),I.push(U.bumpMapUv),I.push(U.normalMapUv),I.push(U.displacementMapUv),I.push(U.emissiveMapUv),I.push(U.metalnessMapUv),I.push(U.roughnessMapUv),I.push(U.anisotropyMapUv),I.push(U.clearcoatMapUv),I.push(U.clearcoatNormalMapUv),I.push(U.clearcoatRoughnessMapUv),I.push(U.iridescenceMapUv),I.push(U.iridescenceThicknessMapUv),I.push(U.sheenColorMapUv),I.push(U.sheenRoughnessMapUv),I.push(U.specularMapUv),I.push(U.specularColorMapUv),I.push(U.specularIntensityMapUv),I.push(U.transmissionMapUv),I.push(U.thicknessMapUv),I.push(U.combine),I.push(U.fogExp2),I.push(U.sizeAttenuation),I.push(U.morphTargetsCount),I.push(U.morphAttributeCount),I.push(U.numSunLights),I.push(U.numDirLights),I.push(U.numPointLights),I.push(U.numSpotLights),I.push(U.numSpotLightMaps),I.push(U.numHemiLights),I.push(U.numRectAreaLights),I.push(U.numSunLightShadows),I.push(U.numDirLightShadows),I.push(U.numPointLightShadows),I.push(U.numSpotLightShadows),I.push(U.numSpotLightShadowsWithMaps),I.push(U.numLightProbes),I.push(U.shadowMapType),I.push(U.toneMapping),I.push(U.numClippingPlanes),I.push(U.numClipIntersection),I.push(U.depthPacking)}function M(I,U){o.disableAll(),U.instancing&&o.enable(0),U.instancingColor&&o.enable(1),U.instancingMorph&&o.enable(2),U.matcap&&o.enable(3),U.envMap&&o.enable(4),U.normalMapObjectSpace&&o.enable(5),U.normalMapTangentSpace&&o.enable(6),U.clearcoat&&o.enable(7),U.iridescence&&o.enable(8),U.alphaTest&&o.enable(9),U.vertexColors&&o.enable(10),U.vertexAlphas&&o.enable(11),U.vertexUv1s&&o.enable(12),U.vertexUv2s&&o.enable(13),U.vertexUv3s&&o.enable(14),U.vertexTangents&&o.enable(15),U.anisotropy&&o.enable(16),U.alphaHash&&o.enable(17),U.batching&&o.enable(18),U.dispersion&&o.enable(19),U.retroreflection&&o.enable(24),U.batchingColor&&o.enable(20),U.gradientMap&&o.enable(21),U.packedNormalMap&&o.enable(22),U.vertexNormals&&o.enable(23),I.push(o.mask),o.disableAll(),U.fog&&o.enable(0),U.useFog&&o.enable(1),U.flatShading&&o.enable(2),U.logarithmicDepthBuffer&&o.enable(3),U.reversedDepthBuffer&&o.enable(4),U.skinning&&o.enable(5),U.morphTargets&&o.enable(6),U.morphNormals&&o.enable(7),U.morphColors&&o.enable(8),U.premultipliedAlpha&&o.enable(9),U.shadowMapEnabled&&o.enable(10),U.doubleSided&&o.enable(11),U.flipSided&&o.enable(12),U.useDepthPacking&&o.enable(13),U.dithering&&o.enable(14),U.transmission&&o.enable(15),U.sheen&&o.enable(16),U.opaque&&o.enable(17),U.pointsUvs&&o.enable(18),U.decodeVideoTexture&&o.enable(19),U.decodeVideoTextureEmissive&&o.enable(20),U.alphaToCoverage&&o.enable(21),U.numLightProbeGrids>0&&o.enable(22),U.hasPositionAttribute&&o.enable(23),I.push(o.mask)}function A(I){let U=p[I.type],V;if(U){let q=wc[U];V=HU.clone(q.uniforms)}else V=I.uniforms;return V}function C(I,U){let V=u.get(U);return V!==void 0?++V.usedTimes:(V=new ZLt(i,U,I,s),c.push(V),u.set(U,V)),V}function R(I){if(--I.usedTimes===0){let U=c.indexOf(I);c[U]=c[c.length-1],c.pop(),u.delete(I.cacheKey),I.destroy()}}function k(I){a.remove(I)}function O(){a.dispose()}return{getParameters:y,getProgramCacheKey:x,getUniforms:A,acquireProgram:C,releaseProgram:R,releaseShaderCache:k,programs:c,dispose:O}}function nIt(){let i=new WeakMap;function t(o){return i.has(o)}function e(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function s(o,a,l){i.get(o)[a]=l}function r(){i=new WeakMap}return{has:t,get:e,remove:n,update:s,dispose:r}}function iIt(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.material.id!==t.material.id?i.material.id-t.material.id:i.materialVariant!==t.materialVariant?i.materialVariant-t.materialVariant:i.z!==t.z?i.z-t.z:i.id-t.id}function cet(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.z!==t.z?t.z-i.z:i.id-t.id}function uet(){let i=[],t=0,e=[],n=[],s=[];function r(){t=0,e.length=0,n.length=0,s.length=0}function o(d){let p=0;return d.isInstancedMesh&&(p+=2),d.isSkinnedMesh&&(p+=1),p}function a(d,p,g,y,x,w){let M=i[t];return M===void 0?(M={id:d.id,object:d,geometry:p,material:g,materialVariant:o(d),groupOrder:y,renderOrder:d.renderOrder,z:x,group:w},i[t]=M):(M.id=d.id,M.object=d,M.geometry=p,M.material=g,M.materialVariant=o(d),M.groupOrder=y,M.renderOrder=d.renderOrder,M.z=x,M.group=w),t++,M}function l(d,p,g,y,x,w,M){M.reversedDepth===!0&&(x=-x);let A=a(d,p,g,y,x,w);g.transmission>0?n.push(A):g.transparent===!0?s.push(A):e.push(A)}function c(d,p,g,y,x,w){let M=a(d,p,g,y,x,w);g.transmission>0?n.unshift(M):g.transparent===!0?s.unshift(M):e.unshift(M)}function u(d,p){e.length>1&&e.sort(d||iIt),n.length>1&&n.sort(p||cet),s.length>1&&s.sort(p||cet)}function h(){for(let d=t,p=i.length;d<p;d++){let g=i[d];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:e,transmissive:n,transparent:s,init:r,push:l,unshift:c,finish:h,sort:u}}function sIt(){let i=new WeakMap;function t(n,s){let r=i.get(n),o;return r===void 0?(o=new uet,i.set(n,[o])):s>=r.length?(o=new uet,r.push(o)):o=r[s],o}function e(){i=new WeakMap}return{get:t,dispose:e}}function rIt(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"SunLight":case"DirectionalLight":e={direction:new bt,color:new Be};break;case"SpotLight":e={position:new bt,direction:new bt,color:new Be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new bt,color:new Be,distance:0,decay:0};break;case"HemisphereLight":e={direction:new bt,skyColor:new Be,groundColor:new Be};break;case"RectAreaLight":e={color:new Be,position:new bt,halfWidth:new bt,halfHeight:new bt};break}return i[t.id]=e,e}}}function oIt(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"SunLight":case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ce};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ce};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ce,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}function lIt(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function cIt(i){let t=new rIt,e=oIt(),n={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new bt);let s=new bt,r=new tn,o=new tn;function a(c){let u=0,h=0,d=0;for(let X=0;X<9;X++)n.probe[X].set(0,0,0);let p=0,g=0,y=0,x=0,w=0,M=0,A=0,C=0,R=0,k=0,O=0,I=0,U=0,V=0;c.sort(lIt);for(let X=0,j=c.length;X<j;X++){let W=c[X],_=W.color,at=W.intensity,ct=W.distance,pt=null;if(W.shadow&&W.shadow.map&&(W.shadow.map.texture.format===xh?pt=W.shadow.map.texture:pt=W.shadow.map.depthTexture||W.shadow.map.texture),W.isAmbientLight)u+=_.r*at,h+=_.g*at,d+=_.b*at;else if(W.isLightProbe){for(let Et=0;Et<9;Et++)n.probe[Et].addScaledVector(W.sh.coefficients[Et],at);V++}else if(W.isSunLight){let Et=t.get(W);if(Et.color.copy(W.color).multiplyScalar(W.intensity),W.castShadow){let vt=W.shadow,yt=e.get(W);yt.shadowIntensity=vt.intensity,yt.shadowBias=vt.bias,yt.shadowNormalBias=vt.normalBias,yt.shadowRadius=vt.radius,yt.shadowMapSize.copy(vt.mapSize).multiply(vt.getFrameExtents()),n.sunShadow[g]=yt,n.sunShadowMap[g]=pt;let kt=vt.getViewportCount();for(let Wt=0;Wt<kt;Wt++)n.sunShadowMatrix[y+Wt]=vt.getMatrix(Wt),n.sunShadowCascade[y+Wt]=vt._cascadeData[Wt];y+=kt,g++}n.sun[p]=Et,p++}else if(W.isDirectionalLight){let Et=t.get(W);if(Et.color.copy(W.color).multiplyScalar(W.intensity),W.castShadow){let vt=W.shadow,yt=e.get(W);yt.shadowIntensity=vt.intensity,yt.shadowBias=vt.bias,yt.shadowNormalBias=vt.normalBias,yt.shadowRadius=vt.radius,yt.shadowMapSize=vt.mapSize,n.directionalShadow[x]=yt,n.directionalShadowMap[x]=pt,n.directionalShadowMatrix[x]=W.shadow.matrix,R++}n.directional[x]=Et,x++}else if(W.isSpotLight){let Et=t.get(W);Et.position.setFromMatrixPosition(W.matrixWorld),Et.color.copy(_).multiplyScalar(at),Et.distance=ct,Et.coneCos=Math.cos(W.angle),Et.penumbraCos=Math.cos(W.angle*(1-W.penumbra)),Et.decay=W.decay,n.spot[M]=Et;let vt=W.shadow;if(W.map&&(n.spotLightMap[I]=W.map,I++,vt.updateMatrices(W),W.castShadow&&U++),n.spotLightMatrix[M]=vt.matrix,W.castShadow){let yt=e.get(W);yt.shadowIntensity=vt.intensity,yt.shadowBias=vt.bias,yt.shadowNormalBias=vt.normalBias,yt.shadowRadius=vt.radius,yt.shadowMapSize=vt.mapSize,n.spotShadow[M]=yt,n.spotShadowMap[M]=pt,O++}M++}else if(W.isRectAreaLight){let Et=t.get(W);Et.color.copy(_).multiplyScalar(at),Et.halfWidth.set(W.width*.5,0,0),Et.halfHeight.set(0,W.height*.5,0),n.rectArea[A]=Et,A++}else if(W.isPointLight){let Et=t.get(W);if(Et.color.copy(W.color).multiplyScalar(W.intensity),Et.distance=W.distance,Et.decay=W.decay,W.castShadow){let vt=W.shadow,yt=e.get(W);yt.shadowIntensity=vt.intensity,yt.shadowBias=vt.bias,yt.shadowNormalBias=vt.normalBias,yt.shadowRadius=vt.radius,yt.shadowMapSize=vt.mapSize,yt.shadowCameraNear=vt.camera.near,yt.shadowCameraFar=vt.camera.far,n.pointShadow[w]=yt,n.pointShadowMap[w]=pt,n.pointShadowMatrix[w]=W.shadow.matrix,k++}n.point[w]=Et,w++}else if(W.isHemisphereLight){let Et=t.get(W);Et.skyColor.copy(W.color).multiplyScalar(at),Et.groundColor.copy(W.groundColor).multiplyScalar(at),n.hemi[C]=Et,C++}}A>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=on.LTC_FLOAT_1,n.rectAreaLTC2=on.LTC_FLOAT_2):(n.rectAreaLTC1=on.LTC_HALF_1,n.rectAreaLTC2=on.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=d;let q=n.hash;(q.sunLength!==p||q.directionalLength!==x||q.pointLength!==w||q.spotLength!==M||q.rectAreaLength!==A||q.hemiLength!==C||q.numSunShadows!==g||q.numDirectionalShadows!==R||q.numPointShadows!==k||q.numSpotShadows!==O||q.numSpotMaps!==I||q.numLightProbes!==V)&&(n.sun.length=p,n.directional.length=x,n.spot.length=M,n.rectArea.length=A,n.point.length=w,n.hemi.length=C,n.sunShadow.length=g,n.sunShadowMap.length=g,n.sunShadowMatrix.length=y,n.sunShadowCascade.length=y,n.directionalShadow.length=R,n.directionalShadowMap.length=R,n.directionalShadowMatrix.length=R,n.pointShadow.length=k,n.pointShadowMap.length=k,n.pointShadowMatrix.length=k,n.spotShadow.length=O,n.spotShadowMap.length=O,n.spotLightMatrix.length=O+I-U,n.spotLightMap.length=I,n.numSpotLightShadowsWithMaps=U,n.numLightProbes=V,q.sunLength=p,q.directionalLength=x,q.pointLength=w,q.spotLength=M,q.rectAreaLength=A,q.hemiLength=C,q.numSunShadows=g,q.numDirectionalShadows=R,q.numPointShadows=k,q.numSpotShadows=O,q.numSpotMaps=I,q.numLightProbes=V,n.version=aIt++)}function l(c,u){let h=0,d=0,p=0,g=0,y=0,x=0,w=u.matrixWorldInverse;for(let M=0,A=c.length;M<A;M++){let C=c[M];if(C.isSunLight){let R=n.sun[h];R.direction.setFromMatrixPosition(C.matrixWorld),R.direction.transformDirection(w),h++}else if(C.isDirectionalLight){let R=n.directional[d];R.direction.setFromMatrixPosition(C.matrixWorld),s.setFromMatrixPosition(C.target.matrixWorld),R.direction.sub(s),R.direction.transformDirection(w),d++}else if(C.isSpotLight){let R=n.spot[g];R.position.setFromMatrixPosition(C.matrixWorld),R.position.applyMatrix4(w),R.direction.setFromMatrixPosition(C.matrixWorld),s.setFromMatrixPosition(C.target.matrixWorld),R.direction.sub(s),R.direction.transformDirection(w),g++}else if(C.isRectAreaLight){let R=n.rectArea[y];R.position.setFromMatrixPosition(C.matrixWorld),R.position.applyMatrix4(w),o.identity(),r.copy(C.matrixWorld),r.premultiply(w),o.extractRotation(r),R.halfWidth.set(C.width*.5,0,0),R.halfHeight.set(0,C.height*.5,0),R.halfWidth.applyMatrix4(o),R.halfHeight.applyMatrix4(o),y++}else if(C.isPointLight){let R=n.point[p];R.position.setFromMatrixPosition(C.matrixWorld),R.position.applyMatrix4(w),p++}else if(C.isHemisphereLight){let R=n.hemi[x];R.direction.setFromMatrixPosition(C.matrixWorld),R.direction.transformDirection(w),x++}}}return{setup:a,setupView:l,state:n}}function het(i){let t=new cIt(i),e=[],n=[],s=[];function r(d){h.camera=d,e.length=0,n.length=0,s.length=0}function o(d){e.push(d)}function a(d){n.push(d)}function l(d){s.push(d)}function c(){t.setup(e)}function u(d){t.setupView(e,d)}let h={lightsArray:e,shadowsArray:n,lightProbeGridArray:s,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:h,setupLights:c,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:l}}function uIt(i){let t=new WeakMap;function e(s,r=0){let o=t.get(s),a;return o===void 0?(a=new het(i),t.set(s,[a])):r>=o.length?(a=new het(i),o.push(a)):a=o[r],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function gIt(i,t,e){let n=new ou,s=new Ce,r=new Ce,o=new pi,a=new Zb,l=new Qb,c={},u=e.maxTextureSize,h={[$a]:Mo,[Mo]:$a,[Ga]:Ga},d=new Zo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ce},radius:{value:4}},vertexShader:hIt,fragmentShader:dIt}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let g=new kn;g.setAttribute("position",new Mi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let y=new qi(g,d),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ov;let w=this.type;this.render=function(k,O,I){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||k.length===0)return;this.type===sU&&(Ze("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=ov);let U=i.getRenderTarget(),V=i.getActiveCubeFace(),q=i.getActiveMipmapLevel(),X=i.state;X.setBlending(yc),X.buffers.depth.getReversed()===!0?X.buffers.color.setClear(0,0,0,0):X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);let j=w!==this.type;j&&O.traverse(function(W){W.material&&(Array.isArray(W.material)?W.material.forEach(_=>_.needsUpdate=!0):W.material.needsUpdate=!0)});for(let W=0,_=k.length;W<_;W++){let at=k[W],ct=at.shadow;if(ct===void 0){Ze("WebGLShadowMap:",at,"has no shadow.");continue}if(ct.autoUpdate===!1&&ct.needsUpdate===!1)continue;s.copy(ct.mapSize);let pt=ct.getFrameExtents();s.multiply(pt),r.copy(ct.mapSize),(s.x>u||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/pt.x),s.x=r.x*pt.x,ct.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/pt.y),s.y=r.y*pt.y,ct.mapSize.y=r.y));let Et=i.state.buffers.depth.getReversed();if(ct.camera._reversedDepth=Et,ct.map===null||j===!0){if(ct.map!==null&&(ct.map.depthTexture!==null&&(ct.map.depthTexture.dispose(),ct.map.depthTexture=null),ct.map.dispose()),this.type===Dg){if(at.isPointLight){Ze("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}ct.map=new no(s.x,s.y,{format:xh,type:Tl,minFilter:$i,magFilter:$i,generateMipmaps:!1}),ct.map.texture.name=at.name+".shadowMap",ct.map.depthTexture=new dh(s.x,s.y,yo),ct.map.depthTexture.name=at.name+".shadowMapDepth",ct.map.depthTexture.format=dc,ct.map.depthTexture.compareFunction=null,ct.map.depthTexture.minFilter=xs,ct.map.depthTexture.magFilter=xs}else at.isPointLight?(ct.map=new X_(s.x),ct.map.depthTexture=new d1(s.x,qa)):(ct.map=new no(s.x,s.y),ct.map.depthTexture=new dh(s.x,s.y,qa)),ct.map.depthTexture.name=at.name+".shadowMap",ct.map.depthTexture.format=dc,this.type===ov?(ct.map.depthTexture.compareFunction=Et?H_:V_,ct.map.depthTexture.minFilter=$i,ct.map.depthTexture.magFilter=$i):(ct.map.depthTexture.compareFunction=null,ct.map.depthTexture.minFilter=xs,ct.map.depthTexture.magFilter=xs);ct.camera.updateProjectionMatrix()}ct.map.isWebGLCubeRenderTarget!==!0&&(ct.map.width!==s.x||ct.map.height!==s.y)&&ct.map.setSize(s.x,s.y);let vt=ct.map.isWebGLCubeRenderTarget?6:ct.getViewportCount();at.isPointLight!==!0&&ct.updateMatrices(at,I);for(let yt=0;yt<vt;yt++){let kt=ct.getCamera(yt);if(at.isPointLight){let Wt=ct.camera,jt=ct.matrix,ae=at.distance||Wt.far;ae!==Wt.far&&(Wt.far=ae,Wt.updateProjectionMatrix()),G_.setFromMatrixPosition(at.matrixWorld),Wt.position.copy(G_),JU.copy(Wt.position),JU.add(fIt[yt]),Wt.up.copy(pIt[yt]),Wt.lookAt(JU),Wt.updateMatrixWorld(),jt.makeTranslation(-G_.x,-G_.y,-G_.z),det.multiplyMatrices(Wt.projectionMatrix,Wt.matrixWorldInverse),ct._frustum.setFromProjectionMatrix(det,Wt.coordinateSystem,Wt.reversedDepth)}if(ct.map.isWebGLCubeRenderTarget)i.setRenderTarget(ct.map,yt),i.clear();else{yt===0&&(i.setRenderTarget(ct.map),i.clear());let Wt=ct.getViewport(yt);o.set(r.x*Wt.x,r.y*Wt.y,r.x*Wt.z,r.y*Wt.w),X.viewport(o)}n=ct.getFrustum(yt),C(O,I,kt,at,this.type)}ct.isPointLightShadow!==!0&&this.type===Dg&&M(ct,I),ct.needsUpdate=!1}w=this.type,x.needsUpdate=!1,i.setRenderTarget(U,V,q)};function M(k,O){let I=t.update(y);d.defines.VSM_SAMPLES!==k.blurSamples&&(d.defines.VSM_SAMPLES=k.blurSamples,p.defines.VSM_SAMPLES=k.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),k.mapPass===null?k.mapPass=new no(s.x,s.y,{format:xh,type:Tl}):(k.mapPass.width!==k.map.width||k.mapPass.height!==k.map.height)&&k.mapPass.setSize(k.map.width,k.map.height),d.uniforms.shadow_pass.value=k.map.depthTexture,d.uniforms.resolution.value.set(k.map.width,k.map.height),d.uniforms.radius.value=k.radius,i.setRenderTarget(k.mapPass),i.clear(),i.renderBufferDirect(O,null,I,d,y,null),p.uniforms.shadow_pass.value=k.mapPass.texture,p.uniforms.resolution.value.set(k.map.width,k.map.height),p.uniforms.radius.value=k.radius,i.setRenderTarget(k.map),i.clear(),i.renderBufferDirect(O,null,I,p,y,null)}function A(k,O,I,U){let V=null,q=I.isPointLight===!0?k.customDistanceMaterial:k.customDepthMaterial;if(q!==void 0)V=q;else if(V=I.isPointLight===!0?l:a,i.localClippingEnabled&&O.clipShadows===!0&&Array.isArray(O.clippingPlanes)&&O.clippingPlanes.length!==0||O.displacementMap&&O.displacementScale!==0||O.alphaMap&&O.alphaTest>0||O.map&&O.alphaTest>0||O.alphaToCoverage===!0){let X=V.uuid,j=O.uuid,W=c[X];W===void 0&&(W={},c[X]=W);let _=W[j];_===void 0&&(_=V.clone(),W[j]=_,O.addEventListener("dispose",R)),V=_}if(V.visible=O.visible,V.wireframe=O.wireframe,U===Dg?V.side=O.shadowSide!==null?O.shadowSide:O.side:V.side=O.shadowSide!==null?O.shadowSide:h[O.side],V.alphaMap=O.alphaMap,V.alphaTest=O.alphaToCoverage===!0?.5:O.alphaTest,V.map=O.map,V.clipShadows=O.clipShadows,V.clippingPlanes=O.clippingPlanes,V.clipIntersection=O.clipIntersection,V.displacementMap=O.displacementMap,V.displacementScale=O.displacementScale,V.displacementBias=O.displacementBias,V.wireframeLinewidth=O.wireframeLinewidth,V.linewidth=O.linewidth,I.isPointLight===!0&&V.isMeshDistanceMaterial===!0){let X=i.properties.get(V);X.light=I}return V}function C(k,O,I,U,V){if(k.visible===!1)return;if(k.layers.test(O.layers)&&(k.isMesh||k.isLine||k.isPoints)&&(k.castShadow||k.receiveShadow&&V===Dg)&&(!k.frustumCulled||k.intersectsFrustum(n))){k.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,k.matrixWorld);let j=t.update(k),W=k.material;if(Array.isArray(W)){let _=j.groups;for(let at=0,ct=_.length;at<ct;at++){let pt=_[at],Et=W[pt.materialIndex];if(Et&&Et.visible){let vt=A(k,Et,U,V);k.onBeforeShadow(i,k,O,I,j,vt,pt),i.renderBufferDirect(I,null,j,vt,k,pt),k.onAfterShadow(i,k,O,I,j,vt,pt)}}}else if(W.visible){let _=A(k,W,U,V);k.onBeforeShadow(i,k,O,I,j,_,null),i.renderBufferDirect(I,null,j,_,k,null),k.onAfterShadow(i,k,O,I,j,_,null)}}let X=k.children;for(let j=0,W=X.length;j<W;j++)C(X[j],O,I,U,V)}function R(k){k.target.removeEventListener("dispose",R);for(let I in c){let U=c[I],V=k.target.uuid;V in U&&(U[V].dispose(),delete U[V])}}}function mIt(i,t){function e(){let Ft=!1,Ee=new pi,J=null,lt=new pi(0,0,0,0);return{setMask:function(xt){J!==xt&&!Ft&&(i.colorMask(xt,xt,xt,xt),J=xt)},setLocked:function(xt){Ft=xt},setClear:function(xt,At,st,rt,Tt){Tt===!0&&(xt*=rt,At*=rt,st*=rt),Ee.set(xt,At,st,rt),lt.equals(Ee)===!1&&(i.clearColor(xt,At,st,rt),lt.copy(Ee))},reset:function(){Ft=!1,J=null,lt.set(-1,0,0,0)}}}function n(){let Ft=!1,Ee=!1,J=null,lt=null,xt=null;return{setReversed:function(At){if(Ee!==At){let st=t.get("EXT_clip_control");At?st.clipControlEXT(st.LOWER_LEFT_EXT,st.ZERO_TO_ONE_EXT):st.clipControlEXT(st.LOWER_LEFT_EXT,st.NEGATIVE_ONE_TO_ONE_EXT),Ee=At;let rt=xt;xt=null,this.setClear(rt)}},getReversed:function(){return Ee},setTest:function(At){At?Gt(i.DEPTH_TEST):Qt(i.DEPTH_TEST)},setMask:function(At){J!==At&&!Ft&&(i.depthMask(At),J=At)},setFunc:function(At){if(Ee&&(At=Itt[At]),lt!==At){switch(At){case Kw:i.depthFunc(i.NEVER);break;case Jw:i.depthFunc(i.ALWAYS);break;case Zw:i.depthFunc(i.LESS);break;case mg:i.depthFunc(i.LEQUAL);break;case Qw:i.depthFunc(i.EQUAL);break;case t1:i.depthFunc(i.GEQUAL);break;case e1:i.depthFunc(i.GREATER);break;case n1:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}lt=At}},setLocked:function(At){Ft=At},setClear:function(At){xt!==At&&(xt=At,Ee&&(At=1-At),i.clearDepth(At))},reset:function(){Ft=!1,J=null,lt=null,xt=null,Ee=!1}}}function s(){let Ft=!1,Ee=null,J=null,lt=null,xt=null,At=null,st=null,rt=null,Tt=null;return{setTest:function(Dt){Ft||(Dt?Gt(i.STENCIL_TEST):Qt(i.STENCIL_TEST))},setMask:function(Dt){Ee!==Dt&&!Ft&&(i.stencilMask(Dt),Ee=Dt)},setFunc:function(Dt,he,se){(J!==Dt||lt!==he||xt!==se)&&(i.stencilFunc(Dt,he,se),J=Dt,lt=he,xt=se)},setOp:function(Dt,he,se){(At!==Dt||st!==he||rt!==se)&&(i.stencilOp(Dt,he,se),At=Dt,st=he,rt=se)},setLocked:function(Dt){Ft=Dt},setClear:function(Dt){Tt!==Dt&&(i.clearStencil(Dt),Tt=Dt)},reset:function(){Ft=!1,Ee=null,J=null,lt=null,xt=null,At=null,st=null,rt=null,Tt=null}}}let r=new e,o=new n,a=new s,l=new WeakMap,c=new WeakMap,u={},h={},d={},p=new WeakMap,g=[],y=null,x=!1,w=null,M=null,A=null,C=null,R=null,k=null,O=null,I=new Be(0,0,0),U=0,V=!1,q=null,X=null,j=null,W=null,_=null,at=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ct=!1,pt=0,Et=i.getParameter(i.VERSION);Et.indexOf("WebGL")!==-1?(pt=parseFloat(/^WebGL (\d)/.exec(Et)[1]),ct=pt>=1):Et.indexOf("OpenGL ES")!==-1&&(pt=parseFloat(/^OpenGL ES (\d)/.exec(Et)[1]),ct=pt>=2);let vt=null,yt={},kt=i.getParameter(i.SCISSOR_BOX),Wt=i.getParameter(i.VIEWPORT),jt=new pi().fromArray(kt),ae=new pi().fromArray(Wt);function ee(Ft,Ee,J,lt){let xt=new Uint8Array(4),At=i.createTexture();i.bindTexture(Ft,At),i.texParameteri(Ft,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(Ft,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let st=0;st<J;st++)Ft===i.TEXTURE_3D||Ft===i.TEXTURE_2D_ARRAY?i.texImage3D(Ee,0,i.RGBA,1,1,lt,0,i.RGBA,i.UNSIGNED_BYTE,xt):i.texImage2D(Ee+st,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,xt);return At}let Bt={};Bt[i.TEXTURE_2D]=ee(i.TEXTURE_2D,i.TEXTURE_2D,1),Bt[i.TEXTURE_CUBE_MAP]=ee(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Bt[i.TEXTURE_2D_ARRAY]=ee(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Bt[i.TEXTURE_3D]=ee(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),o.setClear(1),a.setClear(0),Gt(i.DEPTH_TEST),o.setFunc(mg),de(!1),ve(Sk),Gt(i.CULL_FACE),gt(yc);function Gt(Ft){u[Ft]!==!0&&(i.enable(Ft),u[Ft]=!0)}function Qt(Ft){u[Ft]!==!1&&(i.disable(Ft),u[Ft]=!1)}function xe(Ft,Ee){return d[Ft]!==Ee?(i.bindFramebuffer(Ft,Ee),d[Ft]=Ee,Ft===i.DRAW_FRAMEBUFFER&&(d[i.FRAMEBUFFER]=Ee),Ft===i.FRAMEBUFFER&&(d[i.DRAW_FRAMEBUFFER]=Ee),!0):!1}function Ut(Ft,Ee){let J=g,lt=!1;if(Ft){J=p.get(Ee),J===void 0&&(J=[],p.set(Ee,J));let xt=Ft.textures;if(J.length!==xt.length||J[0]!==i.COLOR_ATTACHMENT0){for(let At=0,st=xt.length;At<st;At++)J[At]=i.COLOR_ATTACHMENT0+At;J.length=xt.length,lt=!0}}else J[0]!==i.BACK&&(J[0]=i.BACK,lt=!0);lt&&i.drawBuffers(J)}function zt(Ft){return y!==Ft?(i.useProgram(Ft),y=Ft,!0):!1}let St={[af]:i.FUNC_ADD,[oU]:i.FUNC_SUBTRACT,[aU]:i.FUNC_REVERSE_SUBTRACT};St[lU]=i.MIN,St[cU]=i.MAX;let it={[uU]:i.ZERO,[hU]:i.ONE,[dU]:i.SRC_COLOR,[Ak]:i.SRC_ALPHA,[vU]:i.SRC_ALPHA_SATURATE,[mU]:i.DST_COLOR,[pU]:i.DST_ALPHA,[fU]:i.ONE_MINUS_SRC_COLOR,[Ek]:i.ONE_MINUS_SRC_ALPHA,[bU]:i.ONE_MINUS_DST_COLOR,[gU]:i.ONE_MINUS_DST_ALPHA,[yU]:i.CONSTANT_COLOR,[xU]:i.ONE_MINUS_CONSTANT_COLOR,[wU]:i.CONSTANT_ALPHA,[_U]:i.ONE_MINUS_CONSTANT_ALPHA};function gt(Ft,Ee,J,lt,xt,At,st,rt,Tt,Dt){if(Ft===yc){x===!0&&(Qt(i.BLEND),x=!1);return}if(x===!1&&(Gt(i.BLEND),x=!0),Ft!==rU){if(Ft!==w||Dt!==V){if((M!==af||R!==af)&&(i.blendEquation(i.FUNC_ADD),M=af,R=af),Dt)switch(Ft){case Lg:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Ck:i.blendFunc(i.ONE,i.ONE);break;case Mk:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Tk:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Tn("WebGLState: Invalid blending: ",Ft);break}else switch(Ft){case Lg:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Ck:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Mk:Tn("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Tk:Tn("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Tn("WebGLState: Invalid blending: ",Ft);break}A=null,C=null,k=null,O=null,I.set(0,0,0),U=0,w=Ft,V=Dt}return}xt=xt||Ee,At=At||J,st=st||lt,(Ee!==M||xt!==R)&&(i.blendEquationSeparate(St[Ee],St[xt]),M=Ee,R=xt),(J!==A||lt!==C||At!==k||st!==O)&&(i.blendFuncSeparate(it[J],it[lt],it[At],it[st]),A=J,C=lt,k=At,O=st),(rt.equals(I)===!1||Tt!==U)&&(i.blendColor(rt.r,rt.g,rt.b,Tt),I.copy(rt),U=Tt),w=Ft,V=!1}function ft(Ft,Ee){Ft.side===Ga?Qt(i.CULL_FACE):Gt(i.CULL_FACE);let J=Ft.side===Mo;Ee&&(J=!J),de(J),Ft.blending===Lg&&Ft.transparent===!1?gt(yc):gt(Ft.blending,Ft.blendEquation,Ft.blendSrc,Ft.blendDst,Ft.blendEquationAlpha,Ft.blendSrcAlpha,Ft.blendDstAlpha,Ft.blendColor,Ft.blendAlpha,Ft.premultipliedAlpha),o.setFunc(Ft.depthFunc),o.setTest(Ft.depthTest),o.setMask(Ft.depthWrite),r.setMask(Ft.colorWrite);let lt=Ft.stencilWrite;a.setTest(lt),lt&&(a.setMask(Ft.stencilWriteMask),a.setFunc(Ft.stencilFunc,Ft.stencilRef,Ft.stencilFuncMask),a.setOp(Ft.stencilFail,Ft.stencilZFail,Ft.stencilZPass)),Ae(Ft.polygonOffset,Ft.polygonOffsetFactor,Ft.polygonOffsetUnits),Ft.alphaToCoverage===!0?Gt(i.SAMPLE_ALPHA_TO_COVERAGE):Qt(i.SAMPLE_ALPHA_TO_COVERAGE)}function de(Ft){q!==Ft&&(Ft?i.frontFace(i.CW):i.frontFace(i.CCW),q=Ft)}function ve(Ft){Ft!==nU?(Gt(i.CULL_FACE),Ft!==X&&(Ft===Sk?i.cullFace(i.BACK):Ft===iU?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Qt(i.CULL_FACE),X=Ft}function we(Ft){Ft!==j&&(ct&&i.lineWidth(Ft),j=Ft)}function Ae(Ft,Ee,J){Ft?(Gt(i.POLYGON_OFFSET_FILL),(W!==Ee||_!==J)&&(W=Ee,_=J,o.getReversed()&&(Ee=-Ee),i.polygonOffset(Ee,J))):Qt(i.POLYGON_OFFSET_FILL)}function Ue(Ft){Ft?Gt(i.SCISSOR_TEST):Qt(i.SCISSOR_TEST)}function en(Ft){Ft===void 0&&(Ft=i.TEXTURE0+at-1),vt!==Ft&&(i.activeTexture(Ft),vt=Ft)}function It(Ft,Ee,J){J===void 0&&(vt===null?J=i.TEXTURE0+at-1:J=vt);let lt=yt[J];lt===void 0&&(lt={type:void 0,texture:void 0},yt[J]=lt),(lt.type!==Ft||lt.texture!==Ee)&&(vt!==J&&(i.activeTexture(J),vt=J),i.bindTexture(Ft,Ee||Bt[Ft]),lt.type=Ft,lt.texture=Ee)}function Cn(){let Ft=yt[vt];Ft!==void 0&&Ft.type!==void 0&&(i.bindTexture(Ft.type,null),Ft.type=void 0,Ft.texture=void 0)}function mn(){try{i.compressedTexImage2D(...arguments)}catch(Ft){Tn("WebGLState:",Ft)}}function mt(){try{i.compressedTexImage3D(...arguments)}catch(Ft){Tn("WebGLState:",Ft)}}function K(){try{i.texSubImage2D(...arguments)}catch(Ft){Tn("WebGLState:",Ft)}}function Vt(){try{i.texSubImage3D(...arguments)}catch(Ft){Tn("WebGLState:",Ft)}}function te(){try{i.compressedTexSubImage2D(...arguments)}catch(Ft){Tn("WebGLState:",Ft)}}function Nt(){try{i.compressedTexSubImage3D(...arguments)}catch(Ft){Tn("WebGLState:",Ft)}}function Se(){try{i.texStorage2D(...arguments)}catch(Ft){Tn("WebGLState:",Ft)}}function Me(){try{i.texStorage3D(...arguments)}catch(Ft){Tn("WebGLState:",Ft)}}function ie(){try{i.texImage2D(...arguments)}catch(Ft){Tn("WebGLState:",Ft)}}function _t(){try{i.texImage3D(...arguments)}catch(Ft){Tn("WebGLState:",Ft)}}function Zt(Ft){return h[Ft]!==void 0?h[Ft]:i.getParameter(Ft)}function fe(Ft,Ee){h[Ft]!==Ee&&(i.pixelStorei(Ft,Ee),h[Ft]=Ee)}function ce(Ft){jt.equals(Ft)===!1&&(i.scissor(Ft.x,Ft.y,Ft.z,Ft.w),jt.copy(Ft))}function pe(Ft){ae.equals(Ft)===!1&&(i.viewport(Ft.x,Ft.y,Ft.z,Ft.w),ae.copy(Ft))}function Fe(Ft,Ee){let J=c.get(Ee);J===void 0&&(J=new WeakMap,c.set(Ee,J));let lt=J.get(Ft);lt===void 0&&(lt=i.getUniformBlockIndex(Ee,Ft.name),J.set(Ft,lt))}function je(Ft,Ee){let lt=c.get(Ee).get(Ft);l.get(Ee)!==lt&&(i.uniformBlockBinding(Ee,lt,Ft.__bindingPointIndex),l.set(Ee,lt))}function Re(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},h={},vt=null,yt={},d={},p=new WeakMap,g=[],y=null,x=!1,w=null,M=null,A=null,C=null,R=null,k=null,O=null,I=new Be(0,0,0),U=0,V=!1,q=null,X=null,j=null,W=null,_=null,jt.set(0,0,i.canvas.width,i.canvas.height),ae.set(0,0,i.canvas.width,i.canvas.height),r.reset(),o.reset(),a.reset()}return{buffers:{color:r,depth:o,stencil:a},enable:Gt,disable:Qt,bindFramebuffer:xe,drawBuffers:Ut,useProgram:zt,setBlending:gt,setMaterial:ft,setFlipSided:de,setCullFace:ve,setLineWidth:we,setPolygonOffset:Ae,setScissorTest:Ue,activeTexture:en,bindTexture:It,unbindTexture:Cn,compressedTexImage2D:mn,compressedTexImage3D:mt,texImage2D:ie,texImage3D:_t,pixelStorei:fe,getParameter:Zt,updateUBOMapping:Fe,uniformBlockBinding:je,texStorage2D:Se,texStorage3D:Me,texSubImage2D:K,texSubImage3D:Vt,compressedTexSubImage2D:te,compressedTexSubImage3D:Nt,scissor:ce,viewport:pe,reset:Re}}function bIt(i,t,e,n,s,r,o){let a=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ce,u=new WeakMap,h=new Set,d,p=new WeakMap,g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(mt,K){return g?new OffscreenCanvas(mt,K):Ob("canvas")}function x(mt,K,Vt){let te=1,Nt=mn(mt);if((Nt.width>Vt||Nt.height>Vt)&&(te=Vt/Math.max(Nt.width,Nt.height)),te<1)if(typeof HTMLImageElement<"u"&&mt instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&mt instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&mt instanceof ImageBitmap||typeof VideoFrame<"u"&&mt instanceof VideoFrame){let Se=Math.floor(te*Nt.width),Me=Math.floor(te*Nt.height);d===void 0&&(d=y(Se,Me));let ie=K?y(Se,Me):d;return ie.width=Se,ie.height=Me,ie.getContext("2d").drawImage(mt,0,0,Se,Me),Ze("WebGLRenderer: Texture has been resized from ("+Nt.width+"x"+Nt.height+") to ("+Se+"x"+Me+")."),ie}else return"data"in mt&&Ze("WebGLRenderer: Image in DataTexture is too big ("+Nt.width+"x"+Nt.height+")."),mt;return mt}function w(mt){return mt.generateMipmaps}function M(mt){i.generateMipmap(mt)}function A(mt){return mt.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:mt.isWebGL3DRenderTarget?i.TEXTURE_3D:mt.isWebGLArrayRenderTarget||mt.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function C(mt,K,Vt,te,Nt,Se=!1){if(mt!==null){if(i[mt]!==void 0)return i[mt];Ze("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+mt+"'")}let Me;te&&(Me=t.get("EXT_texture_norm16"),Me||Ze("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let ie=K;if(K===i.RED&&(Vt===i.FLOAT&&(ie=i.R32F),Vt===i.HALF_FLOAT&&(ie=i.R16F),Vt===i.UNSIGNED_BYTE&&(ie=i.R8),Vt===i.UNSIGNED_SHORT&&Me&&(ie=Me.R16_EXT),Vt===i.SHORT&&Me&&(ie=Me.R16_SNORM_EXT)),K===i.RED_INTEGER&&(Vt===i.UNSIGNED_BYTE&&(ie=i.R8UI),Vt===i.UNSIGNED_SHORT&&(ie=i.R16UI),Vt===i.UNSIGNED_INT&&(ie=i.R32UI),Vt===i.BYTE&&(ie=i.R8I),Vt===i.SHORT&&(ie=i.R16I),Vt===i.INT&&(ie=i.R32I)),K===i.RG&&(Vt===i.FLOAT&&(ie=i.RG32F),Vt===i.HALF_FLOAT&&(ie=i.RG16F),Vt===i.UNSIGNED_BYTE&&(ie=i.RG8),Vt===i.UNSIGNED_SHORT&&Me&&(ie=Me.RG16_EXT),Vt===i.SHORT&&Me&&(ie=Me.RG16_SNORM_EXT)),K===i.RG_INTEGER&&(Vt===i.UNSIGNED_BYTE&&(ie=i.RG8UI),Vt===i.UNSIGNED_SHORT&&(ie=i.RG16UI),Vt===i.UNSIGNED_INT&&(ie=i.RG32UI),Vt===i.BYTE&&(ie=i.RG8I),Vt===i.SHORT&&(ie=i.RG16I),Vt===i.INT&&(ie=i.RG32I)),K===i.RGB_INTEGER&&(Vt===i.UNSIGNED_BYTE&&(ie=i.RGB8UI),Vt===i.UNSIGNED_SHORT&&(ie=i.RGB16UI),Vt===i.UNSIGNED_INT&&(ie=i.RGB32UI),Vt===i.BYTE&&(ie=i.RGB8I),Vt===i.SHORT&&(ie=i.RGB16I),Vt===i.INT&&(ie=i.RGB32I)),K===i.RGBA_INTEGER&&(Vt===i.UNSIGNED_BYTE&&(ie=i.RGBA8UI),Vt===i.UNSIGNED_SHORT&&(ie=i.RGBA16UI),Vt===i.UNSIGNED_INT&&(ie=i.RGBA32UI),Vt===i.BYTE&&(ie=i.RGBA8I),Vt===i.SHORT&&(ie=i.RGBA16I),Vt===i.INT&&(ie=i.RGBA32I)),K===i.RGB&&(Vt===i.UNSIGNED_SHORT&&Me&&(ie=Me.RGB16_EXT),Vt===i.SHORT&&Me&&(ie=Me.RGB16_SNORM_EXT),Vt===i.UNSIGNED_INT_5_9_9_9_REV&&(ie=i.RGB9_E5),Vt===i.UNSIGNED_INT_10F_11F_11F_REV&&(ie=i.R11F_G11F_B10F)),K===i.RGBA){let _t=Se?Ib:Rn.getTransfer(Nt);Vt===i.FLOAT&&(ie=i.RGBA32F),Vt===i.HALF_FLOAT&&(ie=i.RGBA16F),Vt===i.UNSIGNED_BYTE&&(ie=_t===Fi?i.SRGB8_ALPHA8:i.RGBA8),Vt===i.UNSIGNED_SHORT&&Me&&(ie=Me.RGBA16_EXT),Vt===i.SHORT&&Me&&(ie=Me.RGBA16_SNORM_EXT),Vt===i.UNSIGNED_SHORT_4_4_4_4&&(ie=i.RGBA4),Vt===i.UNSIGNED_SHORT_5_5_5_1&&(ie=i.RGB5_A1)}return(ie===i.R16F||ie===i.R32F||ie===i.RG16F||ie===i.RG32F||ie===i.RGBA16F||ie===i.RGBA32F)&&t.get("EXT_color_buffer_float"),ie}function R(mt,K){let Vt;return mt?K===null||K===qa||K===Ng?Vt=i.DEPTH24_STENCIL8:K===yo?Vt=i.DEPTH32F_STENCIL8:K===Og&&(Vt=i.DEPTH24_STENCIL8,Ze("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):K===null||K===qa||K===Ng?Vt=i.DEPTH_COMPONENT24:K===yo?Vt=i.DEPTH_COMPONENT32F:K===Og&&(Vt=i.DEPTH_COMPONENT16),Vt}function k(mt,K){return w(mt)===!0||mt.isFramebufferTexture&&mt.minFilter!==xs&&mt.minFilter!==$i?Math.log2(Math.max(K.width,K.height))+1:mt.mipmaps!==void 0&&mt.mipmaps.length>0?mt.mipmaps.length:mt.isCompressedTexture&&Array.isArray(mt.image)?K.mipmaps.length:1}function O(mt){let K=mt.target;K.removeEventListener("dispose",O),U(K),K.isVideoTexture&&u.delete(K),K.isHTMLTexture&&h.delete(K)}function I(mt){let K=mt.target;K.removeEventListener("dispose",I),q(K)}function U(mt){let K=n.get(mt);if(K.__webglInit===void 0)return;let Vt=mt.source,te=p.get(Vt);if(te){let Nt=te[K.__cacheKey];Nt.usedTimes--,Nt.usedTimes===0&&V(mt),Object.keys(te).length===0&&p.delete(Vt)}n.remove(mt)}function V(mt){let K=n.get(mt);i.deleteTexture(K.__webglTexture);let Vt=mt.source,te=p.get(Vt);delete te[K.__cacheKey],o.memory.textures--}function q(mt){let K=n.get(mt);if(mt.depthTexture&&(mt.depthTexture.dispose(),n.remove(mt.depthTexture)),mt.isWebGLCubeRenderTarget)for(let te=0;te<6;te++){if(Array.isArray(K.__webglFramebuffer[te]))for(let Nt=0;Nt<K.__webglFramebuffer[te].length;Nt++)i.deleteFramebuffer(K.__webglFramebuffer[te][Nt]);else i.deleteFramebuffer(K.__webglFramebuffer[te]);K.__webglDepthbuffer&&i.deleteRenderbuffer(K.__webglDepthbuffer[te])}else{if(Array.isArray(K.__webglFramebuffer))for(let te=0;te<K.__webglFramebuffer.length;te++)i.deleteFramebuffer(K.__webglFramebuffer[te]);else i.deleteFramebuffer(K.__webglFramebuffer);if(K.__webglDepthbuffer&&i.deleteRenderbuffer(K.__webglDepthbuffer),K.__webglMultisampledFramebuffer&&i.deleteFramebuffer(K.__webglMultisampledFramebuffer),K.__webglColorRenderbuffer)for(let te=0;te<K.__webglColorRenderbuffer.length;te++)K.__webglColorRenderbuffer[te]&&i.deleteRenderbuffer(K.__webglColorRenderbuffer[te]);K.__webglDepthRenderbuffer&&i.deleteRenderbuffer(K.__webglDepthRenderbuffer)}let Vt=mt.textures;for(let te=0,Nt=Vt.length;te<Nt;te++){let Se=n.get(Vt[te]);Se.__webglTexture&&(i.deleteTexture(Se.__webglTexture),o.memory.textures--),n.remove(Vt[te])}n.remove(mt)}let X=0;function j(){X=0}function W(){return X}function _(mt){X=mt}function at(){let mt=X;return mt>=s.maxTextures&&Ze("WebGLTextures: Trying to use "+(mt+1)+" texture units while this GPU supports only "+s.maxTextures),X+=1,mt}function ct(mt){let K=[];return K.push(mt.wrapS),K.push(mt.wrapT),K.push(mt.wrapR||0),K.push(mt.magFilter),K.push(mt.minFilter),K.push(mt.anisotropy),K.push(mt.internalFormat),K.push(mt.format),K.push(mt.type),K.push(mt.generateMipmaps),K.push(mt.premultiplyAlpha),K.push(mt.flipY),K.push(mt.unpackAlignment),K.push(mt.colorSpace),K.join()}function pt(mt,K){let Vt=n.get(mt);if(mt.isVideoTexture&&It(mt),mt.isRenderTargetTexture===!1&&mt.isExternalTexture!==!0&&mt.version>0&&Vt.__version!==mt.version){let te=mt.image;if(te===null)Ze("WebGLRenderer: Texture marked for update but no image data found.");else if(te.complete===!1)Ze("WebGLRenderer: Texture marked for update but image is incomplete");else{Qt(Vt,mt,K);return}}else mt.isExternalTexture&&(Vt.__webglTexture=mt.sourceTexture?mt.sourceTexture:null);e.bindTexture(i.TEXTURE_2D,Vt.__webglTexture,i.TEXTURE0+K)}function Et(mt,K){let Vt=n.get(mt);if(mt.isRenderTargetTexture===!1&&mt.version>0&&Vt.__version!==mt.version){Qt(Vt,mt,K);return}else mt.isExternalTexture&&(Vt.__webglTexture=mt.sourceTexture?mt.sourceTexture:null);e.bindTexture(i.TEXTURE_2D_ARRAY,Vt.__webglTexture,i.TEXTURE0+K)}function vt(mt,K){let Vt=n.get(mt);if(mt.isRenderTargetTexture===!1&&mt.version>0&&Vt.__version!==mt.version){Qt(Vt,mt,K);return}e.bindTexture(i.TEXTURE_3D,Vt.__webglTexture,i.TEXTURE0+K)}function yt(mt,K){let Vt=n.get(mt);if(mt.isCubeDepthTexture!==!0&&mt.version>0&&Vt.__version!==mt.version){xe(Vt,mt,K);return}e.bindTexture(i.TEXTURE_CUBE_MAP,Vt.__webglTexture,i.TEXTURE0+K)}let kt={[Ko]:i.REPEAT,[pr]:i.CLAMP_TO_EDGE,[Xd]:i.MIRRORED_REPEAT},Wt={[xs]:i.NEAREST,[cv]:i.NEAREST_MIPMAP_NEAREST,[vh]:i.NEAREST_MIPMAP_LINEAR,[$i]:i.LINEAR,[cf]:i.LINEAR_MIPMAP_NEAREST,[Sa]:i.LINEAR_MIPMAP_LINEAR},jt={[DU]:i.NEVER,[BU]:i.ALWAYS,[LU]:i.LESS,[V_]:i.LEQUAL,[IU]:i.EQUAL,[H_]:i.GEQUAL,[OU]:i.GREATER,[NU]:i.NOTEQUAL};function ae(mt,K){if(K.type===yo&&t.has("OES_texture_float_linear")===!1&&(K.magFilter===$i||K.magFilter===cf||K.magFilter===vh||K.magFilter===Sa||K.minFilter===$i||K.minFilter===cf||K.minFilter===vh||K.minFilter===Sa)&&Ze("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(mt,i.TEXTURE_WRAP_S,kt[K.wrapS]),i.texParameteri(mt,i.TEXTURE_WRAP_T,kt[K.wrapT]),(mt===i.TEXTURE_3D||mt===i.TEXTURE_2D_ARRAY)&&i.texParameteri(mt,i.TEXTURE_WRAP_R,kt[K.wrapR]),i.texParameteri(mt,i.TEXTURE_MAG_FILTER,Wt[K.magFilter]),i.texParameteri(mt,i.TEXTURE_MIN_FILTER,Wt[K.minFilter]),K.compareFunction&&(i.texParameteri(mt,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(mt,i.TEXTURE_COMPARE_FUNC,jt[K.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(K.magFilter===xs||K.minFilter!==vh&&K.minFilter!==Sa||K.type===yo&&t.has("OES_texture_float_linear")===!1)return;if(K.anisotropy>1||n.get(K).__currentAnisotropy){let Vt=t.get("EXT_texture_filter_anisotropic");i.texParameterf(mt,Vt.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(K.anisotropy,s.getMaxAnisotropy())),n.get(K).__currentAnisotropy=K.anisotropy}}}function ee(mt,K){let Vt=!1;mt.__webglInit===void 0&&(mt.__webglInit=!0,K.addEventListener("dispose",O));let te=K.source,Nt=p.get(te);Nt===void 0&&(Nt={},p.set(te,Nt));let Se=ct(K);if(Se!==mt.__cacheKey){Nt[Se]===void 0&&(Nt[Se]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Vt=!0),Nt[Se].usedTimes++;let Me=Nt[mt.__cacheKey];Me!==void 0&&(Nt[mt.__cacheKey].usedTimes--,Me.usedTimes===0&&V(K)),mt.__cacheKey=Se,mt.__webglTexture=Nt[Se].texture}return Vt}function Bt(mt,K,Vt){return Math.floor(Math.floor(mt/Vt)/K)}function Gt(mt,K,Vt,te){let Se=mt.updateRanges;if(Se.length===0)e.texSubImage2D(i.TEXTURE_2D,0,0,0,K.width,K.height,Vt,te,K.data);else{Se.sort((fe,ce)=>fe.start-ce.start);let Me=0;for(let fe=1;fe<Se.length;fe++){let ce=Se[Me],pe=Se[fe],Fe=ce.start+ce.count,je=Bt(pe.start,K.width,4),Re=Bt(ce.start,K.width,4);pe.start<=Fe+1&&je===Re&&Bt(pe.start+pe.count-1,K.width,4)===je?ce.count=Math.max(ce.count,pe.start+pe.count-ce.start):(++Me,Se[Me]=pe)}Se.length=Me+1;let ie=e.getParameter(i.UNPACK_ROW_LENGTH),_t=e.getParameter(i.UNPACK_SKIP_PIXELS),Zt=e.getParameter(i.UNPACK_SKIP_ROWS);e.pixelStorei(i.UNPACK_ROW_LENGTH,K.width);for(let fe=0,ce=Se.length;fe<ce;fe++){let pe=Se[fe],Fe=Math.floor(pe.start/4),je=Math.ceil(pe.count/4),Re=Fe%K.width,Ft=Math.floor(Fe/K.width),Ee=je,J=1;e.pixelStorei(i.UNPACK_SKIP_PIXELS,Re),e.pixelStorei(i.UNPACK_SKIP_ROWS,Ft),e.texSubImage2D(i.TEXTURE_2D,0,Re,Ft,Ee,J,Vt,te,K.data)}mt.clearUpdateRanges(),e.pixelStorei(i.UNPACK_ROW_LENGTH,ie),e.pixelStorei(i.UNPACK_SKIP_PIXELS,_t),e.pixelStorei(i.UNPACK_SKIP_ROWS,Zt)}}function Qt(mt,K,Vt){let te=i.TEXTURE_2D;(K.isDataArrayTexture||K.isCompressedArrayTexture)&&(te=i.TEXTURE_2D_ARRAY),K.isData3DTexture&&(te=i.TEXTURE_3D);let Nt=ee(mt,K),Se=K.source;e.bindTexture(te,mt.__webglTexture,i.TEXTURE0+Vt);let Me=n.get(Se);if(Se.version!==Me.__version||Nt===!0){if(e.activeTexture(i.TEXTURE0+Vt),(typeof ImageBitmap<"u"&&K.image instanceof ImageBitmap)===!1){let J=Rn.getPrimaries(Rn.workingColorSpace),lt=K.colorSpace===fu?null:Rn.getPrimaries(K.colorSpace),xt=K.colorSpace===fu||J===lt?i.NONE:i.BROWSER_DEFAULT_WEBGL;e.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,K.flipY),e.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,K.premultiplyAlpha),e.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,xt)}e.pixelStorei(i.UNPACK_ALIGNMENT,K.unpackAlignment);let _t=x(K.image,!1,s.maxTextureSize);_t=Cn(K,_t);let Zt=r.convert(K.format,K.colorSpace),fe=r.convert(K.type),ce=C(K.internalFormat,Zt,fe,K.normalized,K.colorSpace,K.isVideoTexture);ae(te,K);let pe,Fe=K.mipmaps,je=K.isVideoTexture!==!0,Re=Me.__version===void 0||Nt===!0,Ft=Se.dataReady,Ee=k(K,_t);if(K.isDepthTexture)ce=R(K.format===yh,K.type),Re&&(je?e.texStorage2D(i.TEXTURE_2D,1,ce,_t.width,_t.height):e.texImage2D(i.TEXTURE_2D,0,ce,_t.width,_t.height,0,Zt,fe,null));else if(K.isDataTexture)if(Fe.length>0){je&&Re&&e.texStorage2D(i.TEXTURE_2D,Ee,ce,Fe[0].width,Fe[0].height);for(let J=0,lt=Fe.length;J<lt;J++)pe=Fe[J],je?Ft&&e.texSubImage2D(i.TEXTURE_2D,J,0,0,pe.width,pe.height,Zt,fe,pe.data):e.texImage2D(i.TEXTURE_2D,J,ce,pe.width,pe.height,0,Zt,fe,pe.data);K.generateMipmaps=!1}else je?(Re&&e.texStorage2D(i.TEXTURE_2D,Ee,ce,_t.width,_t.height),Ft&&Gt(K,_t,Zt,fe)):e.texImage2D(i.TEXTURE_2D,0,ce,_t.width,_t.height,0,Zt,fe,_t.data);else if(K.isCompressedTexture)if(K.isCompressedArrayTexture){je&&Re&&e.texStorage3D(i.TEXTURE_2D_ARRAY,Ee,ce,Fe[0].width,Fe[0].height,_t.depth);for(let J=0,lt=Fe.length;J<lt;J++)if(pe=Fe[J],K.format!==xo)if(Zt!==null)if(je){if(Ft)if(K.layerUpdates.size>0){let xt=$k(pe.width,pe.height,K.format,K.type);for(let At of K.layerUpdates){let st=pe.data.subarray(At*xt/pe.data.BYTES_PER_ELEMENT,(At+1)*xt/pe.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,J,0,0,At,pe.width,pe.height,1,Zt,st)}}else e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,J,0,0,0,pe.width,pe.height,_t.depth,Zt,pe.data)}else e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,J,ce,pe.width,pe.height,_t.depth,0,pe.data,0,0);else Ze("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else je?Ft&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,J,0,0,0,pe.width,pe.height,_t.depth,Zt,fe,pe.data):e.texImage3D(i.TEXTURE_2D_ARRAY,J,ce,pe.width,pe.height,_t.depth,0,Zt,fe,pe.data);K.layerUpdates.size>0&&K.clearLayerUpdates()}else{je&&Re&&e.texStorage2D(i.TEXTURE_2D,Ee,ce,Fe[0].width,Fe[0].height);for(let J=0,lt=Fe.length;J<lt;J++)pe=Fe[J],K.format!==xo?Zt!==null?je?Ft&&e.compressedTexSubImage2D(i.TEXTURE_2D,J,0,0,pe.width,pe.height,Zt,pe.data):e.compressedTexImage2D(i.TEXTURE_2D,J,ce,pe.width,pe.height,0,pe.data):Ze("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):je?Ft&&e.texSubImage2D(i.TEXTURE_2D,J,0,0,pe.width,pe.height,Zt,fe,pe.data):e.texImage2D(i.TEXTURE_2D,J,ce,pe.width,pe.height,0,Zt,fe,pe.data)}else if(K.isDataArrayTexture)if(je){if(Re&&e.texStorage3D(i.TEXTURE_2D_ARRAY,Ee,ce,_t.width,_t.height,_t.depth),Ft)if(K.layerUpdates.size>0){let J=$k(_t.width,_t.height,K.format,K.type);for(let lt of K.layerUpdates){let xt=_t.data.subarray(lt*J/_t.data.BYTES_PER_ELEMENT,(lt+1)*J/_t.data.BYTES_PER_ELEMENT);e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,lt,_t.width,_t.height,1,Zt,fe,xt)}K.clearLayerUpdates()}else e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,_t.width,_t.height,_t.depth,Zt,fe,_t.data)}else e.texImage3D(i.TEXTURE_2D_ARRAY,0,ce,_t.width,_t.height,_t.depth,0,Zt,fe,_t.data);else if(K.isData3DTexture)je?(Re&&e.texStorage3D(i.TEXTURE_3D,Ee,ce,_t.width,_t.height,_t.depth),Ft&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,_t.width,_t.height,_t.depth,Zt,fe,_t.data)):e.texImage3D(i.TEXTURE_3D,0,ce,_t.width,_t.height,_t.depth,0,Zt,fe,_t.data);else if(K.isFramebufferTexture){if(Re)if(je)e.texStorage2D(i.TEXTURE_2D,Ee,ce,_t.width,_t.height);else{let J=_t.width,lt=_t.height;for(let xt=0;xt<Ee;xt++)e.texImage2D(i.TEXTURE_2D,xt,ce,J,lt,0,Zt,fe,null),J>>=1,lt>>=1}}else if(K.isHTMLTexture){if("texElementImage2D"in i){let J=i.canvas;if(J.hasAttribute("layoutsubtree")||J.setAttribute("layoutsubtree","true"),_t.parentNode!==J){J.appendChild(_t),h.add(K),J.onpaint=lt=>{let xt=lt.changedElements;for(let At of h)xt.includes(At.image)&&(At.needsUpdate=!0)},J.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,_t);else{let xt=i.RGBA,At=i.RGBA,st=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,xt,At,st,_t)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(Fe.length>0){if(je&&Re){let J=mn(Fe[0]);e.texStorage2D(i.TEXTURE_2D,Ee,ce,J.width,J.height)}for(let J=0,lt=Fe.length;J<lt;J++)pe=Fe[J],je?Ft&&e.texSubImage2D(i.TEXTURE_2D,J,0,0,Zt,fe,pe):e.texImage2D(i.TEXTURE_2D,J,ce,Zt,fe,pe);K.generateMipmaps=!1}else if(je){if(Re){let J=mn(_t);e.texStorage2D(i.TEXTURE_2D,Ee,ce,J.width,J.height)}Ft&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,Zt,fe,_t)}else e.texImage2D(i.TEXTURE_2D,0,ce,Zt,fe,_t);w(K)&&M(te),Me.__version=Se.version,K.onUpdate&&K.onUpdate(K)}mt.__version=K.version}function xe(mt,K,Vt){if(K.image.length!==6)return;let te=ee(mt,K),Nt=K.source;e.bindTexture(i.TEXTURE_CUBE_MAP,mt.__webglTexture,i.TEXTURE0+Vt);let Se=n.get(Nt);if(Nt.version!==Se.__version||te===!0){e.activeTexture(i.TEXTURE0+Vt);let Me=Rn.getPrimaries(Rn.workingColorSpace),ie=K.colorSpace===fu?null:Rn.getPrimaries(K.colorSpace),_t=K.colorSpace===fu||Me===ie?i.NONE:i.BROWSER_DEFAULT_WEBGL;e.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,K.flipY),e.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,K.premultiplyAlpha),e.pixelStorei(i.UNPACK_ALIGNMENT,K.unpackAlignment),e.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,_t);let Zt=K.isCompressedTexture||K.image[0].isCompressedTexture,fe=K.image[0]&&K.image[0].isDataTexture,ce=[];for(let At=0;At<6;At++)!Zt&&!fe?ce[At]=x(K.image[At],!0,s.maxCubemapSize):ce[At]=fe?K.image[At].image:K.image[At],ce[At]=Cn(K,ce[At]);let pe=ce[0],Fe=r.convert(K.format,K.colorSpace),je=r.convert(K.type),Re=C(K.internalFormat,Fe,je,K.normalized,K.colorSpace),Ft=K.isVideoTexture!==!0,Ee=Se.__version===void 0||te===!0,J=Nt.dataReady,lt=k(K,pe);ae(i.TEXTURE_CUBE_MAP,K);let xt;if(Zt){Ft&&Ee&&e.texStorage2D(i.TEXTURE_CUBE_MAP,lt,Re,pe.width,pe.height);for(let At=0;At<6;At++){xt=ce[At].mipmaps;for(let st=0;st<xt.length;st++){let rt=xt[st];K.format!==xo?Fe!==null?Ft?J&&e.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,st,0,0,rt.width,rt.height,Fe,rt.data):e.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,st,Re,rt.width,rt.height,0,rt.data):Ze("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ft?J&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,st,0,0,rt.width,rt.height,Fe,je,rt.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,st,Re,rt.width,rt.height,0,Fe,je,rt.data)}}}else{if(xt=K.mipmaps,Ft&&Ee){xt.length>0&&lt++;let At=mn(ce[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,lt,Re,At.width,At.height)}for(let At=0;At<6;At++)if(fe){Ft?J&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,0,0,0,ce[At].width,ce[At].height,Fe,je,ce[At].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,0,Re,ce[At].width,ce[At].height,0,Fe,je,ce[At].data);for(let st=0;st<xt.length;st++){let Tt=xt[st].image[At].image;Ft?J&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,st+1,0,0,Tt.width,Tt.height,Fe,je,Tt.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,st+1,Re,Tt.width,Tt.height,0,Fe,je,Tt.data)}}else{Ft?J&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,0,0,0,Fe,je,ce[At]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,0,Re,Fe,je,ce[At]);for(let st=0;st<xt.length;st++){let rt=xt[st];Ft?J&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,st+1,0,0,Fe,je,rt.image[At]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+At,st+1,Re,Fe,je,rt.image[At])}}}w(K)&&M(i.TEXTURE_CUBE_MAP),Se.__version=Nt.version,K.onUpdate&&K.onUpdate(K)}mt.__version=K.version}function Ut(mt,K,Vt,te,Nt,Se){let Me=r.convert(Vt.format,Vt.colorSpace),ie=r.convert(Vt.type),_t=C(Vt.internalFormat,Me,ie,Vt.normalized,Vt.colorSpace),Zt=n.get(K),fe=n.get(Vt);if(fe.__renderTarget=K,!Zt.__hasExternalTextures){let ce=Math.max(1,K.width>>Se),pe=Math.max(1,K.height>>Se);Nt===i.TEXTURE_3D||Nt===i.TEXTURE_2D_ARRAY?e.texImage3D(Nt,Se,_t,ce,pe,K.depth,0,Me,ie,null):e.texImage2D(Nt,Se,_t,ce,pe,0,Me,ie,null)}e.bindFramebuffer(i.FRAMEBUFFER,mt),en(K)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,te,Nt,fe.__webglTexture,0,Ue(K)):(Nt===i.TEXTURE_2D||Nt>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Nt<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,te,Nt,fe.__webglTexture,Se),e.bindFramebuffer(i.FRAMEBUFFER,null)}function zt(mt,K,Vt){if(i.bindRenderbuffer(i.RENDERBUFFER,mt),K.depthBuffer){let te=K.depthTexture,Nt=te&&te.isDepthTexture?te.type:null,Se=R(K.stencilBuffer,Nt),Me=K.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;en(K)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ue(K),Se,K.width,K.height):Vt?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ue(K),Se,K.width,K.height):i.renderbufferStorage(i.RENDERBUFFER,Se,K.width,K.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Me,i.RENDERBUFFER,mt)}else{let te=K.textures;for(let Nt=0;Nt<te.length;Nt++){let Se=te[Nt],Me=r.convert(Se.format,Se.colorSpace),ie=r.convert(Se.type),_t=C(Se.internalFormat,Me,ie,Se.normalized,Se.colorSpace);en(K)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ue(K),_t,K.width,K.height):Vt?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ue(K),_t,K.width,K.height):i.renderbufferStorage(i.RENDERBUFFER,_t,K.width,K.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function St(mt,K,Vt){let te=K.isWebGLCubeRenderTarget===!0;if(e.bindFramebuffer(i.FRAMEBUFFER,mt),!(K.depthTexture&&K.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let Nt=n.get(K.depthTexture);if(Nt.__renderTarget=K,(!Nt.__webglTexture||K.depthTexture.image.width!==K.width||K.depthTexture.image.height!==K.height)&&(K.depthTexture.image.width=K.width,K.depthTexture.image.height=K.height,K.depthTexture.needsUpdate=!0),te){if(Nt.__webglInit===void 0&&(Nt.__webglInit=!0,K.depthTexture.addEventListener("dispose",O)),Nt.__webglTexture===void 0){Nt.__webglTexture=i.createTexture(),e.bindTexture(i.TEXTURE_CUBE_MAP,Nt.__webglTexture),ae(i.TEXTURE_CUBE_MAP,K.depthTexture);let Zt=r.convert(K.depthTexture.format),fe=r.convert(K.depthTexture.type),ce;K.depthTexture.format===dc?ce=i.DEPTH_COMPONENT24:K.depthTexture.format===yh&&(ce=i.DEPTH24_STENCIL8);for(let pe=0;pe<6;pe++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,ce,K.width,K.height,0,Zt,fe,null)}}else pt(K.depthTexture,0);let Se=Nt.__webglTexture,Me=Ue(K),ie=te?i.TEXTURE_CUBE_MAP_POSITIVE_X+Vt:i.TEXTURE_2D,_t=K.depthTexture.format===yh?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(K.depthTexture.format===dc)en(K)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,_t,ie,Se,0,Me):i.framebufferTexture2D(i.FRAMEBUFFER,_t,ie,Se,0);else if(K.depthTexture.format===yh)en(K)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,_t,ie,Se,0,Me):i.framebufferTexture2D(i.FRAMEBUFFER,_t,ie,Se,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function it(mt){let K=n.get(mt),Vt=mt.isWebGLCubeRenderTarget===!0;if(K.__boundDepthTexture!==mt.depthTexture){let te=mt.depthTexture;if(K.__depthDisposeCallback&&K.__depthDisposeCallback(),te){let Nt=()=>{delete K.__boundDepthTexture,delete K.__depthDisposeCallback,te.removeEventListener("dispose",Nt)};te.addEventListener("dispose",Nt),K.__depthDisposeCallback=Nt}K.__boundDepthTexture=te}if(mt.depthTexture&&!K.__autoAllocateDepthBuffer)if(Vt)for(let te=0;te<6;te++)St(K.__webglFramebuffer[te],mt,te);else{let te=mt.texture.mipmaps;te&&te.length>0?St(K.__webglFramebuffer[0],mt,0):St(K.__webglFramebuffer,mt,0)}else if(Vt){K.__webglDepthbuffer=[];for(let te=0;te<6;te++)if(e.bindFramebuffer(i.FRAMEBUFFER,K.__webglFramebuffer[te]),K.__webglDepthbuffer[te]===void 0)K.__webglDepthbuffer[te]=i.createRenderbuffer(),zt(K.__webglDepthbuffer[te],mt,!1);else{let Nt=mt.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Se=K.__webglDepthbuffer[te];i.bindRenderbuffer(i.RENDERBUFFER,Se),i.framebufferRenderbuffer(i.FRAMEBUFFER,Nt,i.RENDERBUFFER,Se)}}else{let te=mt.texture.mipmaps;if(te&&te.length>0?e.bindFramebuffer(i.FRAMEBUFFER,K.__webglFramebuffer[0]):e.bindFramebuffer(i.FRAMEBUFFER,K.__webglFramebuffer),K.__webglDepthbuffer===void 0)K.__webglDepthbuffer=i.createRenderbuffer(),zt(K.__webglDepthbuffer,mt,!1);else{let Nt=mt.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Se=K.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,Se),i.framebufferRenderbuffer(i.FRAMEBUFFER,Nt,i.RENDERBUFFER,Se)}}e.bindFramebuffer(i.FRAMEBUFFER,null)}function gt(mt,K,Vt){let te=n.get(mt);K!==void 0&&Ut(te.__webglFramebuffer,mt,mt.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Vt!==void 0&&it(mt)}function ft(mt){let K=mt.texture,Vt=n.get(mt),te=n.get(K);mt.addEventListener("dispose",I);let Nt=mt.textures,Se=mt.isWebGLCubeRenderTarget===!0,Me=Nt.length>1;if(Me||(te.__webglTexture===void 0&&(te.__webglTexture=i.createTexture()),te.__version=K.version,o.memory.textures++),Se){Vt.__webglFramebuffer=[];for(let ie=0;ie<6;ie++)if(K.mipmaps&&K.mipmaps.length>0){Vt.__webglFramebuffer[ie]=[];for(let _t=0;_t<K.mipmaps.length;_t++)Vt.__webglFramebuffer[ie][_t]=i.createFramebuffer()}else Vt.__webglFramebuffer[ie]=i.createFramebuffer()}else{if(K.mipmaps&&K.mipmaps.length>0){Vt.__webglFramebuffer=[];for(let ie=0;ie<K.mipmaps.length;ie++)Vt.__webglFramebuffer[ie]=i.createFramebuffer()}else Vt.__webglFramebuffer=i.createFramebuffer();if(Me)for(let ie=0,_t=Nt.length;ie<_t;ie++){let Zt=n.get(Nt[ie]);Zt.__webglTexture===void 0&&(Zt.__webglTexture=i.createTexture(),o.memory.textures++)}if(mt.samples>0&&en(mt)===!1){Vt.__webglMultisampledFramebuffer=i.createFramebuffer(),Vt.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,Vt.__webglMultisampledFramebuffer);for(let ie=0;ie<Nt.length;ie++){let _t=Nt[ie];Vt.__webglColorRenderbuffer[ie]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Vt.__webglColorRenderbuffer[ie]);let Zt=r.convert(_t.format,_t.colorSpace),fe=r.convert(_t.type),ce=C(_t.internalFormat,Zt,fe,_t.normalized,_t.colorSpace,mt.isXRRenderTarget===!0),pe=Ue(mt);i.renderbufferStorageMultisample(i.RENDERBUFFER,pe,ce,mt.width,mt.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ie,i.RENDERBUFFER,Vt.__webglColorRenderbuffer[ie])}i.bindRenderbuffer(i.RENDERBUFFER,null),mt.depthBuffer&&(Vt.__webglDepthRenderbuffer=i.createRenderbuffer(),zt(Vt.__webglDepthRenderbuffer,mt,!0)),e.bindFramebuffer(i.FRAMEBUFFER,null)}}if(Se){e.bindTexture(i.TEXTURE_CUBE_MAP,te.__webglTexture),ae(i.TEXTURE_CUBE_MAP,K);for(let ie=0;ie<6;ie++)if(K.mipmaps&&K.mipmaps.length>0)for(let _t=0;_t<K.mipmaps.length;_t++)Ut(Vt.__webglFramebuffer[ie][_t],mt,K,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ie,_t);else Ut(Vt.__webglFramebuffer[ie],mt,K,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0);w(K)&&M(i.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(Me){for(let ie=0,_t=Nt.length;ie<_t;ie++){let Zt=Nt[ie],fe=n.get(Zt),ce=i.TEXTURE_2D;(mt.isWebGL3DRenderTarget||mt.isWebGLArrayRenderTarget)&&(ce=mt.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(ce,fe.__webglTexture),ae(ce,Zt),Ut(Vt.__webglFramebuffer,mt,Zt,i.COLOR_ATTACHMENT0+ie,ce,0),w(Zt)&&M(ce)}e.unbindTexture()}else{let ie=i.TEXTURE_2D;if((mt.isWebGL3DRenderTarget||mt.isWebGLArrayRenderTarget)&&(ie=mt.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(ie,te.__webglTexture),ae(ie,K),K.mipmaps&&K.mipmaps.length>0)for(let _t=0;_t<K.mipmaps.length;_t++)Ut(Vt.__webglFramebuffer[_t],mt,K,i.COLOR_ATTACHMENT0,ie,_t);else Ut(Vt.__webglFramebuffer,mt,K,i.COLOR_ATTACHMENT0,ie,0);w(K)&&M(ie),e.unbindTexture()}mt.depthBuffer&&it(mt)}function de(mt){let K=mt.textures;for(let Vt=0,te=K.length;Vt<te;Vt++){let Nt=K[Vt];if(w(Nt)){let Se=A(mt),Me=n.get(Nt).__webglTexture;e.bindTexture(Se,Me),M(Se),e.unbindTexture()}}}let ve=[],we=[];function Ae(mt){if(mt.samples>0){if(en(mt)===!1){let K=mt.textures,Vt=mt.width,te=mt.height,Nt=i.COLOR_BUFFER_BIT,Se=mt.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Me=n.get(mt),ie=K.length>1;if(ie)for(let Zt=0;Zt<K.length;Zt++)e.bindFramebuffer(i.FRAMEBUFFER,Me.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Zt,i.RENDERBUFFER,null),e.bindFramebuffer(i.FRAMEBUFFER,Me.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Zt,i.TEXTURE_2D,null,0);e.bindFramebuffer(i.READ_FRAMEBUFFER,Me.__webglMultisampledFramebuffer);let _t=mt.texture.mipmaps;_t&&_t.length>0?e.bindFramebuffer(i.DRAW_FRAMEBUFFER,Me.__webglFramebuffer[0]):e.bindFramebuffer(i.DRAW_FRAMEBUFFER,Me.__webglFramebuffer);for(let Zt=0;Zt<K.length;Zt++){if(mt.resolveDepthBuffer&&(mt.depthBuffer&&(Nt|=i.DEPTH_BUFFER_BIT),mt.stencilBuffer&&mt.resolveStencilBuffer&&(Nt|=i.STENCIL_BUFFER_BIT)),ie){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Me.__webglColorRenderbuffer[Zt]);let fe=n.get(K[Zt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,fe,0)}i.blitFramebuffer(0,0,Vt,te,0,0,Vt,te,Nt,i.NEAREST),l===!0&&(ve.length=0,we.length=0,ve.push(i.COLOR_ATTACHMENT0+Zt),mt.depthBuffer&&mt.storeMultisampledDepthBuffer===!1&&(ve.push(Se),we.push(Se),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,we)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ve))}if(e.bindFramebuffer(i.READ_FRAMEBUFFER,null),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ie)for(let Zt=0;Zt<K.length;Zt++){e.bindFramebuffer(i.FRAMEBUFFER,Me.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Zt,i.RENDERBUFFER,Me.__webglColorRenderbuffer[Zt]);let fe=n.get(K[Zt]).__webglTexture;e.bindFramebuffer(i.FRAMEBUFFER,Me.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Zt,i.TEXTURE_2D,fe,0)}e.bindFramebuffer(i.DRAW_FRAMEBUFFER,Me.__webglMultisampledFramebuffer)}else if(mt.depthBuffer&&mt.storeMultisampledDepthBuffer===!1&&l){let K=mt.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[K])}}}function Ue(mt){return Math.min(s.maxSamples,mt.samples)}function en(mt){let K=n.get(mt);return mt.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&K.__useRenderToTexture!==!1}function It(mt){let K=o.render.frame;u.get(mt)!==K&&(u.set(mt,K),mt.update())}function Cn(mt,K){let Vt=mt.colorSpace,te=mt.format,Nt=mt.type;return mt.isCompressedTexture===!0||mt.isVideoTexture===!0||Vt!==wo&&Vt!==fu&&(Rn.getTransfer(Vt)===Fi?(te!==xo||Nt!==ta)&&Ze("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Tn("WebGLTextures: Unsupported texture color space:",Vt)),K}function mn(mt){return typeof HTMLImageElement<"u"&&mt instanceof HTMLImageElement?(c.width=mt.naturalWidth||mt.width,c.height=mt.naturalHeight||mt.height):typeof VideoFrame<"u"&&mt instanceof VideoFrame?(c.width=mt.displayWidth,c.height=mt.displayHeight):(c.width=mt.width,c.height=mt.height),c}this.allocateTextureUnit=at,this.resetTextureUnits=j,this.getTextureUnits=W,this.setTextureUnits=_,this.setTexture2D=pt,this.setTexture2DArray=Et,this.setTexture3D=vt,this.setTextureCube=yt,this.rebindTextures=gt,this.setupRenderTarget=ft,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Ae,this.setupDepthRenderbuffer=it,this.setupFrameBufferTexture=Ut,this.useMultisampledRTT=en,this.isReversedDepthBuffer=function(){return e.buffers.depth.getReversed()}}function yet(i,t){function e(n,s=fu){let r,o=Rn.getTransfer(s);if(n===ta)return i.UNSIGNED_BYTE;if(n===r_)return i.UNSIGNED_SHORT_4_4_4_4;if(n===o_)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Fk)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Uk)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Nk)return i.BYTE;if(n===Bk)return i.SHORT;if(n===Og)return i.UNSIGNED_SHORT;if(n===s_)return i.INT;if(n===qa)return i.UNSIGNED_INT;if(n===yo)return i.FLOAT;if(n===Tl)return i.HALF_FLOAT;if(n===zk)return i.ALPHA;if(n===Vk)return i.RGB;if(n===xo)return i.RGBA;if(n===dc)return i.DEPTH_COMPONENT;if(n===yh)return i.DEPTH_STENCIL;if(n===a_)return i.RED;if(n===uv)return i.RED_INTEGER;if(n===xh)return i.RG;if(n===l_)return i.RG_INTEGER;if(n===c_)return i.RGBA_INTEGER;if(n===hv||n===dv||n===fv||n===pv)if(o===Fi)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===hv)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===dv)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===fv)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===pv)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===hv)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===dv)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===fv)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===pv)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===u_||n===h_||n===d_||n===f_)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===u_)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===h_)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===d_)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===f_)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===p_||n===g_||n===m_||n===b_||n===v_||n===gv||n===y_)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(n===p_||n===g_)return o===Fi?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===m_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===b_)return r.COMPRESSED_R11_EAC;if(n===v_)return r.COMPRESSED_SIGNED_R11_EAC;if(n===gv)return r.COMPRESSED_RG11_EAC;if(n===y_)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===x_||n===w_||n===__||n===S_||n===C_||n===M_||n===T_||n===A_||n===E_||n===k_||n===P_||n===R_||n===D_||n===L_)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(n===x_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===w_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===__)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===S_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===C_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===M_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===T_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===A_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===E_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===k_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===P_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===R_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===D_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===L_)return o===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===I_||n===O_||n===N_)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(n===I_)return o===Fi?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===O_)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===N_)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===B_||n===F_||n===mv||n===U_)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(n===B_)return r.COMPRESSED_RED_RGTC1_EXT;if(n===F_)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===mv)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===U_)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ng?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}function wIt(i,t){function e(x,w){x.matrixAutoUpdate===!0&&x.updateMatrix(),w.value.copy(x.matrix)}function n(x,w){w.color.getRGB(x.fogColor.value,VU(i)),w.isFog?(x.fogNear.value=w.near,x.fogFar.value=w.far):w.isFogExp2&&(x.fogDensity.value=w.density)}function s(x,w,M,A,C){w.isNodeMaterial?w.uniformsNeedUpdate=!1:w.isMeshBasicMaterial?r(x,w):w.isMeshLambertMaterial?(r(x,w),w.envMap&&(x.envMapIntensity.value=w.envMapIntensity)):w.isMeshToonMaterial?(r(x,w),h(x,w)):w.isMeshPhongMaterial?(r(x,w),u(x,w),w.envMap&&(x.envMapIntensity.value=w.envMapIntensity)):w.isMeshStandardMaterial?(r(x,w),d(x,w),w.isMeshPhysicalMaterial&&p(x,w,C)):w.isMeshMatcapMaterial?(r(x,w),g(x,w)):w.isMeshDepthMaterial?r(x,w):w.isMeshDistanceMaterial?(r(x,w),y(x,w)):w.isMeshNormalMaterial?r(x,w):w.isLineBasicMaterial?(o(x,w),w.isLineDashedMaterial&&a(x,w)):w.isPointsMaterial?l(x,w,M,A):w.isSpriteMaterial?c(x,w):w.isShadowMaterial?(x.color.value.copy(w.color),x.opacity.value=w.opacity):w.isShaderMaterial&&(w.uniformsNeedUpdate=!1)}function r(x,w){x.opacity.value=w.opacity,w.color&&x.diffuse.value.copy(w.color),w.emissive&&x.emissive.value.copy(w.emissive).multiplyScalar(w.emissiveIntensity),w.map&&(x.map.value=w.map,e(w.map,x.mapTransform)),w.alphaMap&&(x.alphaMap.value=w.alphaMap,e(w.alphaMap,x.alphaMapTransform)),w.bumpMap&&(x.bumpMap.value=w.bumpMap,e(w.bumpMap,x.bumpMapTransform),x.bumpScale.value=w.bumpScale,w.side===Mo&&(x.bumpScale.value*=-1)),w.normalMap&&(x.normalMap.value=w.normalMap,e(w.normalMap,x.normalMapTransform),x.normalScale.value.copy(w.normalScale),w.side===Mo&&x.normalScale.value.negate()),w.displacementMap&&(x.displacementMap.value=w.displacementMap,e(w.displacementMap,x.displacementMapTransform),x.displacementScale.value=w.displacementScale,x.displacementBias.value=w.displacementBias),w.emissiveMap&&(x.emissiveMap.value=w.emissiveMap,e(w.emissiveMap,x.emissiveMapTransform)),w.specularMap&&(x.specularMap.value=w.specularMap,e(w.specularMap,x.specularMapTransform)),w.alphaTest>0&&(x.alphaTest.value=w.alphaTest);let M=t.get(w),A=M.envMap,C=M.envMapRotation;A&&(x.envMap.value=A,x.envMapRotation.value.setFromMatrix4(xIt.makeRotationFromEuler(C)).transpose(),A.isCubeTexture&&A.isRenderTargetTexture===!1&&x.envMapRotation.value.premultiply(xet),x.reflectivity.value=w.reflectivity,x.ior.value=w.ior,x.refractionRatio.value=w.refractionRatio),w.lightMap&&(x.lightMap.value=w.lightMap,x.lightMapIntensity.value=w.lightMapIntensity,e(w.lightMap,x.lightMapTransform)),w.aoMap&&(x.aoMap.value=w.aoMap,x.aoMapIntensity.value=w.aoMapIntensity,e(w.aoMap,x.aoMapTransform))}function o(x,w){x.diffuse.value.copy(w.color),x.opacity.value=w.opacity,w.map&&(x.map.value=w.map,e(w.map,x.mapTransform))}function a(x,w){x.dashSize.value=w.dashSize,x.totalSize.value=w.dashSize+w.gapSize,x.scale.value=w.scale}function l(x,w,M,A){x.diffuse.value.copy(w.color),x.opacity.value=w.opacity,x.size.value=w.size*M,x.scale.value=A*.5,w.map&&(x.map.value=w.map,e(w.map,x.uvTransform)),w.alphaMap&&(x.alphaMap.value=w.alphaMap,e(w.alphaMap,x.alphaMapTransform)),w.alphaTest>0&&(x.alphaTest.value=w.alphaTest)}function c(x,w){x.diffuse.value.copy(w.color),x.opacity.value=w.opacity,x.rotation.value=w.rotation,w.map&&(x.map.value=w.map,e(w.map,x.mapTransform)),w.alphaMap&&(x.alphaMap.value=w.alphaMap,e(w.alphaMap,x.alphaMapTransform)),w.alphaTest>0&&(x.alphaTest.value=w.alphaTest)}function u(x,w){x.specular.value.copy(w.specular),x.shininess.value=Math.max(w.shininess,1e-4)}function h(x,w){w.gradientMap&&(x.gradientMap.value=w.gradientMap)}function d(x,w){x.metalness.value=w.metalness,w.metalnessMap&&(x.metalnessMap.value=w.metalnessMap,e(w.metalnessMap,x.metalnessMapTransform)),x.roughness.value=w.roughness,w.roughnessMap&&(x.roughnessMap.value=w.roughnessMap,e(w.roughnessMap,x.roughnessMapTransform)),w.envMap&&(x.envMapIntensity.value=w.envMapIntensity)}function p(x,w,M){x.ior.value=w.ior,w.sheen>0&&(x.sheenColor.value.copy(w.sheenColor).multiplyScalar(w.sheen),x.sheenRoughness.value=w.sheenRoughness,w.sheenColorMap&&(x.sheenColorMap.value=w.sheenColorMap,e(w.sheenColorMap,x.sheenColorMapTransform)),w.sheenRoughnessMap&&(x.sheenRoughnessMap.value=w.sheenRoughnessMap,e(w.sheenRoughnessMap,x.sheenRoughnessMapTransform))),w.clearcoat>0&&(x.clearcoat.value=w.clearcoat,x.clearcoatRoughness.value=w.clearcoatRoughness,w.clearcoatMap&&(x.clearcoatMap.value=w.clearcoatMap,e(w.clearcoatMap,x.clearcoatMapTransform)),w.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=w.clearcoatRoughnessMap,e(w.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),w.clearcoatNormalMap&&(x.clearcoatNormalMap.value=w.clearcoatNormalMap,e(w.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(w.clearcoatNormalScale),w.side===Mo&&x.clearcoatNormalScale.value.negate())),w.dispersion>0&&(x.dispersion.value=w.dispersion),w.retroreflectivity>0&&(x.retroreflectivity.value=w.retroreflectivity),w.iridescence>0&&(x.iridescence.value=w.iridescence,x.iridescenceIOR.value=w.iridescenceIOR,x.iridescenceThicknessMinimum.value=w.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=w.iridescenceThicknessRange[1],w.iridescenceMap&&(x.iridescenceMap.value=w.iridescenceMap,e(w.iridescenceMap,x.iridescenceMapTransform)),w.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=w.iridescenceThicknessMap,e(w.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),w.transmission>0&&(x.transmission.value=w.transmission,x.transmissionSamplerMap.value=M.texture,x.transmissionSamplerSize.value.set(M.width,M.height),w.transmissionMap&&(x.transmissionMap.value=w.transmissionMap,e(w.transmissionMap,x.transmissionMapTransform)),x.thickness.value=w.thickness,w.thicknessMap&&(x.thicknessMap.value=w.thicknessMap,e(w.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=w.attenuationDistance,x.attenuationColor.value.copy(w.attenuationColor)),w.anisotropy>0&&(x.anisotropyVector.value.set(w.anisotropy*Math.cos(w.anisotropyRotation),w.anisotropy*Math.sin(w.anisotropyRotation)),w.anisotropyMap&&(x.anisotropyMap.value=w.anisotropyMap,e(w.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=w.specularIntensity,x.specularColor.value.copy(w.specularColor),w.specularColorMap&&(x.specularColorMap.value=w.specularColorMap,e(w.specularColorMap,x.specularColorMapTransform)),w.specularIntensityMap&&(x.specularIntensityMap.value=w.specularIntensityMap,e(w.specularIntensityMap,x.specularIntensityMapTransform))}
734function g(x,w){w.matcap&&(x.matcap.value=w.matcap)}function y(x,w){let M=t.get(w).light;x.referencePosition.value.setFromMatrixPosition(M.matrixWorld),x.nearDistance.value=M.shadow.camera.near,x.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function _It(i,t,e,n){let s={},r={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(C,R){let k=R.program;n.uniformBlockBinding(C,k)}function c(C,R){let k=s[C.id];k===void 0&&(x(C),k=u(C),s[C.id]=k,C.addEventListener("dispose",M));let O=R.program;n.updateUBOMapping(C,O);let I=t.render.frame;r[C.id]!==I&&(d(C),r[C.id]=I)}function u(C){let R=h();C.__bindingPointIndex=R;let k=i.createBuffer(),O=C.__size,I=C.usage;return i.bindBuffer(i.UNIFORM_BUFFER,k),i.bufferData(i.UNIFORM_BUFFER,O,I),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,R,k),k}function h(){for(let C=0;C<a;C++)if(o.indexOf(C)===-1)return o.push(C),C;return Tn("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(C){let R=s[C.id],k=C.uniforms,O=C.__cache;i.bindBuffer(i.UNIFORM_BUFFER,R);for(let I=0,U=k.length;I<U;I++){let V=k[I];if(Array.isArray(V))for(let q=0,X=V.length;q<X;q++)p(V[q],I,q,O);else p(V,I,0,O)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(C,R,k,O){if(y(C,R,k,O)===!0){let I=C.__offset,U=C.value;if(Array.isArray(U)){let V=0;for(let q=0;q<U.length;q++){let X=U[q],j=w(X);g(X,C.__data,V),typeof X!="number"&&typeof X!="boolean"&&!X.isMatrix3&&!ArrayBuffer.isView(X)&&(V+=j.storage/Float32Array.BYTES_PER_ELEMENT)}}else g(U,C.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,I,C.__data)}}function g(C,R,k){typeof C=="number"||typeof C=="boolean"?R[0]=C:C.isMatrix3?(R[0]=C.elements[0],R[1]=C.elements[1],R[2]=C.elements[2],R[3]=0,R[4]=C.elements[3],R[5]=C.elements[4],R[6]=C.elements[5],R[7]=0,R[8]=C.elements[6],R[9]=C.elements[7],R[10]=C.elements[8],R[11]=0):ArrayBuffer.isView(C)?R.set(new C.constructor(C.buffer,C.byteOffset,R.length)):C.toArray(R,k)}function y(C,R,k,O){let I=C.value,U=R+"_"+k;if(O[U]===void 0)return typeof I=="number"||typeof I=="boolean"?O[U]=I:ArrayBuffer.isView(I)?O[U]=I.slice():O[U]=I.clone(),!0;{let V=O[U];if(typeof I=="number"||typeof I=="boolean"){if(V!==I)return O[U]=I,!0}else{if(ArrayBuffer.isView(I))return!0;if(V.equals(I)===!1)return V.copy(I),!0}}return!1}function x(C){let R=C.uniforms,k=0,O=16;for(let U=0,V=R.length;U<V;U++){let q=Array.isArray(R[U])?R[U]:[R[U]];for(let X=0,j=q.length;X<j;X++){let W=q[X],_=Array.isArray(W.value)?W.value:[W.value];for(let at=0,ct=_.length;at<ct;at++){let pt=_[at],Et=w(pt),vt=k%O,yt=vt%Et.boundary,kt=vt+yt;k+=yt,kt!==0&&O-kt<Et.storage&&(k+=O-kt),W.__data=new Float32Array(Et.storage/Float32Array.BYTES_PER_ELEMENT),W.__offset=k,k+=Et.storage}}}let I=k%O;return I>0&&(k+=O-I),C.__size=k,C.__cache={},this}function w(C){let R={boundary:0,storage:0};return typeof C=="number"||typeof C=="boolean"?(R.boundary=4,R.storage=4):C.isVector2?(R.boundary=8,R.storage=8):C.isVector3||C.isColor?(R.boundary=16,R.storage=12):C.isVector4?(R.boundary=16,R.storage=16):C.isMatrix3?(R.boundary=48,R.storage=48):C.isMatrix4?(R.boundary=64,R.storage=64):C.isTexture?Ze("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(C)?(R.boundary=16,R.storage=C.byteLength):Ze("WebGLRenderer: Unsupported uniform value type.",C),R}function M(C){let R=C.target;R.removeEventListener("dispose",M);let k=o.indexOf(R.__bindingPointIndex);o.splice(k,1),i.deleteBuffer(s[R.id]),delete s[R.id],delete r[R.id]}function A(){for(let C in s)i.deleteBuffer(s[C]);o=[],s={},r={}}return{bind:l,update:c,dispose:A}}function CIt(){return pu===null&&(pu=new Xo(SIt,16,16,xh,Tl),pu.name="DFG_LUT",pu.minFilter=$i,pu.magFilter=$i,pu.wrapS=pr,pu.wrapT=pr,pu.generateMipmaps=!1,pu.needsUpdate=!0),pu}var Fkt,Ukt,zkt,Vkt,Hkt,jkt,Wkt,$kt,Gkt,qkt,Ykt,Xkt,Kkt,Jkt,Zkt,Qkt,tPt,ePt,nPt,iPt,sPt,rPt,oPt,aPt,lPt,cPt,uPt,hPt,dPt,fPt,pPt,gPt,mPt,bPt,vPt,yPt,xPt,wPt,_Pt,SPt,CPt,MPt,TPt,APt,EPt,kPt,PPt,RPt,DPt,LPt,IPt,OPt,NPt,BPt,FPt,UPt,zPt,VPt,HPt,jPt,WPt,$Pt,GPt,qPt,YPt,XPt,KPt,JPt,ZPt,QPt,tRt,eRt,nRt,iRt,sRt,rRt,oRt,aRt,lRt,cRt,uRt,hRt,dRt,fRt,pRt,gRt,mRt,bRt,vRt,yRt,xRt,wRt,_Rt,SRt,CRt,MRt,TRt,ARt,ERt,kRt,PRt,RRt,DRt,LRt,IRt,ORt,NRt,BRt,FRt,URt,zRt,VRt,HRt,jRt,WRt,$Rt,GRt,qRt,YRt,XRt,KRt,JRt,ZRt,QRt,tDt,eDt,nDt,iDt,sDt,rDt,oDt,aDt,lDt,cDt,uDt,hDt,dDt,fDt,pDt,gDt,mDt,bDt,ii,on,wc,Gk,vDt,pet,yv,CDt,MDt,TDt,$_,$tt,GU,qU,YU,XU,ADt,Ug,Y_,X_,FDt,get,ZU,met,bet,vet,Xtt,Ktt,Jtt,Ztt,Qtt,QU,tz,ez,KU,xv,ALt,ELt,net,DLt,qk,FLt,ULt,VLt,jLt,$Lt,qLt,XLt,QLt,iz,sz,aIt,hIt,dIt,fIt,pIt,det,G_,JU,vIt,yIt,rz,oz,xIt,xet,SIt,pu,az,wh=_n(()=>{$U();$U();Fkt=`#ifdef USE_ALPHAHASH
735	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
736#endif`,Ukt=`#ifdef USE_ALPHAHASH
737	const float ALPHA_HASH_SCALE = 0.05;
738	float hash2D( vec2 value ) {
739		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
740	}
741	float hash3D( vec3 value ) {
742		return hash2D( vec2( hash2D( value.xy ), value.z ) );
743	}
744	float getAlphaHashThreshold( vec3 position ) {
745		float maxDeriv = max(
746			length( dFdx( position.xyz ) ),
747			length( dFdy( position.xyz ) )
748		);
749		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
750		vec2 pixScales = vec2(
751			exp2( floor( log2( pixScale ) ) ),
752			exp2( ceil( log2( pixScale ) ) )
753		);
754		vec2 alpha = vec2(
755			hash3D( floor( pixScales.x * position.xyz ) ),
756			hash3D( floor( pixScales.y * position.xyz ) )
757		);
758		float lerpFactor = fract( log2( pixScale ) );
759		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
760		float a = min( lerpFactor, 1.0 - lerpFactor );
761		vec3 cases = vec3(
762			x * x / ( 2.0 * a * ( 1.0 - a ) ),
763			( x - 0.5 * a ) / ( 1.0 - a ),
764			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
765		);
766		float threshold = ( x < ( 1.0 - a ) )
767			? ( ( x < a ) ? cases.x : cases.y )
768			: cases.z;
769		return clamp( threshold , 1.0e-6, 1.0 );
770	}
771#endif`,zkt=`#ifdef USE_ALPHAMAP
772	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
773#endif`,Vkt=`#ifdef USE_ALPHAMAP
774	uniform sampler2D alphaMap;
775#endif`,Hkt=`#ifdef USE_ALPHATEST
776	#ifdef ALPHA_TO_COVERAGE
777	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
778	if ( diffuseColor.a == 0.0 ) discard;
779	#else
780	if ( diffuseColor.a < alphaTest ) discard;
781	#endif
782#endif`,jkt=`#ifdef USE_ALPHATEST
783	uniform float alphaTest;
784#endif`,Wkt=`#ifdef USE_AOMAP
785	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
786	reflectedLight.indirectDiffuse *= ambientOcclusion;
787	#if defined( USE_CLEARCOAT ) 
788		clearcoatSpecularIndirect *= ambientOcclusion;
789	#endif
790	#if defined( USE_SHEEN ) 
791		sheenSpecularIndirect *= ambientOcclusion;
792	#endif
793	#if defined( USE_ENVMAP ) && defined( STANDARD )
794		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
795		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
796	#endif
797#endif`,$kt=`#ifdef USE_AOMAP
798	uniform sampler2D aoMap;
799	uniform float aoMapIntensity;
800#endif`,Gkt=`#ifdef USE_BATCHING
801	#if ! defined( GL_ANGLE_multi_draw )
802	#define gl_DrawID _gl_DrawID
803	uniform int _gl_DrawID;
804	#endif
805	uniform highp sampler2D batchingTexture;
806	uniform highp usampler2D batchingIdTexture;
807	mat4 getBatchingMatrix( const in float i ) {
808		int size = textureSize( batchingTexture, 0 ).x;
809		int j = int( i ) * 4;
810		int x = j % size;
811		int y = j / size;
812		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
813		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
814		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
815		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
816		return mat4( v1, v2, v3, v4 );
817	}
818	float getIndirectIndex( const in int i ) {
819		int size = textureSize( batchingIdTexture, 0 ).x;
820		int x = i % size;
821		int y = i / size;
822		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
823	}
824#endif
825#ifdef USE_BATCHING_COLOR
826	uniform sampler2D batchingColorTexture;
827	vec4 getBatchingColor( const in float i ) {
828		int size = textureSize( batchingColorTexture, 0 ).x;
829		int j = int( i );
830		int x = j % size;
831		int y = j / size;
832		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
833	}
834#endif`,qkt=`#ifdef USE_BATCHING
835	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
836#endif`,Ykt=`vec3 transformed = vec3( position );
837#ifdef USE_ALPHAHASH
838	vPosition = vec3( position );
839#endif`,Xkt=`vec3 objectNormal = vec3( normal );
840#ifdef USE_TANGENT
841	vec3 objectTangent = vec3( tangent.xyz );
842#endif`,Kkt=`float G_BlinnPhong_Implicit( ) {
843	return 0.25;
844}
845float D_BlinnPhong( const in float shininess, const in float dotNH ) {
846	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
847}
848vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
849	vec3 halfDir = normalize( lightDir + viewDir );
850	float dotNH = saturate( dot( normal, halfDir ) );
851	float dotVH = saturate( dot( viewDir, halfDir ) );
852	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
853	float G = G_BlinnPhong_Implicit( );
854	float D = D_BlinnPhong( shininess, dotNH );
855	return F * ( G * D );
856} // validated`,Jkt=`#ifdef USE_IRIDESCENCE
857	const mat3 XYZ_TO_REC709 = mat3(
858		 3.2404542, -0.9692660,  0.0556434,
859		-1.5371385,  1.8760108, -0.2040259,
860		-0.4985314,  0.0415560,  1.0572252
861	);
862	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
863		vec3 sqrtF0 = sqrt( fresnel0 );
864		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
865	}
866	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
867		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
868	}
869	float IorToFresnel0( float transmittedIor, float incidentIor ) {
870		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
871	}
872	vec3 evalSensitivity( float OPD, vec3 shift ) {
873		float phase = 2.0 * PI * OPD * 1.0e-9;
874		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
875		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
876		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
877		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
878		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
879		xyz /= 1.0685e-7;
880		vec3 rgb = XYZ_TO_REC709 * xyz;
881		return rgb;
882	}
883	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
884		vec3 I;
885		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
886		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
887		float cosTheta2Sq = 1.0 - sinTheta2Sq;
888		if ( cosTheta2Sq < 0.0 ) {
889			return vec3( 1.0 );
890		}
891		float cosTheta2 = sqrt( cosTheta2Sq );
892		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
893		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
894		float T121 = 1.0 - R12;
895		float phi12 = 0.0;
896		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
897		float phi21 = PI - phi12;
898		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
899		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
900		vec3 phi23 = vec3( 0.0 );
901		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
902		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
903		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
904		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
905		vec3 phi = vec3( phi21 ) + phi23;
906		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
907		vec3 r123 = sqrt( R123 );
908		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
909		vec3 C0 = R12 + Rs;
910		I = C0;
911		vec3 Cm = Rs - T121;
912		for ( int m = 1; m <= 2; ++ m ) {
913			Cm *= r123;
914			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
915			I += Cm * Sm;
916		}
917		return max( I, vec3( 0.0 ) );
918	}
919#endif`,Zkt=`#ifdef USE_BUMPMAP
920	uniform sampler2D bumpMap;
921	uniform float bumpScale;
922	vec2 dHdxy_fwd() {
923		vec2 dSTdx = dFdx( vBumpMapUv );
924		vec2 dSTdy = dFdy( vBumpMapUv );
925		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
926		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
927		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
928		return vec2( dBx, dBy );
929	}
930	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
931		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
932		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
933		vec3 vN = surf_norm;
934		vec3 R1 = cross( vSigmaY, vN );
935		vec3 R2 = cross( vN, vSigmaX );
936		float fDet = dot( vSigmaX, R1 ) * faceDirection;
937		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
938		return normalize( abs( fDet ) * surf_norm - vGrad );
939	}
940#endif`,Qkt=`#if NUM_CLIPPING_PLANES > 0
941	vec4 plane;
942	#ifdef ALPHA_TO_COVERAGE
943		float distanceToPlane, distanceGradient;
944		float clipOpacity = 1.0;
945		#pragma unroll_loop_start
946		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
947			plane = clippingPlanes[ i ];
948			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
949			distanceGradient = fwidth( distanceToPlane ) / 2.0;
950			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
951			if ( clipOpacity == 0.0 ) discard;
952		}
953		#pragma unroll_loop_end
954		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
955			float unionClipOpacity = 1.0;
956			#pragma unroll_loop_start
957			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
958				plane = clippingPlanes[ i ];
959				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
960				distanceGradient = fwidth( distanceToPlane ) / 2.0;
961				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
962			}
963			#pragma unroll_loop_end
964			clipOpacity *= 1.0 - unionClipOpacity;
965		#endif
966		diffuseColor.a *= clipOpacity;
967		if ( diffuseColor.a == 0.0 ) discard;
968	#else
969		#pragma unroll_loop_start
970		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
971			plane = clippingPlanes[ i ];
972			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
973		}
974		#pragma unroll_loop_end
975		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
976			bool clipped = true;
977			#pragma unroll_loop_start
978			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
979				plane = clippingPlanes[ i ];
980				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
981			}
982			#pragma unroll_loop_end
983			if ( clipped ) discard;
984		#endif
985	#endif
986#endif`,tPt=`#if NUM_CLIPPING_PLANES > 0
987	varying vec3 vClipPosition;
988	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
989#endif`,ePt=`#if NUM_CLIPPING_PLANES > 0
990	varying vec3 vClipPosition;
991#endif`,nPt=`#if NUM_CLIPPING_PLANES > 0
992	vClipPosition = - mvPosition.xyz;
993#endif`,iPt=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
994	diffuseColor *= vColor;
995#endif`,sPt=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
996	varying vec4 vColor;
997#endif`,rPt=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
998	varying vec4 vColor;
999#endif`,oPt=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
1000	vColor = vec4( 1.0 );
1001#endif
1002#ifdef USE_COLOR_ALPHA
1003	vColor *= color;
1004#elif defined( USE_COLOR )
1005	vColor.rgb *= color;
1006#endif
1007#ifdef USE_INSTANCING_COLOR
1008	vColor.rgb *= instanceColor.rgb;
1009#endif
1010#ifdef USE_BATCHING_COLOR
1011	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
1012#endif`,aPt=`#define PI 3.141592653589793
1013#define PI2 6.283185307179586
1014#define PI_HALF 1.5707963267948966
1015#define RECIPROCAL_PI 0.3183098861837907
1016#define RECIPROCAL_PI2 0.15915494309189535
1017#define EPSILON 1e-6
1018#ifndef saturate
1019#define saturate( a ) clamp( a, 0.0, 1.0 )
1020#endif
1021#define whiteComplement( a ) ( 1.0 - saturate( a ) )
1022float pow2( const in float x ) { return x*x; }
1023vec3 pow2( const in vec3 x ) { return x*x; }
1024float pow3( const in float x ) { return x*x*x; }
1025float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
1026float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
1027float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
1028highp float rand( const in vec2 uv ) {
1029	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
1030	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
1031	return fract( sin( sn ) * c );
1032}
1033#ifdef HIGH_PRECISION
1034	float precisionSafeLength( vec3 v ) { return length( v ); }
1035#else
1036	float precisionSafeLength( vec3 v ) {
1037		float maxComponent = max3( abs( v ) );
1038		return length( v / maxComponent ) * maxComponent;
1039	}
1040#endif
1041struct IncidentLight {
1042	vec3 color;
1043	vec3 direction;
1044	bool visible;
1045};
1046struct ReflectedLight {
1047	vec3 directDiffuse;
1048	vec3 directSpecular;
1049	vec3 indirectDiffuse;
1050	vec3 indirectSpecular;
1051};
1052#ifdef USE_ALPHAHASH
1053	varying vec3 vPosition;
1054#endif
1055vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
1056	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
1057}
1058#define inverseTransformDirection transformDirectionByInverseViewMatrix
1059vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {
1060	return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );
1061}
1062vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {
1063	return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );
1064}
1065bool isPerspectiveMatrix( mat4 m ) {
1066	return m[ 2 ][ 3 ] == - 1.0;
1067}
1068vec2 equirectUv( in vec3 dir ) {
1069	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
1070	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
1071	return vec2( u, v );
1072}
1073vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
1074	return RECIPROCAL_PI * diffuseColor;
1075}
1076vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
1077	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
1078	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
1079}
1080float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
1081	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
1082	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
1083} // validated`,lPt=`#ifdef ENVMAP_TYPE_CUBE_UV
1084	#define cubeUV_minMipLevel 4.0
1085	#define cubeUV_minTileSize 16.0
1086	float getFace( vec3 direction ) {
1087		vec3 absDirection = abs( direction );
1088		float face = - 1.0;
1089		if ( absDirection.x > absDirection.z ) {
1090			if ( absDirection.x > absDirection.y )
1091				face = direction.x > 0.0 ? 0.0 : 3.0;
1092			else
1093				face = direction.y > 0.0 ? 1.0 : 4.0;
1094		} else {
1095			if ( absDirection.z > absDirection.y )
1096				face = direction.z > 0.0 ? 2.0 : 5.0;
1097			else
1098				face = direction.y > 0.0 ? 1.0 : 4.0;
1099		}
1100		return face;
1101	}
1102	vec2 getUV( vec3 direction, float face ) {
1103		vec2 uv;
1104		if ( face == 0.0 ) {
1105			uv = vec2( direction.z, direction.y ) / abs( direction.x );
1106		} else if ( face == 1.0 ) {
1107			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
1108		} else if ( face == 2.0 ) {
1109			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
1110		} else if ( face == 3.0 ) {
1111			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
1112		} else if ( face == 4.0 ) {
1113			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
1114		} else {
1115			uv = vec2( direction.x, direction.y ) / abs( direction.z );
1116		}
1117		return 0.5 * ( uv + 1.0 );
1118	}
1119	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
1120		float face = getFace( direction );
1121		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
1122		mipInt = max( mipInt, cubeUV_minMipLevel );
1123		float faceSize = exp2( mipInt );
1124		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
1125		if ( face > 2.0 ) {
1126			uv.y += faceSize;
1127			face -= 3.0;
1128		}
1129		uv.x += face * faceSize;
1130		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
1131		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
1132		uv.x *= CUBEUV_TEXEL_WIDTH;
1133		uv.y *= CUBEUV_TEXEL_HEIGHT;
1134		#ifdef texture2DGradEXT
1135			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
1136		#else
1137			return texture2D( envMap, uv ).rgb;
1138		#endif
1139	}
1140	#define cubeUV_r0 1.0
1141	#define cubeUV_m0 - 2.0
1142	#define cubeUV_r1 0.8
1143	#define cubeUV_m1 - 1.0
1144	#define cubeUV_r4 0.4
1145	#define cubeUV_m4 2.0
1146	#define cubeUV_r5 0.305
1147	#define cubeUV_m5 3.0
1148	#define cubeUV_r6 0.21
1149	#define cubeUV_m6 4.0
1150	float roughnessToMip( float roughness ) {
1151		float mip = 0.0;
1152		if ( roughness >= cubeUV_r1 ) {
1153			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
1154		} else if ( roughness >= cubeUV_r4 ) {
1155			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
1156		} else if ( roughness >= cubeUV_r5 ) {
1157			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
1158		} else if ( roughness >= cubeUV_r6 ) {
1159			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
1160		} else {
1161			mip = - 2.0 * log2( 1.16 * roughness );		}
1162		return mip;
1163	}
1164	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
1165		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
1166		float mipF = fract( mip );
1167		float mipInt = floor( mip );
1168		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
1169		if ( mipF == 0.0 ) {
1170			return vec4( color0, 1.0 );
1171		} else {
1172			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
1173			return vec4( mix( color0, color1, mipF ), 1.0 );
1174		}
1175	}
1176#endif`,cPt=`vec3 transformedNormal = objectNormal;
1177#ifdef USE_TANGENT
1178	vec3 transformedTangent = objectTangent;
1179#endif
1180#ifdef USE_BATCHING
1181	mat3 bm = mat3( batchingMatrix );
1182	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
1183	transformedNormal = bm * transformedNormal;
1184	#ifdef USE_TANGENT
1185		transformedTangent = bm * transformedTangent;
1186	#endif
1187#endif
1188#ifdef USE_INSTANCING
1189	mat3 im = mat3( instanceMatrix );
1190	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
1191	transformedNormal = im * transformedNormal;
1192	#ifdef USE_TANGENT
1193		transformedTangent = im * transformedTangent;
1194	#endif
1195#endif
1196transformedNormal = normalMatrix * transformedNormal;
1197#ifdef FLIP_SIDED
1198	transformedNormal = - transformedNormal;
1199#endif
1200#ifdef USE_TANGENT
1201	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
1202#endif`,uPt=`#ifdef USE_DISPLACEMENTMAP
1203	uniform sampler2D displacementMap;
1204	uniform float displacementScale;
1205	uniform float displacementBias;
1206#endif`,hPt=`#ifdef USE_DISPLACEMENTMAP
1207	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
1207placementBias );
1208#endif`,dPt=`#ifdef USE_EMISSIVEMAP
1209	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
1210	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
1211		emissiveColor = sRGBTransferEOTF( emissiveColor );
1212	#endif
1213	totalEmissiveRadiance *= emissiveColor.rgb;
1214#endif`,fPt=`#ifdef USE_EMISSIVEMAP
1215	uniform sampler2D emissiveMap;
1216#endif`,pPt="gl_FragColor = linearToOutputTexel( gl_FragColor );",gPt=`vec4 LinearTransferOETF( in vec4 value ) {
1217	return value;
1218}
1219vec4 sRGBTransferEOTF( in vec4 value ) {
1220	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
1221}
1222vec4 sRGBTransferOETF( in vec4 value ) {
1223	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
1224}`,mPt=`#ifdef USE_ENVMAP
1225	#ifdef ENV_WORLDPOS
1226		vec3 cameraToFrag;
1227		if ( isOrthographic ) {
1228			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
1229		} else {
1230			cameraToFrag = normalize( vWorldPosition - cameraPosition );
1231		}
1232		vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
1233		#ifdef ENVMAP_MODE_REFLECTION
1234			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
1235		#else
1236			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
1237		#endif
1238	#else
1239		vec3 reflectVec = vReflect;
1240	#endif
1241	#ifdef ENVMAP_TYPE_CUBE
1242		vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
1243		#ifdef ENVMAP_BLENDING_MULTIPLY
1244			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
1245		#elif defined( ENVMAP_BLENDING_MIX )
1246			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
1247		#elif defined( ENVMAP_BLENDING_ADD )
1248			outgoingLight += envColor.xyz * specularStrength * reflectivity;
1249		#endif
1250	#endif
1251#endif`,bPt=`#ifdef USE_ENVMAP
1252	uniform float envMapIntensity;
1253	uniform mat3 envMapRotation;
1254	#ifdef ENVMAP_TYPE_CUBE
1255		uniform samplerCube envMap;
1256	#else
1257		uniform sampler2D envMap;
1258	#endif
1259#endif`,vPt=`#ifdef USE_ENVMAP
1260	uniform float reflectivity;
1261	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
1262		#define ENV_WORLDPOS
1263	#endif
1264	#ifdef ENV_WORLDPOS
1265		varying vec3 vWorldPosition;
1266		uniform float refractionRatio;
1267	#else
1268		varying vec3 vReflect;
1269	#endif
1270#endif`,yPt=`#ifdef USE_ENVMAP
1271	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
1272		#define ENV_WORLDPOS
1273	#endif
1274	#ifdef ENV_WORLDPOS
1275		
1276		varying vec3 vWorldPosition;
1277	#else
1278		varying vec3 vReflect;
1279		uniform float refractionRatio;
1280	#endif
1281#endif`,xPt=`#ifdef USE_ENVMAP
1282	#ifdef ENV_WORLDPOS
1283		vWorldPosition = worldPosition.xyz;
1284	#else
1285		vec3 cameraToVertex;
1286		if ( isOrthographic ) {
1287			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
1288		} else {
1289			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
1290		}
1291		vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
1292		#ifdef ENVMAP_MODE_REFLECTION
1293			vReflect = reflect( cameraToVertex, worldNormal );
1294		#else
1295			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
1296		#endif
1297	#endif
1298#endif`,wPt=`#ifdef USE_FOG
1299	vFogDepth = - mvPosition.z;
1300#endif`,_Pt=`#ifdef USE_FOG
1301	varying float vFogDepth;
1302#endif`,SPt=`#ifdef USE_FOG
1303	#ifdef FOG_EXP2
1304		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
1305	#else
1306		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
1307	#endif
1308	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
1309#endif`,CPt=`#ifdef USE_FOG
1310	uniform vec3 fogColor;
1311	varying float vFogDepth;
1312	#ifdef FOG_EXP2
1313		uniform float fogDensity;
1314	#else
1315		uniform float fogNear;
1316		uniform float fogFar;
1317	#endif
1318#endif`,MPt=`#ifdef USE_GRADIENTMAP
1319	uniform sampler2D gradientMap;
1320#endif
1321vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
1322	float dotNL = dot( normal, lightDirection );
1323	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
1324	#ifdef USE_GRADIENTMAP
1325		return vec3( texture2D( gradientMap, coord ).r );
1326	#else
1327		vec2 fw = fwidth( coord ) * 0.5;
1328		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
1329	#endif
1330}`,TPt=`#ifdef USE_LIGHTMAP
1331	uniform sampler2D lightMap;
1332	uniform float lightMapIntensity;
1333#endif`,APt=`LambertMaterial material;
1334material.diffuseColor = diffuseColor.rgb;
1335material.specularStrength = specularStrength;`,EPt=`varying vec3 vViewPosition;
1336struct LambertMaterial {
1337	vec3 diffuseColor;
1338	float specularStrength;
1339};
1340void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
1341	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1342	vec3 irradiance = dotNL * directLight.color;
1343	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1344}
1345void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
1346	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1347}
1348#define RE_Direct				RE_Direct_Lambert
1349#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,kPt=`uniform bool receiveShadow;
1350uniform vec3 ambientLightColor;
1351#if defined( USE_LIGHT_PROBES )
1352	uniform vec3 lightProbe[ 9 ];
1353#endif
1354vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
1355	float x = normal.x, y = normal.y, z = normal.z;
1356	vec3 result = shCoefficients[ 0 ] * 0.886227;
1357	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
1358	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
1359	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
1360	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
1361	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
1362	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
1363	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
1364	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
1365	return result;
1366}
1367vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
1368	vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
1369	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
1370	return irradiance;
1371}
1372vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
1373	vec3 irradiance = ambientLightColor;
1374	return irradiance;
1375}
1376float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
1377	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
1378	if ( cutoffDistance > 0.0 ) {
1379		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
1380	}
1381	return distanceFalloff;
1382}
1383float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
1384	return smoothstep( coneCosine, penumbraCosine, angleCosine );
1385}
1386#if NUM_SUN_LIGHTS > 0
1387	struct SunLight {
1388		vec3 direction;
1389		vec3 color;
1390	};
1391	uniform SunLight sunLights[ NUM_SUN_LIGHTS ];
1392	void getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) {
1393		light.color = sunLight.color;
1394		light.direction = sunLight.direction;
1395		light.visible = true;
1396	}
1397#endif
1398#if NUM_DIR_LIGHTS > 0
1399	struct DirectionalLight {
1400		vec3 direction;
1401		vec3 color;
1402	};
1403	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
1404	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
1405		light.color = directionalLight.color;
1406		light.direction = directionalLight.direction;
1407		light.visible = true;
1408	}
1409#endif
1410#if NUM_POINT_LIGHTS > 0
1411	struct PointLight {
1412		vec3 position;
1413		vec3 color;
1414		float distance;
1415		float decay;
1416	};
1417	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
1418	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
1419		vec3 lVector = pointLight.position - geometryPosition;
1420		light.direction = normalize( lVector );
1421		float lightDistance = length( lVector );
1422		light.color = pointLight.color;
1423		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
1424		light.visible = ( light.color != vec3( 0.0 ) );
1425	}
1426#endif
1427#if NUM_SPOT_LIGHTS > 0
1428	struct SpotLight {
1429		vec3 position;
1430		vec3 direction;
1431		vec3 color;
1432		float distance;
1433		float decay;
1434		float coneCos;
1435		float penumbraCos;
1436	};
1437	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
1438	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
1439		vec3 lVector = spotLight.position - geometryPosition;
1440		light.direction = normalize( lVector );
1441		float angleCos = dot( light.direction, spotLight.direction );
1442		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
1443		if ( spotAttenuation > 0.0 ) {
1444			float lightDistance = length( lVector );
1445			light.color = spotLight.color * spotAttenuation;
1446			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
1447			light.visible = ( light.color != vec3( 0.0 ) );
1448		} else {
1449			light.color = vec3( 0.0 );
1450			light.visible = false;
1451		}
1452	}
1453#endif
1454#if NUM_RECT_AREA_LIGHTS > 0
1455	struct RectAreaLight {
1456		vec3 color;
1457		vec3 position;
1458		vec3 halfWidth;
1459		vec3 halfHeight;
1460	};
1461	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
1462	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
1463#endif
1464#if NUM_HEMI_LIGHTS > 0
1465	struct HemisphereLight {
1466		vec3 direction;
1467		vec3 skyColor;
1468		vec3 groundColor;
1469	};
1470	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
1471	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
1472		float dotNL = dot( normal, hemiLight.direction );
1473		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
1474		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
1475		return irradiance;
1476	}
1477#endif
1478#include <lightprobes_pars_fragment>`,PPt=`#ifdef USE_ENVMAP
1479	vec3 getIBLIrradiance( const in vec3 normal ) {
1480		#ifdef ENVMAP_TYPE_CUBE_UV
1481			vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
1482			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
1483			return PI * envMapColor.rgb * envMapIntensity;
1484		#else
1485			return vec3( 0.0 );
1486		#endif
1487	}
1488	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
1489		#ifdef ENVMAP_TYPE_CUBE_UV
1490			vec3 reflectVec = reflect( - viewDir, normal );
1491			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
1492			reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );
1493			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
1494			return envMapColor.rgb * envMapIntensity;
1495		#else
1496			return vec3( 0.0 );
1497		#endif
1498	}
1499	#ifdef USE_RETROREFLECTION
1500		vec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
1501			#ifdef ENVMAP_TYPE_CUBE_UV
1502				vec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) );
1503				retroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix );
1504				vec4 envMapColor = textureCubeUV( envMap, envMapRotation * retroVec, roughness );
1505				return envMapColor.rgb * envMapIntensity;
1506			#else
1507				return vec3( 0.0 );
1508			#endif
1509		}
1510	#endif
1511	#ifdef USE_ANISOTROPY
1512		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
1513			#ifdef ENVMAP_TYPE_CUBE_UV
1514				vec3 bentNormal = cross( bitangent, viewDir );
1515				bentNormal = normalize( cross( bentNormal, bitangent ) );
1516				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
1517				return getIBLRadiance( viewDir, bentNormal, roughness );
1518			#else
1519				return vec3( 0.0 );
1520			#endif
1521		}
1522		#ifdef USE_RETROREFLECTION
1523			vec3 getIBLAnisotropyRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
1524				#ifdef ENVMAP_TYPE_CUBE_UV
1525					vec3 bentNormal = cross( bitangent, viewDir );
1526					bentNormal = normalize( cross( bentNormal, bitangent ) );
1527					bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
1528					return getIBLRetroRadiance( viewDir, bentNormal, roughness );
1529				#else
1530					return vec3( 0.0 );
1531				#endif
1532			}
1533		#endif
1534	#endif
1535#endif`,RPt=`ToonMaterial material;
1536material.diffuseColor = diffuseColor.rgb;`,DPt=`varying vec3 vViewPosition;
1537struct ToonMaterial {
1538	vec3 diffuseColor;
1539};
1540void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
1541	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
1542	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1543}
1544void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
1545	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1546}
1547#define RE_Direct				RE_Direct_Toon
1548#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,LPt=`BlinnPhongMaterial material;
1549material.diffuseColor = diffuseColor.rgb;
1550material.specularColor = specular;
1551material.specularShininess = shininess;
1552material.specularStrength = specularStrength;`,IPt=`varying vec3 vViewPosition;
1553struct BlinnPhongMaterial {
1554	vec3 diffuseColor;
1555	vec3 specularColor;
1556	float specularShininess;
1557	float specularStrength;
1558};
1559void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
1560	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1561	vec3 irradiance = dotNL * directLight.color;
1562	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1563	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
1564}
1565void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
1566	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1567}
1568#define RE_Direct				RE_Direct_BlinnPhong
1569#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,OPt=`PhysicalMaterial material;
1570material.diffuseColor = diffuseColor.rgb;
1571material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
1572material.metalness = metalnessFactor;
1573vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
1574float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
1575material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
1576material.roughness = min( material.roughness, 1.0 );
1577#ifdef IOR
1578	material.ior = ior;
1579	#ifdef USE_SPECULAR
1580		float specularIntensityFactor = specularIntensity;
1581		vec3 specularColorFactor = specularColor;
1582		#ifdef USE_SPECULAR_COLORMAP
1583			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
1584		#endif
1585		#ifdef USE_SPECULAR_INTENSITYMAP
1586			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
1587		#endif
1588		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
1589	#else
1590		float specularIntensityFactor = 1.0;
1591		vec3 specularColorFactor = vec3( 1.0 );
1592		material.specularF90 = 1.0;
1593	#endif
1594	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
1595	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
1596#else
1597	material.specularColor = vec3( 0.04 );
1598	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
1599	material.specularF90 = 1.0;
1600#endif
1601#ifdef USE_CLEARCOAT
1602	material.clearcoat = clearcoat;
1603	material.clearcoatRoughness = clearcoatRoughness;
1604	material.clearcoatF0 = vec3( 0.04 );
1605	material.clearcoatF90 = 1.0;
1606	#ifdef USE_CLEARCOATMAP
1607		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
1608	#endif
1609	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1610		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
1611	#endif
1612	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
1613	material.clearcoatRoughness += geometryRoughness;
1614	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
1615#endif
1616#ifdef USE_DISPERSION
1617	material.dispersion = dispersion;
1618#endif
1619#ifdef USE_RETROREFLECTION
1620	material.retroreflectivity = retroreflectivity;
1621#endif
1622#ifdef USE_IRIDESCENCE
1623	material.iridescence = iridescence;
1624	material.iridescenceIOR = iridescenceIOR;
1625	#ifdef USE_IRIDESCENCEMAP
1626		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
1627	#endif
1628	#ifdef USE_IRIDESCENCE_THICKNESSMAP
1629		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
1630	#else
1631		material.iridescenceThickness = iridescenceThicknessMaximum;
1632	#endif
1633#endif
1634#ifdef USE_SHEEN
1635	material.sheenColor = sheenColor;
1636	#ifdef USE_SHEEN_COLORMAP
1637		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
1638	#endif
1639	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
1640	#ifdef USE_SHEEN_ROUGHNESSMAP
1641		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
1642	#endif
1643#endif
1644#ifdef USE_ANISOTROPY
1645	#ifdef USE_ANISOTROPYMAP
1646		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
1647		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
1648		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
1649	#else
1650		vec2 anisotropyV = anisotropyVector;
1651	#endif
1652	material.anisotropy = length( anisotropyV );
1653	if( material.anisotropy == 0.0 ) {
1654		anisotropyV = vec2( 1.0, 0.0 );
1655	} else {
1656		anisotropyV /= material.anisotropy;
1657		material.anisotropy = saturate( material.anisotropy );
1658	}
1659	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
1660	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
1661	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
1662#endif`,NPt=`uniform sampler2D dfgLUT;
1663struct PhysicalMaterial {
1664	vec3 diffuseColor;
1665	vec3 diffuseContribution;
1666	vec3 specularColor;
1667	vec3 specularColorBlended;
1668	float roughness;
1669	float metalness;
1670	float specularF90;
1671	float dispersion;
1672	vec2 dfg;
1673	vec3 multiScatteringCompensation;
1674	#ifdef USE_RETROREFLECTION
1675		float retroreflectivity;
1676	#endif
1677	#ifdef USE_CLEARCOAT
1678		float clearcoat;
1679		float clearcoatRoughness;
1680		vec3 clearcoatF0;
1681		float clearcoatF90;
1682	#endif
1683	#ifdef USE_IRIDESCENCE
1684		float iridescence;
1685		float iridescenceIOR;
1686		float iridescenceThickness;
1687		vec3 iridescenceFresnel;
1688		vec3 iridescenceF0Dielectric;
1689		vec3 iridescenceF0Metallic;
1690	#endif
1691	#ifdef USE_SHEEN
1692		vec3 sheenColor;
1693		float sheenRoughness;
1694	#endif
1695	#ifdef IOR
1696		float ior;
1697	#endif
1698	#ifdef USE_TRANSMISSION
1699		float transmission;
1700		float transmissionAlpha;
1701		float thickness;
1702		float attenuationDistance;
1703		vec3 attenuationColor;
1704	#endif
1705	#ifdef USE_ANISOTROPY
1706		float anisotropy;
1707		float alphaT;
1708		vec3 anisotropyT;
1709		vec3 anisotropyB;
1710	#endif
1711};
1712vec3 clearcoatSpecularDirect = vec3( 0.0 );
1713vec3 clearcoatSpecularIndirect = vec3( 0.0 );
1714vec3 sheenSpecularDirect = vec3( 0.0 );
1715vec3 sheenSpecularIndirect = vec3(0.0 );
1716vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
1717    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
1718    float x2 = x * x;
1719    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
1720    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
1721}
1722float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1723	float a2 = pow2( alpha );
1724	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1725	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1726	return 0.5 / max( gv + gl, EPSILON );
1727}
1728float D_GGX( const in float alpha, const in float dotNH ) {
1729	float a2 = pow2( alpha );
1730	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1731	return RECIPROCAL_PI * a2 / pow2( denom );
1732}
1733#ifdef USE_ANISOTROPY
1734	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
1735		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1736		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1737		return 0.5 / max( gv + gl, EPSILON );
1738	}
1739	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1740		float a2 = alphaT * alphaB;
1741		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1742		highp float v2 = dot( v, v );
1743		float w2 = a2 / v2;
1744		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1745	}
1746#endif
1747#ifdef USE_CLEARCOAT
1748	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1749		vec3 f0 = material.clearcoatF0;
1750		float f90 = material.clearcoatF90;
1751		float roughness = material.clearcoatRoughness;
1752		float alpha = pow2( roughness );
1753		vec3 halfDir = normalize( lightDir + viewDir );
1754		float dotNL = saturate( dot( normal, lightDir ) );
1755		float dotNV = saturate( dot( normal, viewDir ) );
1756		float dotNH = saturate( dot( normal, halfDir ) );
1757		float dotVH = saturate( dot( viewDir, halfDir ) );
1758		vec3 F = F_Schlick( f0, f90, dotVH );
1759		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1760		float D = D_GGX( alpha, dotNH );
1761		return F * ( V * D );
1762	}
1763#endif
1764vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1765	vec3 f0 = material.specularColorBlended;
1766	float f90 = material.specularF90;
1767	float roughness = material.roughness;
1768	float alpha = pow2( roughness );
1769	vec3 halfDir = normalize( lightDir + viewDir );
1770	float dotNL = saturate( dot( normal, lightDir ) );
1771	float dotNV = saturate( dot( normal, viewDir ) );
1772	float dotNH = saturate( dot( normal, halfDir ) );
1773	float dotVH = saturate( dot( viewDir, halfDir ) );
1774	vec3 F = F_Schlick( f0, f90, dotVH );
1775	#ifdef USE_IRIDESCENCE
1776		F = mix( F, material.iridescenceFresnel, material.iridescence );
1777	#endif
1778	#ifdef USE_ANISOTROPY
1779		float dotTL = dot( material.anisotropyT, lightDir );
1780		float dotTV = dot( material.anisotropyT, viewDir );
1781		float dotTH = dot( material.anisotropyT, halfDir );
1782		float dotBL = dot( material.anisotropyB, lightDir );
1783		float dotBV = dot( material.anisotropyB, viewDir );
1784		float dotBH = dot( material.anisotropyB, halfDir );
1785		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1786		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1787	#else
1788		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1789		float D = D_GGX( alpha, dotNH );
1790	#endif
1791	return F * ( V * D );
1792}
1793vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1794	const float LUT_SIZE = 64.0;
1795	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1796	const float LUT_BIAS = 0.5 / LUT_SIZE;
1797	float dotNV = saturate( dot( N, V ) );
1798	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1799	uv = uv * LUT_SCALE + LUT_BIAS;
1800	return uv;
1801}
1802float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1803	float l = length( f );
1804	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1805}
1806vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1807	float x = dot( v1, v2 );
1808	float y = abs( x );
1809	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1810	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1811	float v = a / b;
1812	float theta_sintheta = ( x >
1812 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1813	return cross( v1, v2 ) * theta_sintheta;
1814}
1815vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1816	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1817	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1818	vec3 lightNormal = cross( v1, v2 );
1819	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1820	vec3 T1, T2;
1821	T1 = normalize( V - N * dot( V, N ) );
1822	T2 = - cross( N, T1 );
1823	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1824	vec3 coords[ 4 ];
1825	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1826	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1827	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1828	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1829	coords[ 0 ] = normalize( coords[ 0 ] );
1830	coords[ 1 ] = normalize( coords[ 1 ] );
1831	coords[ 2 ] = normalize( coords[ 2 ] );
1832	coords[ 3 ] = normalize( coords[ 3 ] );
1833	vec3 vectorFormFactor = vec3( 0.0 );
1834	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1835	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1836	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1837	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1838	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1839	return vec3( result );
1840}
1841#if defined( USE_SHEEN )
1842float D_Charlie( float roughness, float dotNH ) {
1843	float alpha = pow2( roughness );
1844	float invAlpha = 1.0 / alpha;
1845	float cos2h = dotNH * dotNH;
1846	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1847	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1848}
1849float V_Neubelt( float dotNV, float dotNL ) {
1850	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1851}
1852vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1853	vec3 halfDir = normalize( lightDir + viewDir );
1854	float dotNL = saturate( dot( normal, lightDir ) );
1855	float dotNV = saturate( dot( normal, viewDir ) );
1856	float dotNH = saturate( dot( normal, halfDir ) );
1857	float D = D_Charlie( sheenRoughness, dotNH );
1858	float V = V_Neubelt( dotNV, dotNL );
1859	return sheenColor * ( D * V );
1860}
1861#endif
1862float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1863	float dotNV = saturate( dot( normal, viewDir ) );
1864	float r2 = roughness * roughness;
1865	float rInv = 1.0 / ( roughness + 0.1 );
1866	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1867	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1868	float DG = exp( a * dotNV + b );
1869	return saturate( DG );
1870}
1871vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1872	float dotNV = saturate( dot( normal, viewDir ) );
1873	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1874	return specularColor * fab.x + specularF90 * fab.y;
1875}
1876#ifdef USE_IRIDESCENCE
1877void computeMultiscatteringIridescence( const in vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) {
1878#else
1879void computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) {
1880#endif
1881	#ifdef USE_IRIDESCENCE
1882		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1883	#else
1884		vec3 Fr = specularColor;
1885	#endif
1886	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1887	float Ess = fab.x + fab.y;
1888	float Ems = 1.0 - Ess;
1889	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1890	singleScatter += FssEss;
1891	multiScatter += Fms * Ems;
1892}
1893#if NUM_RECT_AREA_LIGHTS > 0
1894	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1895		vec3 normal = geometryNormal;
1896		vec3 viewDir = geometryViewDir;
1897		vec3 position = geometryPosition;
1898		vec3 lightPos = rectAreaLight.position;
1899		vec3 halfWidth = rectAreaLight.halfWidth;
1900		vec3 halfHeight = rectAreaLight.halfHeight;
1901		vec3 lightColor = rectAreaLight.color;
1902		float roughness = material.roughness;
1903		vec3 rectCoords[ 4 ];
1904		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1905		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1906		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1907		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1908		vec4 t1 = texture2D( ltc_1, uv );
1909		vec4 t2 = texture2D( ltc_2, uv );
1910		mat3 mInv = mat3(
1911			vec3( t1.x, 0, t1.y ),
1912			vec3(    0, 1,    0 ),
1913			vec3( t1.z, 0, t1.w )
1914		);
1915		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1916		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1917		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1918		#ifdef USE_CLEARCOAT
1919			vec3 Ncc = geometryClearcoatNormal;
1920			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1921			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1922			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1923			mat3 mInvClearcoat = mat3(
1924				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1925				vec3(             0, 1,             0 ),
1926				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1927			);
1928			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1929			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1930		#endif
1931	}
1932#endif
1933void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1934	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1935	vec3 irradiance = dotNL * directLight.color;
1936	#ifdef USE_CLEARCOAT
1937		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1938		vec3 ccIrradiance = dotNLcc * directLight.color;
1939		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1940	#endif
1941	#ifdef USE_SHEEN
1942 
1943 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1944 
1945 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1946 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1947 
1948 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1949 
1950 		irradiance *= sheenEnergyComp;
1951 
1952 	#endif
1953	vec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1954	#ifdef USE_RETROREFLECTION
1955		vec3 retroViewDir = reflect( - geometryViewDir, geometryNormal );
1956		vec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material );
1957		specularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) );
1958	#endif
1959	reflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation;
1960	vec3 halfDir = normalize( directLight.direction + geometryViewDir );
1961	float dotVH = saturate( dot( geometryViewDir, halfDir ) );
1962	vec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH );
1963	#ifdef USE_RETROREFLECTION
1964		vec3 retroHalfDir = normalize( directLight.direction + retroViewDir );
1965		float dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) );
1966		vec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );
1967		F = mix( F, retroF, saturate( material.retroreflectivity ) );
1968	#endif
1969	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F );
1970}
1971void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1972	vec3 singleScattering = vec3( 0.0 );
1973	vec3 multiScattering = vec3( 0.0 );
1974	#ifdef USE_IRIDESCENCE
1975		computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering );
1976	#else
1977		computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );
1978	#endif
1979	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );
1980	#ifdef USE_SHEEN
1981		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1982		sheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;
1983		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1984		diffuse *= sheenEnergyComp;
1985	#endif
1986	reflectedLight.indirectDiffuse += diffuse;
1987}
1988void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1989	#ifdef USE_CLEARCOAT
1990		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1991	#endif
1992	#ifdef USE_SHEEN
1993		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1994 	#endif
1995	vec3 singleScatteringDielectric = vec3( 0.0 );
1996	vec3 multiScatteringDielectric = vec3( 0.0 );
1997	vec3 singleScatteringMetallic = vec3( 0.0 );
1998	vec3 multiScatteringMetallic = vec3( 0.0 );
1999	#ifdef USE_IRIDESCENCE
2000		computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric );
2001		computeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic );
2002	#else
2003		computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric );
2004		computeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, singleScatteringMetallic, multiScatteringMetallic );
2005	#endif
2006	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
2007	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
2008	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
2009	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
2010	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
2011	vec3 indirectSpecular = radiance * singleScattering;
2012	indirectSpecular += multiScattering * cosineWeightedIrradiance;
2013	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
2014	#ifdef USE_SHEEN
2015		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
2016		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
2017		indirectSpecular *= sheenEnergyComp;
2018		indirectDiffuse *= sheenEnergyComp;
2019	#endif
2020	reflectedLight.indirectSpecular += indirectSpecular;
2021	reflectedLight.indirectDiffuse += indirectDiffuse;
2022}
2023#define RE_Direct				RE_Direct_Physical
2024#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
2025#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
2026#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
2027float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
2028	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
2029}`,BPt=`
2030vec3 geometryPosition = - vViewPosition;
2031vec3 geometryNormal = normal;
2032vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
2033vec3 geometryClearcoatNormal = vec3( 0.0 );
2034#ifdef USE_CLEARCOAT
2035	geometryClearcoatNormal = clearcoatNormal;
2036#endif
2037#ifdef USE_IRIDESCENCE
2038	float dotNVi = saturate( dot( normal, geometryViewDir ) );
2039	if ( material.iridescenceThickness == 0.0 ) {
2040		material.iridescence = 0.0;
2041	} else {
2042		material.iridescence = saturate( material.iridescence );
2043	}
2044	if ( material.iridescence > 0.0 ) {
2045		vec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
2046		vec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
2047		material.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness );
2048		material.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi );
2049		material.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi );
2050	}
2051#endif
2052#ifdef STANDARD
2053	float dotNVms = saturate( dot( geometryNormal, geometryViewDir ) );
2054	material.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg;
2055	#if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 )
2056		float EssMs = material.dfg.x + material.dfg.y;
2057		material.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 );
2058	#endif
2059#endif
2060IncidentLight directLight;
2061#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
2062	PointLight pointLight;
2063	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
2064	PointLightShadow pointLightShadow;
2065	#endif
2066	#pragma unroll_loop_start
2067	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
2068		pointLight = pointLights[ i ];
2069		getPointLightInfo( pointLight, geometryPosition, directLight );
2070		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2071		pointLightShadow = pointLightShadows[ i ];
2072		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
2073		#endif
2074		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2075	}
2076	#pragma unroll_loop_end
2077#endif
2078#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
2079	SpotLight spotLight;
2080	vec4 spotColor;
2081	vec3 spotLightCoord;
2082	bool inSpotLightMap;
2083	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
2084	SpotLightShadow spotLightShadow;
2085	#endif
2086	#pragma unroll_loop_start
2087	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
2088		spotLight = spotLights[ i ];
2089		getSpotLightInfo( spotLight, geometryPosition, directLight );
2090		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
2091		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
2092		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2093		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
2094		#else
2095		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
2096		#endif
2097		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
2098			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
2099			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
2100			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
2101			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
2102		#endif
2103		#undef SPOT_LIGHT_MAP_INDEX
2104		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2105		spotLightShadow = spotLightShadows[ i ];
2106		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2107		#endif
2108		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2109	}
2110	#pragma unroll_loop_end
2111#endif
2112#if ( NUM_SUN_LIGHTS > 0 ) && defined( RE_Direct )
2113	SunLight sunLight;
2114	#if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0
2115	SunLightShadow sunLightShadow;
2116	#endif
2117	#pragma unroll_loop_start
2118	for ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) {
2119		sunLight = sunLights[ i ];
2120		getSunLightInfo( sunLight, directLight );
2121		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS )
2122		sunLightShadow = sunLightShadows[ i ];
2123		directLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 1.0;
2124		#endif
2125		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2126	}
2127	#pragma unroll_loop_end
2128#endif
2129#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
2130	DirectionalLight directionalLight;
2131	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
2132	DirectionalLightShadow directionalLightShadow;
2133	#endif
2134	#pragma unroll_loop_start
2135	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
2136		directionalLight = directionalLights[ i ];
2137		getDirectionalLightInfo( directionalLight, directLight );
2138		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
2139		directionalLightShadow = directionalLightShadows[ i ];
2140		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2141		#endif
2142		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2143	}
2144	#pragma unroll_loop_end
2145#endif
2146#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
2147	RectAreaLight rectAreaLight;
2148	#pragma unroll_loop_start
2149	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
2150		rectAreaLight = rectAreaLights[ i ];
2151		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2152	}
2153	#pragma unroll_loop_end
2154#endif
2155#if defined( RE_IndirectDiffuse )
2156	vec3 iblIrradiance = vec3( 0.0 );
2157	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
2158	#if defined( USE_LIGHT_PROBES )
2159		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
2160	#endif
2161	#if ( NUM_HEMI_LIGHTS > 0 )
2162		#pragma unroll_loop_start
2163		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
2164			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
2165		}
2166		#pragma unroll_loop_end
2167	#endif
2168	#ifdef USE_LIGHT_PROBES_GRID
2169		vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
2170		vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );
2171		irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
2172	#endif
2173#endif
2174#if defined( RE_IndirectSpecular )
2175	vec3 radiance = vec3( 0.0 );
2176	vec3 clearcoatRadiance = vec3( 0.0 );
2177#endif`,FPt=`#if defined( RE_IndirectDiffuse )
2178	#ifdef USE_LIGHTMAP
2179		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2180		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
2181		irradiance += lightMapIrradiance;
2182	#endif
2183	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
2184		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
2185			iblIrradiance += getIBLIrradiance( geometryNormal );
2186		#endif
2187	#endif
2188#endif
2189#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
2190	#ifdef USE_ANISOTROPY
2191		vec3 iblRadiance = getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
2192	#else
2193		vec3 iblRadiance = getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
2194	#endif
2195	#ifdef USE_RETROREFLECTION
2196		#ifdef USE_ANISOTROPY
2197			vec3 retroIBLRadiance = getIBLAnisotropyRetroRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
2198		#else
2199			vec3 retroIBLRadiance = getIBLRetroRadiance( geometryViewDir, geometryNormal, material.roughness );
2200		#endif
2201		iblRadiance = mix( iblRadiance, retroIBLRadiance, saturate( material.retroreflectivity ) );
2202	#endif
2203	radiance += iblRadiance;
2204	#ifdef USE_CLEARCOAT
2205		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
2206	#endif
2207#endif`,UPt=`#if defined( RE_IndirectDiffuse )
2208	#if defined( LAMBERT ) || defined( PHONG )
2209		irradiance += iblIrradiance;
2210	#endif
2211	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2212#endif
2213#if defined( RE_IndirectSpecular )
2214	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2215#endif`,zPt=`#ifdef USE_LIGHT_PROBES_GRID
2216uniform highp sampler3D probesSH;
2217uniform vec3 probesMin;
2218uniform vec3 probesMax;
2219uniform vec3 probesResolution;
2220vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
2221	vec3 res = probesResolution;
2222	vec3 gridRange = probesMax - probesMin;
2223	vec3 resMinusOne = res - 1.0;
2224	vec3 probeSpacing = gridRange / resMinusOne;
2225	vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
2226	vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
2227	uvw = uvw * resMinusOne / res + 0.5 / res;
2228	float nz          = res.z;
2229	float paddedSlices = nz + 2.0;
2230	float atlasDepth  = 7.0 * paddedSlices;
2231	float uvZBase     = uvw.z * nz + 1.0;
2232	vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase                       ) / atlasDepth ) );
2233	vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase +       paddedSlices   ) / atlasDepth ) );
2234	vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices   ) / atlasDepth ) );
2235	vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices   ) / atlasDepth ) );
2236	vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices   ) / atlasDepth ) );
2237	vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices   ) / atlasDepth ) );
2238	vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices   ) / atlasDepth ) );
2239	vec3 c0 = s0.xyz;
2240	vec3 c1 = vec3( s0.w, s1.xy );
2241	vec3 c2 = vec3( s1.zw, s2.x );
2242	vec3 c3 = s2.yzw;
2243	vec3 c4 = s3.xyz;
2244	vec3 c5 = vec3( s3.w, s4.xy );
2245	vec3 c6 = vec3( s4.zw, s5.x );
2246	vec3 c7 = s5.yzw;
2247	vec3 c8 = s6.xyz;
2248	float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
2249	vec3 result = c0 * 0.886227;
2250	result += c1 * 2.0 * 0.511664 * y;
2251	result += c2 * 2.0 * 0.511664 * z;
2252	result += c3 * 2.0 * 0.511664 * x;
2253	result += c4 * 2.0 * 0.429043 * x * y;
2254	result += c5 * 2.0 * 0.429043 * y * z;
2255	result += c6 * ( 0.743125 * z * z - 0.247708 );
2256	result += c7 * 2.0 * 0.429043 * x * z;
2257	result += c8 * 0.429043 * ( x * x - y * y );
2258	return max( result, vec3( 0.0 ) );
2259}
2260#endif`,VPt=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
2261	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
2262#endif`,HPt=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
2263	uniform float logDepthBufFC;
2264	varying float vFragDepth;
2265	varying float vIsPerspective;
2266#endif`,jPt=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
2267	varying float vFragDepth;
2268	varying float vIsPerspective;
2269#endif`,WPt=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
2270	vFragDepth = 1.0 + gl_Position.w;
2271	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
2272#endif`,$Pt=`#ifdef USE_MAP
2273	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
2274	#ifdef DECODE_VIDEO_TEXTURE
2275		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
2276	#endif
2277	diffuseColor *= sampledDiffuseColor;
2278#endif`,GPt=`#ifdef USE_MAP
2279	uniform sampler2D map;
2280#endif`,qPt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
2281	#if defined( USE_POINTS_UV )
2282		vec2 uv = vUv;
2283	#else
2284		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
2285	#endif
2286#endif
2287#ifdef USE_MAP
2288	diffuseColor *= texture2D( map, uv );
2289#endif
2290#ifdef USE_ALPHAMAP
2291	diffuseColor.a *= texture2D( alphaMap, uv ).g;
2292#endif`,YPt=`#if defined( USE_POINTS_UV )
2293	varying vec2 vUv;
2294#else
2295	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
2296		uniform mat3 uvTransform;
2297	#endif
2298#endif
2299#ifdef USE_MAP
2300	uniform sampler2D map;
2301#endif
2302#ifdef USE_ALPHAMAP
2303	uniform sampler2D alphaMap;
2304#endif`,XPt=`float metalnessFactor = metalness;
2305#ifdef USE_METALNESSMAP
2306	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
2307	metalnessFactor *= texelMetalness.b;
2308#endif`,KPt=`#ifdef USE_METALNESSMAP
2309	uniform sampler2D metalnessMap;
2310#endif`,JPt=`#ifdef USE_INSTANCING_MORPH
2311	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
2312	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
2313	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
2314		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
2315	}
2316#endif`,ZPt=`#if defined( USE_MORPHCOLORS )
2317	vColor *= morphTargetBaseInfluence;
2318	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
2319		#if defined( USE_COLOR_ALPHA )
2320			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
2321		#elif defined( USE_COLOR )
2322			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
2323		#endif
2324	}
2325#endif`,QPt=`#ifdef USE_MORPHNORMALS
2326	objectNormal *= morphTargetBaseInfluence;
2327	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
2328		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
2329	}
2330#endif`,tRt=`#ifdef USE_MORPHTARGETS
2331	#ifndef USE_INSTANCING_MORPH
2332		uniform float morphTargetBaseInfluence;
2333		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
2334	#endif
2335	uniform sampler2DArray morphTargetsTexture;
2336	uniform ivec2 morphTargetsTextureSize;
2337	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
2338		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
2339		int y = texelIndex / morphTargetsTextureSize.x;
2340		int x = texelIndex - y * morphTargetsTextureSize.x;
2341		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
2342		return texelFetch( morphTargetsTexture, morphUV, 0 );
2343	}
2344#endif`,eRt=`#ifdef USE_MORPHTARGETS
2345	transformed *= morphTargetBaseInfluence;
2346	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
2347		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
2348	}
2349#endif`,nRt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
2350#ifdef FLAT_SHADED
2351	vec3 fdx = dFdx( vViewPosition );
2352	vec3 fdy = dFdy( vViewPosition );
2353	vec3 normal = normalize( cross( fdx, fdy ) );
2354#else
2355	vec3 normal = normalize( vNormal );
2356	#ifdef DOUBLE_SIDED
2357		normal *= faceDirection;
2358	#endif
2359#endif
2360#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
2361	#ifdef USE_TANGENT
2362		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
2363	#else
2364		mat3 tbn = getTangentFrame( - vViewPosition, normal,
2365		#if defined( USE_NORMALMAP )
2366			vNormalMapUv
2367		#elif defined( USE_CLEARCOAT_NORMALMAP )
2368			vClearcoatNormalMapUv
2369		#else
2370			vUv
2371		#endif
2372		);
2373	#endif
2374	#ifdef DOUBLE_SIDED
2375		tbn[0] *= faceDirection;
2376		tbn[1] *= faceDirection;
2377	#endif
2378#endif
2379#ifdef USE_CLEARCOAT_NORMALMAP
2380	#ifdef USE_TANGENT
2381		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
2382	#else
2383		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
2384	#endif
2385	#ifdef DOUBLE_SIDED
2386		tbn2[0] *= faceDirection;
2387		tbn2[1] *= faceDirection;
2388	#endif
2389#endif
2390vec3 nonPerturbedNormal = normal;`,iRt=`#ifdef USE_NORMALMAP_OBJECTSPACE
2391	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
2392	#ifdef FLIP_SIDED
2393		normal = - normal;
2394	#endif
2395	#ifdef DOUBLE_SIDED
2396		normal = normal * faceDirection;
2397	#endif
2398	normal = normalize( normalMatrix * normal );
2399#elif defined( USE_NORMALMAP_TANGENTSPACE )
2400	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
2401	#if defined( USE_PACKED_NORMALMAP )
2402		mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
2403	#endif
2404	mapN.xy *= normalScale;
2405	normal = 
2405normalize( tbn * mapN );
2406#elif defined( USE_BUMPMAP )
2407	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
2408#endif`,sRt=`#ifndef FLAT_SHADED
2409	varying vec3 vNormal;
2410	#ifdef USE_TANGENT
2411		varying vec3 vTangent;
2412		varying vec3 vBitangent;
2413	#endif
2414#endif`,rRt=`#ifndef FLAT_SHADED
2415	varying vec3 vNormal;
2416	#ifdef USE_TANGENT
2417		varying vec3 vTangent;
2418		varying vec3 vBitangent;
2419	#endif
2420#endif`,oRt=`#ifndef FLAT_SHADED
2421	vNormal = normalize( transformedNormal );
2422	#ifdef USE_TANGENT
2423		vTangent = normalize( transformedTangent );
2424		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
2425		#ifdef FLIP_SIDED
2426			vBitangent = - vBitangent;
2427		#endif
2428	#endif
2429#endif`,aRt=`#ifdef USE_NORMALMAP
2430	uniform sampler2D normalMap;
2431	uniform vec2 normalScale;
2432#endif
2433#ifdef USE_NORMALMAP_OBJECTSPACE
2434	uniform mat3 normalMatrix;
2435#endif
2436#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
2437	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
2438		vec3 q0 = dFdx( eye_pos.xyz );
2439		vec3 q1 = dFdy( eye_pos.xyz );
2440		vec2 st0 = dFdx( uv.st );
2441		vec2 st1 = dFdy( uv.st );
2442		vec3 N = surf_norm;
2443		vec3 q1perp = cross( q1, N );
2444		vec3 q0perp = cross( N, q0 );
2445		vec3 T = q1perp * st0.x + q0perp * st1.x;
2446		vec3 B = q1perp * st0.y + q0perp * st1.y;
2447		float det = max( dot( T, T ), dot( B, B ) );
2448		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
2449		return mat3( T * scale, B * scale, N );
2450	}
2451#endif`,lRt=`#ifdef USE_CLEARCOAT
2452	vec3 clearcoatNormal = nonPerturbedNormal;
2453#endif`,cRt=`#ifdef USE_CLEARCOAT_NORMALMAP
2454	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
2455	clearcoatMapN.xy *= clearcoatNormalScale;
2456	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
2457#endif`,uRt=`#ifdef USE_CLEARCOATMAP
2458	uniform sampler2D clearcoatMap;
2459#endif
2460#ifdef USE_CLEARCOAT_NORMALMAP
2461	uniform sampler2D clearcoatNormalMap;
2462	uniform vec2 clearcoatNormalScale;
2463#endif
2464#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2465	uniform sampler2D clearcoatRoughnessMap;
2466#endif`,hRt=`#ifdef USE_IRIDESCENCEMAP
2467	uniform sampler2D iridescenceMap;
2468#endif
2469#ifdef USE_IRIDESCENCE_THICKNESSMAP
2470	uniform sampler2D iridescenceThicknessMap;
2471#endif`,dRt=`#ifdef OPAQUE
2472diffuseColor.a = 1.0;
2473#endif
2474#ifdef USE_TRANSMISSION
2475diffuseColor.a *= material.transmissionAlpha;
2476#endif
2477gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,fRt=`vec3 packNormalToRGB( const in vec3 normal ) {
2478	return normalize( normal ) * 0.5 + 0.5;
2479}
2480vec3 unpackRGBToNormal( const in vec3 rgb ) {
2481	return 2.0 * rgb.xyz - 1.0;
2482}
2483const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
2484const float Inv255 = 1. / 255.;
2485const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
2486const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
2487const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
2488const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
2489vec4 packDepthToRGBA( const in float v ) {
2490	if( v <= 0.0 )
2491		return vec4( 0., 0., 0., 0. );
2492	if( v >= 1.0 )
2493		return vec4( 1., 1., 1., 1. );
2494	float vuf;
2495	float af = modf( v * PackFactors.a, vuf );
2496	float bf = modf( vuf * ShiftRight8, vuf );
2497	float gf = modf( vuf * ShiftRight8, vuf );
2498	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
2499}
2500vec3 packDepthToRGB( const in float v ) {
2501	if( v <= 0.0 )
2502		return vec3( 0., 0., 0. );
2503	if( v >= 1.0 )
2504		return vec3( 1., 1., 1. );
2505	float vuf;
2506	float bf = modf( v * PackFactors.b, vuf );
2507	float gf = modf( vuf * ShiftRight8, vuf );
2508	return vec3( vuf * Inv255, gf * PackUpscale, bf );
2509}
2510vec2 packDepthToRG( const in float v ) {
2511	if( v <= 0.0 )
2512		return vec2( 0., 0. );
2513	if( v >= 1.0 )
2514		return vec2( 1., 1. );
2515	float vuf;
2516	float gf = modf( v * 256., vuf );
2517	return vec2( vuf * Inv255, gf );
2518}
2519float unpackRGBAToDepth( const in vec4 v ) {
2520	return dot( v, UnpackFactors4 );
2521}
2522float unpackRGBToDepth( const in vec3 v ) {
2523	return dot( v, UnpackFactors3 );
2524}
2525float unpackRGToDepth( const in vec2 v ) {
2526	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
2527}
2528vec4 pack2HalfToRGBA( const in vec2 v ) {
2529	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
2530	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
2531}
2532vec2 unpackRGBATo2Half( const in vec4 v ) {
2533	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
2534}
2535float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
2536	return ( viewZ + near ) / ( near - far );
2537}
2538float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
2539	#ifdef USE_REVERSED_DEPTH_BUFFER
2540	
2541		return depth * ( far - near ) - far;
2542	#else
2543		return depth * ( near - far ) - near;
2544	#endif
2545}
2546float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
2547	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
2548}
2549float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
2550	
2551	#ifdef USE_REVERSED_DEPTH_BUFFER
2552		return ( near * far ) / ( ( near - far ) * depth - near );
2553	#else
2554		return ( near * far ) / ( ( far - near ) * depth - far );
2555	#endif
2556}`,pRt=`#ifdef PREMULTIPLIED_ALPHA
2557	gl_FragColor.rgb *= gl_FragColor.a;
2558#endif`,gRt=`vec4 mvPosition = vec4( transformed, 1.0 );
2559#ifdef USE_BATCHING
2560	mvPosition = batchingMatrix * mvPosition;
2561#endif
2562#ifdef USE_INSTANCING
2563	mvPosition = instanceMatrix * mvPosition;
2564#endif
2565mvPosition = modelViewMatrix * mvPosition;
2566gl_Position = projectionMatrix * mvPosition;`,mRt=`#ifdef DITHERING
2567	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
2568#endif`,bRt=`#ifdef DITHERING
2569	vec3 dithering( vec3 color ) {
2570		float grid_position = rand( gl_FragCoord.xy );
2571		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
2572		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
2573		return color + dither_shift_RGB;
2574	}
2575#endif`,vRt=`float roughnessFactor = roughness;
2576#ifdef USE_ROUGHNESSMAP
2577	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
2578	roughnessFactor *= texelRoughness.g;
2579#endif`,yRt=`#ifdef USE_ROUGHNESSMAP
2580	uniform sampler2D roughnessMap;
2581#endif`,xRt=`#if NUM_SPOT_LIGHT_COORDS > 0
2582	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2583#endif
2584#if NUM_SPOT_LIGHT_MAPS > 0
2585	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
2586#endif
2587#ifdef USE_SHADOWMAP
2588	#if NUM_SUN_LIGHT_SHADOWS > 0
2589		#define SUN_LIGHT_CASCADES 2
2590		#if defined( SHADOWMAP_TYPE_PCF )
2591			uniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];
2592		#else
2593			uniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];
2594		#endif
2595		uniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];
2596		uniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];
2597		varying vec4 vSunShadowWorldPosition;
2598		varying vec3 vSunShadowWorldNormal;
2599		struct SunLightShadow {
2600			float shadowIntensity;
2601			float shadowBias;
2602			float shadowNormalBias;
2603			float shadowRadius;
2604			vec2 shadowMapSize;
2605		};
2606		uniform SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ];
2607	#endif
2608	#if NUM_DIR_LIGHT_SHADOWS > 0
2609		#if defined( SHADOWMAP_TYPE_PCF )
2610			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
2611		#else
2612			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
2613		#endif
2614		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
2615		struct DirectionalLightShadow {
2616			float shadowIntensity;
2617			float shadowBias;
2618			float shadowNormalBias;
2619			float shadowRadius;
2620			vec2 shadowMapSize;
2621		};
2622		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2623	#endif
2624	#if NUM_SPOT_LIGHT_SHADOWS > 0
2625		#if defined( SHADOWMAP_TYPE_PCF )
2626			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
2627		#else
2628			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
2629		#endif
2630		struct SpotLightShadow {
2631			float shadowIntensity;
2632			float shadowBias;
2633			float shadowNormalBias;
2634			float shadowRadius;
2635			vec2 shadowMapSize;
2636		};
2637		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2638	#endif
2639	#if NUM_POINT_LIGHT_SHADOWS > 0
2640		#if defined( SHADOWMAP_TYPE_PCF )
2641			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
2642		#elif defined( SHADOWMAP_TYPE_BASIC )
2643			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
2644		#endif
2645		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2646		struct PointLightShadow {
2647			float shadowIntensity;
2648			float shadowBias;
2649			float shadowNormalBias;
2650			float shadowRadius;
2651			vec2 shadowMapSize;
2652			float shadowCameraNear;
2653			float shadowCameraFar;
2654		};
2655		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2656	#endif
2657	#if defined( SHADOWMAP_TYPE_PCF )
2658		float interleavedGradientNoise( vec2 position ) {
2659			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
2660		}
2661		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
2662			const float goldenAngle = 2.399963229728653;
2663			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
2664			float theta = float( sampleIndex ) * goldenAngle + phi;
2665			return vec2( cos( theta ), sin( theta ) ) * r;
2666		}
2667	#endif
2668	#if defined( SHADOWMAP_TYPE_PCF )
2669		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
2670			float shadow = 1.0;
2671			shadowCoord.xyz /= shadowCoord.w;
2672			shadowCoord.z += shadowBias;
2673			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
2674			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
2675			if ( frustumTest ) {
2676				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
2677				float radius = shadowRadius * texelSize.x;
2678				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
2679				shadow = (
2680					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
2681					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
2682					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
2683					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
2684					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
2685				) * 0.2;
2686			}
2687			return mix( 1.0, shadow, shadowIntensity );
2688		}
2689	#elif defined( SHADOWMAP_TYPE_VSM )
2690		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
2691			float shadow = 1.0;
2692			shadowCoord.xyz /= shadowCoord.w;
2693			#ifdef USE_REVERSED_DEPTH_BUFFER
2694				shadowCoord.z -= shadowBias;
2695			#else
2696				shadowCoord.z += shadowBias;
2697			#endif
2698			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
2699			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
2700			if ( frustumTest ) {
2701				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
2702				float mean = distribution.x;
2703				float variance = distribution.y * distribution.y;
2704				#ifdef USE_REVERSED_DEPTH_BUFFER
2705					float hard_shadow = step( mean, shadowCoord.z );
2706				#else
2707					float hard_shadow = step( shadowCoord.z, mean );
2708				#endif
2709				
2710				if ( hard_shadow == 1.0 ) {
2711					shadow = 1.0;
2712				} else {
2713					variance = max( variance, 0.0000001 );
2714					float d = shadowCoord.z - mean;
2715					float p_max = variance / ( variance + d * d );
2716					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
2717					shadow = max( hard_shadow, p_max );
2718				}
2719			}
2720			return mix( 1.0, shadow, shadowIntensity );
2721		}
2722	#else
2723		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
2724			float shadow = 1.0;
2725			shadowCoord.xyz /= shadowCoord.w;
2726			#ifdef USE_REVERSED_DEPTH_BUFFER
2727				shadowCoord.z -= shadowBias;
2728			#else
2729				shadowCoord.z += shadowBias;
2730			#endif
2731			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
2732			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
2733			if ( frustumTest ) {
2734				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
2735				#ifdef USE_REVERSED_DEPTH_BUFFER
2736					shadow = step( depth, shadowCoord.z );
2737				#else
2738					shadow = step( shadowCoord.z, depth );
2739				#endif
2740			}
2741			return mix( 1.0, shadow, shadowIntensity );
2742		}
2743	#endif
2744	#if NUM_SUN_LIGHT_SHADOWS > 0
2745		float getSunShadow(
2746			#if defined( SHADOWMAP_TYPE_PCF )
2747				sampler2DShadow shadowMap,
2748			#else
2749				sampler2D shadowMap,
2750			#endif
2751			SunLightShadow sunLightShadow,
2752			int shadowIndex
2753		) {
2754			vec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 );
2755			float viewDepth = vSunShadowWorldPosition.w;
2756			int cascadeOffset = shadowIndex * SUN_LIGHT_CASCADES;
2757			float shadow = 1.0;
2758			for ( int i = SUN_LIGHT_CASCADES - 1; i >= 0; i -- ) {
2759				vec4 cascade = sunShadowCascade[ cascadeOffset + i ];
2760				if ( viewDepth >= cascade.x && viewDepth < cascade.y ) {
2761					float cascadeShadow = getShadow(
2762						shadowMap,
2763						sunLightShadow.shadowMapSize,
2764						sunLightShadow.shadowIntensity,
2765						sunLightShadow.shadowBias,
2766						sunLightShadow.shadowRadius,
2767						sunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition
2768					);
2769					shadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) );
2770				}
2771			}
2772			return shadow;
2773		}
2774	#endif
2775	#if NUM_POINT_LIGHT_SHADOWS > 0
2776	#if defined( SHADOWMAP_TYPE_PCF )
2777	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
2778		float shadow = 1.0;
2779		vec3 lightToPosition = shadowCoord.xyz;
2780		vec3 bd3D = normalize( lightToPosition );
2781		vec3 absVec = abs( lightToPosition );
2782		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
2783		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
2784			#ifdef USE_REVERSED_DEPTH_BUFFER
2785				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2786				dp -= shadowBias;
2787			#else
2788				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2789				dp += shadowBias;
2790			#endif
2791			float texelSize = shadowRadius / shadowMapSize.x;
2792			vec3 absDir = abs( bd3D );
2793			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
2794			tangent = normalize( cross( bd3D, tangent ) );
2795			vec3 bitangent = cross( bd3D, tangent );
2796			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
2797			vec2 sample0 = vogelDiskSample( 0, 5, phi );
2798			vec2 sample1 = vogelDiskSample( 1, 5, phi );
2799			vec2 sample2 = vogelDiskSample( 2, 5, phi );
2800			vec2 sample3 = vogelDiskSample( 3, 5, phi );
2801			vec2 sample4 = vogelDiskSample( 4, 5, phi );
2802			shadow = (
2803				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
2804				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
2805				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
2806				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
2807				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
2808			) * 0.2;
2809		}
2810		return mix( 1.0, shadow, shadowIntensity );
2811	}
2812	#elif defined( SHADOWMAP_TYPE_BASIC )
2813	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
2814		float shadow = 1.0;
2815		vec3 lightToPosition = shadowCoord.xyz;
2816		vec3 absVec = abs( lightToPosition );
2817		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
2818		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
2819			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2820			dp += shadowBias;
2821			vec3 bd3D = normalize( lightToPosition );
2822			float depth = textureCube( shadowMap, bd3D ).r;
2823			#ifdef USE_REVERSED_DEPTH_BUFFER
2824				depth = 1.0 - depth;
2825			#endif
2826			shadow = step( dp, depth );
2827		}
2828		return mix( 1.0, shadow, shadowIntensity );
2829	}
2830	#endif
2831	#endif
2832#endif`,wRt=`#if NUM_SPOT_LIGHT_COORDS > 0
2833	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
2834	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2835#endif
2836#ifdef USE_SHADOWMAP
2837	#if NUM_SUN_LIGHT_SHADOWS > 0
2838		varying vec4 vSunShadowWorldPosition;
2839		varying vec3 vSunShadowWorldNormal;
2840	#endif
2841	#if NUM_DIR_LIGHT_SHADOWS > 0
2842		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
2843		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
2844		struct DirectionalLightShadow {
2845			float shadowIntensity;
2846			float shadowBias;
2847			float shadowNormalBias;
2848			float shadowRadius;
2849			vec2 shadowMapSize;
2850		};
2851		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2852	#endif
2853	#if NUM_SPOT_LIGHT_SHADOWS > 0
2854		struct SpotLightShadow {
2855			float shadowIntensity;
2856			float shadowBias;
2857			float shadowNormalBias;
2858			float shadowRadius;
2859			vec2 shadowMapSize;
2860		};
2861		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2862	#endif
2863	#if NUM_POINT_LIGHT_SHADOWS > 0
2864		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2865		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2866		struct PointLightShadow {
2867			float shadowIntensity;
2868			float shadowBias;
2869			float shadowNormalBias;
2870			float shadowRadius;
2871			vec2 shadowMapSize;
2872			float shadowCameraNear;
2873			float shadowCameraFar;
2874		};
2875		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2876	#endif
2877#endif`,_Rt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2878	#ifdef HAS_NORMAL
2879		vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
2880	#else
2881		vec3 shadowWorldNormal = vec3( 0.0 );
2882	#endif
2883	vec4 shadowWorldPosition;
2884#endif
2885#if defined( USE_SHADOWMAP )
2886	#if NUM_SUN_LIGHT_SHADOWS > 0
2887		vSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z );
2888		vSunShadowWorldNormal = shadowWorldNormal;
2889	#endif
2890	#if NUM_DIR_LIGHT_SHADOWS > 0
2891		#pragma unroll_loop_start
2892		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2893			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2894			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2895		}
2896		#pragma unroll_loop_end
2897	#endif
2898	#if NUM_POINT_LIGHT_SHADOWS > 0
2899		#pragma unroll_loop_start
2900		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2901			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2902			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2903		}
2904		#pragma unroll_loop_end
2905	#endif
2906#endif
2907#if NUM_SPOT_LIGHT_COORDS > 0
2908	#pragma unroll_loop_start
2909	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2910		shadowWorldPosition = worldPosition;
2911		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2912			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2913		#endif
2914		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2915	}
2916	#pragma unroll_loop_end
2917#endif`,SRt=`float getShadowMask() {
2918	float shadow = 1.0;
2919	#ifdef USE_SHADOWMAP
2920	#if NUM_SUN_LIGHT_SHADOWS > 0
2921	SunLightShadow sunLight;
2922	#pragma unroll_loop_start
2923	for ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) {
2924		sunLight = sunLightShadows[ i ];
2925		shadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0;
2926	}
2927	#pragma unroll_loop_end
2928	#endif
2929	#if NUM_DIR_LIGHT_SHADOWS > 0
2930	DirectionalLightShadow directionalLight;
2931	#pragma unroll_loop_start
2932	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2933		directionalLight = directionalLightShadows[ i ];
2934		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2935	}
2936	#pragma unroll_loop_end
2937	#endif
2938	#if NUM_SPOT_LIGHT_SHADOWS > 0
2939	SpotLightShadow spotLight;
2940	#pragma unroll_loop_start
2941	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2942		spotLight = spotLightShadows[ i ];
2943		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2944	}
2945	#pragma unroll_loop_end
2946	#endif
2947	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2948	PointLightShadow pointLight;
2949	#pragma unroll_loop_start
2950	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2951		pointLight = pointLightShadows[ i ];
2952		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2953	}
2954	#pragma unroll_loop_end
2955	#endif
2956	#endif
2957	return shadow;
2958}`,CRt=`#ifdef USE_SKINNING
2959	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2960	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2961	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2962	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2963#endif`,MRt=`#ifdef USE_SKINNING
2964	uniform mat4 bindMatrix;
2965	uniform mat4 bindMatrixInverse;
2966	uniform highp sampler2D boneTexture;
2967	mat4 getBoneMatrix( const in float i ) {
2968		int size = textureSize( boneTexture, 0 ).x;
2969		int j = int( i ) * 4;
2970		int x = j % size;
2971		int y = j / size;
2972		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2973		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2974		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2975		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2976		return mat4( v1, v2, v3, v4 );
2977	}
2978#endif`,TRt=`#ifdef USE_SKINNING
2979	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2980	vec4 skinned = vec4( 0.0 );
2981	skinned += boneMatX * skinVertex * skinWeight.x;
2982	skinned += boneMatY * skinVertex * skinWeight.y;
2983	skinned += boneMatZ * skinVertex * skinWeight.z;
2984	skinned += boneMatW * skinVertex * skinWeight.w;
2985	transformed = ( bindMatrixInverse * skinned ).xyz;
2986#endif`,ARt=`#ifdef USE_SKINNING
2987	mat4 skinMatrix = mat4( 0.0 );
2988	skinMatrix += skinWeight.x * boneMatX;
2989	skinMatrix += skinWeight.y * boneMatY;
2990	skinMatrix += skinWeight.z * boneMatZ;
2991	skinMatrix += skinWeight.w * boneMatW;
2992	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2993	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2994	#ifdef USE_TANGENT
2995		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2996	#endif
2997#endif`,ERt=`float specularStrength;
2998#ifdef USE_SPECULARMAP
2999	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
3000	specularStrength = texelSpecular.r;
3001#else
3002	specularStrength = 1.0;
3003#endif`,kRt=`#ifdef USE_SPECULARMAP
3004	uniform sampler2D specularMap;
3005#endif`,PRt=`#if defined( TONE_MAPPING )
3006	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
3007#endif`,RRt=`#ifndef saturate
3008#define saturate( a ) clamp( a, 0.0, 1.0 )
3009#endif
3010uniform float toneMappingExposure;
3011vec3 LinearToneMapping( vec3 color ) {
3012	return saturate( toneMappingExposure * color );
3013}
3014vec3 ReinhardToneMapping( vec3 color ) {
3015	color *= toneMappingExposure;
3016	return saturate( color / ( vec3( 1.0 ) + color ) );
3017}
3018vec3 CineonToneMapping( vec3 color ) {
3019	color *= toneMappingExposure;
3020	color = max( vec3( 0.0 ), color - 0.004 );
3021	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
3022}
3023vec3 RRTAndODTFit( vec3 v ) {
3024	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
3025	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
3026	return a / b;
3027}
3028vec3 ACESFilmicToneMapping( vec3 color ) {
3029	const mat3 ACESInputMat = mat3(
3030		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
3031		vec3( 0.04823, 0.01566, 0.83777 )
3032	);
3033	const mat3 ACESOutputMat = mat3(
3034		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
3035		vec3( -0.07367, -0.00605,  1.07602 )
3036	);
3037	color *= toneMappingExposure / 0.6;
3038	color = ACESInputMat * color;
3039	color = RRTAndODTFit( color );
3040	color = ACESOutputMat * color;
3041	return saturate( color );
3042}
3043const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
3044	vec3( 1.6605, - 0.1246, - 0.0182 ),
3045	vec3( - 0.5876, 1.1329, - 0.1006 ),
3046	vec3( - 0.0728, - 0.0083, 1.1187 )
3047);
3048const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
3049	vec3( 0.6274, 0.0691, 0.0164 ),
3050	vec3( 0.3293, 0.9195, 0.0880 ),
3051	vec3( 0.0433, 0.0113, 0.8956 )
3052);
3053vec3 agxDefaultContrastApprox( vec3 x ) {
3054	vec3 x2 = x * x;
3055	vec3 x4 = x2 * x2;
3056	return + 15.5 * x4 * x2
3057		- 40.14 * x4 * x
3058		+ 31.96 * x4
3059		- 6.868 * x2 * x
3060		+ 0.4298 * x2
3061		+ 0.1191 * x
3062		- 0.00232;
3063}
3064vec3 AgXToneMapping( vec3 color ) {
3065	const mat3 AgXInsetMatrix = mat3(
3066		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
3067		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
3068		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
3069	);
3070	const mat3 AgXOutsetMatrix = mat3(
3071		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
3072		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
3073		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
3074	);
3075	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
3076	color *= toneMappingExposure;
3077	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
3078	color = AgXInsetMatrix * color;
3079	color = max( color, 1e-10 );	color = log2( color );
3080	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
3081	color = clamp( color, 0.0, 1.0 );
3082	color = agxDefaultContrastApprox( color );
3083	color = AgXOutsetMatrix * color;
3084	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
3085	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
3086	color = clamp( color, 0.0, 1.0 );
3087	return color;
3088}
3089vec3 NeutralToneMapping( vec3 color ) {
3090	const float StartCompression = 0.8 - 0.04;
3091	const float Desaturation = 0.15;
3092	color *= toneMappingExposure;
3093	float x = min( color.r, min( color.g, color.b ) );
3094	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
3095	color -= offset;
3096	float peak = max( color.r, max( color.g, color.b ) );
3097	if ( peak < StartCompression ) return color;
3098	float d = 1. - StartCompression;
3099	float newPeak = 1. - d * d / ( peak + d - StartCompression );
3100	color *= newPeak / peak;
3101	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
3102	return mix( color, vec3( newPeak ), g );
3103}
3104vec3 CustomToneMapping( vec3 color ) { return color; }`,DRt=`#ifdef USE_TRANSMISSION
3105	material.transmission = transmission;
3106	material.transmissionAlpha = 1.0;
3107	material.thickness = thickness;
3108	material.attenuationDistance = attenuationDistance;
3109	material.attenuationColor = attenuationColor;
3110	#ifdef USE_TRANSMISSIONMAP
3111		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
3112	#endif
3113	#ifdef USE_THICKNESSMAP
3114		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
3115	#endif
3116	vec3 pos = vWorldPosition;
3117	vec3 v = normalize( cameraPosition - pos );
3118	vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );
3119	vec4 transmitted = getIBLVolumeRefraction(
3120		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
3121		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
3122		material.attenuationColor, material.attenuationDistance );
3123	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
3124	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
3125#endif`,LRt=`#ifdef USE_TRANSMISSION
3126	uniform float transmission;
3127	uniform float thickness;
3128	uniform float attenuationDistance;
3129	uniform vec3 attenuationColor;
3130	#ifdef USE_TRANSMISSIONMAP
3131		uniform sampler2D transmissionMap;
3132	#endif
3133	#ifdef USE_THICKNESSMAP
3134		uniform sampler2D thicknessMap;
3135	#endif
3136	uniform vec2 transmissionSamplerSize;
3137	uniform sampler2D transmissionSamplerMap;
3138	uniform mat4 modelMatrix;
3139	uniform mat4 projectionMatrix;
3140	varying vec3 vWorldPosition;
3141	float w0( float a ) {
3142		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
3143	}
3144	float w1( float a ) {
3145		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
3146	}
3147	float w2( float a ){
3148		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
3149	}
3150	float w3( float a ) {
3151		return ( 1.0 / 6.0 ) * ( a * a * a );
3152	}
3153	float g0( float a ) {
3154		return w0( a ) + w1( a );
3155	}
3156	float g1( float a ) {
3157		return w2( a ) + w3( a );
3158	}
3159	float h0( float a ) {
3160		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
3161	}
3162	float h1( float a ) {
3163		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
3164	}
3165	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
3166		uv = uv * texelSize.zw + 0.5;
3167		vec2 iuv = floor( uv );
3168		vec2 fuv = fract( uv );
3169		float g0x = g0( fuv.x );
3170		float g1x = g1( fuv.x );
3171		float h0x = h0( fuv.x );
3172		float h1x = h1( fuv.x );
3173		float h0y = h0( fuv.y );
3174		float h1y = h1( fuv.y );
3175		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
3176		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
3177		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
3178		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
3179		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
3180			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
3181	}
3182	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
3183		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
3184		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
3185		vec2 fLodSizeInv = 1.0 / fLodSize;
3186		vec2 cLodSizeInv = 1.0 / cLodSize;
3187		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
3188		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
3189		return mix( fSample, cSample, fract( lod ) );
3190	}
3191	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
3192		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
3193		vec3 modelScale;
3194		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
3195		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
3196		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
3197		return normalize( refractionVector ) * thickness * modelScale;
3198	}
3199	float applyIorToRoughness( const in float roughness, const in float ior ) {
3200		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
3201	}
3202	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
3203		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
3204		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
3205	}
3206	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
3207		if ( isinf( attenuationDistance ) ) {
3208			return vec3( 1.0 );
3209		} else {
3210			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
3211			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
3212		}
3213	}
3214	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
3215		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
3216		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
3217		const in vec3 attenuationColor, const in float attenuationDistance ) {
3218		vec4 transmittedLight;
3219		vec3 transmittance;
3220		#ifdef USE_DISPERSION
3221			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
3222			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
3223			for ( int i = 0; i < 3; i ++ ) {
3224				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
3225				vec3 refractedRayExit = position + transmissionRay;
3226				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
3227				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
3228				refractionCoords += 1.0;
3229				refractionCoords /= 2.0;
3230				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
3231				transmittedLight[ i ] = transmissionSample[ i ];
3232				transmittedLight.a += transmissionSample.a;
3233				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
3234			}
3235			transmittedLight.a /= 3.0;
3236		#else
3237			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
3238			vec3 refractedRayExit = position + transmissionRay;
3239			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
3240			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
3241			refractionCoords += 1.0;
3242			refractionCoords /= 2.0;
3243			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
3244			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
3245		#endif
3246		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
3247		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
3248		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
3249		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
3250	}
3251#endif`,IRt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
3252	varying vec2 vUv;
3253#endif
3254#ifdef USE_MAP
3255	varying vec2 vMapUv;
3256#endif
3257#ifdef USE_ALPHAMAP
3258	varying vec2 vAlphaMapUv;
3259#endif
3260#ifdef USE_LIGHTMAP
3261	varying vec2 vLightMapUv;
3262#endif
3263#ifdef USE_AOMAP
3264	varying vec2 vAoMapUv;
3265#endif
3266#ifdef USE_BUMPMAP
3267	varying vec2 vBumpMapUv;
3268#endif
3269#ifdef USE_NORMALMAP
3270	varying vec2 vNormalMapUv;
3271#endif
3272#ifdef USE_EMISSIVEMAP
3273	varying vec2 vEmissiveMapUv;
3274#endif
3275#ifdef USE_METALNESSMAP
3276	varying vec2 vMetalnessMapUv;
3277#endif
3278#ifdef USE_ROUGHNESSMAP
3279	varying vec2 vRoughnessMapUv;
3280#endif
3281#ifdef USE_ANISOTROPYMAP
3282	varying vec2 vAnisotropyMapUv;
3283#endif
3284#ifdef USE_CLEARCOATMAP
3285	varying vec2 vClearcoatMapUv;
3286#endif
3287#ifdef USE_CLEARCOAT_NORMALMAP
3288	varying vec2 vClearcoatNormalMapUv;
3289#endif
3290#ifdef USE_CLEARCOAT_ROUGHNESSMAP
3291	varying vec2 vClearcoatRoughnessMapUv;
3292#endif
3293#ifdef USE_IRIDESCENCEMAP
3294	varying vec2 vIridescenceMapUv;
3295#endif
3296#ifdef USE_IRIDESCENCE_THICKNESSMAP
3297	varying vec2 vIridescenceThicknessMapUv;
3298#endif
3299#ifdef USE_SHEEN_COLORMAP
3300	varying vec2 vSheenColorMapUv;
3301#endif
3302#ifdef USE_SHEEN_ROUGHNESSMAP
3303	varying vec2 vSheenRoughnessMapUv;
3304#endif
3305#ifdef USE_SPECULARMAP
3306	varying vec2 vSpecularMapUv;
3307#endif
3308#ifdef USE_SPECULAR_COLORMAP
3309	varying vec2 vSpecularColorMapUv;
3310#endif
3311#ifdef USE_SPECULAR_INTENSITYMAP
3312	varying vec2 vSpecularIntensityMapUv;
3313#endif
3314#ifdef USE_TRANSMISSIONMAP
3315	uniform mat3 transmissionMapTransform;
3316	varying vec2 vTransmissionMapUv;
3317#endif
3318#ifdef USE_THICKNESSMAP
3319	uniform mat3 thicknessMapTransform;
3320	varying vec2 vThicknessMapUv;
3321#endif`,ORt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
3322	varying vec2 vUv;
3323#endif
3324#ifdef USE_MAP
3325	uniform mat3 mapTransform;
3326	varying vec2 vMapUv;
3327#endif
3328#ifdef USE_ALPHAMAP
3329	uniform mat3 alphaMapTransform;
3330	varying vec2 vAlphaMapUv;
3331#endif
3332#ifdef USE_LIGHTMAP
3333	uniform mat3 lightMapTransform;
3334	varying vec2 vLightMapUv;
3335#endif
3336#ifdef USE_AOMAP
3337	uniform mat3 aoMapTransform;
3338	varying vec2 vAoMapUv;
3339#endif
3340#ifdef USE_BUMPMAP
3341	uniform mat3 bumpMapTransform;
3342	varying vec2 vBumpMapUv;
3343#endif
3344#ifdef USE_NORMALMAP
3345	uniform mat3 normalMapTransform;
3346	varying vec2 vNormalMapUv;
3347#endif
3348#ifdef USE_DISPLACEMENTMAP
3349	uniform mat3 displacementMapTransform;
3350	varying vec2 vDisplacementMapUv;
3351#endif
3352#ifdef USE_EMISSIVEMAP
3353	uniform mat3 emissiveMapTransform;
3354	varying vec2 vEmissiveMapUv;
3355#endif
3356#ifdef USE_METALNESSMAP
3357	uniform mat3 metalnessMapTransform;
3358	varying vec2 vMetalnessMapUv;
3359#endif
3360#ifdef USE_ROUGHNESSMAP
3361	uniform mat3 roughnessMapTransform;
3362	varying vec2 vRoughnessMapUv;
3363#endif
3364#ifdef USE_ANISOTROPYMAP
3365	uniform mat3 anisotropyMapTransform;
3366	varying vec2 vAnisotropyMapUv;
3367#endif
3368#ifdef USE_CLEARCOATMAP
3369	uniform mat3 clearcoatMapTransform;
3370	varying vec2 vClearcoatMapUv;
3371#endif
3372#ifdef USE_CLEARCOAT_NORMALMAP
3373	uniform mat3 clearcoatNormalMapTransform;
3374	varying vec2 vClearcoatNormalMapUv;
3375#endif
3376#ifdef USE_CLEARCOAT_ROUGHNESSMAP
3377	uniform mat3 clearcoatRoughnessMapTransform;
3378	varying vec2 vClearcoatRoughnessMapUv;
3379#endif
3380#ifdef USE_SHEEN_COLORMAP
3381	uniform mat3 sheenColorMapTransform;
3382	varying vec2 vSheenColorMapUv;
3383#endif
3384#ifdef USE_SHEEN_ROUGHNESSMAP
3385	uniform mat3 sheenRoughnessMapTransform;
3386	varying vec2 vSheenRoughnessMapUv;
3387#endif
3388#ifdef USE_IRIDESCENCEMAP
3389	uniform mat3 iridescenceMapTransform;
3390	varying vec2 vIridescenceMapUv;
3391#endif
3392#ifdef USE_IRIDESCENCE_THICKNESSMAP
3393	uniform mat3 iridescenceThicknessMapTransform;
3394	varying vec2 vIridescenceThicknessMapUv;
3395#endif
3396#ifdef USE_SPECULARMAP
3397	uniform mat3 specularMapTransform;
3398	varying vec2 vSpecularMapUv;
3399#endif
3400#ifdef USE_SPECULAR_COLORMAP
3401	uniform mat3 specularColorMapTransform;
3402	varying vec2 vSpecularColorMapUv;
3403#endif
3404#ifdef USE_SPECULAR_INTENSITYMAP
3405	uniform mat3 specularIntensityMapTransform;
3406	varying vec2 vSpecularIntensityMapUv;
3407#endif
3408#ifdef USE_TRANSMISSIONMAP
3409	uniform mat3 transmissionMapTransform;
3410	varying vec2 vTransmissionMapUv;
3411#endif
3412#ifdef USE_THICKNESSMAP
3413	uniform mat3 thicknessMapTransform;
3414	varying vec2 vThicknessMapUv;
3415#endif`,NRt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
3416	vUv = vec3( uv, 1 ).xy;
3417#endif
3418#ifdef USE_MAP
3419	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
3420#endif
3421#ifdef USE_ALPHAMAP
3422	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
3423#endif
3424#ifdef USE_LIGHTMAP
3425	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
3426#endif
3427#ifdef USE_AOMAP
3428	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
3429#endif
3430#ifdef USE_BUMPMAP
3431	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
3432#endif
3433#ifdef USE_NORMALMAP
3434	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
3435#endif
3436#ifdef USE_DISPLACEMENTMAP
3437	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
3438#endif
3439#ifdef USE_EMISSIVEMAP
3440	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
3441#endif
3442#ifdef USE_METALNESSMAP
3443	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
3444#endif
3445#ifdef USE_ROUGHNESSMAP
3446	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
3447#endif
3448#ifdef USE_ANISOTROPYMAP
3449	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
3450#endif
3451#ifdef USE_CLEARCOATMAP
3452	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
3453#endif
3454#ifdef USE_CLEARCOAT_NORMALMAP
3455	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
3456#endif
3457#ifdef USE_CLEARCOAT_ROUGHNESSMAP
3458	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
3459#endif
3460#ifdef USE_IRIDESCENCEMAP
3461	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
3462#endif
3463#ifdef USE_IRIDESCENCE_THICKNESSMAP
3464	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
3465#endif
3466#ifdef USE_SHEEN_COLORMAP
3467	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
3468#endif
3469#ifdef USE_SHEEN_ROUGHNESSMAP
3470	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
3471#endif
3472#ifdef USE_SPECULARMAP
3473	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
3474#endif
3475#ifdef USE_SPECULAR_COLORMAP
3476	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
3477#endif
3478#ifdef USE_SPECULAR_INTENSITYMAP
3479	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
3480#endif
3481#ifdef USE_TRANSMISSIONMAP
3482	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
3483#endif
3484#ifdef USE_THICKNESSMAP
3485	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
3486#endif`,BRt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
3487	vec4 worldPosition = vec4( transformed, 1.0 );
3488	#ifdef USE_BATCHING
3489		worldPosition = batchingMatrix * worldPosition;
3490	#endif
3491	#ifdef USE_INSTANCING
3492		worldPosition = instanceMatrix * worldPosition;
3493	#endif
3494	worldPosition = modelMatrix * worldPosition;
3495#endif`,FRt=`varying vec2 vUv;
3496uniform mat3 uvTransform;
3497void main() {
3498	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3499	gl_Position = vec4( position.xy, 1.0, 1.0 );
3500}`,URt=`uniform sampler2D t2D;
3501uniform float backgroundIntensity;
3502varying vec2 vUv;
3503void main() {
3504	vec4 texColor = texture2D( t2D, vUv );
3505	#ifdef DECODE_VIDEO_TEXTURE
3506		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
3507	#endif
3508	texColor.rgb *= backgroundIntensity;
3509	gl_FragColor = texColor;
3510	#include <tonemapping_fragment>
3511	#include <colorspace_fragment>
3512}`,zRt=`varying vec3 vWorldDirection;
3513#include <common>
3514void main() {
3515	vWorldDirection = transformDirection( position, modelMatrix );
3516	#include <begin_vertex>
3517	#include <project_vertex>
3518	gl_Position.z = gl_Position.w;
3519}`,VRt=`#ifdef ENVMAP_TYPE_CUBE
3520	uniform samplerCube envMap;
3521#elif defined( ENVMAP_TYPE_CUBE_UV )
3522	uniform sampler2D envMap;
3523#endif
3524uniform float backgroundBlurriness;
3525uniform float backgroundIntensity;
3526uniform mat3 backgroundRotation;
3527varying vec3 vWorldDirection;
3528#include <cube_uv_reflection_fragment>
3529void main() {
3530	#ifdef ENVMAP_TYPE_CUBE
3531		vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
3532	#elif defined( ENVMAP_TYPE_CUBE_UV )
3533		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
3534	#else
3535		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3536	#endif
3537	texColor.rgb *= backgroundIntensity;
3538	gl_FragColor = texColor;
3539	#include <tonemapping_fragment>
3540	#include <colorspace_fragment>
3541}`,HRt=`varying vec3 vWorldDirection;
3542#include <common>
3543void main() {
3544	vWorldDirection = transformDirection( position, modelMatrix );
3545	#include <begin_vertex>
3546	#include <project_vertex>
3547	gl_Position.z = gl_Position.w;
3548}`,jRt=`uniform samplerCube tCube;
3549uniform float tFlip;
3550uniform float opacity;
3551varying vec3 vWorldDirection;
3552void main() {
3553	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
3554	gl_FragColor = texColor;
3555	gl_FragColor.a *= opacity;
3556	#include <tonemapping_fragment>
3557	#include <colorspace_fragment>
3558}`,WRt=`#include <common>
3559#include <batching_pars_vertex>
3560#include <uv_pars_vertex>
3561#include <displacementmap_pars_vertex>
3562#include <morphtarget_pars_vertex>
3563#include <skinning_pars_vertex>
3564#include <logdepthbuf_pars_vertex>
3565#include <clipping_planes_pars_vertex>
3566varying vec2 vHighPrecisionZW;
3567void main() {
3568	#include <uv_vertex>
3569	#include <batching_vertex>
3570	#include <skinbase_vertex>
3571	#include <morphinstance_vertex>
3572	#ifdef USE_DISPLACEMENTMAP
3573		#include <beginnormal_vertex>
3574		#include <morphnormal_vertex>
3575		#include <skinnormal_vertex>
3576	#endif
3577	#include <begin_vertex>
3578	#include <morphtarget_vertex>
3579	#include <skinning_vertex>
3580	#include <displacementmap_vertex>
3581	#include <project_vertex>
3582	#include <logdepthbuf_vertex>
3583	#include <clipping_planes_vertex>
3584	vHighPrecisionZW = gl_Position.zw;
3585}`,$Rt=`#if DEPTH_PACKING == 3200
3586	uniform float opacity;
3587#endif
3588#include <common>
3589#include <packing>
3590#include <uv_pars_fragment>
3591#include <map_pars_fragment>
3592#include <alphamap_pars_fragment>
3593#include <alphatest_pars_fragment>
3594#include <alphahash_pars_fragment>
3595#include <logdepthbuf_pars_fragment>
3596#include <clipping_planes_pars_fragment>
3597varying vec2 vHighPrecisionZW;
3598void main() {
3599	vec4 diffuseColor = vec4( 1.0 );
3600	#include <clipping_planes_fragment>
3601	#if DEPTH_PACKING == 3200
3602		diffuseColor.a = opacity;
3603	#endif
3604	#include <map_fragment>
3605	#include <alphamap_fragment>
3606	#include <alphatest_fragment>
3607	#include <alphahash_fragment>
3608	#include <logdepthbuf_fragment>
3609	#ifdef USE_REVERSED_DEPTH_BUFFER
3610		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
3611	#else
3612		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
3613	#endif
3614	#if DEPTH_PACKING == 3200
3615		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
3616	#elif DEPTH_PACKING == 3201
3617		gl_FragColor = packDepthToRGBA( fragCoordZ );
3618	#elif DEPTH_PACKING == 3202
3619		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
3620	#elif DEPTH_PACKING == 3203
3621		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
3622	#endif
3623}`,GRt=`#define DISTANCE
3624varying vec3 vWorldPosition;
3625#include <common>
3626#include <batching_pars_vertex>
3627#include <uv_pars_vertex>
3628#include <displacementmap_pars_vertex>
3629#include <morphtarget_pars_vertex>
3630#include <skinning_pars_vertex>
3631#include <clipping_planes_pars_vertex>
3632void main() {
3633	#include <uv_vertex>
3634	#include <batching_vertex>
3635	#include <skinbase_vertex>
3636	#include <morphinstance_vertex>
3637	#ifdef USE_DISPLACEMENTMAP
3638		#include <beginnormal_vertex>
3639		#include <morphnormal_vertex>
3640		#include <skinnormal_vertex>
3641	#endif
3642	#include <begin_vertex>
3643	#include <morphtarget_vertex>
3644	#include <skinning_vertex>
3645	#include <displacementmap_vertex>
3646	#include <project_vertex>
3647	#include <worldpos_vertex>
3648	#include <clipping_planes_vertex>
3649	vWorldPosition = worldPosition.xyz;
3650}`,qRt=`#define DISTANCE
3651uniform vec3 referencePosition;
3652uniform float nearDistance;
3653uniform float farDistance;
3654varying vec3 vWorldPosition;
3655#include <common>
3656#include <uv_pars_fragment>
3657#include <map_pars_fragment>
3658#include <alphamap_pars_fragment>
3659#include <alphatest_pars_fragment>
3660#include <alphahash_pars_fragment>
3661#include <clipping_planes_pars_fragment>
3662void main() {
3663	vec4 diffuseColor = vec4( 1.0 );
3664	#include <clipping_planes_fragment>
3665	#include <map_fragment>
3666	#include <alphamap_fragment>
3667	#include <alphatest_fragment>
3668	#include <alphahash_fragment>
3669	float dist = length( vWorldPosition - referencePosition );
3670	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
3671	dist = saturate( dist );
3672	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
3673}`,YRt=`varying vec3 vWorldDirection;
3674#include <common>
3675void main() {
3676	vWorldDirection = transformDirection( position, modelMatrix );
3677	#include <begin_vertex>
3678	#include <project_vertex>
3679}`,XRt=`uniform sampler2D tEquirect;
3680varying vec3 vWorldDirection;
3681#include <common>
3682void main() {
3683	vec3 direction = normalize( vWorldDirection );
3684	vec2 sampleUV = equirectUv( direction );
3685	gl_FragColor = texture2D( tEquirect, sampleUV );
3686	#include <tonemapping_fragment>
3687	#include <colorspace_fragment>
3688}`,KRt=`uniform float scale;
3689attribute float lineDistance;
3690varying float vLineDistance;
3691#include <common>
3692#include <uv_pars_vertex>
3693#include <color_pars_vertex>
3694#include <fog_pars_vertex>
3695#include <morphtarget_pars_vertex>
3696#include <logdepthbuf_pars_vertex>
3697#include <clipping_planes_pars_vertex>
3698void main() {
3699	vLineDistance = scale * lineDistance;
3700	#include <uv_vertex>
3701	#include <color_vertex>
3702	#include <morphinstance_vertex>
3703	#include <morphcolor_vertex>
3704	#include <begin_vertex>
3705	#include <morphtarget_vertex>
3706	#include <project_vertex>
3707	#include <logdepthbuf_vertex>
3708	#include <clipping_planes_vertex>
3709	#include <fog_vertex>
3710}`,JRt=`uniform vec3 diffuse;
3711uniform float opacity;
3712uniform float dashSize;
3713uniform float totalSize;
3714varying float vLineDistance;
3715#include <common>
3716#include <color_pars_fragment>
3717#include <uv_pars_fragment>
3718#include <map_pars_fragment>
3719#include <fog_pars_fragment>
3720#include <logdepthbuf_pars_fragment>
3721#include <clipping_planes_pars_fragment>
3722void main() {
3723	vec4 diffuseColor = vec4( diffuse, opacity );
3724	#include <clipping_planes_fragment>
3725	if ( mod( vLineDistance, totalSize ) > dashSize ) {
3726		discard;
3727	}
3728	vec3 outgoingLight = vec3( 0.0 );
3729	#include <logdepthbuf_fragment>
3730	#include <map_fragment>
3731	#include <color_fragment>
3732	outgoingLight = diffuseColor.rgb;
3733	#include <opaque_fragment>
3734	#include <tonemapping_fragment>
3735	#include <colorspace_fragment>
3736	#include <fog_fragment>
3737	#include <premultiplied_alpha_fragment>
3738}`,ZRt=`#include <common>
3739#include <batching_pars_vertex>
3740#include <uv_pars_vertex>
3741#include <envmap_pars_vertex>
3742#include <color_pars_vertex>
3743#include <fog_pars_vertex>
3744#include <morphtarget_pars_vertex>
3745#include <skinning_pars_vertex>
3746#include <logdepthbuf_pars_vertex>
3747#include <clipping_planes_pars_vertex>
3748void main() {
3749	#include <uv_vertex>
3750	#include <color_vertex>
3751	#include <morphinstance_vertex>
3752	#include <morphcolor_vertex>
3753	#include <batching_vertex>
3754	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
3755		#include <beginnormal_vertex>
3756		#include <morphnormal_vertex>
3757		#include <skinbase_vertex>
3758		#include <skinnormal_vertex>
3759		#include <defaultnormal_vertex>
3760	#endif
3761	#include <begin_vertex>
3762	#include <morphtarget_vertex>
3763	#include <skinning_vertex>
3764	#include <project_vertex>
3765	#include <logdepthbuf_vertex>
3766	#include <clipping_planes_vertex>
3767	#include <worldpos_vertex>
3768	#include <envmap_vertex>
3769	#include <fog_vertex>
3770}`,QRt=`uniform vec3 diffuse;
3771uniform float opacity;
3772#ifndef FLAT_SHADED
3773	varying vec3 vNormal;
3774#endif
3775#include <common>
3776#include <dithering_pars_fragment>
3777#include <color_pars_fragment>
3778#include <uv_pars_fragment>
3779#include <map_pars_fragment>
3780#include <alphamap_pars_fragment>
3781#include <alphatest_pars_fragment>
3782#include <alphahash_pars_fragment>
3783#include <aomap_pars_fragment>
3784#include <lightmap_pars_fragment>
3785#include <envmap_common_pars_fragment>
3786#include <envmap_pars_fragment>
3787#include <fog_pars_fragment>
3788#include <specularmap_pars_fragment>
3789#include <logdepthbuf_pars_fragment>
3790#include <clipping_planes_pars_fragment>
3791void main() {
3792	vec4 diffuseColor = vec4( diffuse, opacity );
3793	#include <clipping_planes_fragment>
3794	#include <logdepthbuf_fragment>
3795	#include <map_fragment>
3796	#include <color_fragment>
3797	#include <alphamap_fragment>
3798	#include <alphatest_fragment>
3799	#include <alphahash_fragment>
3800	#include <specularmap_fragment>
3801	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3802	#ifdef USE_LIGHTMAP
3803		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
3804		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
3805	#else
3806		reflectedLight.indirectDiffuse += vec3( 1.0 );
3807	#endif
3808	#include <aomap_fragment>
3809	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
3810	vec3 outgoingLight = reflectedLight.indirectDiffuse;
3811	#include <envmap_fragment>
3812	#include <opaque_fragment>
3813	#include <tonemapping_fragment>
3814	#include <colorspace_fragment>
3815	#include <fog_fragment>
3816	#include <premultiplied_alpha_fragment>
3817	#include <dithering_fragment>
3818}`,tDt=`#define LAMBERT
3819varying vec3 vViewPosition;
3820#include <common>
3821#include <batching_pars_vertex>
3822#include <uv_pars_vertex>
3823#include <displacementmap_pars_vertex>
3824#include <envmap_pars_vertex>
3825#include <color_pars_vertex>
3826#include <fog_pars_vertex>
3827#include <normal_pars_vertex>
3828#include <morphtarget_pars_vertex>
3829#include <skinning_pars_vertex>
3830#include <shadowmap_pars_vertex>
3831#include <logdepthbuf_pars_vertex>
3832#include <clipping_planes_pars_vertex>
3833void main() {
3834	#include <uv_vertex>
3835	#include <color_vertex>
3836	#include <morphinstance_vertex>
3837	#include <morphcolor_vertex>
3838	#include <batching_vertex>
3839	#include <beginnormal_vertex>
3840	#include <morphnormal_vertex>
3841	#include <skinbase_vertex>
3842	#include <skinnormal_vertex>
3843	#include <defaultnormal_vertex>
3844	#include <normal_vertex>
3845	#include <begin_vertex>
3846	#include <morphtarget_vertex>
3847	#include <skinning_vertex>
3848	#include <displacementmap_vertex>
3849	#include <project_vertex>
3850	#include <logdepthbuf_vertex>
3851	#include <clipping_planes_vertex>
3852	vViewPosition = - mvPosition.xyz;
3853	#include <worldpos_vertex>
3854	#include <envmap_vertex>
3855	#include <shadowmap_vertex>
3856	#include <fog_vertex>
3857}`,eDt=`#define LAMBERT
3858uniform vec3 diffuse;
3859uniform vec3 emissive;
3860uniform float opacity;
3861#include <common>
3862#include <dithering_pars_fragment>
3863#include <color_pars_fragment>
3864#include <uv_pars_fragment>
3865#include <map_pars_fragment>
3866#include <alphamap_pars_fragment>
3867#include <alphatest_pars_fragment>
3868#include <alphahash_pars_fragment>
3869#include <aomap_pars_fragment>
3870#include <lightmap_pars_fragment>
3871#include <emissivemap_pars_fragment>
3872#include <cube_uv_reflection_fragment>
3873#include <envmap_common_pars_fragment>
3874#include <envmap_pars_fragment>
3875#include <envmap_physical_pars_fragment>
3876#include <fog_pars_fragment>
3877#include <bsdfs>
3878#include <lights_pars_begin>
3879#include <normal_pars_fragment>
3880#include <lights_lambert_pars_fragment>
3881#include <shadowmap_pars_fragment>
3882#include <bumpmap_pars_fragment>
3883#include <normalmap_pars_fragment>
3884#include <specularmap_pars_fragment>
3885#include <logdepthbuf_pars_fragment>
3886#include <clipping_planes_pars_fragment>
3887void main() {
3888	vec4 diffuseColor = vec4( diffuse, opacity );
3889	#include <clipping_planes_fragment>
3890	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3891	vec3 totalEmissiveRadiance = emissive;
3892	#include <logdepthbuf_fragment>
3893	#include <map_fragment>
3894	#include <color_fragment>
3895	#include <alphamap_fragment>
3896	#include <alphatest_fragment>
3897	#include <alphahash_fragment>
3898	#include <specularmap_fragment>
3899	#include <normal_fragment_begin>
3900	#include <normal_fragment_maps>
3901	#include <emissivemap_fragment>
3902	#include <lights_lambert_fragment>
3903	#include <lights_fragment_begin>
3904	#include <lights_fragment_maps>
3905	#include <lights_fragment_end>
3906	#include <aomap_fragment>
3907	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3908	#include <envmap_fragment>
3909	#include <opaque_fragment>
3910	#include <tonemapping_fragment>
3911	#include <colorspace_fragment>
3912	#include <fog_fragment>
3913	#include <premultiplied_alpha_fragment>
3914	#include <dithering_fragment>
3915}`,nDt=`#define MATCAP
3916varying vec3 vViewPosition;
3917#include <common>
3918#include <batching_pars_vertex>
3919#include <uv_pars_vertex>
3920#include <color_pars_vertex>
3921#include <displacementmap_pars_vertex>
3922#include <fog_pars_vertex>
3923#include <normal_pars_vertex>
3924#include <morphtarget_pars_vertex>
3925#include <skinning_pars_vertex>
3926#include <logdepthbuf_pars_vertex>
3927#include <clipping_planes_pars_vertex>
3928void main() {
3929	#include <uv_vertex>
3930	#include <color_vertex>
3931	#include <morphinstance_vertex>
3932	#include <morphcolor_vertex>
3933	#include <batching_vertex>
3934	#include <beginnormal_vertex>
3935	#include <morphnormal_vertex>
3936	#include <skinbase_vertex>
3937	#include <skinnormal_vertex>
3938	#include <defaultnormal_vertex>
3939	#include <normal_vertex>
3940	#include <begin_vertex>
3941	#include <morphtarget_vertex>
3942	#include <skinning_vertex>
3943	#include <displacementmap_vertex>
3944	#include <project_vertex>
3945	#include <logdepthbuf_vertex>
3946	#include <clipping_planes_vertex>
3947	#include <fog_vertex>
3948	vViewPosition = - mvPosition.xyz;
3949}`,iDt=`#define MATCAP
3950uniform vec3 diffuse;
3951uniform float opacity;
3952uniform sampler2D matcap;
3953varying vec3 vViewPosition;
3954#include <common>
3955#include <dithering_pars_fragment>
3956#include <color_pars_fragment>
3957#include <uv_pars_fragment>
3958#include <map_pars_fragment>
3959#include <alphamap_pars_fragment>
3960#include <alphatest_pars_fragment>
3961#include <alphahash_pars_fragment>
3962#include <fog_pars_fragment>
3963#include <normal_pars_fragment>
3964#include <bumpmap_pars_fragment>
3965#include <normalm
3965ap_pars_fragment>
3966#include <logdepthbuf_pars_fragment>
3967#include <clipping_planes_pars_fragment>
3968void main() {
3969	vec4 diffuseColor = vec4( diffuse, opacity );
3970	#include <clipping_planes_fragment>
3971	#include <logdepthbuf_fragment>
3972	#include <map_fragment>
3973	#include <color_fragment>
3974	#include <alphamap_fragment>
3975	#include <alphatest_fragment>
3976	#include <alphahash_fragment>
3977	#include <normal_fragment_begin>
3978	#include <normal_fragment_maps>
3979	vec3 viewDir = normalize( vViewPosition );
3980	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3981	vec3 y = cross( viewDir, x );
3982	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3983	#ifdef USE_MATCAP
3984		vec4 matcapColor = texture2D( matcap, uv );
3985	#else
3986		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3987	#endif
3988	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3989	#include <opaque_fragment>
3990	#include <tonemapping_fragment>
3991	#include <colorspace_fragment>
3992	#include <fog_fragment>
3993	#include <premultiplied_alpha_fragment>
3994	#include <dithering_fragment>
3995}`,sDt=`#define NORMAL
3996#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3997	varying vec3 vViewPosition;
3998#endif
3999#include <common>
4000#include <batching_pars_vertex>
4001#include <uv_pars_vertex>
4002#include <displacementmap_pars_vertex>
4003#include <normal_pars_vertex>
4004#include <morphtarget_pars_vertex>
4005#include <skinning_pars_vertex>
4006#include <logdepthbuf_pars_vertex>
4007#include <clipping_planes_pars_vertex>
4008void main() {
4009	#include <uv_vertex>
4010	#include <batching_vertex>
4011	#include <beginnormal_vertex>
4012	#include <morphinstance_vertex>
4013	#include <morphnormal_vertex>
4014	#include <skinbase_vertex>
4015	#include <skinnormal_vertex>
4016	#include <defaultnormal_vertex>
4017	#include <normal_vertex>
4018	#include <begin_vertex>
4019	#include <morphtarget_vertex>
4020	#include <skinning_vertex>
4021	#include <displacementmap_vertex>
4022	#include <project_vertex>
4023	#include <logdepthbuf_vertex>
4024	#include <clipping_planes_vertex>
4025#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
4026	vViewPosition = - mvPosition.xyz;
4027#endif
4028}`,rDt=`#define NORMAL
4029uniform float opacity;
4030#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
4031	varying vec3 vViewPosition;
4032#endif
4033#include <uv_pars_fragment>
4034#include <normal_pars_fragment>
4035#include <bumpmap_pars_fragment>
4036#include <normalmap_pars_fragment>
4037#include <logdepthbuf_pars_fragment>
4038#include <clipping_planes_pars_fragment>
4039void main() {
4040	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
4041	#include <clipping_planes_fragment>
4042	#include <logdepthbuf_fragment>
4043	#include <normal_fragment_begin>
4044	#include <normal_fragment_maps>
4045	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
4046	#ifdef OPAQUE
4047		gl_FragColor.a = 1.0;
4048	#endif
4049}`,oDt=`#define PHONG
4050varying vec3 vViewPosition;
4051#include <common>
4052#include <batching_pars_vertex>
4053#include <uv_pars_vertex>
4054#include <displacementmap_pars_vertex>
4055#include <envmap_pars_vertex>
4056#include <color_pars_vertex>
4057#include <fog_pars_vertex>
4058#include <normal_pars_vertex>
4059#include <morphtarget_pars_vertex>
4060#include <skinning_pars_vertex>
4061#include <shadowmap_pars_vertex>
4062#include <logdepthbuf_pars_vertex>
4063#include <clipping_planes_pars_vertex>
4064void main() {
4065	#include <uv_vertex>
4066	#include <color_vertex>
4067	#include <morphcolor_vertex>
4068	#include <batching_vertex>
4069	#include <beginnormal_vertex>
4070	#include <morphinstance_vertex>
4071	#include <morphnormal_vertex>
4072	#include <skinbase_vertex>
4073	#include <skinnormal_vertex>
4074	#include <defaultnormal_vertex>
4075	#include <normal_vertex>
4076	#include <begin_vertex>
4077	#include <morphtarget_vertex>
4078	#include <skinning_vertex>
4079	#include <displacementmap_vertex>
4080	#include <project_vertex>
4081	#include <logdepthbuf_vertex>
4082	#include <clipping_planes_vertex>
4083	vViewPosition = - mvPosition.xyz;
4084	#include <worldpos_vertex>
4085	#include <envmap_vertex>
4086	#include <shadowmap_vertex>
4087	#include <fog_vertex>
4088}`,aDt=`#define PHONG
4089uniform vec3 diffuse;
4090uniform vec3 emissive;
4091uniform vec3 specular;
4092uniform float shininess;
4093uniform float opacity;
4094#include <common>
4095#include <dithering_pars_fragment>
4096#include <color_pars_fragment>
4097#include <uv_pars_fragment>
4098#include <map_pars_fragment>
4099#include <alphamap_pars_fragment>
4100#include <alphatest_pars_fragment>
4101#include <alphahash_pars_fragment>
4102#include <aomap_pars_fragment>
4103#include <lightmap_pars_fragment>
4104#include <emissivemap_pars_fragment>
4105#include <cube_uv_reflection_fragment>
4106#include <envmap_common_pars_fragment>
4107#include <envmap_pars_fragment>
4108#include <envmap_physical_pars_fragment>
4109#include <fog_pars_fragment>
4110#include <bsdfs>
4111#include <lights_pars_begin>
4112#include <normal_pars_fragment>
4113#include <lights_phong_pars_fragment>
4114#include <shadowmap_pars_fragment>
4115#include <bumpmap_pars_fragment>
4116#include <normalmap_pars_fragment>
4117#include <specularmap_pars_fragment>
4118#include <logdepthbuf_pars_fragment>
4119#include <clipping_planes_pars_fragment>
4120void main() {
4121	vec4 diffuseColor = vec4( diffuse, opacity );
4122	#include <clipping_planes_fragment>
4123	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
4124	vec3 totalEmissiveRadiance = emissive;
4125	#include <logdepthbuf_fragment>
4126	#include <map_fragment>
4127	#include <color_fragment>
4128	#include <alphamap_fragment>
4129	#include <alphatest_fragment>
4130	#include <alphahash_fragment>
4131	#include <specularmap_fragment>
4132	#include <normal_fragment_begin>
4133	#include <normal_fragment_maps>
4134	#include <emissivemap_fragment>
4135	#include <lights_phong_fragment>
4136	#include <lights_fragment_begin>
4137	#include <lights_fragment_maps>
4138	#include <lights_fragment_end>
4139	#include <aomap_fragment>
4140	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
4141	#include <envmap_fragment>
4142	#include <opaque_fragment>
4143	#include <tonemapping_fragment>
4144	#include <colorspace_fragment>
4145	#include <fog_fragment>
4146	#include <premultiplied_alpha_fragment>
4147	#include <dithering_fragment>
4148}`,lDt=`#define STANDARD
4149varying vec3 vViewPosition;
4150#ifdef USE_TRANSMISSION
4151	varying vec3 vWorldPosition;
4152#endif
4153#include <common>
4154#include <batching_pars_vertex>
4155#include <uv_pars_vertex>
4156#include <displacementmap_pars_vertex>
4157#include <color_pars_vertex>
4158#include <fog_pars_vertex>
4159#include <normal_pars_vertex>
4160#include <morphtarget_pars_vertex>
4161#include <skinning_pars_vertex>
4162#include <shadowmap_pars_vertex>
4163#include <logdepthbuf_pars_vertex>
4164#include <clipping_planes_pars_vertex>
4165void main() {
4166	#include <uv_vertex>
4167	#include <color_vertex>
4168	#include <morphinstance_vertex>
4169	#include <morphcolor_vertex>
4170	#include <batching_vertex>
4171	#include <beginnormal_vertex>
4172	#include <morphnormal_vertex>
4173	#include <skinbase_vertex>
4174	#include <skinnormal_vertex>
4175	#include <defaultnormal_vertex>
4176	#include <normal_vertex>
4177	#include <begin_vertex>
4178	#include <morphtarget_vertex>
4179	#include <skinning_vertex>
4180	#include <displacementmap_vertex>
4181	#include <project_vertex>
4182	#include <logdepthbuf_vertex>
4183	#include <clipping_planes_vertex>
4184	vViewPosition = - mvPosition.xyz;
4185	#include <worldpos_vertex>
4186	#include <shadowmap_vertex>
4187	#include <fog_vertex>
4188#ifdef USE_TRANSMISSION
4189	vWorldPosition = worldPosition.xyz;
4190#endif
4191}`,cDt=`#define STANDARD
4192#ifdef PHYSICAL
4193	#define IOR
4194	#define USE_SPECULAR
4195#endif
4196uniform vec3 diffuse;
4197uniform vec3 emissive;
4198uniform float roughness;
4199uniform float metalness;
4200uniform float opacity;
4201#ifdef IOR
4202	uniform float ior;
4203#endif
4204#ifdef USE_SPECULAR
4205	uniform float specularIntensity;
4206	uniform vec3 specularColor;
4207	#ifdef USE_SPECULAR_COLORMAP
4208		uniform sampler2D specularColorMap;
4209	#endif
4210	#ifdef USE_SPECULAR_INTENSITYMAP
4211		uniform sampler2D specularIntensityMap;
4212	#endif
4213#endif
4214#ifdef USE_CLEARCOAT
4215	uniform float clearcoat;
4216	uniform float clearcoatRoughness;
4217#endif
4218#ifdef USE_DISPERSION
4219	uniform float dispersion;
4220#endif
4221#ifdef USE_RETROREFLECTION
4222	uniform float retroreflectivity;
4223#endif
4224#ifdef USE_IRIDESCENCE
4225	uniform float iridescence;
4226	uniform float iridescenceIOR;
4227	uniform float iridescenceThicknessMinimum;
4228	uniform float iridescenceThicknessMaximum;
4229#endif
4230#ifdef USE_SHEEN
4231	uniform vec3 sheenColor;
4232	uniform float sheenRoughness;
4233	#ifdef USE_SHEEN_COLORMAP
4234		uniform sampler2D sheenColorMap;
4235	#endif
4236	#ifdef USE_SHEEN_ROUGHNESSMAP
4237		uniform sampler2D sheenRoughnessMap;
4238	#endif
4239#endif
4240#ifdef USE_ANISOTROPY
4241	uniform vec2 anisotropyVector;
4242	#ifdef USE_ANISOTROPYMAP
4243		uniform sampler2D anisotropyMap;
4244	#endif
4245#endif
4246varying vec3 vViewPosition;
4247#include <common>
4248#include <dithering_pars_fragment>
4249#include <color_pars_fragment>
4250#include <uv_pars_fragment>
4251#include <map_pars_fragment>
4252#include <alphamap_pars_fragment>
4253#include <alphatest_pars_fragment>
4254#include <alphahash_pars_fragment>
4255#include <aomap_pars_fragment>
4256#include <lightmap_pars_fragment>
4257#include <emissivemap_pars_fragment>
4258#include <iridescence_fragment>
4259#include <cube_uv_reflection_fragment>
4260#include <envmap_common_pars_fragment>
4261#include <envmap_physical_pars_fragment>
4262#include <fog_pars_fragment>
4263#include <lights_pars_begin>
4264#include <normal_pars_fragment>
4265#include <lights_physical_pars_fragment>
4266#include <transmission_pars_fragment>
4267#include <shadowmap_pars_fragment>
4268#include <bumpmap_pars_fragment>
4269#include <normalmap_pars_fragment>
4270#include <clearcoat_pars_fragment>
4271#include <iridescence_pars_fragment>
4272#include <roughnessmap_pars_fragment>
4273#include <metalnessmap_pars_fragment>
4274#include <logdepthbuf_pars_fragment>
4275#include <clipping_planes_pars_fragment>
4276void main() {
4277	vec4 diffuseColor = vec4( diffuse, opacity );
4278	#include <clipping_planes_fragment>
4279	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
4280	vec3 totalEmissiveRadiance = emissive;
4281	#include <logdepthbuf_fragment>
4282	#include <map_fragment>
4283	#include <color_fragment>
4284	#include <alphamap_fragment>
4285	#include <alphatest_fragment>
4286	#include <alphahash_fragment>
4287	#include <roughnessmap_fragment>
4288	#include <metalnessmap_fragment>
4289	#include <normal_fragment_begin>
4290	#include <normal_fragment_maps>
4291	#include <clearcoat_normal_fragment_begin>
4292	#include <clearcoat_normal_fragment_maps>
4293	#include <emissivemap_fragment>
4294	#include <lights_physical_fragment>
4295	#include <lights_fragment_begin>
4296	#include <lights_fragment_maps>
4297	#include <lights_fragment_end>
4298	#include <aomap_fragment>
4299	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
4300	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
4301	#include <transmission_fragment>
4302	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
4303	#ifdef USE_SHEEN
4304 
4305		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
4306 
4307 	#endif
4308	#ifdef USE_CLEARCOAT
4309		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
4310		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
4311		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
4312	#endif
4313	#include <opaque_fragment>
4314	#include <tonemapping_fragment>
4315	#include <colorspace_fragment>
4316	#include <fog_fragment>
4317	#include <premultiplied_alpha_fragment>
4318	#include <dithering_fragment>
4319}`,uDt=`#define TOON
4320varying vec3 vViewPosition;
4321#include <common>
4322#include <batching_pars_vertex>
4323#include <uv_pars_vertex>
4324#include <displacementmap_pars_vertex>
4325#include <color_pars_vertex>
4326#include <fog_pars_vertex>
4327#include <normal_pars_vertex>
4328#include <morphtarget_pars_vertex>
4329#include <skinning_pars_vertex>
4330#include <shadowmap_pars_vertex>
4331#include <logdepthbuf_pars_vertex>
4332#include <clipping_planes_pars_vertex>
4333void main() {
4334	#include <uv_vertex>
4335	#include <color_vertex>
4336	#include <morphinstance_vertex>
4337	#include <morphcolor_vertex>
4338	#include <batching_vertex>
4339	#include <beginnormal_vertex>
4340	#include <morphnormal_vertex>
4341	#include <skinbase_vertex>
4342	#include <skinnormal_vertex>
4343	#include <defaultnormal_vertex>
4344	#include <normal_vertex>
4345	#include <begin_vertex>
4346	#include <morphtarget_vertex>
4347	#include <skinning_vertex>
4348	#include <displacementmap_vertex>
4349	#include <project_vertex>
4350	#include <logdepthbuf_vertex>
4351	#include <clipping_planes_vertex>
4352	vViewPosition = - mvPosition.xyz;
4353	#include <worldpos_vertex>
4354	#include <shadowmap_vertex>
4355	#include <fog_vertex>
4356}`,hDt=`#define TOON
4357uniform vec3 diffuse;
4358uniform vec3 emissive;
4359uniform float opacity;
4360#include <common>
4361#include <dithering_pars_fragment>
4362#include <color_pars_fragment>
4363#include <uv_pars_fragment>
4364#include <map_pars_fragment>
4365#include <alphamap_pars_fragment>
4366#include <alphatest_pars_fragment>
4367#include <alphahash_pars_fragment>
4368#include <aomap_pars_fragment>
4369#include <lightmap_pars_fragment>
4370#include <emissivemap_pars_fragment>
4371#include <gradientmap_pars_fragment>
4372#include <fog_pars_fragment>
4373#include <bsdfs>
4374#include <lights_pars_begin>
4375#include <normal_pars_fragment>
4376#include <lights_toon_pars_fragment>
4377#include <shadowmap_pars_fragment>
4378#include <bumpmap_pars_fragment>
4379#include <normalmap_pars_fragment>
4380#include <logdepthbuf_pars_fragment>
4381#include <clipping_planes_pars_fragment>
4382void main() {
4383	vec4 diffuseColor = vec4( diffuse, opacity );
4384	#include <clipping_planes_fragment>
4385	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
4386	vec3 totalEmissiveRadiance = emissive;
4387	#include <logdepthbuf_fragment>
4388	#include <map_fragment>
4389	#include <color_fragment>
4390	#include <alphamap_fragment>
4391	#include <alphatest_fragment>
4392	#include <alphahash_fragment>
4393	#include <normal_fragment_begin>
4394	#include <normal_fragment_maps>
4395	#include <emissivemap_fragment>
4396	#include <lights_toon_fragment>
4397	#include <lights_fragment_begin>
4398	#include <lights_fragment_maps>
4399	#include <lights_fragment_end>
4400	#include <aomap_fragment>
4401	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
4402	#include <opaque_fragment>
4403	#include <tonemapping_fragment>
4404	#include <colorspace_fragment>
4405	#include <fog_fragment>
4406	#include <premultiplied_alpha_fragment>
4407	#include <dithering_fragment>
4408}`,dDt=`uniform float size;
4409uniform float scale;
4410#include <common>
4411#include <color_pars_vertex>
4412#include <fog_pars_vertex>
4413#include <morphtarget_pars_vertex>
4414#include <logdepthbuf_pars_vertex>
4415#include <clipping_planes_pars_vertex>
4416#ifdef USE_POINTS_UV
4417	varying vec2 vUv;
4418	uniform mat3 uvTransform;
4419#endif
4420void main() {
4421	#ifdef USE_POINTS_UV
4422		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
4423	#endif
4424	#include <color_vertex>
4425	#include <morphinstance_vertex>
4426	#include <morphcolor_vertex>
4427	#include <begin_vertex>
4428	#include <morphtarget_vertex>
4429	#include <project_vertex>
4430	gl_PointSize = size;
4431	#ifdef USE_SIZEATTENUATION
4432		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
4433		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
4434	#endif
4435	#include <logdepthbuf_vertex>
4436	#include <clipping_planes_vertex>
4437	#include <worldpos_vertex>
4438	#include <fog_vertex>
4439}`,fDt=`uniform vec3 diffuse;
4440uniform float opacity;
4441#include <common>
4442#include <color_pars_fragment>
4443#include <map_particle_pars_fragment>
4444#include <alphatest_pars_fragment>
4445#include <alphahash_pars_fragment>
4446#include <fog_pars_fragment>
4447#include <logdepthbuf_pars_fragment>
4448#include <clipping_planes_pars_fragment>
4449void main() {
4450	vec4 diffuseColor = vec4( diffuse, opacity );
4451	#include <clipping_planes_fragment>
4452	vec3 outgoingLight = vec3( 0.0 );
4453	#include <logdepthbuf_fragment>
4454	#include <map_particle_fragment>
4455	#include <color_fragment>
4456	#include <alphatest_fragment>
4457	#include <alphahash_fragment>
4458	outgoingLight = diffuseColor.rgb;
4459	#include <opaque_fragment>
4460	#include <tonemapping_fragment>
4461	#include <colorspace_fragment>
4462	#include <fog_fragment>
4463	#include <premultiplied_alpha_fragment>
4464}`,pDt=`#include <common>
4465#include <batching_pars_vertex>
4466#include <fog_pars_vertex>
4467#include <morphtarget_pars_vertex>
4468#include <skinning_pars_vertex>
4469#include <logdepthbuf_pars_vertex>
4470#include <shadowmap_pars_vertex>
4471void main() {
4472	#include <batching_vertex>
4473	#include <beginnormal_vertex>
4474	#include <morphinstance_vertex>
4475	#include <morphnormal_vertex>
4476	#include <skinbase_vertex>
4477	#include <skinnormal_vertex>
4478	#include <defaultnormal_vertex>
4479	#include <begin_vertex>
4480	#include <morphtarget_vertex>
4481	#include <skinning_vertex>
4482	#include <project_vertex>
4483	#include <logdepthbuf_vertex>
4484	#include <worldpos_vertex>
4485	#include <shadowmap_vertex>
4486	#include <fog_vertex>
4487}`,gDt=`uniform vec3 color;
4488uniform float opacity;
4489#include <common>
4490#include <fog_pars_fragment>
4491#include <bsdfs>
4492#include <lights_pars_begin>
4493#include <logdepthbuf_pars_fragment>
4494#include <shadowmap_pars_fragment>
4495#include <shadowmask_pars_fragment>
4496void main() {
4497	#include <logdepthbuf_fragment>
4498	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
4499	#include <tonemapping_fragment>
4500	#include <colorspace_fragment>
4501	#include <fog_fragment>
4502	#include <premultiplied_alpha_fragment>
4503}`,mDt=`uniform float rotation;
4504uniform vec2 center;
4505#include <common>
4506#include <uv_pars_vertex>
4507#include <fog_pars_vertex>
4508#include <logdepthbuf_pars_vertex>
4509#include <clipping_planes_pars_vertex>
4510void main() {
4511	#include <uv_vertex>
4512	vec4 mvPosition = modelViewMatrix[ 3 ];
4513	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
4514	#ifndef USE_SIZEATTENUATION
4515		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
4516		if ( isPerspective ) scale *= - mvPosition.z;
4517	#endif
4518	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
4519	vec2 rotatedPosition;
4520	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
4521	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
4522	mvPosition.xy += rotatedPosition;
4523	gl_Position = projectionMatrix * mvPosition;
4524	#include <logdepthbuf_vertex>
4525	#include <clipping_planes_vertex>
4526	#include <fog_vertex>
4527}`,bDt=`uniform vec3 diffuse;
4528uniform float opacity;
4529#include <common>
4530#include <uv_pars_fragment>
4531#include <map_pars_fragment>
4532#include <alphamap_pars_fragment>
4533#include <alphatest_pars_fragment>
4534#include <alphahash_pars_fragment>
4535#include <fog_pars_fragment>
4536#include <logdepthbuf_pars_fragment>
4537#include <clipping_planes_pars_fragment>
4538void main() {
4539	vec4 diffuseColor = vec4( diffuse, opacity );
4540	#include <clipping_planes_fragment>
4541	vec3 outgoingLight = vec3( 0.0 );
4542	#include <logdepthbuf_fragment>
4543	#include <map_fragment>
4544	#include <alphamap_fragment>
4545	#include <alphatest_fragment>
4546	#include <alphahash_fragment>
4547	outgoingLight = diffuseColor.rgb;
4548	#include <opaque_fragment>
4549	#include <tonemapping_fragment>
4550	#include <colorspace_fragment>
4551	#include <fog_fragment>
4552}`,ii={alphahash_fragment:Fkt,alphahash_pars_fragment:Ukt,alphamap_fragment:zkt,alphamap_pars_fragment:Vkt,alphatest_fragment:Hkt,alphatest_pars_fragment:jkt,aomap_fragment:Wkt,aomap_pars_fragment:$kt,batching_pars_vertex:Gkt,batching_vertex:qkt,begin_vertex:Ykt,beginnormal_vertex:Xkt,b
vendor: 7,589 bytes, line 4552
4552sdfs:Kkt,iridescence_fragment:Jkt,bumpmap_pars_fragment:Zkt,clipping_planes_fragment:Qkt,clipping_planes_pars_fragment:tPt,clipping_planes_pars_vertex:ePt,clipping_planes_vertex:nPt,color_fragment:iPt,color_pars_fragment:sPt,color_pars_vertex:rPt,color_vertex:oPt,common:aPt,cube_uv_reflection_fragment:lPt,defaultnormal_vertex:cPt,displacementmap_pars_vertex:uPt,displacementmap_vertex:hPt,emissivemap_fragment:dPt,emissivemap_pars_fragment:fPt,colorspace_fragment:pPt,colorspace_pars_fragment:gPt,envmap_fragment:mPt,envmap_common_pars_fragment:bPt,envmap_pars_fragment:vPt,envmap_pars_vertex:yPt,envmap_physical_pars_fragment:PPt,envmap_vertex:xPt,fog_vertex:wPt,fog_pars_vertex:_Pt,fog_fragment:SPt,fog_pars_fragment:CPt,gradientmap_pars_fragment:MPt,lightmap_pars_fragment:TPt,lights_lambert_fragment:APt,lights_lambert_pars_fragment:EPt,lights_pars_begin:kPt,lights_toon_fragment:RPt,lights_toon_pars_fragment:DPt,lights_phong_fragment:LPt,lights_phong_pars_fragment:IPt,lights_physical_fragment:OPt,lights_physical_pars_fragment:NPt,lights_fragment_begin:BPt,lights_fragment_maps:FPt,lights_fragment_end:UPt,lightprobes_pars_fragment:zPt,logdepthbuf_fragment:VPt,logdepthbuf_pars_fragment:HPt,logdepthbuf_pars_vertex:jPt,logdepthbuf_vertex:WPt,map_fragment:$Pt,map_pars_fragment:GPt,map_particle_fragment:qPt,map_particle_pars_fragment:YPt,metalnessmap_fragment:XPt,metalnessmap_pars_fragment:KPt,morphinstance_vertex:JPt,morphcolor_vertex:ZPt,morphnormal_vertex:QPt,morphtarget_pars_vertex:tRt,morphtarget_vertex:eRt,normal_fragment_begin:nRt,normal_fragment_maps:iRt,normal_pars_fragment:sRt,normal_pars_vertex:rRt,normal_vertex:oRt,normalmap_pars_fragment:aRt,clearcoat_normal_fragment_begin:lRt,clearcoat_normal_fragment_maps:cRt,clearcoat_pars_fragment:uRt,iridescence_pars_fragment:hRt,opaque_fragment:dRt,packing:fRt,premultiplied_alpha_fragment:pRt,project_vertex:gRt,dithering_fragment:mRt,dithering_pars_fragment:bRt,roughnessmap_fragment:vRt,roughnessmap_pars_fragment:yRt,shadowmap_pars_fragment:xRt,shadowmap_pars_vertex:wRt,shadowmap_vertex:_Rt,shadowmask_pars_fragment:SRt,skinbase_vertex:CRt,skinning_pars_vertex:MRt,skinning_vertex:TRt,skinnormal_vertex:ARt,specularmap_fragment:ERt,specularmap_pars_fragment:kRt,tonemapping_fragment:PRt,tonemapping_pars_fragment:RRt,transmission_fragment:DRt,transmission_pars_fragment:LRt,uv_pars_fragment:IRt,uv_pars_vertex:ORt,uv_vertex:NRt,worldpos_vertex:BRt,background_vert:FRt,background_frag:URt,backgroundCube_vert:zRt,backgroundCube_frag:VRt,cube_vert:HRt,cube_frag:jRt,depth_vert:WRt,depth_frag:$Rt,distance_vert:GRt,distance_frag:qRt,equirect_vert:YRt,equirect_frag:XRt,linedashed_vert:KRt,linedashed_frag:JRt,meshbasic_vert:ZRt,meshbasic_frag:QRt,meshlambert_vert:tDt,meshlambert_frag:eDt,meshmatcap_vert:nDt,meshmatcap_frag:iDt,meshnormal_vert:sDt,meshnormal_frag:rDt,meshphong_vert:oDt,meshphong_frag:aDt,meshphysical_vert:lDt,meshphysical_frag:cDt,meshtoon_vert:uDt,meshtoon_frag:hDt,points_vert:dDt,points_frag:fDt,shadow_vert:pDt,shadow_frag:gDt,sprite_vert:mDt,sprite_frag:bDt},on={common:{diffuse:{value:new Be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Vn},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Vn}},envmap:{envMap:{value:null},envMapRotation:{value:new Vn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Vn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Vn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Vn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Vn},normalScale:{value:new Ce(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Vn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Vn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Vn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Vn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Be(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new bt},probesMax:{value:new bt},probesResolution:{value:new bt}},points:{diffuse:{value:new Be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0},uvTransform:{value:new Vn}},sprite:{diffuse:{value:new Be(16777215)},opacity:{value:1},center:{value:new Ce(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Vn},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0}}},wc={basic:{uniforms:To([on.common,on.specularmap,on.envmap,on.aomap,on.lightmap,on.fog]),vertexShader:ii.meshbasic_vert,fragmentShader:ii.meshbasic_frag},lambert:{uniforms:To([on.common,on.specularmap,on.envmap,on.aomap,on.lightmap,on.emissivemap,on.bumpmap,on.normalmap,on.displacementmap,on.fog,on.lights,{emissive:{value:new Be(0)},envMapIntensity:{value:1}}]),vertexShader:ii.meshlambert_vert,fragmentShader:ii.meshlambert_frag},phong:{uniforms:To([on.common,on.specularmap,on.envmap,on.aomap,on.lightmap,on.emissivemap,on.bumpmap,on.normalmap,on.displacementmap,on.fog,on.lights,{emissive:{value:new Be(0)},specular:{value:new Be(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:ii.meshphong_vert,fragmentShader:ii.meshphong_frag},standard:{uniforms:To([on.common,on.envmap,on.aomap,on.lightmap,on.emissivemap,on.bumpmap,on.normalmap,on.displacementmap,on.roughnessmap,on.metalnessmap,on.fog,on.lights,{emissive:{value:new Be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ii.meshphysical_vert,fragmentShader:ii.meshphysical_frag},toon:{uniforms:To([on.common,on.aomap,on.lightmap,on.emissivemap,on.bumpmap,on.normalmap,on.displacementmap,on.gradientmap,on.fog,on.lights,{emissive:{value:new Be(0)}}]),vertexShader:ii.meshtoon_vert,fragmentShader:ii.meshtoon_frag},matcap:{uniforms:To([on.common,on.bumpmap,on.normalmap,on.displacementmap,on.fog,{matc
vendor: 6,653 bytes, line 4552
4552ap:{value:null}}]),vertexShader:ii.meshmatcap_vert,fragmentShader:ii.meshmatcap_frag},points:{uniforms:To([on.points,on.fog]),vertexShader:ii.points_vert,fragmentShader:ii.points_frag},dashed:{uniforms:To([on.common,on.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ii.linedashed_vert,fragmentShader:ii.linedashed_frag},depth:{uniforms:To([on.common,on.displacementmap]),vertexShader:ii.depth_vert,fragmentShader:ii.depth_frag},normal:{uniforms:To([on.common,on.bumpmap,on.normalmap,on.displacementmap,{opacity:{value:1}}]),vertexShader:ii.meshnormal_vert,fragmentShader:ii.meshnormal_frag},sprite:{uniforms:To([on.sprite,on.fog]),vertexShader:ii.sprite_vert,fragmentShader:ii.sprite_frag},background:{uniforms:{uvTransform:{value:new Vn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ii.background_vert,fragmentShader:ii.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Vn}},vertexShader:ii.backgroundCube_vert,fragmentShader:ii.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ii.cube_vert,fragmentShader:ii.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ii.equirect_vert,fragmentShader:ii.equirect_frag},distance:{uniforms:To([on.common,on.displacementmap,{referencePosition:{value:new bt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ii.distance_vert,fragmentShader:ii.distance_frag},shadow:{uniforms:To([on.lights,on.fog,{color:{value:new Be(0)},opacity:{value:1}}]),vertexShader:ii.shadow_vert,fragmentShader:ii.shadow_frag}};wc.physical={uniforms:To([wc.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Vn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Vn},clearcoatNormalScale:{value:new Ce(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Vn},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Vn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Vn},sheen:{value:0},sheenColor:{value:new Be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Vn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Vn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Vn},transmissionSamplerSize:{value:new Ce},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Vn},attenuationDistance:{value:0},attenuationColor:{value:new Be(0)},specularColor:{value:new Be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Vn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Vn},anisotropyVector:{value:new Ce},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Vn}}]),vertexShader:ii.meshphysical_vert,fragmentShader:ii.meshphysical_frag};Gk={r:0,b:0,g:0},vDt=new tn,pet=new Vn;pet.set(-1,0,0,0,1,0,0,0,1);yv=4,CDt=6,MDt=20,TDt=256,$_=new hu,$tt=new Be,GU=null,qU=0,YU=0,XU=!1,ADt=new bt,Ug=new bt,Y_=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(t,e=0,n=.1,s=100,r={}){let{size:o=256,position:a=ADt}=r;GU=this._renderer.getRenderTarget(),qU=this._renderer.getActiveCubeFace(),YU=this._renderer.getActiveMipmapLevel(),XU=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(t,n,s,l,a),e>0&&this._blur(l,0,0,e),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ytt(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=qtt(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodMeshes.length;t++)this._lodMeshes[t].geometry.dispose()}_cleanup(t){this._renderer.setRenderTarget(GU,qU,YU),this._renderer.xr.enabled=XU,t.scissorTest=!1,vv(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===xc||t.mapping===bh?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),GU=this._renderer.getRenderTarget(),qU=this._renderer.getActiveCubeFace(),YU=this._renderer.getActiveMipmapLevel(),XU=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:$i,minFilter:$i,generateMipmaps:!1,type:Tl,format:xo,colorSpace:wo,depthBuffer:!1},s=Gtt(t,e,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Gtt(t,e,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods}=EDt(r)),this._blurMaterial=PDt(r,t,e),this._ggxMaterial=kDt(r,t,e)}return s}_compileMaterial(t){let e=new qi(new kn,t);this._renderer.compile(e,$_)}_sceneToCubeUV(t,e,n,s,r){let l=new Ds(90,1,e,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,p=h.toneMapping;h.getClearColor($tt),h.toneMapping=Ml,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(s),h.clearDepth(),h.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new qi(new nf,new io({name:"PMREM.Backgroun
4552d",side:Mo,depthWrite:!1,depthTest:!1})));let y=this._backgroundBox,x=y.material,w=!1,M=t.background;M?M.isColor&&(x.color.copy(M),t.background=null,w=!0):(x.color.copy($tt),w=!0);for(let A=0;A<6;A++){let C=A%3;C===0?(l.up.set(0,c[A],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x+u[A],r.y,r.z)):C===1?(l.up.set(0,0,c[A]),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y+u[A],r.z)):(l.up.set(0,c[A],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y,r.z+u[A]));let R=this._cubeSize;vv(s,C*R,A>2?R:0,R,R),h.setRenderTarget(s),w&&h.render(y,l),h.render(t,l)}h.toneMapping=p,h.autoClear=d,t.background=M}_textureToCubeUV(t,e){let n=this._renderer,s=t.mapping===xc||t.mapping===bh;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ytt()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=qtt());let r=s?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=r;let a=r.uniforms;a.envMap.value=t;let l=this._cubeSize;vv(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(o,$_)}_applyPMREM(t){let e=this._renderer,n=e.autoClear;e.autoClear=!1;let s=this._lodMeshes.length;for(let r=1;r<s;r++)this._applyGGXFilter(t,r-1,r);e.autoClear=n}_applyGGXFilter(t,e,n){let s=this._renderer,r=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=o.uniforms,c=n/(this._lodMeshes.length-1),u=e/(this._lodMeshes.length-1),h=Math.sqrt(c*c-u*u),d=c*1.25,p=h*d,{_lodMax:g}=this,y=this._sizeLods[n],x=3*y*(n>g-yv?n-g+yv:0),w=4*(this._cubeSize-y);l.envMap.value=t.texture,l.roughness.value=p,l.mipInt.value=g-e,vv(r,x,w,3*y,2*y),s.setRenderTarget(r),s.render(a,$_),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=g-n,vv(t,x,w,3*y,2*y),s.setRenderTarget(t),s.render(a,$_)}_blur(t,e,n,s){let r=this._pingPongRenderTarget,o=Math.min(s,Math.PI)/Math.SQRT2;this._blurPass(t,r,e,n,o),this._blurPass(r,t,n,n,o)}_blurPass(t,e,n,s,r){let o=this._renderer,a=this._blurMaterial,l=this._lodMeshes[s];l.material=a;let c=a.uniforms;c.envMap.value=t.texture,c.sigma.value=r,c.mipInt.value=this._lodMax-n;let u=this._sizeLods[s],h=3*u*(s>this._lodMax-yv?s-this._lodMax+yv:0),d=4*(this._cubeSize-u);vv(e,h,d,3*u,2*u),o.setRenderTarget(e),o.render(l,$_)}};X_=class extends no{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let n={width:t,height:t,depth:1},s=[n,n,n,n,n,n];this.texture=new ef(s),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
4553
4554				varying vec3 vWorldDirection;
4555
4556				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
4557
4558					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
4559
4560				}
4561
4562				void main() {
4563
4564					vWorldDirection = transformDirection( position, modelMatrix );
4565
4566					#include <begin_vertex>
4567					#include <project_vertex>
4568
4569				}
4570			`,fragmentShader:`
4571
4572				uniform sampler2D tEquirect;
4573
4574				varying vec3 vWorldDirection;
4575
4576				#include <common>
4577
4578				void main() {
4579
4580					vec3 direction = normalize( vWorldDirection );
4581
4582					vec2 sampleUV = equirectUv( direction );
4583
4584					gl_FragColor = texture2D( tEquirect, sampleUV );
4585
4586				}
4587			`},s=new nf(5,5,5),r=new Zo({name:"CubemapFromEquirect",uniforms:Fg(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Mo,blending:yc});r.uniforms.tEquirect.value=e;let o=new qi(s,r),a=e.minFilter;return e.minFilter===Sa&&(e.minFilter=$i),new K1(1,10,this).update(t,o),e.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(t,e=!0,n=!0,s=!0){let r=t.getRenderTarget();for(let o=0;o<6;o++)t.setRenderTarget(this,o),t.clear(e,n,s);t.setRenderTarget(r)}};FDt={[kk]:"LINEAR_TONE_MAPPING",[Pk]:"REINHARD_TONE_MAPPING",[Rk]:"CINEON_TONE_MAPPING",[Dk]:"ACES_FILMIC_TONE_MAPPING",[Ik]:"AGX_TONE_MAPPING",[Ok]:"NEUTRAL_TONE_MAPPING",[Lk]:"CUSTOM_TONE_MAPPING"};get=new is,ZU=new dh(1,1),met=new vg,bet=new yg,vet=new ef,Xtt=[],Ktt=[],Jtt=new Float32Array(16),Ztt=new Float32Array(9),Qtt=new Float32Array(4);QU=class{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=rLt
vendor: 7,090 bytes, lines 4587-4638
4587(e.type)}},tz=class{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=MLt(e.type)}},ez=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){let s=this.seq;for(let r=0,o=s.length;r!==o;++r){let a=s[r];a.setValue(t,e[a.id],n)}}},KU=/(\w+)(\])?(\[|\.)?/g;xv=class{constructor(t,e){this.seq=[],this.map={};let n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){let a=t.getActiveUniform(e,o),l=t.getUniformLocation(e,a.name);TLt(a,l,this)}let s=[],r=[];for(let o of this.seq)o.type===t.SAMPLER_2D_SHADOW||o.type===t.SAMPLER_CUBE_SHADOW||o.type===t.SAMPLER_2D_ARRAY_SHADOW?s.push(o):r.push(o);s.length>0&&(this.seq=s.concat(r))}setValue(t,e,n,s){let r=this.map[e];r!==void 0&&r.setValue(t,n,s)}setOptional(t,e,n){let s=e[n];s!==void 0&&this.setValue(t,n,s)}static upload(t,e,n,s){for(let r=0,o=e.length;r!==o;++r){let a=e[r],l=n[a.id];l.needsUpdate!==!1&&a.setValue(t,l.value,s)}}static seqWithValue(t,e){let n=[];for(let s=0,r=t.length;s!==r;++s){let o=t[s];o.id in e&&n.push(o)}return n}};ALt=37297,ELt=0;net=new Vn;DLt={[kk]:"Linear",[Pk]:"Reinhard",[Rk]:"Cineon",[Dk]:"ACESFilmic",[Ik]:"AgX",[Ok]:"Neutral",[Lk]:"Custom"};qk=new bt;FLt=/^[ \t]*#include +<([\w\d./]+)>/gm;ULt=new Map;VLt=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;jLt={[ov]:"SHADOWMAP_TYPE_PCF",[Dg]:"SHADOWMAP_TYPE_VSM"};$Lt={[xc]:"ENVMAP_TYPE_CUBE",[bh]:"ENVMAP_TYPE_CUBE",[Ig]:"ENVMAP_TYPE_CUBE_UV"};qLt={[bh]:"ENVMAP_MODE_REFRACTION"};XLt={[av]:"ENVMAP_BLENDING_MULTIPLY",[SU]:"ENVMAP_BLENDING_MIX",[CU]:"ENVMAP_BLENDING_ADD"};QLt=0,iz=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t,e,n){let s=this._getShaderCacheForMaterial(t);return s.has(e)===!1&&(s.add(e),e.usedTimes++),s.has(n)===!1&&(s.add(n),n.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderStage(t){return this._getShaderStage(t.vertexShader)}getFragmentShaderStage(t){return this._getShaderStage(t.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){let e=this.shaderCache,n=e.get(t);return n===void 0&&(n=new sz(t),e.set(t,n)),n}},sz=class{constructor(t){this.id=QLt++,this.code=t,this.usedTimes=0}};aIt=0;hIt=`void main() {
4588	gl_Position = vec4( position, 1.0 );
4589}`,dIt=`uniform sampler2D shadow_pass;
4590uniform vec2 resolution;
4591uniform float radius;
4592void main() {
4593	const float samples = float( VSM_SAMPLES );
4594	float mean = 0.0;
4595	float squared_mean = 0.0;
4596	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4597	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4598	for ( float i = 0.0; i < samples; i ++ ) {
4599		float uvOffset = uvStart + i * uvStride;
4600		#ifdef HORIZONTAL_PASS
4601			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4602			mean += distribution.x;
4603			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4604		#else
4605			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4606			mean += depth;
4607			squared_mean += depth * depth;
4608		#endif
4609	}
4610	mean = mean / samples;
4611	squared_mean = squared_mean / samples;
4612	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4613	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4614}`,fIt=[new bt(1,0,0),new bt(-1,0,0),new bt(0,1,0),new bt(0,-1,0),new bt(0,0,1),new bt(0,0,-1)],pIt=[new bt(0,-1,0),new bt(0,-1,0),new bt(0,0,1),new bt(0,0,-1),new bt(0,-1,0),new bt(0,-1,0)],det=new tn,G_=new bt,JU=new bt;vIt=`
4615void main() {
4616
4617	gl_Position = vec4( position, 1.0 );
4618
4619}`,yIt=`
4620uniform sampler2DArray depthColor;
4621uniform float depthWidth;
4622uniform float depthHeight;
4623
4624void main() {
4625
4626	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4627
4628	if ( coord.x >= 1.0 ) {
4629
4630		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4631
4632	} else {
4633
4634		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4635
4636	}
4637
4638}`,rz=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){let n=new zb(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(this.texture!==null&&this.mesh===null){let e=t.cameras[0].viewport,n=new Zo({vertexShader:vIt,fragmentShader:yIt,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new qi(new Ag(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},oz=class extends wa{constructor(t,e){super();let n=this,s=null,r=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,d=null,p=null,g=null,y=typeof XRWebGLBinding<"u",x=new rz,w={},M=e.getContextAttributes(),A=null,C=null,R=[],k=[],O=new Ce,I=null,U=null,V=new Ds;V.viewport=new pi;let q=new Ds;q.viewport=new pi;let X=[V,q],j=new J1,W=null,_=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Bt){let Gt=R[Bt];return Gt===void 0&&(Gt=new wg,R[Bt]=Gt),Gt.getTargetRaySpace()},this.getControllerGrip=function(Bt){let Gt=R[Bt];return Gt===void 0&&(Gt=new wg,R[Bt]=Gt),Gt.getGripSpace()},this.getHand=function(Bt){let Gt=R[Bt];return Gt===void 0&&(Gt=new wg,R[Bt]=Gt),Gt.getHandSpace()};function at(Bt){let Gt=k.indexOf(Bt.inputSource);if(Gt===-1)return;let Qt=R[Gt];Qt!==void 0&&(Qt.update(Bt.inputSource,Bt.frame,c||o),Qt.dispatchEvent({type:Bt.type,data:Bt.inputSource}))}function ct(){s.removeEventListener("select",at),s.removeEventListener("selectstart",at),s.removeEventListener("selectend",at),s.removeEventListener("squeeze",at),s.removeEventListener("squeezestart",at),s.removeEventListener("squeezeend",at),s.removeEventListener("end",ct),s.removeEventListener("inputsourceschange",pt);for(let Bt=0;Bt<R.length;Bt++){let Gt=k[Bt];Gt!==null&&(k[Bt]=null,R[Bt].disconnect(Gt))}W=null,_=null,x.reset();for(let Bt in w)delete w[Bt];if(t.setRenderTarget(A),p=null,d=null,h=null,s=null,C=null,ee.stop(),n.isPresenting=!1,t.setPixelRatio(I),t.setSize(O.width,O.height,!1),U!==null){let Bt=U.camera;Bt.fov=U.fov,Bt.zoom=U.zoom,Bt.updateProjectionMatrix(),U=null}n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Bt){r=Bt,n.isPresenting===!0&&Ze("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Bt){a=Bt,n.isPresenting===!0&&Ze("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Bt){c=Bt},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h===null&&y&&(h=new XRWebGLBinding(s,e)),h},this.getFrame=function(){return g}
vendor: 5,345 bytes, line 4638
4638,this.getSession=function(){return s},this.setSession=async function(Bt){if(s=Bt,s!==null){if(A=t.getRenderTarget(),s.addEventListener("select",at),s.addEventListener("selectstart",at),s.addEventListener("selectend",at),s.addEventListener("squeeze",at),s.addEventListener("squeezestart",at),s.addEventListener("squeezeend",at),s.addEventListener("end",ct),s.addEventListener("inputsourceschange",pt),M.xrCompatible!==!0&&await e.makeXRCompatible(),I=t.getPixelRatio(),t.getSize(O),y&&"createProjectionLayer"in XRWebGLBinding.prototype){let Qt=null,xe=null,Ut=null;M.depth&&(Ut=M.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Qt=M.stencil?yh:dc,xe=M.stencil?Ng:qa);let zt={colorFormat:e.RGBA8,depthFormat:Ut,scaleFactor:r};h=this.getBinding(),d=h.createProjectionLayer(zt),s.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),C=new no(d.textureWidth,d.textureHeight,{format:xo,type:ta,depthTexture:new dh(d.textureWidth,d.textureHeight,xe,void 0,void 0,void 0,void 0,void 0,void 0,Qt),stencilBuffer:M.stencil,colorSpace:t.outputColorSpace,samples:M.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,storeMultisampledDepthBuffer:d.ignoreDepthValues===!1,storeMultisampledStencilBuffer:d.ignoreDepthValues===!1})}else{let Qt={antialias:M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:r};p=new XRWebGLLayer(s,e,Qt),s.updateRenderState({baseLayer:p}),t.setPixelRatio(1),t.setSize(p.framebufferWidth,p.framebufferHeight,!1),C=new no(p.framebufferWidth,p.framebufferHeight,{format:xo,type:ta,colorSpace:t.outputColorSpace,stencilBuffer:M.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1,storeMultisampledDepthBuffer:p.ignoreDepthValues===!1,storeMultisampledStencilBuffer:p.ignoreDepthValues===!1})}C.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await s.requestReferenceSpace(a),ee.setContext(s),ee.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function pt(Bt){for(let Gt=0;Gt<Bt.removed.length;Gt++){let Qt=Bt.removed[Gt],xe=k.indexOf(Qt);xe>=0&&(k[xe]=null,R[xe].disconnect(Qt))}for(let Gt=0;Gt<Bt.added.length;Gt++){let Qt=Bt.added[Gt],xe=k.indexOf(Qt);if(xe===-1){for(let zt=0;zt<R.length;zt++)if(zt>=k.length){k.push(Qt),xe=zt;break}else if(k[zt]===null){k[zt]=Qt,xe=zt;break}if(xe===-1)break}let Ut=R[xe];Ut&&Ut.connect(Qt)}}let Et=new bt,vt=new bt;function yt(Bt,Gt,Qt){Et.setFromMatrixPosition(Gt.matrixWorld),vt.setFromMatrixPosition(Qt.matrixWorld);let xe=Et.distanceTo(vt),Ut=Gt.projectionMatrix.elements,zt=Qt.projectionMatrix.elements,St=Ut[14]/(Ut[10]-1),it=Ut[14]/(Ut[10]+1),gt=(Ut[9]+1)/Ut[5],ft=(Ut[9]-1)/Ut[5],de=(Ut[8]-1)/Ut[0],ve=(zt[8]+1)/zt[0],we=St*de,Ae=St*ve,Ue=xe/(-de+ve),en=Ue*-de;if(Gt.matrixWorld.decompose(Bt.position,Bt.quaternion,Bt.scale),Bt.translateX(en),Bt.translateZ(Ue),Bt.matrixWorld.compose(Bt.position,Bt.quaternion,Bt.scale),Bt.matrixWorldInverse.copy(Bt.matrixWorld).invert(),Ut[10]===-1)Bt.projectionMatrix.copy(Gt.projectionMatrix),Bt.projectionMatrixInverse.copy(Gt.projectionMatrixInverse);else{let It=St+Ue,Cn=it+Ue,mn=we-en,mt=Ae+(xe-en),K=gt*it/Cn*It,Vt=ft*it/Cn*It;Bt.projectionMatrix.makePerspective(mn,mt,K,Vt,It,Cn),Bt.projectionMatrixInverse.copy(Bt.projectionMatrix).invert()}}function kt(Bt,Gt){Gt===null?Bt.matrixWorld.copy(Bt.matrix):Bt.matrixWorld.multiplyMatrices(Gt.matrixWorld,Bt.matrix),Bt.matrixWorldInverse.copy(Bt.matrixWorld).invert()}this.updateCamera=function(Bt){if(s===null)return;let Gt=Bt.near,Qt=Bt.far;x.texture!==null&&(x.depthNear>0&&(Gt=x.depthNear),x.depthFar>0&&(Qt=x.depthFar)),j.near=q.near=V.near=Gt,j.far=q.far=V.far=Qt,(W!==j.near||_!==j.far)&&(s.updateRenderState({depthNear:j.near,depthFar:j.far}),W=j.near,_=j.far),j.layers.mask=Bt.layers.mask|6,V.layers.mask=j.layers.mask&-5,q.layers.mask=j.layers.mask&-3;let xe=Bt.parent,Ut=j.cameras;kt(j,xe);for(let zt=0;zt<Ut.length;zt++)kt(Ut[zt],xe);Ut.length===2?yt(j,V,q):j.projectionMatrix.copy(V.projectionMatrix),U===null&&Bt.isPerspectiveCamera&&(U={camera:Bt,fov:Bt.fov,zoom:Bt.zoom}),Wt(Bt,j,xe)};function Wt(Bt,Gt,Qt){Qt===null?Bt.matrix.copy(Gt.matrixWorld):(Bt.matrix.copy(Qt.matrixWorld),Bt.matrix.invert(),Bt.matrix.multiply(Gt.matrixWorld)),Bt.matrix.decompose(Bt.position,Bt.quaternion,Bt.scale),Bt.updateMatrixWorld(!0),Bt.projectionMatrix.copy(Gt.projectionMatrix),Bt.projectionMatrixInverse.copy(Gt.projectionMatrixInverse),Bt.isPerspectiveCamera&&(Bt.fov=bg*2*Math.atan(1/Bt.projectionMatrix.elements[5]),Bt.zoom=1)}this.getCamera=function(){return j},this.getFoveation=function(){if(!(d===null&&p===null))return l},this.setFoveation=function(Bt){l=Bt,d!==null&&(d.fixedFoveation=Bt),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=Bt)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(j)},this.getCameraTexture=function(Bt){return w[Bt]};let jt=null;function ae(Bt,Gt){if(u=Gt.getViewerPose(c||o),g=Gt,u!==null){let Qt=u.views;p!==null&&(t.setRenderTargetFramebuffer(C,p.framebuffer),t.setRenderTarget(C));let xe=!1;Qt.length!==j.cameras.length&&(j.cameras.length=0,xe=!0);for(let it=0;
vendor: 2,516 bytes, line 4638
4638it<Qt.length;it++){let gt=Qt[it],ft=null;if(p!==null)ft=p.getViewport(gt);else{let ve=h.getViewSubImage(d,gt);ft=ve.viewport,it===0&&(t.setRenderTargetTextures(C,ve.colorTexture,ve.depthStencilTexture),t.setRenderTarget(C))}let de=X[it];de===void 0&&(de=new Ds,de.layers.enable(it),de.viewport=new pi,X[it]=de),de.matrix.fromArray(gt.transform.matrix),de.matrix.decompose(de.position,de.quaternion,de.scale),de.projectionMatrix.fromArray(gt.projectionMatrix),de.projectionMatrixInverse.copy(de.projectionMatrix).invert(),de.viewport.set(ft.x,ft.y,ft.width,ft.height),it===0&&(j.matrix.copy(de.matrix),j.matrix.decompose(j.position,j.quaternion,j.scale)),xe===!0&&j.cameras.push(de)}let Ut=s.enabledFeatures;if(Ut&&Ut.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&y){h=n.getBinding();let it=h.getDepthInformation(Qt[0]);it&&it.isValid&&it.texture&&x.init(it,s.renderState)}if(Ut&&Ut.includes("camera-access")&&y){t.state.unbindTexture(),h=n.getBinding();for(let it=0;it<Qt.length;it++){let gt=Qt[it].camera;if(gt){let ft=w[gt];ft||(ft=new zb,w[gt]=ft);let de=h.getCameraImage(gt);ft.sourceTexture=de}}}}for(let Qt=0;Qt<R.length;Qt++){let xe=k[Qt],Ut=R[Qt];xe!==null&&Ut!==void 0&&Ut.update(xe,Gt,c||o)}jt&&jt(Bt,Gt),Gt.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Gt}),g=null}let ee=new fet;ee.setAnimationLoop(ae),this.setAnimationLoop=function(Bt){jt=Bt},this.dispose=function(){}}},xIt=new tn,xet=new Vn;xet.set(-1,0,0,0,1,0,0,0,1);SIt=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,
463814942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),pu=null;az=class{constructor(t={}){let{canvas:e=FU(),context:n=null,depth:s=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:d=!1,outputBufferType:p=ta}=t;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=o;let y=p,x=new Set([c_,l_,uv]),w=new Set([ta,qa,Og,Ng,r_,o_]),M=new Uint32Array(4),A=new Int32Array(4),C=new bt,R=null,k=null,O=[],I=[],U=null;this.domElement=e,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Ml,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let V=this,q=!1,X=null,j=null,W=null,_=null;this._outputColorSpace=Zn;let at=0,ct=0,pt=null,Et=-1,vt=null,yt=new pi,kt=new pi,Wt=null,jt=new Be(0),ae=0,ee=e.width,Bt=e.height,Gt=1,Qt=null,xe=null,Ut=new pi(0,0,ee,Bt),zt=new pi(0,0,ee,Bt),St=!1,it=new ou,gt=!1,ft=!1,de=new tn,ve=new bt,we=new pi,Ae={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Ue=!1;function en(){return pt===null?Gt:1}let It=n;function Cn(nt,Ot){return e.getContext(nt,Ot)}let mn,mt,K,Vt,te,Nt,Se,Me,ie,_t,Zt,fe,ce,pe,Fe,je,Re,Ft,Ee,J,lt,xt,At;try{let nt={alpha:!0,depth:s,stencil:r,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"186"}`),e.addEventListener("webglcontextlost",Tt,!1),e.addEventListener("webglcontextrestored",Dt,!1),e.addEventListener("webglcontextcreationerror",he,!1),It===null){let Ot="webgl2";if(It=Cn(Ot,nt),It===null)throw Cn(Ot)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}st()}catch(nt){throw e.removeEventListener("webglcontextlost",Tt,!1),e.removeEventListener("webglcontextrestored",Dt,!1),e.removeEventListener("webglcontextcreationerror",he,!1),Tn("WebGLRenderer: "+nt.message),nt}function st(){mn=new DDt(It),mn.init(),lt=new yet(It,mn),mt=new _Dt(It,mn,t,lt),K=new mIt(It,mn),mt.reversedDepthBuffer&&d&&K.buffers.depth.setReversed(!0),j=It.createFramebuffer(),W=It.createFramebuffer(),_=It.createFramebuffer(),Vt=new ODt(It),te=new nIt,Nt=new bIt(It,mn,K,te,mt,lt,Vt),Se=new RDt(V),Me=new Bkt(It),xt=new xDt(It,Me),ie=new LDt(It,Me,Vt,xt),_t=new BDt(It,ie,Me,xt,Vt),Ft=new NDt(It,mt,Nt),Fe=new SDt(te),Zt=new eIt(V,Se,mn,mt,xt,Fe),fe=new wIt(V,te),ce=new sIt,pe=new uIt(mn),Re=new yDt(V,Se,K,_t,g,l),je=new gIt(V,_t,mt),At=new _It(It,Vt,mt,K),Ee=new wDt(It,mn,Vt),J=new IDt(It,mn,Vt),Vt.programs=Zt.programs,V.capabilities=mt,V.extensions=mn,V.properties=te,V.renderLists=ce,V.shadowMap=je,V.state=K,V.info=Vt}y!==ta&&(U=new UDt(y,e.width,e.height,a,s,r));let rt=new oz(V,It);this.xr=rt,this.getContext=function(){return It},this.getContextAttributes=function(){return It.getContextAttributes()},this.forceContextLoss=function(){let nt=mn.get("WEBGL_lose_context");nt&&nt.loseContext()},this.forceContextRestore=function(){let nt=mn.get("WEBGL_lose_context");nt&&nt.restoreContext()},this.getPixelRatio=function(){return Gt},this.setPixelRatio=function(nt){nt!==void 0&&(Gt=nt,this.setSize(ee,Bt,!1))}
vendor: 5,484 bytes, line 4638
4638,this.getSize=function(nt){return nt.set(ee,Bt)},this.setSize=function(nt,Ot,re=!0){if(rt.isPresenting){Ze("WebGLRenderer: Can't change size while VR device is presenting.");return}ee=nt,Bt=Ot,e.width=Math.floor(nt*Gt),e.height=Math.floor(Ot*Gt),re===!0&&(e.style.width=nt+"px",e.style.height=Ot+"px"),U!==null&&U.setSize(e.width,e.height),this.setViewport(0,0,nt,Ot)},this.getDrawingBufferSize=function(nt){return nt.set(ee*Gt,Bt*Gt).floor()},this.setDrawingBufferSize=function(nt,Ot,re){ee=nt,Bt=Ot,Gt=re,e.width=Math.floor(nt*re),e.height=Math.floor(Ot*re),this.setViewport(0,0,nt,Ot)},this.setEffects=function(nt){if(y===ta){Tn("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(nt){for(let Ot=0;Ot<nt.length;Ot++)if(nt[Ot].isOutputPass===!0){Ze("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}U.setEffects(nt||[])},this.getCurrentViewport=function(nt){return nt.copy(yt)},this.getViewport=function(nt){return nt.copy(Ut)},this.setViewport=function(nt,Ot,re,Kt){nt.isVector4?Ut.set(nt.x,nt.y,nt.z,nt.w):Ut.set(nt,Ot,re,Kt),K.viewport(yt.copy(Ut).multiplyScalar(Gt).round())},this.getScissor=function(nt){return nt.copy(zt)},this.setScissor=function(nt,Ot,re,Kt){nt.isVector4?zt.set(nt.x,nt.y,nt.z,nt.w):zt.set(nt,Ot,re,Kt),K.scissor(kt.copy(zt).multiplyScalar(Gt).round())},this.getScissorTest=function(){return St},this.setScissorTest=function(nt){K.setScissorTest(St=nt)},this.setOpaqueSort=function(nt){Qt=nt},this.setTransparentSort=function(nt){xe=nt},this.getClearColor=function(nt){return nt.copy(Re.getClearColor())},this.setClearColor=function(){Re.setClearColor(...arguments)},this.getClearAlpha=function(){return Re.getClearAlpha()},this.setClearAlpha=function(){Re.setClearAlpha(...arguments)},this.clear=function(nt=!0,Ot=!0,re=!0){let Kt=0;if(nt){let ne=!1;if(pt!==null){let Ke=pt.texture.format;ne=x.has(Ke)}if(ne){let Ke=pt.texture.type,nn=w.has(Ke),$e=Re.getClearColor(),bn=Re.getClearAlpha(),We=$e.r,Nn=$e.g,Hn=$e.b;nn?(M[0]=We,M[1]=Nn,M[2]=Hn,M[3]=bn,It.clearBufferuiv(It.COLOR,0,M)):(A[0]=We,A[1]=Nn,A[2]=Hn,A[3]=bn,It.clearBufferiv(It.COLOR,0,A))}else Kt|=It.COLOR_BUFFER_BIT}Ot&&(Kt|=It.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),re&&(Kt|=It.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Kt!==0&&It.clear(Kt)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(nt){nt.setRenderer(this),X=nt},this.dispose=function(){e.removeEventListener("webglcontextlost",Tt,!1),e.removeEventListener("webglcontextrestored",Dt,!1),e.removeEventListener("webglcontextcreationerror",he,!1),Re.dispose(),ce.dispose(),pe.dispose(),te.dispose(),Se.dispose(),_t.dispose(),xt.dispose(),At.dispose(),Zt.dispose(),rt.dispose(),rt.removeEventListener("sessionstart",vn),rt.removeEventListener("sessionend",jn),Fn.stop()};function Tt(nt){nt.preventDefault(),Nb("WebGLRenderer: Context Lost."),q=!0}function Dt(){Nb("WebGLRenderer: Context Restored."),q=!1;let nt=Vt.autoReset,Ot=je.enabled,re=je.autoUpdate,Kt=je.needsUpdate,ne=je.type;st(),Vt.autoReset=nt,je.enabled=Ot,je.autoUpdate=re,je.needsUpdate=Kt,je.type=ne}function he(nt){Tn("WebGLRenderer: A WebGL context could not be created. Reason: ",nt.statusMessage)}function se(nt){let Ot=nt.target;Ot.removeEventListener("dispose",se),ye(Ot)}function ye(nt){be(nt),te.remove(nt)}function be(nt){let Ot=te.get(nt).programs;Ot!==void 0&&(Ot.forEach(function(re){Zt.releaseProgram(re)}),nt.isShaderMaterial&&Zt.releaseShaderCache(nt))}this.renderBufferDirect=function(nt,Ot,re,Kt,ne,Ke){Ot===null&&(Ot=Ae);let nn=ne.isMesh&&ne.matrixWorld.determinantAffine()<0,$e=Xe(nt,Ot,re,Kt,ne);K.setMaterial(Kt,nn);let bn=re.index,We=1;if(Kt.wireframe===!0){if(bn=ie.getWireframeAttribute(re),bn===void 0)return;We=2}let Nn=re.drawRange,Hn=re.attributes.position,pn=Nn.start*We,ri=(Nn.start+Nn.count)*We;Ke!==null&&(pn=Math.max(pn,Ke.start*We),ri=Math.min(ri,(Ke.start+Ke.count)*We)),bn!==null?(pn=Math.max(pn,0),ri=Math.min(ri,bn.count)):Hn!=null&&(pn=Math.max(pn,0),ri=Math.min(ri,Hn.count));let Ni=ri-pn;if(Ni<0||Ni===1/0)return;xt.setup(ne,Kt,$e,re,bn);let Si,Un=Ee;if(bn!==null&&(Si=Me.get(bn),Un=J,Un.setIndex(Si)),ne.isMesh)Kt.wireframe===!0?(K.setLineWidth(Kt.wireframeLinewidth*en()),Un.setMode(It.LINES)):Un.setMode(It.TRIANGLES);else if(ne.isLine){let Ss=Kt.linewidth;Ss===void 0&&(Ss=1),K.setLineWidth(Ss*en()),ne.isLineSegments?Un.setMode(It.LINES):ne.isLineLoop?Un.setMode(It.LINE_LOOP):Un.setMode(It.LINE_STRIP)}else ne.isPoints?Un.setMode(It.POINTS):ne.isSprite&&Un.setMode(It.TRIANGLES);if(ne.isBatchedMesh)if(mn.get("WEBGL_multi_draw"))Un.renderMultiDraw(ne._multiDrawStarts,ne._multiDrawCounts,ne._multiDrawCount);else{let Ss=ne._multiDrawStarts,Ye=ne._multiDrawCounts,ps=ne._multiDrawCount,ti=bn?Me.get(bn).bytesPerElement:1,$n=te.get(Kt).currentProgram.getUniforms();for(let $r=0;$r<ps;$r++)$n.setValue(It,"_gl_DrawID",$r),Un.render(Ss[$r]/ti,Ye[$r])}else if(ne.isInstancedMesh)Un.renderInstances(pn,Ni,ne.count);else if(re.isInstancedBufferGeometry){let Ss=re._maxInstanceCount!==void 0?re._maxInstanceCount:1/0,Ye=Math.min(re.instanceCount,Ss);Un.renderInstances(pn,Ni,Ye)}else Un.render(pn,Ni)};function fn(nt,Ot,re,Kt){X!==null&&nt.isNodeMaterial&&X.setObject(Kt,nt),gt===!0&&Fe.setState(nt,re,!1),nt.transparent===!0&&nt.
4638side===Ga&&nt.forceSinglePass===!1?(nt.side=Mo,nt.needsUpdate=!0,ze(nt,Ot,Kt),nt.side=$a,nt.needsUpdate=!0,ze(nt,Ot,Kt),nt.side=Ga):ze(nt,Ot,Kt)}this.compile=function(nt,Ot,re=null){re===null&&(re=nt),X!==null&&X.renderStart(nt,Ot,re),k=pe.get(re),k.init(Ot),I.push(k),re.traverseVisible(function(ne){ne.isLight&&ne.layers.test(Ot.layers)&&(k.pushLight(ne),ne.castShadow&&k.pushShadow(ne))}),nt!==re&&nt.traverseVisible(function(ne){ne.isLight&&ne.layers.test(Ot.layers)&&(k.pushLight(ne),ne.castShadow&&k.pushShadow(ne))}),k.setupLights(),X!==null&&X.updateLights(k.state.lightsArray),ft=this.localClippingEnabled,gt=Fe.init(this.clippingPlanes,ft),gt===!0&&Fe.setGlobalState(this.clippingPlanes,Ot),X!==null&&je.render(k.state.shadowsArray,re,Ot);let Kt=new Set;return nt.traverse(function(ne){if(!(ne.isMesh||ne.isPoints||ne.isLine||ne.isSprite))return;let Ke=ne.material;if(Ke)if(Array.isArray(Ke))for(let nn=0;nn<Ke.length;nn++){let $e=Ke[nn];fn($e,re,Ot,ne),Kt.add($e)}else fn(Ke,re,Ot,ne),Kt.add(Ke)}),k=I.pop(),X!==null&&X.renderEnd(),Kt},this.compileAsync=function(nt,Ot,re=null){let Kt=this.compile(nt,Ot,re);return new Promise(ne=>{function Ke(){if(Kt.forEach(function(nn){let bn=te.get(nn).currentProgram;(bn===void 0||bn.isReady())&&Kt.delete(nn)}),Kt.size===0){ne(nt);return}setTimeout(Ke,10)}mn.get("KHR_parallel_shader_compile")!==null?Ke():setTimeout(Ke,10)})};let qe=null;function xn(nt){qe&&qe(nt)}function vn(){Fn.stop()}function jn(){Fn.start()}let Fn=new fet;Fn.setAnimationLoop(xn),typeof self<"u"&&Fn.setContext(self),this.setAnimationLoop=function(nt){qe=nt,rt.setAnimationLoop(nt),nt===null?Fn.stop():Fn.start()},rt.addEventListener("sessionstart",vn),rt.addEventListener("sessionend",jn),this.render=function(nt,Ot){if(Ot!==void 0&&Ot.isCamera!==!0){Tn("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(q===!0)return;X!==null&&X.renderStart(nt,Ot);let re=rt.enabled===!0&&rt.isPresenting===!0,Kt=U!==null&&(pt===null||re)&&U.begin(V,pt);if(nt.matrixWorldAutoUpdate===!0&&nt.updateMatrixWorld(),Ot.parent===null&&Ot.matrixWorldAutoUpdate===!0&&Ot.updateMatrixWorld(),rt.enabled===!0&&rt.isPresenting===!0&&(U===null||U.isCompositing()===!1)&&(rt.cameraAutoUpdate===!0&&rt.updateCamera(Ot),Ot=rt.getCamera()),nt.isScene===!0&&nt.onBeforeRender(V,nt,Ot,pt),k=pe.get(nt,I.length),k.init(Ot),k.state.textureUnits=Nt.getTextureUnits(),I.push(k),de.multiplyMatrices(Ot.projectionMatrix,Ot.matrixWorldInverse),it.
vendor: 24,517 bytes, line 4638
4638setFromProjectionMatrix(de,ya,Ot.reversedDepth),ft=this.localClippingEnabled,gt=Fe.init(this.clippingPlanes,ft),R=ce.get(nt,O.length),R.init(),O.push(R),rt.enabled===!0&&rt.isPresenting===!0){let nn=V.xr.getDepthSensingMesh();nn!==null&&si(nn,Ot,-1/0,V.sortObjects)}si(nt,Ot,0,V.sortObjects),R.finish(),X!==null&&X.updateLights(k.state.lightsArray),V.sortObjects===!0&&R.sort(Qt,xe),Ue=rt.enabled===!1||rt.isPresenting===!1||rt.hasDepthSensing()===!1,Ue&&Re.addToRenderList(R,nt),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),gt===!0&&Fe.beginShadows();let ne=k.state.shadowsArray;if(je.render(ne,nt,Ot),gt===!0&&Fe.endShadows(),(Kt&&U.hasRenderPass())===!1){let nn=R.opaque,$e=R.transmissive;if(k.setupLights(),Ot.isArrayCamera){let bn=Ot.cameras;if($e.length>0)for(let We=0,Nn=bn.length;We<Nn;We++){let Hn=bn[We];Yi(nn,$e,nt,Hn)}Ue&&Re.render(nt);for(let We=0,Nn=bn.length;We<Nn;We++){let Hn=bn[We];Ti(R,nt,Hn,Hn.viewport)}}else $e.length>0&&Yi(nn,$e,nt,Ot),Ue&&Re.render(nt),Ti(R,nt,Ot)}pt!==null&&ct===0&&(Nt.updateMultisampleRenderTarget(pt),Nt.updateRenderTargetMipmap(pt)),Kt&&U.end(V),nt.isScene===!0&&nt.onAfterRender(V,nt,Ot),xt.resetDefaultState(),Et=-1,vt=null,I.pop(),I.length>0?(k=I[I.length-1],Nt.setTextureUnits(k.state.textureUnits),gt===!0&&Fe.setGlobalState(V.clippingPlanes,k.state.camera)):k=null,O.pop(),O.length>0?R=O[O.length-1]:R=null,X!==null&&X.renderEnd()};function si(nt,Ot,re,Kt){if(nt.visible===!1)return;if(nt.layers.test(Ot.layers)){if(nt.isGroup)re=nt.renderOrder;else if(nt.isLOD)nt.autoUpdate===!0&&nt.update(Ot);else if(nt.isLightProbeGrid)k.pushLightProbeGrid(nt);else if(nt.isLight)k.pushLight(nt),nt.castShadow&&k.pushShadow(nt);else if(nt.isSprite){if(!nt.frustumCulled||nt.intersectsFrustum(it)){Kt&&we.setFromMatrixPosition(nt.matrixWorld).applyMatrix4(de);let nn=_t.update(nt),$e=nt.material;$e.visible&&R.push(nt,nn,$e,re,we.z,null,Ot)}}else if((nt.isMesh||nt.isLine||nt.isPoints)&&(!nt.frustumCulled||nt.intersectsFrustum(it))){let nn=_t.update(nt),$e=nt.material;if(Kt&&(nt.boundingSphere!==void 0?(nt.boundingSphere===null&&nt.computeBoundingSphere(),we.copy(nt.boundingSphere.center)):(nn.boundingSphere===null&&nn.computeBoundingSphere(),we.copy(nn.boundingSphere.center)),we.applyMatrix4(nt.matrixWorld).applyMatrix4(de)),Array.isArray($e)){let bn=nn.groups;for(let We=0,Nn=bn.length;We<Nn;We++){let Hn=bn[We],pn=$e[Hn.materialIndex];pn&&pn.visible&&R.push(nt,nn,pn,re,we.z,Hn,Ot)}}else $e.visible&&R.push(nt,nn,$e,re,we.z,null,Ot)}}let Ke=nt.children;for(let nn=0,$e=Ke.length;nn<$e;nn++)si(Ke[nn],Ot,re,Kt)}function Ti(nt,Ot,re,Kt){let{opaque:ne,transmissive:Ke,transparent:nn}=nt;k.setupLightsView(re),gt===!0&&Fe.setGlobalState(V.clippingPlanes,re),Kt&&K.viewport(yt.copy(Kt)),ne.length>0&&_s(ne,Ot,re),Ke.length>0&&_s(Ke,Ot,re),nn.length>0&&_s(nn,Ot,re),K.buffers.depth.setTest(!0),K.buffers.depth.setMask(!0),K.buffers.color.setMask(!0),K.setPolygonOffset(!1)}function Yi(nt,Ot,re,Kt){if((re.isScene===!0?re.overrideMaterial:null)!==null)return;if(k.state.transmissionRenderTarget[Kt.id]===void 0){let pn=mn.has("EXT_color_buffer_half_float")||mn.has("EXT_color_buffer_float");k.state.transmissionRenderTarget[Kt.id]=new no(1,1,{generateMipmaps:!0,type:pn?Tl:ta,minFilter:Sa,samples:Math.max(4,mt.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:Rn.workingColorSpace})}let Ke=k.state.transmissionRenderTarget[Kt.id],nn=Kt.viewport||yt;Ke.setSize(nn.z*V.transmissionResolutionScale,nn.w*V.transmissionResolutionScale);let $e=V.getRenderTarget(),bn=V.getActiveCubeFace(),We=V.getActiveMipmapLevel();V.setRenderTarget(Ke),V.getClearColor(jt),ae=V.getClearAlpha(),ae<1&&V.setClearColor(16777215,.5),V.clear(),Ue&&Re.render(re);let Nn=V.toneMapping;V.toneMapping=Ml;let Hn=Kt.viewport;if(Kt.viewport!==void 0&&(Kt.viewport=void 0),k.setupLightsView(Kt),gt===!0&&Fe.setGlobalState(V.clippingPlanes,Kt),_s(nt,re,Kt),Nt.updateMultisampleRenderTarget(Ke),Nt.updateRenderTargetMipmap(Ke),mn.has("WEBGL_multisampled_render_to_texture")===!1){let pn=!1;for(let ri=0,Ni=Ot.length;ri<Ni;ri++){let Si=Ot[ri],{object:Un,geometry:Ss,material:Ye,group:ps}=Si;if(Ye.side===Ga&&Un.layers.test(Kt.layers)){let ti=Ye.side;Ye.side=Mo,Ye.needsUpdate=!0,Pt(Un,re,Kt,Ss,Ye,ps),Ye.side=ti,Ye.needsUpdate=!0,pn=!0}}pn===!0&&(Nt.updateMultisampleRenderTarget(Ke),Nt.updateRenderTargetMipmap(Ke))}V.setRenderTarget($e,bn,We),V.setClearColor(jt,ae),Hn!==void 0&&(Kt.viewport=Hn),V.toneMapping=Nn}function _s(nt,Ot,re){let Kt=Ot.isScene===!0?Ot.overrideMaterial:null;for(let ne=0,Ke=nt.length;ne<Ke;ne++){let nn=nt[ne],{object:$e,geometry:bn,group:We}=nn,Nn=nn.material;Nn.allowOverride===!0&&Kt!==null&&(Nn=Kt),$e.layers.test(re.layers)&&Pt($e,Ot,re,bn,Nn,We)}}function Pt(nt,Ot,re,Kt,ne,Ke){X!==null&&ne.isNodeMaterial&&X.setObject(nt,ne),nt.onBeforeRender(V,Ot,re,Kt,ne,Ke),nt.modelViewMatrix.multiplyMatrices(re.matrixWorldInverse,nt.matrixWorld),nt.normalMatrix.getNormalMatrix(nt.modelViewMatrix),ne.onBeforeRender(V,Ot,re,Kt,nt,Ke),ne.transparent===!0&&ne.side===Ga&&ne.forceSinglePass===!1?(ne.side=Mo,ne.needsUpdate=!0,V.renderBufferDirect(re,Ot,Kt,ne,nt,Ke),ne.side=$a,ne.needsUpdate=!0,V.renderBufferDirect(re,Ot,Kt,ne,nt,Ke),ne.side=Ga):V.renderBufferDirect(re,Ot,Kt,ne,nt,Ke),nt.onAfterRender(V,Ot,re,Kt,ne,Ke)}function ze(nt,Ot,re){Ot.isScene!==!0&&(Ot=Ae);let Kt=te.get(nt),ne=k.state.lights,Ke=k.state.shadowsArray,nn=ne.state.version,$e=Zt.getParameters(nt,ne.state,Ke,Ot,re,k.state.lightProbeGridArray),bn=Zt.getProgramCacheKey($e),We=Kt.programs;Kt.environment=nt.isMeshStandardMaterial||nt.isMeshLambertMaterial||nt.isMeshPhongMaterial?Ot.environment:null,Kt.fog=Ot.fog;let Nn=nt.isMeshStandardMaterial||nt.isMeshLambertMaterial&&!nt.envMap||nt.isMeshPhongMaterial&&!nt.envMap;Kt.envMap=Se.get(nt.envMap||Kt.environment,Nn),Kt.envMapRotation=Kt.environment!==null&&nt.envMap===null?Ot.environmentRotation:nt.envMapRotation,We===void 0&&(nt.addEventListener("dispose",se),We=new Map,Kt.programs=We);let Hn=We.get(bn);if(Hn!==void 0){if(Kt.currentProgram===Hn&&Kt.lightsStateVersion===nn)return En(nt,$e),Hn}else $e.uniforms=Zt.getUniforms(nt),X!==null&&nt.isNodeMaterial&&X.build(nt,re,$e),nt.onBeforeCompile($e,V),Hn=Zt.acquireProgram($e,bn),We.set(bn,Hn),Kt.uniforms=$e.uniforms;let pn=Kt.uniforms;return(!nt.isShaderMaterial&&!nt.isRawShaderMaterial||nt.clipping===!0)&&(pn.clippingPlanes=Fe.uniform),En(nt,$e),Kt.needsLights=Qi(nt),Kt.lightsStateVersion=nn,Kt.needsLights&&(pn.ambientLightColor.value=ne.state.ambient,pn.lightProbe.value=ne.state.probe,pn.sunLights.value=ne.state.sun,pn.sunLightShadows.value=ne.state.sunShadow,pn.directionalLights.value=ne.state.directional,pn.directionalLightShadows.value=ne.state.directionalShadow,pn.spotLights.value=ne.state.spot,pn.spotLightShadows.value=ne.state.spotShadow,pn.rectAreaLights.value=ne.state.rectArea,pn.ltc_1.value=ne.state.rectAreaLTC1,pn.ltc_2.value=ne.state.rectAreaLTC2,pn.pointLights.value=ne.state.point,pn.pointLightShadows.value=ne.state.pointShadow,pn.hemisphereLights.value=ne.state.hemi,pn.sunShadowMatrix.value=ne.state.sunShadowMatrix,pn.sunShadowCascade.value=ne.state.sunShadowCascade,pn.directionalShadowMatrix.value=ne.state.directionalShadowMatrix,pn.spotLightMatrix.value=ne.state.spotLightMatrix,pn.spotLightMap.value=ne.state.spotLightMap,pn.pointShadowMatrix.value=ne.state.pointShadowMatrix),Kt.lightProbeGrid=k.state.lightProbeGridArray.length>0,Kt.currentProgram=Hn,Kt.uniformsList=null,Hn}function Ie(nt){if(nt.uniformsList===null){let Ot=nt.currentProgram.getUniforms();nt.uniformsList=xv.seqWithValue(Ot.seq,nt.uniforms)}return nt.uniformsList}function En(nt,Ot){let re=te.get(nt);re.outputColorSpace=Ot.outputColorSpace,re.batching=Ot.batching,re.batchingColor=Ot.batchingColor,re.instancing=Ot.instancing,re.instancingColor=Ot.instancingColor,re.instancingMorph=Ot.instancingMorph,re.skinning=Ot.skinning,re.morphTargets=Ot.morphTargets,re.morphNormals=Ot.morphNormals,re.morphColors=Ot.morphColors,re.morphTargetsCount=Ot.morphTargetsCount,re.numClippingPlanes=Ot.numClippingPlanes,re.numIntersection=Ot.numClipIntersection,re.vertexAlphas=Ot.vertexAlphas,re.vertexTangents=Ot.vertexTangents,re.toneMapping=Ot.toneMapping}function Dn(nt,Ot){if(nt.length===0)return null;if(nt.length===1)return nt[0].texture!==null?nt[0]:null;C.setFromMatrixPosition(Ot.matrixWorld);for(let re=0,Kt=nt.length;re<Kt;re++){let ne=nt[re];if(ne.texture!==null&&ne.boundingBox.containsPoint(C))return ne}return null}function Xe(nt,Ot,re,Kt,ne){Ot.isScene!==!0&&(Ot=Ae),Nt.resetTextureUnits();let Ke=Ot.fog,nn=Kt.isMeshStandardMaterial||Kt.isMeshLambertMaterial||Kt.isMeshPhongMaterial?Ot.environment:null,$e=pt===null?V.outputColorSpace:pt.isXRRenderTarget===!0?pt.texture.colorSpace:Rn.workingColorSpace,bn=Kt.isMeshStandardMaterial||Kt.isMeshLambertMaterial&&!Kt.envMap||Kt.isMeshPhongMaterial&&!Kt.envMap,We=Se.get(Kt.envMap||nn,bn),Nn=Kt.vertexColors===!0&&!!re.attributes.color&&re.attributes.color.itemSize===4,Hn=!!re.attributes.tangent&&(!!Kt.normalMap||Kt.anisotropy>0),pn=!!re.morphAttributes.position,ri=!!re.morphAttributes.normal,Ni=!!re.morphAttributes.color,Si=Ml;Kt.toneMapped&&(pt===null||pt.isXRRenderTarget===!0)&&(Si=V.toneMapping);let Un=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,Ss=Un!==void 0?Un.length:0,Ye=te.get(Kt),ps=k.state.lights;if(gt===!0&&(ft===!0||nt!==vt)){let xi=nt===vt&&Kt.id===Et;Fe.setState(Kt,nt,xi)}let ti=!1;Kt.version===Ye.__version?(Ye.needsLights&&Ye.lightsStateVersion!==ps.state.version||Ye.outputColorSpace!==$e||ne.isBatchedMesh&&Ye.batching===!1||!ne.isBatchedMesh&&Ye.batching===!0||ne.isBatchedMesh&&Ye.batchingColor===!0&&ne._colorsTexture===null||ne.isBatchedMesh&&Ye.batchingColor===!1&&ne._colorsTexture!==null||ne.isInstancedMesh&&Ye.instancing===!1||!ne.isInstancedMesh&&Ye.instancing===!0||ne.isSkinnedMesh&&Ye.skinning===!1||!ne.isSkinnedMesh&&Ye.skinning===!0||ne.isInstancedMesh&&Ye.instancingColor===!0&&ne.instanceColor===null||ne.isInstancedMesh&&Ye.instancingColor===!1&&ne.instanceColor!==null||ne.isInstancedMesh&&Ye.instancingMorph===!0&&ne.morphTexture===null||ne.isInstancedMesh&&Ye.instancingMorph===!1&&ne.morphTexture!==null||Ye.envMap!==We||Kt.fog===!0&&Ye.fog!==Ke||Ye.numClippingPlanes!==void 0&&(Ye.numClippingPlanes!==Fe.numPlanes||Ye.numIntersection!==Fe.numIntersection)||Ye.vertexAlphas!==Nn||Ye.vertexTangents!==Hn||Ye.morphTargets!==pn||Ye.morphNormals!==ri||Ye.morphColors!==Ni||Ye.toneMapping!==Si||Ye.morphTargetsCount!==Ss||!!Ye.lightProbeGrid!=k.state.lightProbeGridArray.length>0)&&(ti=!0):(ti=!0,Ye.__version=Kt.version);let $n=Ye.currentProgram;ti===!0&&($n=ze(Kt,Ot,ne),X&&Kt.isNodeMaterial&&X.onUpdateProgram(Kt,$n,Ye));let $r=!1,so=!1,ea=!1,Xn=$n.getUniforms(),Bi=Ye.uniforms;if(K.useProgram($n.program)&&($r=!0,so=!0,ea=!0),Kt.id!==Et&&(Et=Kt.id,so=!0),Ye.needsLights){let xi=Dn(k.state.lightProbeGridArray,ne);Ye.lightProbeGrid!==xi&&(Ye.lightProbeGrid=xi,so=!0)}if($r||vt!==nt){K.buffers.depth.getReversed()&&nt.reversedDepth!==!0&&(nt._reversedDepth=!0,nt.updateProjectionMatrix()),Xn.setValue(It,"projectionMatrix",nt.projectionMatrix),Xn.setValue(It,"viewMatrix",nt.matrixWorldInverse);let yr=Xn.map.cameraPosition;yr!==void 0&&yr.setValue(It,ve.setFromMatrixPosition(nt.matrixWorld)),mt.logarithmicDepthBuffer&&Xn.setValue(It,"logDepthBufFC",2/(Math.log(nt.far+1)/Math.LN2)),(Kt.isMeshPhongMaterial||Kt.isMeshToonMaterial||Kt.isMeshLambertMaterial||Kt.isMeshBasicMaterial||Kt.isMeshStandardMaterial||Kt.isShaderMaterial)&&Xn.setValue(It,"isOrthographic",nt.isOrthographicCamera===!0),vt!==nt&&(vt=nt,so=!0,ea=!0)}if(Ye.needsLights&&(ps.state.sunShadowMap.length>0&&Xn.setValue(It,"sunShadowMap",ps.state.sunShadowMap,Nt),ps.state.directionalShadowMap.length>0&&Xn.setValue(It,"directionalShadowMap",ps.state.directionalShadowMap,Nt),ps.state.spotShadowMap.length>0&&Xn.setValue(It,"spotShadowMap",ps.state.spotShadowMap,Nt),ps.state.pointShadowMap.length>0&&Xn.setValue(It,"pointShadowMap",ps.state.pointShadowMap,Nt)),ne.isSkinnedMesh){Xn.setOptional(It,ne,"bindMatrix"),Xn.setOptional(It,ne,"bindMatrixInverse");let xi=ne.skeleton;xi&&(xi.boneTexture===null&&xi.computeBoneTexture(),Xn.setValue(It,"boneTexture",xi.boneTexture,Nt))}ne.isBatchedMesh&&(Xn.setOptional(It,ne,"batchingTexture"),Xn.setValue(It,"batchingTexture",ne._matricesTexture,Nt),Xn.setOptional(It,ne,"batchingIdTexture"),Xn.setValue(It,"batchingIdTexture",ne._indirectTexture,Nt),Xn.setOptional(It,ne,"batchingColorTexture"),ne._colorsTexture!==null&&Xn.setValue(It,"batchingColorTexture",ne._colorsTexture,Nt));let Cs=re.morphAttributes;if((Cs.position!==void 0||Cs.normal!==void 0||Cs.color!==void 0)&&Ft.update(ne,re,$n),(so||Ye.receiveShadow!==ne.receiveShadow)&&(Ye.receiveShadow=ne.receiveShadow,Xn.setValue(It,"receiveShadow",ne.receiveShadow)),(Kt.isMeshStandardMaterial||Kt.isMeshLambertMaterial||Kt.isMeshPhongMaterial)&&Kt.envMap===null&&Ot.environment!==null&&(Bi.envMapIntensity.value=Ot.environmentIntensity),Bi.dfgLUT!==void 0&&(Bi.dfgLUT.value=CIt()),so){if(Xn.setValue(It,"toneMappingExposure",V.toneMappingExposure),Ye.needsLights&&mi(Bi,ea),Ke&&Kt.fog===!0&&fe.refreshFogUniforms(Bi,Ke),fe.refreshMaterialUniforms(Bi,Kt,Gt,Bt,k.state.transmissionRenderTarget[nt.id]),Ye.needsLights&&Ye.lightProbeGrid){let xi=Ye.lightProbeGrid;Bi.probesSH.value=xi.texture,Bi.probesMin.value.copy(xi.boundingBox.min),Bi.probesMax.value.copy(xi.boundingBox.max),Bi.probesResolution.value.copy(xi.resolution)}xv.upload(It,Ie(Ye),Bi,Nt)}if(Kt.isShaderMaterial&&Kt.uniformsNeedUpdate===!0&&(xv.upload(It,Ie(Ye),Bi,Nt),Kt.uniformsNeedUpdate=!1),Kt.isSpriteMaterial&&Xn.setValue(It,"center",ne.center),Xn.setValue(It,"modelViewMatrix",ne.modelViewMatrix),Xn.setValue(It,"normalMatrix",ne.normalMatrix),Xn.setValue(It,"modelMatrix",ne.matrixWorld),Kt.uniformsGroups!==void 0){let xi=Kt.uniformsGroups;for(let yr=0,Ro=xi.length;yr<Ro;yr++){let xr=xi[yr];At.update(xr,$n),At.bind(xr,$n)}}return $n}function mi(nt,Ot){nt.ambientLightColor.needsUpdate=Ot,nt.lightProbe.needsUpdate=Ot,nt.sunLights.needsUpdate=Ot,nt.sunLightShadows.needsUpdate=Ot,nt.directionalLights.needsUpdate=Ot,nt.directionalLightShadows.needsUpdate=Ot,nt.pointLights.needsUpdate=Ot,nt.pointLightShadows.needsUpdate=Ot,nt.spotLights.needsUpdate=Ot,nt.spotLightShadows.needsUpdate=Ot,nt.rectAreaLights.needsUpdate=Ot,nt.hemisphereLights.needsUpdate=Ot}function Qi(nt){return nt.isMeshLambertMaterial||nt.isMeshToonMaterial||nt.isMeshPhongMaterial||nt.isMeshStandardMaterial||nt.isShadowMaterial||nt.isShaderMaterial&&nt.lights===!0}this.getActiveCubeFace=function(){return at},this.getActiveMipmapLevel=function(){return ct},this.getRenderTarget=function(){return pt},this.setRenderTargetTextures=function(nt,Ot,re){let Kt=te.get(nt);Kt.__autoAllocateDepthBuffer=nt.resolveDepthBuffer===!1,Kt.__autoAllocateDepthBuffer===!1&&(Kt.__useRenderToTexture=!1),te.get(nt.texture).__webglTexture=Ot,te.get(nt.depthTexture).__webglTexture=Kt.__autoAllocateDepthBuffer?void 0:re,Kt.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(nt,Ot){let re=te.get(nt);re.__webglFramebuffer=Ot,re.__useDefaultFramebuffer=Ot===void 0},this.setRenderTarget=function(nt,Ot=0,re=0){pt=nt,at=Ot,ct=re;let Kt=null,ne=!1,Ke=!1;if(nt){let $e=te.get(nt);if($e.__useDefaultFramebuffer!==void 0){K.bindFramebuffer(It.FRAMEBUFFER,$e.__webglFramebuffer),yt.copy(nt.viewport),kt.copy(nt.scissor),Wt=nt.scissorTest,K.viewport(yt),K.scissor(kt),K.setScissorTest(Wt),Et=-1;return}else if($e.__webglFramebuffer===void 0)Nt.setupRenderTarget(nt);else if($e.__hasExternalTextures)Nt.rebindTextures(nt,te.get(nt.texture).__webglTexture,te.get(nt.depthTexture).__webglTexture);else if(nt.depthBuffer){let Nn=nt.depthTexture;if($e.__boundDepthTexture!==Nn){if(Nn!==null&&te.has(Nn)&&(nt.width!==Nn.image.width||nt.height!==Nn.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Nt.setupDepthRenderbuffer(nt)}}let bn=nt.texture;(bn.isData3DTexture||bn.isDataArrayTexture||bn.isCompressedArrayTexture)&&(Ke=!0);let We=te.get(nt).__webglFramebuffer;nt.isWebGLCubeRenderTarget?(Array.isArray(We[Ot])?Kt=We[Ot][re]:Kt=We[Ot],ne=!0):nt.samples>0&&Nt.useMultisampledRTT(nt)===!1?Kt=te.get(nt).__webglMultisampledFramebuffer:Array.isArray(We)?Kt=We[re]:Kt=We,yt.copy(nt.viewport),kt.copy(nt.scissor),Wt=nt.scissorTest}else yt.copy(Ut).multiplyScalar(Gt).floor(),kt.copy(zt).multiplyScalar(Gt).floor(),Wt=St;if(re!==0&&(Kt=j),K.bindFramebuffer(It.FRAMEBUFFER,Kt)&&K.drawBuffers(nt,Kt),K.viewport(yt),K.scissor(kt),K.setScissorTest(Wt),ne){let $e=te.get(nt.texture);It.framebufferTexture2D(It.FRAMEBUFFER,It.COLOR_ATTACHMENT0,It.TEXTURE_CUBE_MAP_POSITIVE_X+Ot,$e.__webglTexture,re)}else if(Ke){let $e=Ot;for(let bn=0;bn<nt.textures.length;bn++){let We=te.get(nt.textures[bn]);It.framebufferTextureLayer(It.FRAMEBUFFER,It.COLOR_ATTACHMENT0+bn,We.__webglTexture,re,$e)}}else if(nt!==null&&re!==0){let $e=te.get(nt.texture);It.framebufferTexture2D(It.FRAMEBUFFER,It.COLOR_ATTACHMENT0,It.TEXTURE_2D,$e.__webglTexture,re)}Et=-1};function hi(nt){let Ot=te.get(nt);return(Ot.__readFormat!==nt.format||Ot.__readType!==nt.type)&&(Ot.__readFormat=nt.format,Ot.__readType=nt.type,Ot.__formatReadable=mt.textureFormatReadable(nt.format),Ot.__typeReadable=mt.textureTypeReadable(nt.type)),Ot}this.readRenderTargetPixels=function(nt,Ot,re,Kt,ne,Ke,nn,$e=0){if(!(nt&&nt.isWebGLRenderTarget)){Tn("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let bn=te.get(nt).__webglFramebuffer;if(nt.isWebGLCubeRenderTarget&&nn!==void 0&&(bn=bn[nn]),bn){K.bindFramebuffer(It.FRAMEBUFFER,bn);try{let We=nt.textures[$e],Nn=We.format,Hn=We.type;nt.textures.length>1&&It.readBuffer(It.COLOR_ATTACHMENT0+$e);let pn=hi(We);if(pn.__formatReadable===!1){Tn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(pn.__typeReadable===!1){Tn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Ot>=0&&Ot<=nt.width-Kt&&re>=0&&re<=nt.height-ne&&It.readPixels(Ot,re,Kt,ne,lt.convert(Nn),lt.convert(Hn),Ke)}finally{let We=pt!==null?te.get(pt).__webglFramebuffer:null;K.bindFramebuffer(It.FRAMEBUFFER,We)}}},this.readRenderTargetPixelsAsync=async function(nt,Ot,re,Kt,ne,Ke,nn,$e=0){if(!(nt&&nt.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let bn=te.get(nt).__webglFramebuffer;if(nt.isWebGLCubeRenderTarget&&nn!==void 0&&(bn=bn[nn]),bn)if(Ot>=0&&Ot<=nt.width-Kt&&re>=0&&re<=nt.height-ne){K.bindFramebuffer(It.FRAMEBUFFER,bn);let We=nt.textures[$e],Nn=We.format,Hn=We.type;nt.textures.length>1&&It.readBuffer(It.COLOR_ATTACHMENT0+$e);let pn=hi(We);if(pn.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(pn.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let ri=It.createBuffer();It.bindBuffer(It.PIXEL_PACK_BUFFER,ri),It.bufferData(It.PIXEL_PACK_BUFFER,Ke.byteLength,It.STREAM_READ),It.readPixels(Ot,re,Kt,ne,lt.convert(Nn),lt.convert(Hn),0),It.bindBuffer(It.PIXEL_PACK_BUFFER,null);let Ni=pt!==null?te.get(pt).__webglFramebuffer:null;K.bindFramebuffer(It.FRAMEBUFFER,Ni);let Si=It.fenceSync(It.SYNC_GPU_COMMANDS_COMPLETE,0);return It.flush(),await Ltt(It,Si,4),It.bindBuffer(It.PIXEL_PACK_BUFFER,ri),It.getBufferSubData(It.PIXEL_PACK_BUFFER,0,Ke),It.bindBuffer(It.PIXEL_PACK_BUFFER,null),It.deleteBuffer(ri),It.deleteSync(Si),Ke}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(nt,Ot=null,re=0){let Kt=Math.pow(2,-re),ne=Math.floor(nt.image.width*Kt),Ke=Math.floor(nt.image.height*Kt),nn=Ot!==null?Ot.x:0,$e=Ot!==null?Ot.y:0;Nt.setTexture2D(nt,0),It.copyTexSubImage2D(It.TEXTURE_2D,re,0,0,nn,$e,ne,Ke),K.unbindTexture()},this.copyTextureToTexture=function(nt,Ot,re=null,Kt=null,ne=0,Ke=0){let nn,$e,bn,We,Nn,Hn,pn,ri,Ni,Si=nt.isCompressedTexture?nt.mipmaps[Ke]:nt.image;if(re!==null)nn=re.max.x-re.min.x,$e=re.max.y-re.min.y,bn=re.isBox3?re.max.z-re.min.z:1,We=re.min.x,Nn=re.min.y,Hn=re.isBox3?re.min.z:0;else{let Bi=Math.pow(2,-ne);nn=Math.floor(Si.width*Bi),$e=Math.floor(Si.height*Bi),nt.isDataArrayTexture?bn=Si.depth:nt.isData3DTexture?bn=Math.floor(Si.depth*Bi):bn=1,We=0,Nn=0,Hn=0}Kt!==null?(pn=Kt.x,ri=Kt.y,Ni=Kt.z):(pn=0,ri=0,Ni=0);let Un=lt.convert(Ot.format),Ss=lt.convert(Ot.type),Ye;Ot.isData3DTexture?(Nt.setTexture3D(Ot,0),Ye=It.TEXTURE_3D):Ot.isDataArrayTexture||Ot.isCompressedArrayTexture?(Nt.setTexture2DArray(Ot,0),Ye=It.TEXTURE_2D_ARRAY):(Nt.setTexture2D(Ot,0),Ye=It.TEXTURE_2D),K.activeTexture(It.TEXTURE0),K.pixelStorei(It.UNPACK_FLIP_Y_WEBGL,Ot.flipY),K.pixelStorei(It.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ot.premultiplyAlpha),K.pixelStorei(It.UNPACK_ALIGNMENT,Ot.unpackAlignment);let ps=K.getParameter(It.UNPACK_ROW_LENGTH),ti=K.getParameter(It.UNPACK_IMAGE_HEIGHT),$n=K.getParameter(It.UNPACK_SKIP_PIXELS),$r=K.getParameter(It.UNPACK_SKIP_ROWS),so=K.getParameter(It.UNPACK_SKIP_IMAGES);K.pixelStorei(It.UNPACK_ROW_LENGTH,Si.width),K.pixelStorei(It.UNPACK_IMAGE_HEIGHT,Si.height),K.pixelStorei(It.UNPACK_SKIP_PIXELS,We),K.pixelStorei(It.UNPACK_SKIP_ROWS,Nn),K.pixelStorei(It.UNPACK_SKIP_IMAGES,Hn);let ea=nt.isDataArrayTexture||nt.isData3DTexture,Xn=Ot.isDataArrayTexture||Ot.isData3DTexture;if(nt.isDepthTexture){let Bi=te.get(nt),Cs=te.get(Ot),xi=te.get(Bi.__renderTarget),yr=te.get(Cs.__renderTarget);K.bindFramebuffer(It.READ_FRAMEBUFFER,xi.__webglFramebuffer),K.bindFramebuffer(It.DRAW_FRAMEBUFFER,yr.__webglFramebuffer);for(let Ro=0;Ro<bn;Ro++)ea&&(It.framebufferTextureLayer(It.READ_FRAMEBUFFER,It.COLOR_ATTACHMENT0,te.get(nt).__webglTexture,ne,Hn+Ro),It.framebufferTextureLayer(It.DRAW_FRAMEBUFFER,It.COLOR_ATTACHMENT0,te.get(Ot).__webglTexture,Ke,Ni+Ro)),It.blitFramebuffer(We,Nn,nn,$e,pn,ri,nn,$e,It.DEPTH_BUFFER_BIT,It.NEAREST);K.bindFramebuffer(It.READ_FRAMEBUFFER,null),K.bindFramebuffer(It.DRAW_FRAMEBUFFER,null)}else if(ne!==0||nt.isRenderTargetTexture||te.has(nt)){let Bi=te.get(nt),Cs=te.get(Ot);K.bindFramebuffer(It.READ_FRAMEBUFFER,W),K.bindFramebuffer(It.DRAW_FRAMEBUFFER,_);for(let xi=0;xi<bn;xi++)ea?It.framebufferTextureLayer(It.READ_FRAMEBUFFER,It.COLOR_ATTACHMENT0,Bi.__webglTexture,ne,Hn+xi):It.framebufferTexture2D(It.READ_FRAMEBUFFER,It.COLOR_ATTACHMENT0,It.TEXTURE_2D,Bi.__webglTexture,ne),Xn?It.framebufferTextureLayer(It.DRAW_FRAMEBUFFER,It.COLOR_ATTACHMENT0,Cs.__webglTexture,Ke,Ni+xi):It.framebufferTexture2D(It.DRAW_FRAMEBUFFER,It.COLOR_ATTACHMENT0,It.TEXTURE_2D,Cs.__webglTexture,Ke),ne!==0?It.blitFramebuffer(We,Nn,nn,$e,pn,ri,nn,$e,It.COLOR_BUFFER_BIT,It.NEAREST):Xn?It.copyTexSubImage3D(Ye,Ke,pn,ri,Ni+xi,We,Nn,nn,$e):It.copyTexSubImage2D(Ye,Ke,pn,ri,We,Nn,nn,$e);K.bindFramebuffer(It.READ_FRAMEBUFFER,null),K.bindFramebuffer(It.DRAW_FRAMEBUFFER,null)}else Xn?nt.isDataTexture||nt.isData3DTexture?It.texSubImage3D(Ye,Ke,pn,ri,Ni,nn,$e,bn,Un,Ss,Si.data):Ot.isCompressedArrayTexture?It.compressedTexSubImage3D(Ye,Ke,pn,ri,Ni,nn,$e,bn,Un,Si.data):It.texSubImage3D(Ye,Ke,pn,ri,Ni,nn,$e,bn,Un,Ss,Si):nt.isDataTexture?It.texSubImage2D(It.TEXTURE_2D,Ke,pn,ri,nn,$e,Un,Ss,Si.data):nt.isCompressedTexture?It.compressedTexSubImage2D(It.TEXTURE_2D,Ke,pn,ri,Si.width,Si.height,Un,Si.data):It.texSubImage2D(It.TEXTURE_2D,Ke,pn,ri,nn,$e,Un,Ss,Si);K.pixelStorei(It.UNPACK_ROW_LENGTH,ps),K.pixelStorei(It.UNPACK_IMAGE_HEIGHT,ti),K.pixelStorei(It.UNPACK_SKIP_PIXELS,$n),K.pixelStorei(It.UNPACK_SKIP_ROWS,$r),K.pixelStorei(It.UNPACK_SKIP_IMAGES,so),Ke===0&&Ot.generateMipmaps&&It.generateMipmap(Ye),K.unbindTexture()},this.initRenderTarget=function(nt){te.get(nt).__webglFramebuffer===void 0&&Nt.setupRenderTarget(nt)},this.initTexture=function(nt){nt.isCubeTexture?Nt.setTextureCube(nt,0):nt.isData3DTexture?Nt.setTexture3D(nt,0):nt.isDataArrayTexture||nt.isCompressedArrayTexture?Nt.setTexture2DArray(nt,0):Nt.setTexture2D(nt,0),K.unbindTexture()},this.resetState=function(){at=0,ct=0,pt=null,K.reset(),xt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ya}get outputColorSpace(){return this._outputColorSpace}
vendor: 5,844 bytes, line 4638
4638set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=Rn._getDrawingBufferColorSpace(t),e.unpackColorSpace=Rn._getUnpackColorSpace()}}});function lz(i,t){if(t===jk)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(t===Bg||t===bv){let e=i.getIndex();if(e===null){let r=[],o=i.getAttribute("position");if(o!==void 0){for(let a=0;a<o.count;a++)r.push(a);i.setIndex(r),e=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}let n=e.count-2,s=[];if(t===Bg)for(let r=1;r<=n;r++)s.push(e.getX(0)),s.push(e.getX(r)),s.push(e.getX(r+1));else for(let r=0;r<n;r++)r%2===0?(s.push(e.getX(r)),s.push(e.getX(r+1)),s.push(e.getX(r+2))):(s.push(e.getX(r+2)),s.push(e.getX(r+1)),s.push(e.getX(r)));return s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),i.setIndex(s),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),i}var _et=_n(()=>{wh()});function Cet(i){let t=new Map,e=new Map,n=i.clone();return Met(i,n,function(s,r){t.set(r,s),e.set(s,r)}),n.traverse(function(s){if(!s.isSkinnedMesh)return;let r=s,o=t.get(s),a=o.skeleton.bones;r.skeleton=o.skeleton.clone(),r.bindMatrix.copy(o.bindMatrix),r.skeleton.bones=a.map(function(l){return e.get(l)}),r.bind(r.skeleton,r.bindMatrix)}),n}function Met(i,t,e){e(i,t);for(let n=0;n<i.children.length;n++)Met(i.children[n],t.children[n],e)}var Tet=_n(()=>{});var Det={};Le(Det,{GLTFLoader:()=>dz});function MIt(){let i={};return{get:function(t){return i[t]},add:function(t,e){i[t]=e},remove:function(t){delete i[t]},removeAll:function(){i={}}}}function ar(i,t,e){let n=i.json.materials[t];return n.extensions&&n.extensions[e]?n.extensions[e]:null}function EIt(i){return i.DefaultMaterial===void 0&&(i.DefaultMaterial=new ph({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:$a})),i.DefaultMaterial}function zg(i,t,e){for(let n in e.extensions)i[n]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=e.extensions[n])}function gu(i,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(i.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function kIt(i,t,e){let n=!1,s=!1,r=!1;for(let c=0,u=t.length;c<u;c++){let h=t[c];if(h.POSITION!==void 0&&(n=!0),h.NORMAL!==void 0&&(s=!0),h.COLOR_0!==void 0&&(r=!0),n&&s&&r)break}if(!n&&!s&&!r)return Promise.resolve(i);let o=[],a=[],l=[];for(let c=0,u=t.length;c<u;c++){let h=t[c];if(n){let d=h.POSITION!==void 0?e.getDependency("accessor",h.POSITION):i.attributes.position;o.push(d)}if(s){let d=h.NORMAL!==void 0?e.getDependency("accessor",h.NORMAL):i.attributes.normal;a.push(d)}if(r){let d=h.COLOR_0!==void 0?e.getDependency("accessor",h.COLOR_0):i.attributes.color;l.push(d)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then(function(c){let u=c[0],h=c[1],d=c[2];return n&&(i.morphAttributes.position=u),s&&(i.morphAttributes.normal=h),r&&(i.morphAttributes.color=d),i.morphTargetsRelative=!0,i})}function PIt(i,t){if(i.updateMorphTargets(),t.weights!==void 0)for(let e=0,n=t.weights.length;e<n;e++)i.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){let e=t.extras.targetNames;if(i.morphTargetInfluences.length===e.length){i.morphTargetDictionary={};for(let n=0,s=e.length;n<s;n++)i.morphTargetDictionary[e[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function RIt(i){let t,e=i.extensions&&i.extensions[gi.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+hz(e.attributes):t=i.indices+":"+hz(i.attributes)+":"+i.mode,i.targets!==void 0)for(let n=0,s=i.targets.length;n<s;n++)t+=":"+hz(i.targets[n]);return t}function hz(i){let t="",e=Object.keys(i).sort();for(let n=0,s=e.length;n<s;n++)t+=e[n]+":"+i[e[n]]+";";return t}function Nz(i){switch(i){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function DIt(i){return i.search(/\.jpe?g($|\?)/i)>0||i.search(/^data\:image\/jpeg/)===0?"image/jpeg":i.search(/\.webp($|\?)/i)>0||i.search(/^data\:image\/webp/)===0?"image/webp":i.search(/\.ktx2($|\?)/i)>0||i.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}function IIt(i,t,e){let n=t.attributes,s=new rr;if(n.POSITION!==void 0){let a=e.json.accessors[n.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(s.set(new bt(l[0],l[1],l[2]),new bt(c[0],c[1],c[2])),a.normalized){let u=Nz(_v[a.componentType]);s.min.multiplyScalar(u),s.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let r=t.targets;if(r!==void 0){let a=new bt,l=new bt;for(let c=0,u=r.length;c<u;c++){let h=r[c];if(h.POSITION!==void 0){let d=e.json.accessors[h.POSITION],p=d.min,g=d.max;if(p!==void 0&&g!==void 0){if(l.setX(Math.max(Math.abs(p[0]),Math.abs(g[0]))),l.setY(Math.max(Math.abs(p[1]),Math.abs(g[1]))),l.setZ(Math.max(Math.abs(p[2]),Math.abs(g[2]))),d.normalized){let y=Nz(_v[d.componentType]);l.multiplyScalar(y)}a.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(a)}i.boundingBox=s;let o=new Gs;s.getCenter(o.center),o.radius=s.min.distanceTo(s.max)/2,i.boundingSphere=o}function Pet(i,t,e){let n=t.attributes,s=[];function r(o,a){return e.getDependency("accessor",o).then(function(l){i.setAttribute(a,l)})}for(let o in n){let a=Oz[o]||o.toLowerCase();
vendor: 8,396 bytes, line 4638
4638a in i.attributes||s.push(r(n[o],a))}if(t.indices!==void 0&&!i.index){let o=e.getDependency("accessor",t.indices).then(function(a){i.setIndex(a)});s.push(o)}return Rn.workingColorSpace!==wo&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Rn.workingColorSpace}" not supported.`),gu(i,t),IIt(i,t,e),Promise.all(s).then(function(){return t.targets!==void 0?kIt(i,t.targets,e):i})}var dz,gi,fz,pz,gz,mz,bz,vz,yz,xz,wz,_z,Sz,Cz,Mz,Tz,Az,Ez,Kk,kz,Ret,K_,Aet,Pz,Rz,Dz,Lz,Jk,TIt,Iz,Al,_v,Eet,ket,cz,Oz,uf,AIt,uz,LIt,Bz,Let=_n(()=>{wh();_et();Tet();dz=class extends rs{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new mz(e)}),this.register(function(e){return new bz(e)}),this.register(function(e){return new Tz(e)}),this.register(function(e){return new Az(e)}),this.register(function(e){return new Ez(e)}),this.register(function(e){return new yz(e)}),this.register(function(e){return new xz(e)}),this.register(function(e){return new wz(e)}),this.register(function(e){return new _z(e)}),this.register(function(e){return new gz(e)}),this.register(function(e){return new Sz(e)}),this.register(function(e){return new vz(e)}),this.register(function(e){return new Mz(e)}),this.register(function(e){return new Cz(e)}),this.register(function(e){return new fz(e)}),this.register(function(e){return new Kk(e,gi.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new Kk(e,gi.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new kz(e)})}load(t,e,n,s){let r=this,o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){let c=Co.extractUrlBase(t);o=Co.resolveURL(c,this.path)}else o=Co.extractUrlBase(t);this.manager.itemStart(t);let a=function(c){s?s(c):console.error(c),r.manager.itemError(t),r.manager.itemEnd(t)},l=new or(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,function(c){try{r.parse(c,o,function(u){e(u),r.manager.itemEnd(t)},a)}catch(u){a(u)}},n,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n,s){let r,o={},a={},l=new TextDecoder;if(typeof t=="string")r=JSON.parse(t);else if(t instanceof ArrayBuffer)if(l.decode(new Uint8Array(t,0,4))===Ret){try{o[gi.KHR_BINARY_GLTF]=new Pz(t)}catch(h){s&&s(h);return}r=JSON.parse(o[gi.KHR_BINARY_GLTF].content)}else r=JSON.parse(l.decode(t));else r=t;if(r.asset===void 0||r.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let c=new Bz(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){let h=this.pluginCallbacks[u](c);h.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[h.name]=h,o[h.name]=!0}if(r.extensionsUsed)for(let u=0;u<r.extensionsUsed.length;++u){let h=r.extensionsUsed[u],d=r.extensionsRequired||[];switch(h){case gi.KHR_MATERIALS_UNLIT:o[h]=new pz;break;case gi.KHR_DRACO_MESH_COMPRESSION:o[h]=new Rz(r,this.dracoLoader);break;case gi.KHR_TEXTURE_TRANSFORM:o[h]=new Dz;break;case gi.KHR_MESH_QUANTIZATION:o[h]=new Lz;break;default:d.indexOf(h)>=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(n,s)}parseAsync(t,e){let n=this;return new Promise(function(s,r){n.parse(t,e,s,r)})}};gi={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},fz=class{constructor(t){this.parser=t,this.name=gi.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let t=this.parser,e=this.parser.json.nodes||[];for(let n=0,s=e.length;n<s;n++){let r=e[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(t){let e=this.parser,n="light:"+t,s=e.cache.get(n);if(s)return s;let r=e.json,l=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t],c,u=new Be(16777215);l.color!==void 0&&u.setRGB(l.color[0],l.color[1],l.color[2],wo);let h=l.range!==void 0?l.range:0;switch(l.type){case"directional":c=new mh(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new uu(u),c.distance=h;break;case"spot":c=new gh(u),c.distance=h,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),gu(c,l),l.intensity!==void 0&&(c.intensity=l.intensity),c.name=e.createUniqueName(l.name||"light_"+t),s=Promise.resolve(c),e.cache.add(n,s),s}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){let e=this,n=this.parser,r=n.json.nodes[t],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(l){return n._getNodeRef(e.cache,a,l)})}},pz=class{constructor(){this.name=gi.KHR_MATERIALS_UNLIT}getMaterialType(){return io}extendParams(t,e,n){let s=[];t.color=new Be(1,1,1),t.opacity=1;let r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let o=r.baseColorFactor;t.color.setRGB(o[0],o[1],o[2],wo),t.opacity=o[3]}r.baseColorTexture!==void 0&&s.push(n.assignTexture(t,"map",r.baseColorTexture,Zn))}return Promise.all(s)}},gz=class{constructor(t){this.parser=t,this.name=gi.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){let n=ar(this.parser,t,this.name);return n===null||n.emissiveStrength!==void 0&&(e.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},mz=class{constructor(t){this.parser=t,this.name=gi.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){return ar(this.parser,t,this.name)!==null?So:null}extendMaterialParams(t,e){let n=ar(this.parser,t,this.name);if(n===null)return Promise.resolve();let s=[];if(n.clearcoatFactor!==void 0&&(e.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&s.push(this.parser.assignTexture(e,"clearcoatMap",n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&s.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(s.push(this.parser.assignTexture(e,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let r=n.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Ce(r,r)}return Promise.all(s)}},bz=class{constructor(t){this.parser=t,this.name=gi.KHR_MATERIALS_DISPERSION}getMaterialType(t){return ar(this.parser,t,this.name)!==null?So:null}extendMaterialParams(t,e){let n=ar(this.parser,t,this.name);
4638return n===null||(e.dispersion=n.dispersion!==void 0?n.dispersion:0),Promise.resolve()}},vz=class{constructor(t){this.parser=t,this.name=gi.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){return ar(this.parser,t,this.name)!==null?So:null}extendMaterialParams(t,e){let n=ar(this.parser,t,this.name);if(n===null)return Promise.resolve();let s=[];return n.iridescenceFactor!==void 0&&(e.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&s.push(this.parser.assignTexture(e,"iridescenceMap",n.iridescenceTexture)),n.iridescenceIor!==void 0&&(e.iridescenceIOR=n.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&s.push(this.parser.assignTexture(e,"iridescenceThicknessMap",n.iridescenceThicknessTexture)),Promise.all(s)}},yz=class{constructor(t){this.parser=t,this.name=gi.KHR_MATERIALS_SHEEN}getMaterialType(t){return ar(this.parser,t,this.name)!==null?So:null}extendMaterialParams(t,e){let n=ar(this.parser,t,this.name);if(n===null)return Promise.resolve();let s=[];if(e.sheenColor=new Be(0,0,0),e.sheenRoughness=0,e.sheen=1,n.sheenColorFactor!==void 0){let r=n.sheenColorFactor;e.sheenColor.setRGB(r[0],r[1],r[2],wo)}return n.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&s.push(this.parser.assignTexture(e,"sheenColorMap",n.sheenColorTexture,Zn)),n.sheenRoughnessTexture!==void 0&&s.push(this.parser.assignTexture(e,"sheenRoughnessMap",n.sheenRoughnessTexture)),Promise.all(s)}},xz=class{constructor(t){this.parser=t,this.name=gi.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){return ar(this.parser,t,this.name)!==null?So:null}extendMaterialParams(t,e){let n=ar(this.parser,t,this.name);if(n===null)return Promise.resolve();let s=[];return n.transmissionFactor!==void 0&&(e.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&s.push(this.parser.assignTexture(e,"transmissionMap",n.transmissionTexture)),Promise.all(s)}},wz=class{constructor(t){this.parser=t,this.name=gi.KHR_MATERIALS_VOLUME}getMaterialType(t){return ar(this.parser,t,this.name)!==null?So:null}extendMaterialParams(t,e){let n=ar(this.parser,t,this.name);if(n===null)return Promise.resolve();let s=[];e.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0&&s.push(this.parser.assignTexture(e,"thicknessMap",n.thicknessTexture)),e.attenuationDistance=n.attenuationDistance||1/0;let r=n.attenuationColor||[1,1,1];return e.attenuationColor=new Be().setRGB(r[0],r[1],r[2],wo),Promise.all(s)}},_z=class{constructor(t){this.parser=t,this.name=gi.KHR_MATERIALS_IOR}getMaterialType(t){return ar(this.parser,t,this.name)!==null?So:null}extendMaterialParams(t,e){let n=ar(this.parser,t,this.name);return n===null||(e.ior=n.ior!==void 0?n.ior:1.5,e.ior===0&&(e.ior=1e3)),Promise.resolve()}},Sz=class{constructor(t){this.parser=t,this.name=gi.KHR_MATERIALS_SPECULAR}getMaterialType(t){return ar(this.parser,t,this.name)!==null?So:null}extendMaterialParams(t,e){let n=ar(this.parser,t,this.name);if(n===null)return Promise.resolve();let s=[];e.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0&&s.push(this.parser.assignTexture(e,"specularIntensityMap",n.specularTexture));let r=n.specularColorFactor||[1,1,1];return e.specularColor=new Be().setRGB(r[0],r[1],r[2],wo),n.specularColorTexture!==void 0&&s.push(this.parser.assignTexture(e,"specularColorMap",n.specularColorTexture,Zn)),Promise.all(s)}},Cz=class{constructor(t){this.parser=t,this.name=gi.EXT_MATERIALS_BUMP}getMaterialType(t){return ar(this.parser,t,this.name)!==null?So:null}extendMaterialParams(t,e){let n=ar(this.parser,t,this.name);if(n===null)return Promise.resolve();let s=[];return e.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0&&s.push(this.parser.assignTexture(e,"bumpMap",n.bumpTexture)),Promise.all(s)}},Mz=class{constructor(t){this.parser=t,this.name=gi.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){return ar(this.parser,t,this.name)!==null?So:null}extendMaterialParams(t,e){let n=ar(this.parser,t,this.name);if(n===null)return Promise.resolve();let s=[];return n.anisotropyStrength!==void 0&&(e.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(e.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&s.push(this.parser.assignTexture(e,"anisotropyMap",n.anisotropyTexture)),Promise.all(s)}},Tz=class{constructor(t){this.parser=t,this.name=gi.KHR_TEXTURE_BASISU}loadTexture(t){let e=this.parser,n=e.json,s=n.textures[t];if(!s.extensions||!s.extensions[this.name])return null;let r=s.extensions[this.name],o=e.options.ktx2Loader;if(!o){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,o)}},Az=class{constructor(t){this.parser=t,this.name=gi.EXT_TEXTURE_WEBP}loadTexture(t){let e=this.name,n=this.parser,s=n.json,r=s.textures[t];if(!r.extensions||!r.extensions[e])return null;let o=r.extensions[e],a=s.images[o.source],l=n.textureLoader;if(a.uri){let c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return n.loadTextureImage(t,o.source,l)}
4638},Ez=class{constructor(t){this.parser=t,this.name=gi.EXT_TEXTURE_AVIF}loadTexture(t){let e=this.name,n=this.parser,s=n.json,r=s.textures[t];if(!r.extensions||!r.extensions[e])return null;let o=r.extensions[e],a=s.images[o.source],l=n.textureLoader;if(a.uri){let c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return n.loadTextureImage(t,o.source,l)}},Kk=class{constructor(t,e){this.name=e,this.parser=t}loadBufferView(t){let e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){let s=n.extensions[this.name],r=this.parser.getDependency("buffer",s.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){let l=s.byteOffset||0,c=s.byteLength||0,u=s.count,h=s.byteStride,d=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,h,d,s.mode,s.filter).then(function(p){return p.buffer}):o.ready.then(function(){let p=new ArrayBuffer(u*h);return o.decodeGltfBuffer(new Uint8Array(p),u,h,d,s.mode,s.filter),p})})}else return null}},kz=class{constructor(t){this.name=gi.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){let e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let s=e.meshes[n.mesh];for(let c of s.primitives)if(c.mode!==Al.TRIANGLES&&c.mode!==Al.TRIANGLE_STRIP&&c.mode!==Al.TRIANGLE_FAN&&c.mode!==void 0)return null;let o=n.extensions[this.name].attributes,a=[],l={};for(let c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{let u=c.pop(),h=u.isGroup?u.children:[u],d=c[0].count,p=[];for(let g of h){let y=new tn,x=new bt,w=new Gi,M=new bt(1,1,1),A=new _g(g.geometry,g.material,d);for(let R=0;R<d;R++)l.TRANSLATION&&x.fromBufferAttribute(l.TRANSLATION,R),l.ROTATION&&w.fromBufferAttribute(l.ROTATION,R),l.SCALE&&M.fromBufferAttribute(l.SCALE,R),A.setMatrixAt(R,y.compose(x,w,M));let C=null;for(let R in l)if(R==="_COLOR_0"){let k=l[R];A.instanceColor=new ja(k.array,k.itemSize,k.normalized)}else if(R!=="TRANSLATION"&&R!=="ROTATION"&&R!=="SCALE"){if(C===null){let O=A.geometry;C=new kn,C.name=O.name;for(let I in O.attributes)C.setAttribute(I,O.attributes[I]);for(let I in O.morphAttributes)C.morphAttributes[I]=O.morphAttributes[I];O.index!==null&&C.setIndex(O.index),C.morphTargetsRelative=O.morphTargetsRelative;for(let I of O.groups)C.addGroup(I.start,I.count,I.materialIndex);O.boundingBox!==null&&(C.boundingBox=O.boundingBox.clone()),O.boundingSphere!==null&&(C.boundingSphere=O.boundingSphere.clone()),C.drawRange.start=O.drawRange.start,C.drawRange.count=O.drawRange.count,C.userData=Object.assign({},O.userData),A.geometry=C}let k=l[R];C.setAttribute(R,new ja(k.array,k.itemSize,k.normalized))}ai.prototype.copy.call(A,g),this.parser.assignFinalMaterial(A),p.push(A)}return u.isGroup?(u.clear(),u.add(...p),u):p[0]}))}},Ret="glTF",K_=12,Aet={JSON:1313821514,BIN:5130562},Pz=class{constructor(t){this.name=gi.KHR_BINARY_GLTF,this.content=null,this.body=null;let e=new DataView(t,0,K_),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Ret)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let s=this.header.length-K_,r=new DataView(t,K_),o=0;for(;o<s;){let a=r.getUint32(o,!0);o+=4;let l=r.getUint32(o,!0);if(o+=4,l===Aet.JSON){let c=new Uint8Array(t,K_+o,a);this.content=n.decode(c)}else if(l===Aet.BIN){let c=K_+o;this.body=t.slice(c,c+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}},Rz=class{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=gi.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){let n=this.json,s=this.dracoLoader,r=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,a={},l={},c={};for(let u in o){let h=Oz[u]||u.toLowerCase();a[h]=o[u]}for(let u in t.attributes){let h=Oz[u]||u.toLowerCase();if(o[u]!==void 0){let d=n.accessors[t.attributes[u]],p=_v[d.componentType];c[h]=p.name,l[h]=d.normalized===!0}}return e.getDependency("bufferView",r).then(function(u){return new Promise(function(h,d){s.decodeDracoFile(u,function(p){for(let g in p.attributes){let y=p.attributes[g],x=l[g];x!==void 0&&(y.normalized=x)}h(p)},a,c,wo,d)})})}},Dz=class{constructor(){this.name=gi.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){if((e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0)return t;if(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),e.rotation!==void 0){let n=Math.cos(t.rotation),s=Math.sin(t.rotation);t.matrix.set(t.repeat.x*n,t.repeat.y*s,t.offset.x,-t.repeat.x*s,t.repeat.y*n,t.offset.y,0,0,1),t.matrixAutoUpdate=!1}return t.needsUpdate=!0,t}}
vendor: 9,880 bytes, line 4638
4638,Lz=class{constructor(){this.name=gi.KHR_MESH_QUANTIZATION}},Jk=class extends mc{constructor(t,e,n,s){super(t,e,n,s)}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=t*s*3+s;for(let o=0;o!==s;o++)e[o]=n[r+o];return e}interpolate_(t,e,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,c=a*3,u=s-e,h=(n-e)/u,d=h*h,p=d*h,g=t*c,y=g-c,x=-2*p+3*d,w=p-d,M=1-x,A=w-d+h;for(let C=0;C!==a;C++){let R=o[y+C+a],k=o[y+C+l]*u,O=o[g+C+a],I=o[g+C]*u;r[C]=M*R+A*k+x*O+w*I}return r}},TIt=new Gi,Iz=class extends Jk{interpolate_(t,e,n,s){let r=super.interpolate_(t,e,n,s);return TIt.fromArray(r).normalize().toArray(r),r}},Al={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},_v={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Eet={9728:xs,9729:$i,9984:cv,9985:cf,9986:vh,9987:Sa},ket={33071:pr,33648:Xd,10497:Ko},cz={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Oz={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},uf={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},AIt={CUBICSPLINE:void 0,LINEAR:Jd,STEP:Kd},uz={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};LIt=new tn,Bz=class{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new MIt,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,s=-1,r=!1,o=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;let l=a.match(/Version\/(\d+)/);s=n&&l?parseInt(l[1],10):-1,r=a.indexOf("Firefox")>-1,o=r?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&s<17||r&&o<98?this.textureLoader=new cu(this.options.manager):this.textureLoader=new sv(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new or(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){let n=this,s=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){let a={scene:o[0][s.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:s.asset,parser:n,userData:{}};return zg(r,a,s),gu(a,s),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(let l of a.scenes)l.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){let t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let s=0,r=e.length;s<r;s++){let o=e[s].joints;for(let a=0,l=o.length;a<l;a++)t[o[a]].isBone=!0}for(let s=0,r=t.length;s<r;s++){let o=t[s];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(n[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;let s=n.clone(),r=(o,a)=>{let l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(let[c,u]of o.children.entries())r(u,a.children[c])};return r(n,s),s.name+="_instance_"+t.uses[e]++,s}_invokeOne(t){let e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){let s=t(e[n]);if(s)return s}return null}_invokeAll(t){let e=Object.values(this.plugins);e.unshift(this);let n=[];for(let s=0;s<e.length;s++){let r=t(e[s]);r&&n.push(r)}return n}getDependency(t,e){let n=t+":"+e,s=this.cache.get(n);if(!s){switch(t){case"scene":s=this.loadScene(e);break;case"node":s=this._invokeOne(function(r){return r.loadNode&&r.loadNode(e)});break;case"mesh":s=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(e)});break;case"accessor":s=this.loadAccessor(e);break;case"bufferView":s=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(e)});break;case"buffer":s=this.loadBuffer(e);break;case"material":s=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(e)});break;case"texture":s=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(e)});break;case"skin":s=this.loadSkin(e);break;case"animation":s=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(e)});break;case"camera":s=this.loadCamera(e);break;default:if(s=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(t,e)}),!s)throw new Error("Unknown type: "+t);break}this.cache.add(n,s)}return s}getDependencies(t){let e=this.cache.get(t);if(!e){let n=this,s=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(s.map(function(r,o){return n.getDependency(t,o)})),this.cache.add(t,e)}return e}loadBuffer(t){let e=this.json.buffers[t],n=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[gi.KHR_BINARY_GLTF].body);let s=this.options;return new Promise(function(r,o){n.load(Co.resolveURL(e.uri,s.path),r,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){let e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(n){let s=e.byteLength||0,r=e.byteOffset||0;return n.slice(r,r+s)})}loadAccessor(t){let e=this,n=this.json,s=this.json.accessors[t];if(s.bufferView===void 0&&s.sparse===void 0){let o=cz[s.type],a=_v[s.componentType],l=s.normalized===!0,c=new a(s.count*o);return Promise.resolve(new Mi(c,o,l))}let r=[];return s.bufferView!==void 0?r.push(this.getDependency("bufferView",s.bufferView)):r.push(null),s.sparse!==void 0&&(r.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(r).then(function(o){let a=o[0],l=cz[s.type],c=_v[s.componentType],u=c.BYTES_PER_ELEMENT,h=u*l,d=s.byteOffset||0,p=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,g=s.normalized===!0,y,x;if(p&&p!==h){let w=Math.floor(d/p),M="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+w+":"+s.count,A=e.cache.get(M);A||(y=new c(a,w*p,s.count*p/u),A=new ru(y,p/u),e.cache.add(M,A)),x=new fc(A,l,d%p/u,g)}else a===null?y=new c(s.count*l):y=new c(a,d,s.count*l),x=new Mi(y,l,g);if(s.sparse!==void 0){let w=cz.SCALAR,M=_v[s.sparse.indices.componentType],A=s.sparse.indices.byteOffset||0,C=s.sparse.values.byteOffset||0,R=new M(o[1],A,s.sparse.count*w),k=new c(o[2],C,s.sparse.count*l);a!==null&&(x=new Mi(x.array.slice(),x.itemSize,x.normalized)),x.normalized=!1;for(let O=0,I=R.length;O<I;O++){let U=R[O];if(x.setX(U,k[O*l]),l>=2&&x.setY(U,k[O*l+1]),l>=3&&x.setZ(U,k[O*l+2]),l>=4&&x.setW(U,k[O*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}x.normalized=g}return x})}loadTexture(t){let e=this.json,n=this.options,r=e.textures[t].source,o=e.images[r],a=this.textureLoader;if(o.uri){let l=n.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(t,r,a)}loadTextureImage(t,e,n){let s=this,r=this.json,o=r.textures[t],a=r.images[e],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];let c=this.loadImageSource(e,n).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);let d=(r.samplers||{})[o.sampler]||{};return u.magFilter=Eet[d.magFilter]||$i,u.minFilter=Eet[d.minFilter]||Sa,u.wrapS=ket[d.wrapS]||Ko,u.wrapT=ket[d.wrapT]||Ko,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==xs&&u.minFilter!==$i,s.associations.set(u,{textures:t}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(t,e){let n=this,s=this.json,r=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(h=>h.clone());let o=s.images[t],a=self.URL||self.webkitURL,l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=n.getDependency("bufferView",o.bufferView).then(function(h){c=!0;let d=new Blob([h],{type:o.mimeType});return l=a.createObjectURL(d),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");let u=Promise.resolve(l).then(function(h){return new Promise(function(d,p){let g=d;e.isImageBitmapLoader===!0&&(g=function(y){let x=new is(y);x.needsUpdate=!0,d(x)}),e.load(Co.resolveURL(h,r.path),g,void 0,p)})}).then(function(h){return c===!0&&a.revokeObjectURL(l),gu(h,o),h.userData.mimeType=o.mimeType||DIt(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[t]=u,u}assignTexture(t,e,n,s){let r=this;return this.getDependency("texture",n.index).then(function(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),r.extensions[gi.KHR_TEXTURE_TRANSFORM]){let a=n.extensions!==void 0?n.extensions[gi.KHR_TEXTURE_TRANSFORM]:void 0;if(a){let l=r.associations.get(o);o=r.extensions[gi.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),r.associations.set(o,l)}}
vendor: 9,708 bytes, line 4638
4638return s!==void 0&&(o.colorSpace=s),t[e]=o,o})}assignFinalMaterial(t){let e=t.geometry,n=t.material,s=e.attributes.tangent===void 0,r=e.attributes.color!==void 0,o=e.attributes.normal===void 0;if(t.isPoints){let a="PointsMaterial:"+n.uuid,l=this.cache.get(a);l||(l=new Wa,ss.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(a,l)),n=l}else if(t.isLine){let a="LineBasicMaterial:"+n.uuid,l=this.cache.get(a);l||(l=new fs,ss.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(a,l)),n=l}if(s||r||o){let a="ClonedMaterial:"+n.uuid+":";s&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=n.clone(),r&&(l.vertexColors=!0),o&&(l.flatShading=!0),s&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(n))),n=l}t.material=n}getMaterialType(){return ph}loadMaterial(t){let e=this,n=this.json,s=this.extensions,r=n.materials[t],o,a={},l=r.extensions||{},c=[];if(l[gi.KHR_MATERIALS_UNLIT]){let h=s[gi.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,r,e))}else{let h=r.pbrMetallicRoughness||{};if(a.color=new Be(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){let d=h.baseColorFactor;a.color.setRGB(d[0],d[1],d[2],wo),a.opacity=d[3]}h.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",h.baseColorTexture,Zn)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(t,a)})))}r.doubleSided===!0&&(a.side=Ga);let u=r.alphaMode||uz.OPAQUE;if(u===uz.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===uz.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&o!==io&&(c.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new Ce(1,1),r.normalTexture.scale!==void 0)){let h=r.normalTexture.scale;a.normalScale.set(h,h)}if(r.occlusionTexture!==void 0&&o!==io&&(c.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&o!==io){let h=r.emissiveFactor;a.emissive=new Be().setRGB(h[0],h[1],h[2],wo)}return r.emissiveTexture!==void 0&&o!==io&&c.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,Zn)),Promise.all(c).then(function(){let h=new o(a);return r.name&&(h.name=r.name),gu(h,r),e.associations.set(h,{materials:t}),r.extensions&&zg(s,h,r),h})}createUniqueName(t){let e=yi.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){let e=this,n=this.extensions,s=this.primitiveCache;function r(a){return n[gi.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(l){return Pet(l,a,e)})}let o=[];for(let a=0,l=t.length;a<l;a++){let c=t[a],u=RIt(c),h=s[u];if(h)o.push(h.promise);else{let d;c.extensions&&c.extensions[gi.KHR_DRACO_MESH_COMPRESSION]?d=r(c):d=Pet(new kn,c,e),c.mode===Al.TRIANGLE_STRIP?d=d.then(p=>lz(p,bv)):c.mode===Al.TRIANGLE_FAN&&(d=d.then(p=>lz(p,Bg))),s[u]={primitive:c,promise:d},o.push(d)}}return Promise.all(o)}loadMesh(t){let e=this,n=this.json,s=this.extensions,r=n.meshes[t],o=r.primitives,a=[];for(let l=0,c=o.length;l<c;l++){let u=o[l].material===void 0?EIt(this.cache):this.getDependency("material",o[l].material);a.push(u)}return a.push(e.loadGeometries(o)),Promise.all(a).then(async function(l){let c=l.slice(0,l.length-1),u=l[l.length-1],h=[];for(let p=0,g=u.length;p<g;p++){let y=u[p],x=o[p],w,M=c[p];if(x.mode===Al.TRIANGLES||x.mode===Al.TRIANGLE_STRIP||x.mode===Al.TRIANGLE_FAN||x.mode===void 0){let A=r.isSkinnedMesh===!0,C=y.hasAttribute("skinIndex")&&y.hasAttribute("skinWeight");A&&C===!1&&console.warn("THREE.GLTFLoader: Missing skinIndex or skinWeight attributes. Skinning disabled."),w=A&&C?new uh(y,M):new qi(y,M),w.isSkinnedMesh===!0&&w.normalizeSkinWeights()}else if(x.mode===Al.LINES)w=new Wr(y,M);else if(x.mode===Al.LINE_STRIP)w=new Jo(y,M);else if(x.mode===Al.LINE_LOOP)w=new Sg(y,M);else if(x.mode===Al.POINTS)w=new gc(y,M);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(w.geometry.morphAttributes).length>0&&PIt(w,r),w.name=e.createUniqueName(r.name||"mesh_"+t),gu(w,r),x.extensions&&zg(s,w,x),e.assignFinalMaterial(w),h.push(w)}for(let p=0,g=h.length;p<g;p++)e.associations.set(h[p],{meshes:t,primitives:p});if(h.length===1)return r.extensions&&zg(s,h[0],r),h[0];let d=new jr;r.extensions&&zg(s,d,r),e.associations.set(d,{meshes:t});for(let p=0,g=h.length;p<g;p++)d.add(h[p]);return d})}loadCamera(t){let e,n=this.json.cameras[t],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?e=new Ds(mr.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(e=new hu(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),gu(e,n),Promise.resolve(e)}loadSkin(t){let e=this.json.skins[t],n=[];for(let s=0,r=e.joints.length;s<r;s++)n.push(this._loadNodeShallow(e.joints[s]));return e.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){let r=s.pop(),o=s,a=[],l=[];for(let c=0,u=o.length;c<u;c++){let h=o[c];if(h){a.push(h);let d=new tn;r!==null&&d.fromArray(r.array,c*16),l.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new hh(a,l)})}loadAnimation(t){let e=this.json,n=this,s=e.animations[t],r=s.name?s.name:"animation_"+t,o=[],a=[],l=[],c=[],u=[];for(let h=0,d=s.channels.length;h<d;h++){let p=s.channels[h],g=s.samplers[p.sampler],y=p.target,x=y.node,w=s.parameters!==void 0?s.parameters[g.input]:g.input,M=s.parameters!==void 0?s.parameters[g.output]:g.output;y.node!==void 0&&(o.push(this.getDependency("node",x)),a.push(this.getDependency("accessor",w)),l.push(this.getDependency("accessor",M)),c.push(g),u.push(y))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c),Promise.all(u)]).then(function(h){let d=h[0],p=h[1],g=h[2],y=h[3],x=h[4],w=[];for(let A=0,C=d.length;A<C;A++){let R=d[A],k=p[A],O=g[A],I=y[A],U=x[A];if(R===void 0)continue;R.updateMatrix&&R.updateMatrix();let V=n._createAnimationTracks(R,k,O,I,U);if(V)for(let q=0;q<V.length;q++)w.push(V[q])}let M=new Cl(r,void 0,w);return gu(M,s),M})}createNodeMesh(t){let e=this.json,n=this,s=e.nodes[t];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(r){let o=n._getNodeRef(n.meshCache,s.mesh,r);return s.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let l=0,c=s.weights.length;l<c;l++)a.morphTargetInfluences[l]=s.weights[l]}),o})}loadNode(t){let e=this.json,n=this,s=e.nodes[t],r=n._loadNodeShallow(t),o=[],a=s.children||[];for(let c=0,u=a.length;c<u;c++)o.push(n.getDependency("node",a[c]));let l=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([r,Promise.all(o),l]).then(function(c){let u=c[0],h=c[1],d=c[2];d!==null&&u.traverse(function(p){p.isSkinnedMesh&&p.bind(d,LIt)});for(let p=0,g=h.length;p<g;p++)u.add(h[p]);if(u.userData.pivot!==void 0&&h.length>0){let p=u.userData.pivot,g=h[0];u.pivot=new bt().fromArray(p),u.position.x-=p[0],u.position.y-=p[1],u.position.z-=p[2],g.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(t){let e=this.json,n=this.extensions,s=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];let r=e.nodes[t],o=r.name?s.createUniqueName(r.name):"",a=[],l=s._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return l&&a.push(l),r.camera!==void 0&&a.push(s.getDependency("camera",r.camera).then(function(c){return s._getNodeRef(s.cameraCache,r.camera,c)})),s._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){a.push(c)}),this.nodeCache[t]=Promise.all(a).then(function(c){let u;if(r.isBone===!0?u=new pc:c.length>1?u=new jr:c.length===1?u=c[0]:u=new ai,u!==c[0])for(let h=0,d=c.length;h<d;h++)u.add(c[h]);if(r.name&&(u.userData.name=r.name,u.name=o),gu(u,r),r.extensions&&zg(n,u,r),r.matrix!==void 0){let h=new tn;h.fromArray(r.matrix),u.applyMatrix4(h)}else r.translation!==void 0&&u.position.fromArray(r.translation),r.rotation!==void 0&&u.quaternion.fromArray(r.rotation),r.scale!==void 0&&u.scale.fromArray(r.scale);if(!s.associations.has(u))s.associations.set(u,{});else if(r.mesh!==void 0&&s.meshCache.refs[r.mesh]>1){let h=s.associations.get(u);s.associations.set(u,{...h})}return s.associations.get(u).nodes=t,u}),this.nodeCache[t]}loadScene(t){let e=this.extensions,n=this.json.scenes[t],s=this,r=new jr;n.name&&(r.name=s.createUniqueName(n.name)),gu(r,n),n.extensions&&zg(e,r,n);let o=n.nodes||[],a=[];for(let l=0,c=o.length;l<c;l++)a.push(s.getDependency("node",o[l]));return Promise.all(a).then(function(l){for(let u=0,h=l.length;u<h;u++){let d=l[u];d.parent!==null?r.add(Cet(d)):r.add(d)}let c=u=>{let h=new Map;for(let[d,p]of s.associations)(d instanceof ss||d instanceof is)&&h.set(d,p);return u.traverse(d=>{let p=s.associations.get(d);p!=null&&h.set(d,p)}),h};return s.associations=c(r),r})}_createAnimationTracks(t,e,n,s,r){let o=[],a=t.name?t.name:t.uuid,l=[];function c(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}
4638uf[r.path]===uf.weights?(c(t),t.isGroup&&t.children.forEach(c)):l.push(a);let u;switch(uf[r.path]){case uf.weights:u=_l;break;case uf.rotation:u=Sl;break;case uf.translation:case uf.scale:u=bc;break;default:n.itemSize===1?u=_l:u=bc;break}let h=s.interpolation!==void 0?AIt[s.interpolation]:Jd,d=this._getArrayFromAccessor(n);for(let p=0,g=l.length;p<g;p++){let y=new u(l[p]+"."+uf[r.path],e.array,d,h);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(y),o.push(y)}return o}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){let n=Nz(e.constructor),s=new Float32Array(e.length);for(let r=0,o=e.length;r<o;r++)s[r]=e[r]*n;e=s}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(n){let s=this instanceof Sl?Iz:Jk;return new s(this.times,this.values,this.getValueSize()/3,n)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}});var Fet={};Le(Fet,{OBJLoader:()=>Uz});function UIt(){let i={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(t,e){if(this.object&&this.object.fromDeclaration===!1){this.object.name=t,this.object.fromDeclaration=e!==!1;return}let n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:e!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(s,r){let o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);let a={index:this.materials.length,name:s||"",mtllib:Array.isArray(r)&&r.length>0?r[r.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(l){let c={index:typeof l=="number"?l:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return c.clone=this.clone.bind(c),c}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(s){let r=this.currentMaterial();if(r&&r.groupEnd===-1&&(r.groupEnd=this.geometry.vertices.length/3,r.groupCount=r.groupEnd-r.groupStart,r.inherited=!1),s&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return s&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),r}},n&&n.name&&typeof n.clone=="function"){let s=n.clone(0);s.inherited=!0,this.object.materials.push(s)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(t,e){let n=parseInt(t,10);return(n>=0?n-1:n+e/3)*3},parseNormalIndex:function(t,e){let n=parseInt(t,10);return(n>=0?n-1:n+e/3)*3},parseUVIndex:function(t,e){let n=parseInt(t,10);return(n>=0?n-1:n+e/2)*2},addVertex:function(t,e,n){let s=this.vertices,r=this.object.geometry.vertices;r.push(s[t+0],s[t+1],s[t+2]),r.push(s[e+0],s[e+1],s[e+2]),r.push(s[n+0],s[n+1],s[n+2])},addVertexPoint:function(t){let e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addVertexLine:function(t){let e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addNormal:function(t,e,n){let s=this.normals,r=this.object.geometry.normals;r.push(s[t+0],s[t+1],s[t+2]),r.push(s[e+0],s[e+1],s[e+2]),r.push(s[n+0],s[n+1],s[n+2])},addFaceNormal:function(t,e,n){let s=this.vertices,r=this.object.geometry.normals;Oet.fromArray(s,t),Fz.fromArray(s,e),Net.fromArray(s,n),El.subVectors(Net,Fz),Bet.subVectors(Oet,Fz),El.cross(Bet),El.normalize(),r.push(El.x,El.y,El.z),r.push(El.x,El.y,El.z),r.push(El.x,El.y,El.z)},addColor:function(t,e,n){let s=this.colors,r=this.object.geometry.colors;s[t]!==void 0&&r.push(s[t+0],s[t+1],s[t+2]),s[e]!==void 0&&r.push(s[e+0],s[e+1],s[e+2]),s[n]!==void 0&&r.push(s[n+0],s[n+1],s[n+2])},addUV:function(t,e,n){let s=this.uvs,r=this.object.geometry.uvs;r.push(s[t+0],s[t+1]),r.push(s[e+0],s[e+1]),r.push(s[n+0],s[n+1])},addDefaultUV:function(){let t=this.object.geometry.uvs;t.push(0,0),t.push(0,0),t.push(0,0)},addUVLine:function(t){let e=this.uvs;
4638this.object.geometry.uvs.push(e[t+0],e[t+1])},addFace:function(t,e,n,s,r,o,a,l,c){let u=this.vertices.length,h=this.parseVertexIndex(t,u),d=this.parseVertexIndex(e,u),p=this.parseVertexIndex(n,u);if(this.addVertex(h,d,p),this.addColor(h,d,p),a!==void 0&&a!==""){let g=this.normals.length;h=this.parseNormalIndex(a,g),d=this.parseNormalIndex(l,g),p=this.parseNormalIndex(c,g),this.addNormal(h,d,p)}else this.addFaceNormal(h,d,p);if(s!==void 0&&s!==""){let g=this.uvs.length;h=this.parseUVIndex(s,g),d=this.parseUVIndex(r,g),p=this.parseUVIndex(o,g),this.addUV(h,d,p),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(t){this.object.geometry.type="Points";let e=this.vertices.length;for(let n=0,s=t.length;n<s;n++){let r=this.parseVertexIndex(t[n],e);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(t,e){this.object.geometry.type="Line";let n=this.vertices.length,s=this.uvs.length;for(let r=0,o=t.length;r<o;r++)this.addVertexLine(this.parseVertexIndex(t[r],n));for(let r=0,o=e.length;r<o;r++)this.addUVLine(this.parseUVIndex(e[r],s))}};return i.startObject("",!1),i}var OIt,NIt,BIt,FIt,Iet,Oet,Fz,Net,Bet,El,Zk,Uz,Uet=_n(()=>{wh();OIt=/^[og]\s*(.+)?/,NIt=/^mtllib /,BIt=/^usemtl /,FIt=/^usemap /,Iet=/\s+/,Oet=new bt,Fz=new bt,Net=new bt,Bet=new bt,El=new bt,Zk=new Be;Uz=class extends rs{constructor(t){super(t),this.materials=null}load(t,e,n,s){let r=this,o=new or(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(a){try{e(r.parse(a))}catch(l){s?s(l):console.error(l),r.manager.itemError(t)}},n,s)}setMaterials(t){return this.materials=t,this}parse(t){let e=new UIt;t.indexOf(`\r
4639`)!==-1&&(t=t.replace(/\r\n/g,`
4640`)),t.indexOf(`\\
4641`)!==-1&&(t=t.replace(/\\\n/g,""));let n=t.split(`
4642`),s=[];for(let a=0,l=n.length;a<l;a++){let c=n[a].trimStart();if(c.length===0)continue;let u=c.charAt(0);if(u!=="#")if(u==="v"){let h=c.split(Iet);switch(h[0]){case"v":e.vertices.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),h.length>=7?(Zk.setRGB(parseFloat(h[4]),parseFloat(h[5]),parseFloat(h[6]),Zn),e.colors.push(Zk.r,Zk.g,Zk.b)):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));break;case"vt":e.uvs.push(parseFloat(h[1]),parseFloat(h[2]));break}}else if(u==="f"){let d=c.slice(1).trim().split(Iet),p=[];for(let y=0,x=d.length;y<x;y++){let w=d[y];if(w.length>0){let M=w.split("/");p.push(M)}}let g=p[0];for(let y=1,x=p.length-1;y<x;y++){let w=p[y],M=p[y+1];e.addFace(g[0],w[0],M[0],g[1],w[1],M[1],g[2],w[2],M[2])}}else if(u==="l"){let h=c.substring(1).trim().split(" "),d=[],p=[];if(c.indexOf("/")===-1)d=h;else for(let g=0,y=h.length;g<y;g++){let x=h[g].split("/");x[0]!==""&&d.push(x[0]),x[1]!==""&&p.push(x[1])}e.addLineGeometry(d,p)}else if(u==="p"){let d=c.slice(1).trim().split(" ");e.addPointGeometry(d)}else if((s=OIt.exec(c))!==null){let h=(" "+s[0].slice(1).trim()).slice(1);e.startObject(h)}else if(BIt.test(c))e.object.startMaterial(c.substring(7).trim(),e.materialLibraries);else if(NIt.test(c))e.materialLibraries.push(c.substring(7).trim());else if(FIt.test(c))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(u==="s"){if(s=c.split(" "),s.length>1){let d=s[1].trim().toLowerCase();e.object.smooth=d!=="0"&&d!=="off"}else e.object.smooth=!0;let h=e.object.currentMaterial();h&&(h.smooth=e.object.smooth)}else{if(c==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+c+'"')}}e.finalize();let r=new jr;if(r.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0)===!0)for(let a=0,l=e.objects.length;a<l;a++){let c=e.objects[a],u=c.geometry,h=c.materials,d=u.type==="Line",p=u.type==="Points",g=!1;if(u.vertices.length===0)continue;let y=new kn;y.setAttribute("position",new Ge(u.vertices,3)),u.normals.length>0&&y.setAttribute("normal",new Ge(u.normals,3)),u.colors.length>0&&(g=!0,y.setAttribute("color",new Ge(u.colors,3))),u.hasUVIndices===!0&&y.setAttribute("uv",new Ge(u.uvs,2));let x=[];for(let M=0,A=h.length;M<A;M++){let C=h[M],R=C.name+"_"+C.smooth+"_"+g,k=e.materials[R];if(this.materials!==null){if(k=this.materials.create(C.name),d&&k&&!(k instanceof fs)){let O=new fs;ss.prototype.copy.call(O,k),O.color.copy(k.color),k=O}else if(p&&k&&!(k instanceof Wa)){let O=new Wa({size:10,sizeAttenuation:!1});ss.prototype.copy.call(O,k),O.color.copy(k.color),O.map=k.map,k=O}}k===void 0&&(d?k=new fs:p?k=new Wa({size:1,sizeAttenuation:!1}):k=new _a,k.name=C.name,k.flatShading=!C.smooth,k.vertexColors=g,e.materials[R]=k),x.push(k)}let w;if(x.length>1){for(let M=0,A=h.length;M<A;M++){let C=h[M];y.addGroup(C.groupStart,C.groupCount,M)}d?w=new Wr(y,x):p?w=new gc(y,x):w=new qi(y,x)}else d?w=new Wr(y,x[0]):p?w=new gc(y,x[0]):w=new qi(y,x[0]);w.name=c.name,r.add(w)}else if(e.vertices.length>0){let a=new Wa({size:1,sizeAttenuation:!1}),l=new kn;l.setAttribute("position",new Ge(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(l.setAttribute("color",new Ge(e.colors,3)),a.vertexColors=!0);let c=new gc(l,a);r.add(c)}return r}}});var zet={};Le(zet,{MTLLoader:()=>zz});var zz,Vz,Vet=_n(()=>{wh();zz=class extends rs{constructor(t){super(t)}load(t,e,n,s){let r=this,o=this.path===""?Co.extractUrlBase(t):this.path,a=new or(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(l){try{e(r.parse(l,o))}catch(c){s?s(c):console.error(c),r.manager.itemError(t)}},n,s)}setMaterialOptions(t){return this.materialOptions=t,this}parse(t,e){let n=t.split(`
4643`),s={},r=/\s+/,o={};for(let l=0;l<n.length;l++){let c=n[l];if(c=c.trim(),c.length===0||c.charAt(0)==="#")continue;let u=c.indexOf(" "),h=u>=0?c.substring(0,u):c;h=h.toLowerCase();let d=u>=0?c.substring(u+1):"";if(d=d.trim(),h==="newmtl")s={name:d},o[d]=s;else if(h==="ka"||h==="kd"||h==="ks"||h==="ke"){let p=d.split(r,3);s[h]=[parseFloat(p[0]),parseFloat(p[1]),parseFloat(p[2])]}else s[h]=d}let a=new Vz(this.resourcePath||e,this.materialOptions);return a.setCrossOrigin(this.crossOrigin),a.setManager(this.manager),a.setMaterials(o),a}},Vz=class{constructor(t="",e={}){this.baseUrl=t,this.options=e,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:$a,this.wrap=this.options.wrap!==void 0?this.options.wrap:Ko}setCrossOrigin(t){return this.crossOrigin=t,this}setManager(t){this.manager=t}setMaterials(t){this.materialsInfo=this.convert(t),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(t){if(!this.options)return t;let e={};for(let n in t){let s=t[n],r={};e[n]=r;for(let o in s){let a=!0,l=s[o],c=o.toLowerCase();switch(c){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(l=[l[0]/255,l[1]/255,l[2]/255]),this.options&&this.options.ignoreZeroRGBs&&l[0]===0&&l[1]===0&&l[2]===0&&(a=!1);break;default:break}a&&(r[c]=l)}}return e}preload(){for(let t in this.materialsInfo)this.create(t)}getIndex(t){return this.nameLookup[t]}getAsArray(){let t=0;for(let e in this.materialsInfo)this.materialsArray[t]=this.create(e),this.nameLookup[e]=t,t++;return this.materialsArray}create(t){return this.materials[t]===void 0&&this.createMaterial_(t),this.materials[t]}createMaterial_(t){let e=this,n=this.materialsInfo[t],s={name:t,side:this.side};function r(a,l){return typeof l!="string"||l===""?"":/^https?:\/\//i.test(l)?l:a+l}function o(a,l){if(s[a])return;
4643let c=e.getTextureParams(l,s),u=e.loadTexture(r(e.baseUrl,c.url));u.repeat.copy(c.scale),u.offset.copy(c.offset),u.wrapS=e.wrap,u.wrapT=e.wrap,(a==="map"||a==="emissiveMap")&&(u.colorSpace=Zn),s[a]=u}for(let a in n){let l=n[a],c;if(l!=="")switch(a.toLowerCase()){case"kd":s.color=Rn.colorSpaceToWorking(new Be().fromArray(l),Zn);break;case"ks":s.specular=Rn.colorSpaceToWorking(new Be().fromArray(l),Zn);break;case"ke":s.emissive=Rn.colorSpaceToWorking(new Be().fromArray(l),Zn);break;case"map_kd":o("map",l);break;case"map_ks":o("specularMap",l);break;case"map_ke":o("emissiveMap",l);break;case"norm":o("normalMap",l);break;case"map_bump":case"bump":o("bumpMap",l);break;case"disp":o("displacementMap",l);break;case"map_d":o("alphaMap",l),s.transparent=!0;break;case"ns":s.shininess=parseFloat(l);break;case"d":c=parseFloat(l),c<1&&(s.opacity=c,s.transparent=!0);break;case"tr":c=parseFloat(l),this.options&&this.options.invertTrProperty&&(c=1-c),c>0&&(s.opacity=1-c,s.transparent=!0);break;default:break}}return this.materials[t]=new _a(s),this.materials[t]}getTextureParams(t,e){let n={scale:new Ce(1,1),offset:new Ce(0,0)},s=t.split(/\s+/),r;return r=s.indexOf("-bm"),r>=0&&(e.bumpScale=parseFloat(s[r+1]),s.splice(r,2)),r=s.indexOf("-mm"),r>=0&&(e.displacementBias=parseFloat(s[r+1]),e.displacementScale=parseFloat(s[r+2]),s.splice(r,3)),r=s.indexOf("-s"),r>=0&&(n.scale.set(parseFloat(s[r+1]),parseFloat(s[r+2])),s.splice(r,4)),r=s.indexOf("-o"),r>=0&&(n.offset.set(parseFloat(s[r+1]),parseFloat(s[r+2])),s.splice(r,4)),n.url=s.join(" ").trim(),n}loadTexture(t,e,n,s,r){let o=this.manager!==void 0?this.manager:W_,a=o.getHandler(t);a===null&&(a=new cu(o)),a.setCrossOrigin&&a.setCrossOrigin(this.crossOrigin);let l=a.load(t,n,s,r);return e!==void 0&&(l.mapping=e),l}}});function Xet(i,t){return XIt(i.subarray(JIt(i,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var kl,Sv,zIt,Het,jet,VIt,Wet,$et,Get,HIt,qet,jIt,Tye,Wz,_h,Ui,J_,Z_,Ui,Ui,Ui,Ui,Yet,Ui,WIt,$It,Hz,_c,jz,GIt,qIt,YIt,Sc,XIt,KIt,JIt,ZIt,QIt,Ket=_n(()=>{kl=Uint8Array,Sv=Uint16Array,zIt=Int32Array,Het=new kl([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),jet=new kl([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),VIt=new kl([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wet=function(i,t){for(var e=new Sv(31),n=0;n<31;++n)e[n]=t+=1<<i[n-1];for(var s=new zIt(e[30]),n=1;n<30;++n)for(var r=e[n];r<e[n+1];++r)s[r]=r-e[n]<<5|n;return{b:e,r:s}},$et=Wet(Het,2),Get=$et.b,HIt=$et.r;Get[28]=258,HIt[258]=28;qet=Wet(jet,0),jIt=qet.b,Tye=qet.r,Wz=new Sv(32768);for(Ui=0;Ui<32768;++Ui)_h=(Ui&43690)>>1|(Ui&21845)<<1,_h=(_h&52428)>>2|(_h&13107)<<2,_h=(_h&61680)>>4|(_h&3855)<<4,Wz[Ui]=((_h&65280)>>8|(_h&255)<<8)>>1;J_=(function(i,t,e){for(var n=i.length,s=0,r=new Sv(t);s<n;++s)i[s]&&++r[i[s]-1];var o=new Sv(t);for(s=1;s<t;++s)o[s]=o[s-1]+r[s-1]<<1;var a;if(e){a=new Sv(1<<t);var l=15-t;for(s=0;s<n;++s)if(i[s])for(var c=s<<4|i[s],u=t-i[s],h=o[i[s]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)a[Wz[h]>>l]=c}else for(a=new Sv(n),s=0;s<n;++s)i[s]&&(a[s]=Wz[o[i[s]-1]++]>>15-i[s]);return a}),Z_=new kl(288);for(Ui=0;Ui<144;++Ui)Z_[Ui]=8;for(Ui=144;Ui<256;++Ui)Z_[Ui]=9;for(Ui=256;Ui<280;++Ui)Z_[Ui]=7;for(Ui=280;Ui<288;++Ui)Z_[Ui]=8;Yet=new kl(32);for(Ui=0;Ui<32;++Ui)Yet[Ui]=5;WIt=J_(Z_,9,1),$It=J_(Yet,5,1),Hz=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},_c=function(i,t,e){var n=t/8|0;return(i[n]|i[n+1]<<8)>>(t&7)&e},jz=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},GIt=function(i){return(i+7)/8|0},qIt=function(i,t,e){return(t==null||t<0)&&(t=0),(e==null||e>i.length)&&(e=i.length),new kl(i.subarray(t,e))}
4643,YIt=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Sc=function(i,t,e){var n=new Error(t||YIt[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,Sc),!e)throw n;return n},XIt=function(i,t,e,n){var s=i.length,r=n?n.length:0;if(!s||t.f&&!t.l)return e||new kl(0);var o=!e,a=o||t.i!=2,l=t.i;o&&(e=new kl(s*3));var c=function(Ut){var zt=e.length;if(Ut>zt){var St=new kl(Math.max(zt*2,Ut));St.set(e),e=St}},u=t.f||0,h=t.p||0,d=t.b||0,p=t.l,g=t.d,y=t.m,x=t.n,w=s*8;do{if(!p){u=_c(i,h,1);var M=_c(i,h+1,3);if(h+=3,M)if(M==1)p=WIt,g=$It,y=9,x=5;else if(M==2){var k=_c(i,h,31)+257,O=_c(i,h+10,15)+4,I=k+_c(i,h+5,31)+1;h+=14;for(var U=new kl(I),V=new kl(19),q=0;q<O;++q)V[VIt[q]]=_c(i,h+q*3,7);h+=O*3;for(var X=Hz(V),j=(1<<X)-1,W=J_(V,X,1),q=0;q<I;){var _=W[_c(i,h,j)];h+=_&15;var A=_>>4;if(A<16)U[q++]=A;else{var at=0,ct=0;for(A==16?(ct=3+_c(i,h,3),h+=2,at=U[q-1]):A==17?(ct=3+_c(i,h,7),h+=3):A==18&&(ct=11+_c(i,h,127),h+=7);ct--;)U[q++]=at}}var pt=U.subarray(0,k),Et=U.subarray(k);y=Hz(pt),x=Hz(Et),p=J_(pt,y,1),g=J_(Et,x,1)}else Sc(1);else{var A=GIt(h)+4,C=i[A-4]|i[A-3]<<8,R=A+C;if(R>s){l&&Sc(0);break}a&&c(d+C),e.set(i.subarray(A,R),d),t.b=d+=C,t.p=h=R*8,t.f=u;continue}if(h>w){l&&Sc(0);break}}a&&c(d+131072);for(var vt=(1<<y)-1,yt=(1<<x)-1,kt=h;;kt=h){var at=p[jz(i,h)&vt],Wt=at>>4;if(h+=at&15,h>w){l&&Sc(0);break}if(at||Sc(2),Wt<256)e[d++]=Wt;else if(Wt==256){kt=h,p=null;break}else{var jt=Wt-254;if(Wt>264){var q=Wt-257,ae=Het[q];jt=_c(i,h,(1<<ae)-1)+Get[q],h+=ae}var ee=g[jz(i,h)&yt],Bt=ee>>4;ee||Sc(3),h+=ee&15;var Et=jIt[Bt];if(Bt>3){var ae=jet[Bt];Et+=jz(i,h)&(1<<ae)-1,h+=ae}if(h>w){l&&Sc(0);break}a&&c(d+131072);var Gt=d+jt;if(d<Et){var Qt=r-Et,xe=Math.min(Et,Gt);for(Qt+d<0&&Sc(3);d<xe;++d)e[d]=n[Qt+d]}for(;d<Gt;++d)e[d]=e[d-Et]}}t.l=p,t.p=kt,t.b=d,t.f=u,p&&(u=1,t.m=y,t.d=g,t.n=x)}while(!u);return d!=e.length&&o?qIt(e,0,d):e.subarray(0,d)},KIt=new kl(0),JIt=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&Sc(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&Sc(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};ZIt=typeof TextDecoder<"u"&&new TextDecoder,QIt=0;try{ZIt.decode(KIt,{stream:!0}),QIt=1}catch{}});function Jet(i,t,e){let n=e.length-i-1;if(t>=e[n])return n-1;if(t<=e[i])return i;let s=i,r=n,o=Math.floor((s+r)/2);for(;t<e[o]||t>=e[o+1];)t<e[o]?r=o:s=o,o=Math.floor((s+r)/2);return o}function tOt(i,t,e,n){let s=[],r=[],o=[];s[0]=1;for(let a=1;a<=e;++a){r[a]=t-n[i+1-a],o[a]=n[i+a]-t;let l=0;for(let c=0;c<a;++c){let u=o[c+1],h=r[a-c],d=s[c]/(u+h);s[c]=l+u*d,l=h*d}s[a]=l}return s}function Zet(i,t,e,n){let s=Jet(i,n,t),r=tOt(s,n,i,t),o=new pi(0,0,0,0);for(let a=0;a<=i;++a){let l=e[s-i+a],c=r[a],u=l.w*c;o.x+=l.x*u,o.y+=l.y*u,o.z+=l.z*u,o.w+=l.w*c}return o}function eOt(i,t,e,n,s){let r=[];for(let h=0;h<=e;++h)r[h]=0;let o=[];for(let h=0;h<=n;++h)o[h]=r.slice(0);let a=[];for(let h=0;h<=e;++h)a[h]=r.slice(0);a[0][0]=1;let l=r.slice(0),c=r.slice(0);for(let h=1;h<=e;++h){l[h]=t-s[i+1-h],c[h]=s[i+h]-t;let d=0;for(let p=0;p<h;++p){let g=c[p+1],y=l[h-p];a[h][p]=g+y;let x=a[p][h-1]/a[h][p];a[p][h]=d+g*x,d=y*x}a[h][h]=d}for(let h=0;h<=e;++h)o[0][h]=a[h][e];for(let h=0;h<=e;++h){let d=0,p=1,g=[];for(let y=0;y<=e;++y)g[y]=r.slice(0);g[0][0]=1;for(let y=1;y<=n;++y){let x=0,w=h-y,M=e-y;h>=y&&(g[p][0]=g[d][0]/a[M+1][w],x=g[p][0]*a[w][M]);let A=w>=-1?1:-w,C=h-1<=M?y-1:e-h;for(let k=A;k<=C;++k)g[p][k]=(g[d][k]-g[d][k-1])/a[M+1][w+k],x+=g[p][k]*a[w+k][M];h<=M&&(g[p][y]=-g[d][y-1]/a[M+1][h],x+=g[p][y]*a[h][M]),o[y][h]=x;let R=d;d=p,p=R}}let u=e;for(let h=1;h<=n;++h){for(let d=0;d<=e;++d)o[h][d]*=u;u*=e-h}return o}function nOt(i,t,e,n,s){let r=s<i?s:i,o=[],a=Jet(i,n,t),l=eOt(a,n,i,r,t),c=[];for(let u=0;u<e.length;++u){let h=e[u].clone(),d=h.w;h.x*=d,h.y*=d,h.z*=d,c[u]=h}for(let u=0;u<=r;++u){let h=c[a-i].clone().multiplyScalar(l[u][0]);for(let d=1;d<=i;++d)h.add(c[a-i+d].clone().multiplyScalar(l[u][d]));o[u]=h}for(let u=r+1;u<=s+1;++u)o[u]=new pi(0,0,0);return o}function iOt(i,t){let e=1;for(let s=2;s<=i;++s)e*=s;let n=1;for(let s=2;s<=t;++s)n*=s;for(let s=2;s<=i-t;++s)n*=s;return e/n}function sOt(i){let t=i.length,e=[],n=[];for(let r=0;r<t;++r){let o=i[r];e[r]=new bt(o.x,o.y,o.z),n[r]=o.w}let s=[];for(let r=0;r<t;++r){let o=e[r].clone();for(let a=1;a<=r;
4643++a)o.sub(s[r-a].clone().multiplyScalar(iOt(r,a)*n[a]));s[r]=o.divideScalar(n[0])}return s}function Qet(i,t,e,n,s){let r=nOt(i,t,e,n,s);return sOt(r)}var tnt=_n(()=>{wh()});var Qk,ent=_n(()=>{wh();tnt();Qk=class extends _o{constructor(t,e,n,s,r){super();let o=e?e.length-1:0,a=n?n.length:0;this.degree=t,this.knots=e,this.controlPoints=[],this.startKnot=s||0,this.endKnot=r||o;for(let l=0;l<a;++l){let c=n[l];this.controlPoints[l]=new pi(c.x,c.y,c.z,c.w)}}getPoint(t,e=new bt){let n=e,s=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),r=Zet(this.degree,this.knots,this.controlPoints,s);return r.w!==1&&r.divideScalar(r.w),n.set(r.x,r.y,r.z)}getTangent(t,e=new bt){let n=e,s=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),r=Qet(this.degree,this.knots,this.controlPoints,s,1);return n.copy(r[1]).normalize(),n}toJSON(){let t=super.toJSON();return t.degree=this.degree,t.knots=[...this.knots],t.controlPoints=this.controlPoints.map(e=>e.toArray()),t.startKnot=this.startKnot,t.endKnot=this.endKnot,t}fromJSON(t){return super.fromJSON(t),this.degree=t.degree,this.knots=[...t.knots],this.controlPoints=t.controlPoints.map(e=>new pi(e[0],e[1],e[2],e[3])),this.startKnot=t.startKnot,this.endKnot=t.endKnot,this}}});var rnt={};Le(rnt,{FBXLoader:()=>Yz});function oOt(i){let t="Kaydara FBX Binary  \0";return i.byteLength>=t.length&&t===snt(i,0,t.length)}function aOt(i){let t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],e=0;function n(s){let r=i[s-1];return i=i.slice(e+s),e++,r}for(let s=0;s<t.length;++s)if(n(1)===t[s])return!1;return!0}function nnt(i){let t=/FBXVersion: (\d+)/,e=i.match(t);if(e)return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function $z(i){return i/46186158e3}function tP(i,t,e,n){let s;switch(n.mappingType){case"ByPolygonVertex":s=i;break;case"ByPolygon":s=t;break;case"ByVertice":s=e;break;case"AllSame":s=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(s=n.indices[s]);let r=s*n.dataSize,o=r+n.dataSize;return uOt(lOt,n.buffer,r,o)}function int(i){let t=new tn,e=new tn,n=new tn,s=new tn,r=new tn,o=new tn,a=new tn,l=new tn,c=new tn,u=new tn,h=new tn,d=new tn,p=i.inheritType?i.inheritType:0;i.translation&&t.setPosition(Cv.fromArray(i.translation));let g=Q_(0);if(i.preRotation){let q=i.preRotation.map(mr.degToRad);q.push(g),e.makeRotationFromEuler(Gz.fromArray(q))}if(i.rotation){let q=i.rotation.map(mr.degToRad);q.push(i.eulerOrder||g),n.makeRotationFromEuler(Gz.fromArray(q))}if(i.postRotation){let q=i.postRotation.map(mr.degToRad);q.push(g),s.makeRotationFromEuler(Gz.fromArray(q)),s.invert()}i.scale&&r.scale(Cv.fromArray(i.scale)),i.scalingOffset&&a.setPosition(Cv.fromArray(i.scalingOffset)),i.scalingPivot&&o.setPosition(Cv.fromArray(i.scalingPivot)),i.rotationOffset&&l.setPosition(Cv.fromArray(i.rotationOffset)),i.rotationPivot&&c.setPosition(Cv.fromArray(i.rotationPivot)),i.parentMatrixWorld&&(h.copy(i.parentMatrix),u.copy(i.parentMatrixWorld));let y=e.clone().multiply(n).multiply(s),x=new tn;x.extractRotation(u);let w=new tn;w.copyPosition(u);let M=w.clone().invert().multiply(u),A=x.clone().invert().multiply(M),C=r,R=new tn;if(p===0)R.copy(x).multiply(y).multiply(A).multiply(C);else if(p===1)R.copy(x).multiply(A).multiply(y).multiply(C);else{let X=new tn().scale(new bt().setFromMatrixScale(h)).clone().invert(),j=A.clone().multiply(X);R.copy(x).multiply(y).multiply(j).multiply(C)}let k=c.clone().invert(),O=o.clone().invert(),I=t.clone().multiply(l).multiply(c).multiply(e).multiply(n).multiply(s).multiply(k).multiply(a).multiply(o).multiply(r).multiply(O),U=new tn().copyPosition(I),V=u.clone().multiply(U);return d.copyPosition(V),I=d.clone().multiply(R),I.premultiply(u.invert()),I}function Q_(i){i=i||0;let t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return i===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[i]}function qz(i){return i.split(",").map(function(e){return parseFloat(e)})}function snt(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=i.byteLength),new TextDecoder().decode(new Uint8Array(i,t,e))}function cOt(i,t){for(let e=0,n=i.length,s=t.length;e<s;e++,n++)i[n]=t[e]}function uOt(i,t,e,n){for(let s=e,r=0;s<n;s++,r++)i[r]=t[s];return i}var Qn,lr,kr,Yz,Xz,Kz,Jz,Zz,Qz,eP,nP,lOt,Gz,Cv,ont=_n(()=>{wh();Ket();ent();Yz=class extends rs{constructor(t){super(t),this.trimAnimationClips=!1}load(t,e,n,s){let r=this,o=r.path===""?Co.extractUrlBase(t):r.path,a=new or(this.manager);a.setPath(r.path),a.setResponseType("arraybuffer"),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(t,function(l){try{e(r.parse(l,o))}catch(c){s?s(c):console.error(c),r.manager.itemError(t)}},n,s)}parse(t,e){if(oOt(t))Qn=new Qz().parse(t);else{let s=snt(t);if(!aOt(s))throw new Error("THREE.FBXLoader: Unknown format.");if(nnt(s)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+nnt(s));Qn=new Zz().parse(s)}let n=new cu(this.manager).setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin);return new Xz(n,this.manager,this.trimAnimationClips).parse(Qn)}},Xz=class{constructor(t,e,n){this.textureLoader=t,this.manager=e,this.trimAnimationClips=n}parse(){lr=this.parseConnections();let t=this.parseImages(),e=this.parseTextures(t),n=this.parseMaterials(e),s=this.parseDeformers(),r=new Kz().parse(s);return this.parseScene(s,r,n),kr}parseConnections(){let t=new Map;return"Connections"in Qn&&Qn.Connections.connections.forEach(function(n){let s=n[0],r=n[1],o=n[2];t.has(s)||t.set(s,{parents:[],children:[]});let a={ID:r,relationship:o};t.get(s).parents.push(a),t.has(r)||t.set(r,{parents:[],children:[]});let l={ID:s,relationship:o};t.get(r).children.push(l)}),t}parseImages(){let t={},e={};if("Video"in Qn.Objects){let n=Qn.Objects.Video;for(let s in n){let r=n[s],o=parseInt(s);if(t[o]=r.RelativeFilename||r.Filename,"Content"in r){let a=r.Content instanceof ArrayBuffer&&r.Content.byteLength>0,l=typeof r.Content=="string"&&r.Content!=="";if(a||l){let c=this.parseImage(n[s]);e[r.RelativeFilename||r.Filename]=c}}}}for(let n in t){let s=t[n];e[s]!==void 0?t[n]=e[s]:t[n]=t[n].split("\\").pop()}return t}parseImage(t){let e=t.Content,n=t.RelativeFilename||t.Filename,s=n.slice(n.lastIndexOf(".")+1).toLowerCase(),r;switch(s){case"bmp":r="image/bmp";break;case"jpg":case"jpeg":r="image/jpeg";break;case"png":r="image/png";break;case"tif":r="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),r="image/tga";break;case"webp":r="image/webp";break;default:console.warn('FBXLoader: Image type "'+s+'" is not supported.');return}if(typeof e=="string")return"data:"+r+";base64,"+e;{let o=new Uint8Array(e);return URL.createObjectURL(new Blob([o],{type:r}))}}parseTextures(t){let e=new Map;if("Texture"in Qn.Objects){let n=Qn.Objects.Texture;for(let s in n){let r=this.parseTexture(n[s],t);e.set(parseInt(s),r)}}return e}parseTexture(t,e){let n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;let s=t.WrapModeU,r=t.WrapModeV,o=s!==void 0?s.value:0,a=r!==void 0?r.value:0;if(n.wrapS=o===0?Ko:pr,n.wrapT=a===0?Ko:pr,"Scaling"in t){let l=t.Scaling.value;n.repeat.x=l[0],n.repeat.y=l[1]}if("Translation"in t){let l=t.Translation.value;n.offset.x=l[0],n.offset.y=l[1]}return n}loadTexture(t,e){let n=t.FileName.split(".").pop().toLowerCase(),s=this.manager.getHandler(`.${n}`);s===null&&(s=this.textureLoader);let r=s.path;r||s.setPath(this.textureLoader.path);let o=lr.get(t.id).children,a;
4643if(o!==void 0&&o.length>0&&e[o[0].ID]!==void 0&&(a=e[o[0].ID],(a.indexOf("blob:")===0||a.indexOf("data:")===0)&&s.setPath(void 0)),a===void 0)return console.warn("FBXLoader: Undefined filename, creating placeholder texture."),new is;let l=s.load(a);return s.setPath(r),l}parseMaterials(t){let e=new Map;if("Material"in Qn.Objects){let n=Qn.Objects.Material;for(let s in n){let r=this.parseMaterial(n[s],t);r!==null&&e.set(parseInt(s),r)}}return e}parseMaterial(t,e){let n=t.id,s=t.attrName,r=t.ShadingModel;if(typeof r=="object"&&(r=r.value),!lr.has(n))return null;let o=this.parseParameters(t,e,n),a;switch(r.toLowerCase()){case"phong":a=new _a;break;case"lambert":a=new Eg;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',r),a=new _a;break}return a.setValues(o),a.name=s,a}parseParameters(t,e,n){let s={};t.BumpFactor&&(s.bumpScale=t.BumpFactor.value),t.Diffuse?s.color=Rn.colorSpaceToWorking(new Be().fromArray(t.Diffuse.value),Zn):t.DiffuseColor&&(t.DiffuseColor.type==="Color"||t.DiffuseColor.type==="ColorRGB")&&(s.color=Rn.colorSpaceToWorking(new Be().fromArray(t.DiffuseColor.value),Zn)),t.DisplacementFactor&&(s.displacementScale=t.DisplacementFactor.value),t.Emissive?s.emissive=Rn.colorSpaceToWorking(new Be().fromArray(t.Emissive.value),Zn):t.EmissiveColor&&(t.EmissiveColor.type==="Color"||t.EmissiveColor.type==="ColorRGB")&&(s.emissive=Rn.colorSpaceToWorking(new Be().fromArray(t.EmissiveColor.value),Zn)),t.EmissiveFactor&&(s.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),s.opacity=1-(t.TransparencyFactor?parseFloat(t.TransparencyFactor.value):0),(s.opacity===1||s.opacity===0)&&(s.opacity=t.Opacity?parseFloat(t.Opacity.value):null,s.opacity===null&&(s.opacity=1)),s.opacity<1&&(s.transparent=!0),t.ReflectionFactor&&(s.reflectivity=t.ReflectionFactor.value),t.Shininess&&(s.shininess=t.Shininess.value),t.Specular?s.specular=Rn.colorSpaceToWorking(new Be().fromArray(t.Specular.value),Zn):t.SpecularColor&&t.SpecularColor.type==="Color"&&(s.specular=Rn.colorSpaceToWorking(new Be().fromArray(t.SpecularColor.value),Zn));let r=this;return lr.get(n).children.forEach(function(o){let a=o.relationship;switch(a){case"Bump":s.bumpMap=r.getTexture(e,o.ID);break;case"Maya|TEX_ao_map":s.aoMap=r.getTexture(e,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":s.map=r.getTexture(e,o.ID),s.map!==void 0&&(s.map.colorSpace
4643=Zn);break;case"DisplacementColor":s.displacementMap=r.getTexture(e,o.ID);break;case"EmissiveColor":s.emissiveMap=r.getTexture(e,o.ID),s.emissiveMap!==void 0&&(s.emissiveMap.colorSpace=Zn);break;case"NormalMap":case"Maya|TEX_normal_map":s.normalMap=r.getTexture(e,o.ID);break;case"ReflectionColor":s.envMap=r.getTexture(e,o.ID),s.envMap!==void 0&&(s.envMap.mapping=lf,s.envMap.colorSpace=Zn);break;case"SpecularColor":s.specularMap=r.getTexture(e,o.ID),s.specularMap!==void 0&&(s.specularMap.colorSpace=Zn);break;case"TransparentColor":case"TransparencyFactor":s.alphaMap=r.getTexture(e,o.ID),s.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),s}getTexture(t,e){return"LayeredTexture"in Qn.Objects&&e in Qn.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=lr.get(e).children[0].ID),t.get(e)}parseDeformers(){let t={},e={};if("Deformer"in Qn.Objects){let n=Qn.Objects.Deformer;for(let s in n){let r=n[s],o=lr.get(parseInt(s));if(r.attrType==="Skin"){let a=this.parseSkeleton(o,n);a.ID=s,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,t[s]=a}else if(r.attrType==="BlendShape"){let a={id:s};a.rawTargets=this.parseMorphTargets(o,n),a.id=s,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[s]=a}}}return{skeletons:t,morphTargets:e}}parseSkeleton(t,e){let n=[];return t.children.forEach(function(s){let r=e[s.ID];if(r.attrType!=="Cluster")return;let o={ID:s.ID,indices:[],weights:[],transformLink:new tn().fromArray(r.TransformLink.a)};"Indexes"in r&&(o.indices=r.Indexes.a,o.weights=r.Weights.a),n.push(o)}),{rawBones:n,bones:[]}}parseMorphTargets(t,e){let n=[];for(let s=0;s<t.children.length;s++){let r=t.children[s],o=e[r.ID],a={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if(o.attrType!=="BlendShapeChannel")return;a.geoID=lr.get(parseInt(r.ID)).children.filter(function(l){return l.relationship===void 0})[0].ID,n.push(a)}return n}parseScene(t,e,n){kr=new jr;let s=this.parseModels(t.skeletons,e,n),r=Qn.Objects.Model,o=this;s.forEach(function(h){let d=r[h.ID];o.setLookAtProperties(h,d),lr.get(h.ID).parents.forEach(function(g){let y=s.get(g.ID);y!==void 0&&y.add(h)}),h.parent===null&&kr.add(h)}),this.addGlobalSceneSettings(),kr.traverse(function(h){if(h.userData.transformData){h.parent&&(h.userData.transformData.parentMatrix=h.parent.matrix,h.userData.transformData.parentMatrixWorld=h.parent.matrixWorld);let d=int(h.userData.transformData);h.applyMatrix4(d),h.updateWorldMatrix()}});let a=this.parsePoseNodes(),l=new Set;for(let h in t.skeletons)t.skeletons[h].rawBones.forEach(function(d,p){let g=t.skeletons[h].bones[p];g&&l.add(g.ID)});let c=new tn;kr.traverse(function(h){if(h.isBone&&h.ID!==void 0&&!l.has(h.ID)){let d=a[h.ID];d!==void 0&&(h.parent?(c.copy(h.parent.matrixWorld).invert(),c.multiply(d)):c.copy(d),c.decompose(h.position,h.quaternion,h.scale),h.updateMatrix(),h.matrixWorld.copy(d))}}),this.bindSkeleton(t.skeletons,e,s);let u=new Jz(this.trimAnimationClips).parse();kr.children.length===1&&kr.children[0].isGroup&&(kr.children[0].animations=u,Object.assign(kr.children[0].userData,kr.userData),kr=kr.children[0]),kr.animations=u,"GlobalSettings"in Qn&&"UpAxis"in Qn.GlobalSettings&&Qn.GlobalSettings.UpAxis.value===2&&(console.warn("THREE.FBXLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted."),kr.rotation.set(-Math.PI/2,0,0))}parseModels(t,e,n){let s=new Map,r=Qn.Objects.Model;for(let o in r){let a=parseInt(o),l=r[o],c=lr.get(a),u=this.buildSkeleton(c,t,a,l.attrName);if(!u){switch(l.attrType){case"Camera":u=this.createCamera(c);break;case"Light":u=this.createLight(c);break;case"Mesh":u=this.createMesh(c,e,n);break;case"NurbsCurve":u=this.createCurve(c,e);break;case"LimbNode":case"Root":u=new pc;break;default:u=new jr;break}u.name=l.attrName?yi.sanitizeNodeName(l.attrName):"",u.userData.originalName=l.attrName,u.ID=a}this.getTransformData(u,l),s.set(a,u)}return s}buildSkeleton(t,e,n,s){let r=null;
4643return t.parents.forEach(function(o){for(let a in e){let l=e[a];l.rawBones.forEach(function(c,u){if(c.ID===o.ID){let h=r;r=new pc,r.matrixWorld.copy(c.transformLink),r.name=s?yi.sanitizeNodeName(s):"",r.userData.originalName=s,r.ID=n,l.bones[u]=r,h!==null&&r.add(h)}})}}),r}createCamera(t){let e,n;if(t.children.forEach(function(s){let r=Qn.Objects.NodeAttribute[s.ID];r!==void 0&&(n=r)}),n===void 0)e=new ai;else{let s=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(s=1);let r=1;n.NearPlane!==void 0&&(r=n.NearPlane.value/1e3);let o=1e3;n.FarPlane!==void 0&&(o=n.FarPlane.value/1e3);let a=window.innerWidth,l=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(a=n.AspectWidth.value,l=n.AspectHeight.value);let c=a/l,u=45;n.FieldOfView!==void 0&&(u=n.FieldOfView.value);let h=n.FocalLength?n.FocalLength.value:null;switch(s){case 0:e=new Ds(u,c,r,o),h!==null&&e.setFocalLength(h);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),e=new ai;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),e=new ai;break}}return e}createLight(t){let e,n;if(t.children.forEach(function(s){let r=Qn.Objects.NodeAttribute[s.ID];r!==void 0&&(n=r)}),n===void 0)e=new ai;else{let s;n.LightType===void 0?s=0:s=n.LightType.value;let r=16777215;n.Color!==void 0&&(r=Rn.colorSpaceToWorking(new Be().fromArray(n.Color.value),Zn));let o=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(o=0);let a=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?a=0:a=n.FarAttenuationEnd.value);let l=1;switch(s){case 0:e=new uu(r,o,a,l);break;case 1:e=new mh(r,o);break;case 2:let c=Math.PI/3,u=0;n.OuterAngle!==void 0?(c=mr.degToRad(n.OuterAngle.value),n.InnerAngle!==void 0&&(u=1-n.InnerAngle.value/n.OuterAngle.value,u=Math.max(0,u))):n.InnerAngle!==void 0&&(c=mr.degToRad(n.InnerAngle.value)),e=new gh(r,o,a,c,u,l);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),e=new uu(r,o);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(e.castShadow=!0)}return e}createMesh(t,e,n){let s,r=null,o=null,a=[];if(t.children.forEach(function(l){e.has(l.ID)&&(r=e.get(l.ID)),n.has(l.ID)&&a.push(n.get(l.ID))}),a.length>1?o=a:a.length>0?o=a[0]:(o=new _a({name:rs.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(o)),"color"in r.attributes&&a.forEach(function(l){l.vertexColors=!0}),r.groups.length>0){let l=!1;for(let c=0,u=r.groups.length;c<u;c++){let h=r.groups[c];(h.materialIndex<0||h.materialIndex>=a.length)&&(h.materialIndex=a.length,l=!0)}if(l){let c=new _a;a.push(c)}}return r.FBX_Deformer?(s=new uh(r,o),s.normalizeSkinWeights()):s=new qi(r,o),s}createCurve(t,e){let n=t.children.reduce(function(r,o){return e.has(o.ID)&&(r=e.get(o.ID)),r},null),s=new fs({name:rs.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Jo(n,s)}getTransformData(t,e){let n={};"InheritType"in e&&(n.inheritType=parseInt(e.InheritType.value)),"RotationOrder"in e?n.eulerOrder=Q_(e.RotationOrder.value):n.eulerOrder=Q_(0),"Lcl_Translation"in e&&(n.translation=e.Lcl_Translation.value),"PreRotation"in e&&(n.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(n.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(n.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(n.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(n.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(n.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(n.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(n.rotationPivot=e.RotationPivot.value),t.userData.transformData=n}setLookAtProperties(t,e){"LookAtProperty"in e&&lr.get(t.ID).children.forEach(function(s){if(s.relationship==="LookAtProperty"){let r=Qn.Objects.Model[s.ID];if("Lcl_Translation"in r){let o=r.Lcl_Translation.value;t.target!==void 0?(t.target.position.fromArray(o),kr.add(t.target)):t.lookAt(new bt().fromArray(o))}}})}bindSkeleton(t,e,n){for(let s in t){let r=t[s],o=[];for(let l=0,c=r.bones.length;l<c;l++){let u=new tn;r.bones[l]&&r.rawBones[l]&&u.copy(r.rawBones[l].transformLink).invert(),o.push(u)}
4643lr.get(parseInt(r.ID)).parents.forEach(function(l){if(e.has(l.ID)){let c=l.ID;lr.get(c).parents.forEach(function(h){if(n.has(h.ID)){let d=n.get(h.ID);d.updateMatrixWorld(!0),d.bind(new hh(r.bones,o),d.matrixWorld)}})}})}}parsePoseNodes(){let t={};if("Pose"in Qn.Objects){let e=Qn.Objects.Pose;for(let n in e)if(e[n].attrType==="BindPose"&&e[n].NbPoseNodes>0){let s=e[n].PoseNode;Array.isArray(s)?s.forEach(function(r){t[r.Node]=new tn().fromArray(r.Matrix.a)}):t[s.Node]=new tn().fromArray(s.Matrix.a)}}return t}addGlobalSceneSettings(){if("GlobalSettings"in Qn){if("AmbientColor"in Qn.GlobalSettings){let t=Qn.GlobalSettings.AmbientColor.value,e=t[0],n=t[1],s=t[2];if(e!==0||n!==0||s!==0){let r=new Be().setRGB(e,n,s,Zn);kr.add(new Rg(r,1))}}"UnitScaleFactor"in Qn.GlobalSettings&&(kr.userData.unitScaleFactor=Qn.GlobalSettings.UnitScaleFactor.value)}}},Kz=class{constructor(){this.negativeMaterialIndices=!1}parse(t){let e=new Map;if("Geometry"in Qn.Objects){let n=Qn.Objects.Geometry;for(let s in n){let r=lr.get(parseInt(s)),o=this.parseGeometry(r,n[s],t);e.set(parseInt(s),o)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),e}parseGeometry(t,e,n){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,n);case"NurbsCurve":return this.parseNurbsGeometry(e)}}parseMeshGeometry(t,e,n){let s=n.skeletons,r=[],o=t.parents.map(function(h){return Qn.Objects.Model[h.ID]});if(o.length===0)return;let a=t.children.reduce(function(h,d){return s[d.ID]!==void 0&&(h=s[d.ID]),h},null);t.children.forEach(function(h){n.morphTargets[h.ID]!==void 0&&r.push(n.morphTargets[h.ID])});let l=o[0],c={};"RotationOrder"in l&&(c.eulerOrder=Q_(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);let u=int(c);return this.genGeometry(e,a,r,u)}genGeometry(t,e,n,s){let r=new kn;t.attrName&&(r.name=t.attrName);let o=this.parseGeoNode(t,e),a=this.genBuffers(o),l=new Ge(a.vertex,3);if(l.applyMatrix4(s),r.setAttribute("position",l),a.colors.length>0&&r.setAttribute("color",new Ge(a.colors,3)),e&&(r.setAttribute("skinIndex",new tf(a.weightsIndices,4)),r.setAttribute("skinWeight",new Ge(a.vertexWeights,4)),r.FBX_Deformer=e),a.normal.length>0){let c=new Vn().getNormalMatrix(s),u=new Ge(a.normal,3);u.applyNormalMatrix(c),r.setAttribute("normal",u)}
4643if(a.uvs.forEach(function(c,u){let h=u===0?"uv":`uv${u}`;r.setAttribute(h,new Ge(a.uvs[u],2))}),o.material&&o.material.mappingType!=="AllSame"){let c=a.materialIndex[0],u=0;if(a.materialIndex.forEach(function(h,d){h!==c&&(r.addGroup(u,d-u,c),c=h,u=d)}),r.groups.length>0){let h=r.groups[r.groups.length-1],d=h.start+h.count;d!==a.materialIndex.length&&r.addGroup(d,a.materialIndex.length-d,c)}r.groups.length===0&&r.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(r,t,n,s),r}parseGeoNode(t,e){let n={};if(n.vertexPositions=t.Vertices!==void 0?t.Vertices.a:[],n.vertexIndices=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],t.LayerElementColor&&t.LayerElementColor[0].Colors&&(n.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(n.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(n.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){n.uv=[];let s=0;for(;t.LayerElementUV[s];)t.LayerElementUV[s].UV&&n.uv.push(this.parseUVs(t.LayerElementUV[s])),s++}return n.weightTable={},e!==null&&(n.skeleton=e,e.rawBones.forEach(function(s,r){s.indices.forEach(function(o,a){n.weightTable[o]===void 0&&(n.weightTable[o]=[]),n.weightTable[o].push({id:r,weight:s.weights[a]})})})),n}genBuffers(t){let e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,s=0,r=!1,o=[],a=[],l=[],c=[],u=[],h=[],d=this;return t.vertexIndices.forEach(function(p,g){let y,x=!1;p<0&&(p=p^-1,x=!0);let w=[],M=[];if(o.push(p*3,p*3+1,p*3+2),t.color){let A=tP(g,n,p,t.color);l.push(A[0],A[1],A[2])}if(t.skeleton){if(t.weightTable[p]!==void 0&&t.weightTable[p].forEach(function(A){M.push(A.weight),w.push(A.id)}),M.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);let A=[0,0,0,0],C=[0,0,0,0];M.forEach(function(R,k){let O=R,I=w[k];C.forEach(function(U,V,q){if(O>U){q[V]=O,O=U;let X=A[V];A[V]=I,I=X}})}),w=A,M=C}for(;M.length<4;)M.push(0),w.push(0);for(let A=0;A<4;++A)u.push(M[A]),h.push(w[A])}if(t.normal){let A=tP(g,n,p,t.normal);a.push(A[0],A[1],A[2])}t.material&&t.material.mappingType!=="AllSame"&&(y=tP(g,n,p,t.material)[0],y<0&&(d.negativeMaterialIndices=!0,y=0)),t.uv&&t.uv.forEach(function(A,C){let R=tP(g,n,p,A);c[C]===void 0&&(c[C]=[]),c[C].push(R[0]),c[C].push(R[1])}),s++,x&&(d.genFace(e,t,o,y,a,l,c,u,h,s),n++,s=0,o=[],a=[],l=[],c=[],u=[],h=[])}),e}getNormalNewell(t){let e=new bt(0,0,0);for(let n=0;n<t.length;n++){let s=t[n],r=t[(n+1)%t.length];e.x+=(s.y-r.y)*(s.z+r.z),e.y+=(s.z-r.z)*(s.x+r.x),e.z+=(s.x-r.x)*(s.y+r.y)}return e.normalize(),e}getNormalTangentAndBitangent(t){let e=this.getNormalNewell(t),s=(Math.abs(e.z)>.5?new bt(0,1,0):new bt(0,0,1)).cross(e).normalize(),r=e.clone().cross(s).normalize();return{normal:e,tangent:s,bitangent:r}}flattenVertex(t,e,n){return new Ce(t.dot(e),t.dot(n))}genFace(t,e,n,s,r,o,a,l,c,u){let h;if(u>3){let d=[],p=e.baseVertexPositions||e.vertexPositions;for(let w=0;w<n.length;w+=3)d.push(new bt(p[n[w]],p[n[w+1]],p[n[w+2]]));let{tangent:g,bitangent:y}=this.getNormalTangentAndBitangent(d),x=[];for(let w of d)x.push(this.flattenVertex(w,g,y));h=xa.triangulateShape(x,[])}else h=[[0,1,2]];for(let[d,p,g]of h)t.vertex.push(e.vertexPositions[n[d*3]]),t.vertex.push(e.vertexPositions[n[d*3+1]]),t.vertex.push(e.vertexPositions[n[d*3+2]]),t.vertex.push(e.vertexPositions[n[p*3]]),t.vertex.push(e.vertexPositions[n[p*3+1]]),t.vertex.push(e.vertexPositions[n[p*3+2]]),t.vertex.push(e.vertexPositions[n[g*3]]),t.vertex.push(e.vertexPositions[n[g*3+1]]),t.vertex.push(e.vertexPositions[n[g*3+2]]),e.skeleton&&(t.vertexWeights.push(l[d*4]),t.vertexWeights.push(l[d*4+1]),t.vertexWeights.push(l[d*4+2]),t.vertexWeights.push(l[d*4+3]),t.vertexWeights.push(l[p*4]),t.vertexWeights.push(l[p*4+1]),t.vertexWeights.push(l[p*4+2]),t.vertexWeights.push(l[p*4+3]),t.vertexWeights.push(l[g*4]),t.vertexWeights.push(l[g*4+1]),t.vertexWeights.push(l[g*4+2]),t.vertexWeights.push(l[g*4+3]),t.weightsIndices.push(c[d*4]),t.weightsIndices.push(c[d*4+1]),t.weightsIndices.push(c[d*4+2]),t.weightsIndices.push(c[d*4+3]),t.weightsIndices.push(c[p*4]),t.weightsIndices.push(c[p*4+1]),t.weightsIndices.push(c[p*4+2]),t.weightsIndices.push(c[p*4+3]),t.weightsIndices.push(c[g*4]),t.weightsIndices.push(c[g*4+1]),t.weightsIndices.push(c[g*4+2]),t.weightsIndices.push(c[g*4+3])),e.color&&(t.colors.push(o[d*3]),t.colors.push(o[d*3+1]),t.colors.push(o[d*3+2]),t.colors.push(o[p*3]),t.colors.push(o[p*3+1]),t.colors.push(o[p*3+2]),t.colors.push(o[g*3]),t.colors.push(o[g*3+1]),t.colors.push(o[g*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(s),t.materialIndex.push(s),t.materialIndex.push(s)),e.normal&&(t.normal.push(r[d*3]),t.normal.push(r[d*3+1]),t.normal.push(r[d*3+2]),t.normal.push(r[p*3]),t.normal.push(r[p*3+1]),t.normal.push(r[p*3+2]),t.normal.push(r[g*3]),t.normal.push(r[g*3+1
4643]),t.normal.push(r[g*3+2])),e.uv&&e.uv.forEach(function(y,x){t.uvs[x]===void 0&&(t.uvs[x]=[]),t.uvs[x].push(a[x][d*2]),t.uvs[x].push(a[x][d*2+1]),t.uvs[x].push(a[x][p*2]),t.uvs[x].push(a[x][p*2+1]),t.uvs[x].push(a[x][g*2]),t.uvs[x].push(a[x][g*2+1])})}addMorphTargets(t,e,n,s){if(n.length===0)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];let r=s.clone().setPosition(0,0,0),o=this;n.forEach(function(a){a.rawTargets.forEach(function(l){let c=Qn.Objects.Geometry[l.geoID];c!==void 0&&o.genMorphGeometry(t,e,c,r,l.name)})})}genMorphGeometry(t,e,n,s,r){let o=e.Vertices!==void 0?e.Vertices.a:[],a=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],l=n.Vertices!==void 0?n.Vertices.a:[],c=n.Indexes!==void 0?n.Indexes.a:[],u=t.attributes.position.count*3,h=new Float32Array(u);for(let y=0;y<c.length;y++){let x=c[y]*3;h[x]=l[y*3],h[x+1]=l[y*3+1],h[x+2]=l[y*3+2]}let d={vertexIndices:a,vertexPositions:h,baseVertexPositions:o},p=this.genBuffers(d),g=new Ge(p.vertex,3);g.name=r||n.attrName,g.applyMatrix4(s),t.morphAttributes.position.push(g)}parseNormals(t){let e=t.MappingInformationType,n=t.ReferenceInformationType,s=t.Normals.a,r=[];return n==="IndexToDirect"&&("NormalIndex"in t?r=t.NormalIndex.a:"NormalsIndex"in t&&(r=t.NormalsIndex.a)),{dataSize:3,buffer:s,indices:r,mappingType:e,referenceType:n}}parseUVs(t){let e=t.MappingInformationType,n=t.ReferenceInformationType,s=t.UV.a,r=[];return n==="IndexToDirect"&&(r=t.UVIndex.a),{dataSize:2,buffer:s,indices:r,mappingType:e,referenceType:n}}parseVertexColors(t){let e=t.MappingInformationType,n=t.ReferenceInformationType,s=t.Colors.a,r=[];n==="IndexToDirect"&&(r=t.ColorIndex.a);for(let o=0,a=new Be;o<s.length;o+=4)a.fromArray(s,o),Rn.colorSpaceToWorking(a,Zn),a.toArray(s,o);return{dataSize:4,buffer:s,indices:r,mappingType:e,referenceType:n}}parseMaterialIndices(t){let e=t.MappingInformationType,n=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};let s=t.Materials.a,r=[];for(let o=0;o<s.length;++o)r.push(o);return{dataSize:1,buffer:s,indices:r,mappingType:e,referenceType:n}}parseNurbsGeometry(t){let e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new kn;let n=e-1,s=t.KnotVector.a,r=[],o=t.Points.a;for(let h=0,d=o.length;h<d;h+=4)r.push(new pi().fromArray(o,h));let a,l;if(t.Form==="Closed")r.push(r[0]);else if(t.Form==="Periodic"){a=n,l=s.length-1-a;for(let h=0;h<n;++h)r.push(r[h])}let u=new Qk(n,s,r,a,l).getPoints(r.length*12);return new kn().setFromPoints(u)}},Jz=class{constructor(t){this.trimAnimationClips=t}parse(){let t=[],e=this.parseClips();if(e!==void 0)for(let n in e){let s=e[n],r=this.addClip(s);t.push(r)}return t}parseClips(){if(Qn.Objects.AnimationCurve===void 0)return;let t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);let e=this.parseAnimationLayers(t);return this.parseAnimStacks(e)}parseAnimationCurveNodes(){let t=Qn.Objects.AnimationCurveNode,e=new Map;for(let n in t){let s=t[n];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){let r={id:s.id,attr:s.attrName,curves:{}};e.set(r.id,r)}}return e}parseAnimationCurves(t){let e=Qn.Objects.AnimationCurve;for(let n in e){let s={id:e[n].id,times:e[n].KeyTime.a.map($z),values:e[n].KeyValueFloat.a},r=lr.get(s.id);if(r!==void 0){let o=r.parents[0].ID,a=r.parents[0].relationship;a.match(/X/)?t.get(o).curves.x=s:a.match(/Y/)?t.get(o).curves.y=s:a.match(/Z/)?t.get(o).curves.z=s:a.match(/DeformPercent/)&&t.has(o)&&(t.get(o).curves.morph=s)}}}parseAnimationLayers(t){let e=Qn.Objects.AnimationLayer,n=new Map;for(let s in e){let r=[],o=lr.get(parseInt(s));o!==void 0&&(o.children.forEach(function(l,c){if(t.has(l.ID)){let u=t.get(l.ID);if(u.curves.x!==void 0||u.curves.y!==void 0||u.curves.z!==void 0){if(r[c]===void 0){let h=lr.get(l.ID).parents.filter(function(p){return p.relationship!==void 0});if(h.length===0)return;let d=h[0].ID;if(d!==void 0){let p=Qn.Objects.Model[d.toString()];if(p===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",l);return}let g={modelName:p.attrName?yi.sanitizeNodeName(p.attrName):"",ID:p.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};kr.traverse(function(y){y.ID===p.id&&(g.transform=y.matrix,y.userData.transformData&&(g.eulerOrder=y.userData.transformData.eulerOrder,y.userData.transformData.rotation&&(g.initialRotation=y.userData.transformData.rotation)))}),g.transform||(g.transform=new tn),"PreRotation"in p&&(g.preRotation=p.PreRotation.value),"PostRotation"in p&&(g.postRotation=p.PostRotation.value),r[c]=g}}r[c]&&(r[c][u.attr]=u)}else if(u.curves.morph!==void 0){if(r[c]===void 0){let h=lr.get(l.ID).parents.filter(function(M){return M.relationship!==void 0});if(h.length===0)return;let d=h[0].ID,p=lr.get(d).parents[0].ID,g=lr.get(p).parents[0].ID,y=lr.get(g).parents[0].ID,x=Qn.Objects.Model[y],w={modelName:x.attrName?yi.sanitizeNodeName(x.attrName):"",morphName:Qn.Objects.Deformer[d].attrName};r[c]=w}r[c][u.attr]=u}}}),n.set(parseInt(s),r))}return n}parseAnimStacks(t){let e=Qn.Objects.AnimationStack,n={};for(let s in e){let r=lr.get(parseInt(s)).children;r.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");let o=t.get(r[0].ID),a=e[s];n[s]={name:a.attrName,layer:o,localStart:a.LocalStart!==void 0?$z(Number(a.LocalStart.value)):0,localStop:a.LocalStop!==void 0?$z(Number(a.LocalStop.value)):0}}return n}addClip(t){let e=[],n=this;return t.layer.forEach(function(s){e=e.concat(n.generateTracks(s))}),this.trimAnimationClips===!0&&t.localStop>t.localStart&&(e=this.trimTracks(e,t.localStart,t.localStop)),new Cl(t.name,-1,e)}trimTracks(t,e,n){let s=Math.fround(e),r=Math.fround(n),o=[];for(let a=0;a<t.length;a++){let l=t[a],c=l.getValueSize(),u=[],h=[];for(let d=0;d<l.times.length;d++){let p=l.times[d];if(!(p<s||p>r)){u.push(p-s);for(let g=0;g<c;g++)h.push(l.values[d*c+g])}}u.length!==0&&(l.times=new Float32Array(u),l.values=new Float32Array(h),o.push(l))}return o}generateTracks(t){let e=[],n=new bt,s=new bt;if(t.transform&&t.transform.decompose(n,new Gi,s),n=n.toArray(),s=s.toArray(),t.T!==void 0&&Object.keys(t.T.curves).length>0){let r=this.generateVectorTrack(t.modelName,t.T.curves,n,"position");r!==void 0&&e.push(r)}if(t.R!==void 0&&Object.keys(t.R.curves).length>0){let r=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder,t.initialRotation);r!==void 0&&e.push(r)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){let r=this.generateVectorTrack(t.modelName,t.S.curves,s,"scale");r!==void 0&&e.push(r)}if(t.DeformPercent!==void 0){let r=this.generateMorphTrack(t);r!==void 0&&e.push(r)}return e}generateVectorTrack(t,e,n,s){let r=this.getTimesForAllAxes(e),o=this.getKeyframeTrackValues(r,e,n);return new bc(t+"."+s,r,o)}generateRotationTrack(t,e,n,s,r,o){let a,l;if(e.x!==void 0||e.y!==void 0||e.z!==void 0){let p=this.getTimesForAllAxes(e);if(p.length>0){let g=o||[0,0,0],y=this.synchronizeCurve(e.x,p,g[0]),x=this.synchronizeCurve(e.y,p,g[1]),w=this.synchronizeCurve(e.z,p,g[2]),M=this.interpolateRotations(y,x,w,r);a=M[0],l=M[1]}}let c=Q_(0);n!==void 0&&(n=n.map(mr.degToRad),n.push(c),n=new gr().fromArray(n),n=new Gi().setFromEuler(n)),s!==void 0&&(s=s.map(mr.degToRad),s.push(c),s=new gr().fromArray(s),s=new Gi().setFromEuler(s).invert());let u=new Gi,h=new gr,d=[];if(!(!l||!a)){for(let p=0;p<l.length;p+=3)h.set(l[p],l[p+1],l[p+2],r),u.setFromEuler(h),n!==void 0&&u.premultiply(n),s!==void 0&&u.multiply(s),p>2&&new Gi().fromArray(d,(p-3)/3*4).dot(u)<0&&u.set(-u.x,-u.y,-u.z,-u.w),u.toArray(d,p/3*4);return new Sl(t+".quaternion",a,d)}}generateMorphTrack(t){let e=t.DeformPercent.curves.morph,n=e.values.map(function(r){return r/100}),s=kr.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new _l(t.modelName+".morphTargetInfluences["+s+"]",e.times,n)}getTimesForAllAxes(t){let e=[];
4643if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(n,s){return n-s}),e.length>1){let n=1,s=e[0];for(let r=1;r<e.length;r++){let o=e[r];o!==s&&(e[n]=o,s=o,n++)}e=e.slice(0,n)}return e}getKeyframeTrackValues(t,e,n){let s=n,r=[],o=-1,a=-1,l=-1;return t.forEach(function(c){if(e.x&&(o=e.x.times.indexOf(c)),e.y&&(a=e.y.times.indexOf(c)),e.z&&(l=e.z.times.indexOf(c)),o!==-1){let u=e.x.values[o];r.push(u),s[0]=u}else r.push(s[0]);if(a!==-1){let u=e.y.values[a];r.push(u),s[1]=u}else r.push(s[1]);if(l!==-1){let u=e.z.values[l];r.push(u),s[2]=u}else r.push(s[2])}),r}synchronizeCurve(t,e,n){if(t===void 0)return{times:e,values:e.map(()=>n)};if(t.times.length===e.length)return t;let s=[];for(let r=0;r<e.length;r++)s.push(this.sampleCurveValue(t,e[r],n));return{times:e,values:s}}sampleCurveValue(t,e,n){let s=t.times,r=t.values;if(e<=s[0])return r[0];if(e>=s[s.length-1])return r[r.length-1];for(let o=0;o<s.length-1;o++)if(e>=s[o]&&e<=s[o+1]){if(s[o]===e)return r[o];let a=(e-s[o])/(s[o+1]-s[o]);return r[o]*(1-a)+r[o+1]*a}return n}interpolateRotations(t,e,n,s){let r=[],o=[];r.push(t.times[0]),o.push(mr.degToRad(t.values[0])),o.push(mr.degToRad(e.values[0])),o.push(mr.degToRad(n.values[0]));for(let a=1;a<t.values.length;a++){let l=[t.values[a-1],e.values[a-1],n.values[a-1]];if(isNaN(l[0])||isNaN(l[1])||isNaN(l[2]))continue;let c=l.map(mr.degToRad),u=[t.values[a],e.values[a],n.values[a]];if(isNaN(u[0])||isNaN(u[1])||isNaN(u[2]))continue;let h=u.map(mr.degToRad),d=[u[0]-l[0],u[1]-l[1],u[2]-l[2]],p=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(p[0]>=180||p[1]>=180||p[2]>=180){let y=Math.max(...p)/180,x=new gr(...c,s),w=new gr(...h,s),M=new Gi().setFromEuler(x),A=new Gi().setFromEuler(w);M.dot(A)<0&&A.set(-A.x,-A.y,-A.z,-A.w);let C=t.times[a-1],R=t.times[a]-C,k=new Gi,O=new gr;for(let I=0;I<1;I+=1/y)k.copy(M.clone().slerp(A.clone(),I)),r.push(C+I*R),O.setFromQuaternion(k,s),o.push(O.x),o.push(O.y),o.push(O.z)}else r.push(t.times[a]),o.push(mr.degToRad(t.values[a])),o.push(mr.degToRad(e.values[a])),o.push(mr.degToRad(n.values[a]))}return[r,o]}},Zz=class{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(t){this.nodeStack.push(t),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(t,e){this.currentProp=t,this.currentPropName=e}parse(t){this.currentIndent=0,this.allNodes=new nP,this.nodeStack=[],this.currentProp=[],this.currentPropName="";let e=this,n=t.split(/[\r\n]+/);return n.forEach(function(s,r){let o=s.match(/^[\s\t]*;/),a=s.match(/^[\s\t]*$/);if(o||a)return;let l=s.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){",""),c=s.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=s.match("^\\t{"+(e.currentIndent-1)+"}}");l?e.parseNodeBegin(s,l):c?e.parseNodeProperty(s,c,n[++r]):u?e.popStack():s.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(s)}),this.allNodes}parseNodeBegin(t,e){let n=e[1].trim().replace(/^"/,"").replace(/"$/,""),s=e[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),r={name:n},o=this.parseNodeAttr(s),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,r):n in a?(n==="PoseNode"?a.PoseNode.push(r):a[n].id!==void 0&&(a[n]={},a[n][a[n].id]=a[n]),o.id!==""&&(a[n][o.id]=r)):typeof o.id=="number"?(a[n]={},a[n][o.id]=r):n!=="Properties70"&&(n==="PoseNode"?a[n]=[r]:a[n]=r),typeof o.id=="number"&&(r.id=o.id),o.name!==""&&(r.attrName=o.name),o.type!==""&&(r.attrType=o.type),this.pushStack(r)}parseNodeAttr(t){let e=t[0];t[0]!==""&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));let n="",s="";return t.length>1&&(n=t[1].replace(/^(\w+)::/,""),s=t[2]),{id:e,name:n,type:s}}parseNodeProperty(t,e,n){let s=e[1].replace(/^"/,"").replace(/"$/,"").trim(),r=e[2].replace(/^"/,"").replace(/"$/,"").trim();s==="Content"&&r===","&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());let o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(t,s,r);return}if(s==="C"){let l=r.split(",").slice(1),c=parseInt(l[0]),u=parseInt(l[1]),h=r.split(",").slice(3);h=h.map(function(d){return d.trim().replace(/^"/,"")}),s="connections",r=[c,u],cOt(r,h),o[s]===void 0&&(o[s]=[])}s==="Node"&&(o.id=r),s in o&&Array.isArray(o[s])?o[s].push(r):s!=="a"?o[s]=r:o.a=r,this.setCurrentProp(o,s),s==="a"&&r.slice(-1)!==","&&(o.a=qz(r))}parseNodePropertyContinued(t){let e=this.getCurrentNode();e.a+=t,t.slice(-1)!==","&&(e.a=qz(e.a))}parseNodeSpecialProperty(t,e,n){let s=n.split('",').map(function(u){return u.trim().replace(/^\"/,"").replace(/\s/,"_")}
4643),r=s[0],o=s[1],a=s[2],l=s[3],c=s[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=qz(c);break}this.getPrevNode()[r]={type:o,type2:a,flag:l,value:c},this.setCurrentProp(this.getPrevNode(),r)}},Qz=class{parse(t){let e=new eP(t);e.skip(23);let n=e.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);let s=new nP;for(;!this.endOfContent(e);){let r=this.parseNode(e,n);r!==null&&s.add(r.name,r)}return s}endOfContent(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()}parseNode(t,e){let n={},s=e>=7500?t.getUint64():t.getUint32(),r=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();let o=t.getUint8(),a=t.getString(o);if(s===0)return null;let l=[];for(let d=0;d<r;d++)l.push(this.parseProperty(t));let c=l.length>0?l[0]:"",u=l.length>1?l[1]:"",h=l.length>2?l[2]:"";for(n.singleProperty=r===1&&t.getOffset()===s;s>t.getOffset();){let d=this.parseNode(t,e);d!==null&&this.parseSubNode(a,n,d)}return n.propertyList=l,typeof c=="number"&&(n.id=c),u!==""&&(n.attrName=u),h!==""&&(n.attrType=h),a!==""&&(n.name=a),n}parseSubNode(t,e,n){if(n.singleProperty===!0){let s=n.propertyList[0];Array.isArray(s)?(e[n.name]=n,n.a=s):e[n.name]=s}else if(t==="Connections"&&n.name==="C"){let s=[];n.propertyList.forEach(function(r,o){o!==0&&s.push(r)}),e.connections===void 0&&(e.connections=[]),e.connections.push(s)}else if(n.name==="Properties70")Object.keys(n).forEach(function(r){e[r]=n[r]});else if(t==="Properties70"&&n.name==="P"){let s=n.propertyList[0],r=n.propertyList[1],o=n.propertyList[2],a=n.propertyList[3],l;s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),r==="Color"||r==="ColorRGB"||r==="Vector"||r==="Vector3D"||r.indexOf("Lcl_")===0?l=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:l=n.propertyList[4],e[s]={type:r,type2:o,flag:a,value:l}}else e[n.name]===void 0?typeof n.id=="number"?(e[n.name]={},e[n.name][n.id]=n):e[n.name]=n:n.name==="PoseNode"?(Array.isArray(e[n.name])||(e[n.name]=[e[n.name]]),e[n.name].push(n)):e[n.name][n.id]===void 0&&(e[n.name][n.id]=n)}parseProperty(t){let e=t.getString(1),n;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return n=t.getUint32(),t.getArrayBuffer(n);case"S":return n=t.getUint32(),t.getString(n);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":let s=t.getUint32(),r=t.getUint32(),o=t.getUint32();if(r===0)switch(e){case"b":case"c":return t.getBooleanArray(s);case"d":return t.getFloat64Array(s);case"f":return t.getFloat32Array(s);case"i":return t.getInt32Array(s);case"l":return t.getInt64Array(s)}let a=Xet(new Uint8Array(t.getArrayBuffer(o))),l=new eP(a.buffer);switch(e){case"b":case"c":return l.getBooleanArray(s);case"d":return l.getFloat64Array(s);case"f":return l.getFloat32Array(s);case"i":return l.getInt32Array(s);case"l":return l.getInt64Array(s)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}}},eP=class{constructor(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=e!==void 0?e:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(t){this.offset+=t}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(t){let e=[];for(let n=0;n<t;n++)e.push(this.getBoolean());return e}getUint8(){let t=this.dv.getUint8(this.offset);return this.offset+=1,t}getInt16(){let t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}getInt32(){let t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}getInt32Array(t){let e=[];for(let n=0;n<t;n++)e.push(this.getInt32());return e}getUint32(){let t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}getInt64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e&2147483648?(e=~e&4294967295,t=~t&4294967295,t===4294967295&&(e=e+1&4294967295),t=t+1&4294967295,-(e*4294967296+t)):e*4294967296+t}getInt64Array(t){let e=[];for(let n=0;n<t;n++)e.push(this.getInt64());return e}getUint64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e*4294967296+t}getFloat32(){let t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}getFloat32Array(t){let e=[];for(let n=0;n<t;n++)e.push(this.getFloat32());return e}getFloat64(){let t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}getFloat64Array(t){let e=[];for(let n=0;n<t;n++)e.push(this.getFloat64());return e}getArrayBuffer(t){let e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}getString(t){let e=this.offset,n=new Uint8Array(this.dv.buffer,e,t);this.skip(t);let s=n.indexOf(0);return s>=0&&(n=new Uint8Array(this.dv.buffer,e,s)),this._textDecoder.decode(n)}},nP=class{add(t,e){this[t]=e}};lOt=[];Gz=new gr,Cv=new bt});var Eit=uo(()=>{function A3t(i,t,e){let n="",s=e?.dataset?.turboConfirmText||t.dataset.turboConfirmText,r=e?.dataset?.turboConfirmDescription||t.dataset.turboConfirmDescription||"";s&&(n='<input type="text" class="bs-input" style="margin-top: 12px;" data-behavior="confirm-text" />');let o=`confirm-modal-${new Date().getTime()}`,a=`
4644    <div id="${o}" style="position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 16px;">
4645      <div class="bs-card" style="max-width: 440px; width: 100%; padding: 24px;">
4646        <h5 style="font-size: 16px; font-weight: 600; color: var(--bs-fg); margin: 0;">${i}</h5>
4647        ${r?`<p style="margin-top: 12px; font-size: 13px; color: var(--bs-fg-mute);">${r}</p>`:""}
4648
4649        ${n}
4650
4651        <div style="display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px;">
4652          <button data-behavior="cancel" class="bs-btn bs-btn-ghost">Cancel</button>
4653          <button data-behavior="commit" class="bs-btn" style="background: var(--bs-err-soft); color: var(--bs-err); border-color: transparent;">Confirm</button>
4654        </div>
4655      </div>
4656    </div>
4657  `;document.body.insertAdjacentHTML("beforeend",a);
4657let l=document.getElementById(o);if(l.querySelector("button").focus(),s){let c=l.querySelector("[data-behavior='commit']");c.disabled=!0,l.querySelector("input[data-behavior='confirm-text']").addEventListener("input",u=>{c.disabled=u.target.value!=s})}return l}typeof Turbo<"u"&&Turbo.config?.forms&&(Turbo.config.forms.confirm=(i,t,e)=>{let n=A3t(i,t,e);return new Promise((s,r)=>{n.querySelector("[data-behavior='cancel']").addEventListener("click",o=>{n.remove(),s(!1)},{once:!0}),n.querySelector("[data-behavior='commit']").addEventListener("click",o=>{n.remove(),s(!0)},{once:!0})})})});var kit=uo(()=>{addEventListener("direct-upload:initialize",i=>{let{target:t,detail:e}=i,{id:n,file:s}=e;t.insertAdjacentHTML("beforebegin",`
4658    <div id="direct-upload-${n}" class="direct-upload direct-upload--pending">
4659      <div id="direct-upload-progress-${n}" class="direct-upload__progress" style="width: 0%"></div>
4660      <span class="direct-upload__filename">${s.name}</span>
4661    </div>
4662  `)});addEventListener("direct-upload:start",i=>{let{id:t}=i.detail;document.getElementById(`direct-upload-${t}`).classList.remove("direct-upload--pending")});addEventListener("direct-upload:progress",i=>{let{id:t,progress:e}=i.detail,n=document.getElementById(`direct-upload-progress-${t}`);n.style.width=`${e}%`});addEventListener("direct-upload:error",i=>{i.preventDefault();let{id:t,error:e}=i.detail,n=document.getElementById(`direct-upload-${t}`);n.classList.add("direct-upload--error"),n.setAttribute("title",e)});addEventListener("direct-upload:end",i=>{let{id:t}=i.detail;document.getElementById(`direct-upload-${t}`).classList.add("direct-upload--complete")}
4662)});var Pit=uo(()=>{document.addEventListener("turbo:load",()=>{document.querySelectorAll("[data-src]").forEach(i=>{i.setAttribute("src",i.getAttribute("data-src"))})})});var Dit=uo((d_e,EP)=>{(function(i){var t=(function(){"use strict";var e="s",n={DAY:864e5,HOUR:36e5,MINUTE:6e4,SECOND:1e3,BASELINE_YEAR:2014,MAX_SCORE:864e6,AMBIGUITIES:{"America/Denver":["America/Mazatlan"],"Europe/London":["Africa/Casablanca"],"America/Chicago":["America/Mexico_City"],"America/Asuncion":["America/Campo_Grande","America/Santiago"],"America/Montevideo":["America/Sao_Paulo","America/Santiago"],"Asia/Beirut":["Asia/Amman","Asia/Jerusalem","Europe/Helsinki","Asia/Damascus","Africa/Cairo","Asia/Gaza","Europe/Minsk"],"Pacific/Auckland":["Pacific/Fiji"],"America/Los_Angeles":["America/Santa_Isabel"],"America/New_York":["America/Havana"],"America/Halifax":["America/Goose_Bay"],"America/Godthab":["America/Miquelon"],"Asia/Dubai":["Asia/Yerevan"],"Asia/Jakarta":["Asia/Krasnoyarsk"],"Asia/Shanghai":["Asia/Irkutsk","Australia/Perth"],"Australia/Sydney":["Australia/Lord_Howe"],"Asia/Tokyo":["Asia/Yakutsk"],"Asia/Dhaka":["Asia/Omsk"],"Asia/Baku":["Asia/Yerevan"],"Australia/Brisbane":["Asia/Vladivostok"],"Pacific/Noumea":["Asia/Vladivostok"],"Pacific/Majuro":["Asia/Kamchatka","Pacific/Fiji"],"Pacific/Tongatapu":["Pacific/Apia"],"Asia/Baghdad":["Europe/Minsk","Europe/Moscow"],"Asia/Karachi":["Asia/Yekaterinburg"],"Africa/Johannesburg":["Asia/Gaza","Africa/Cairo"]}},s=function(g){var y=-g.getTimezoneOffset();return y!==null?y:0},r=function(){var g=s(new Date(n.BASELINE_YEAR,0,2)),y=s(new Date(n.BASELINE_YEAR,5,2)),x=g-y;return x<0?g+",1":x>0?y+",1,"+e:g+",0"},o=function(){var g,y;if(!(typeof Intl>"u"||typeof Intl.DateTimeFormat>"u")&&(g=Intl.DateTimeFormat(),!(typeof g>"u"||typeof g.resolvedOptions>"u")&&(y=g.resolvedOptions().timeZone,y&&(y.indexOf("/")>-1||y==="UTC")&&y.indexOf("Etc")!=0)))return y},a=function(g){for(var y=new Date(g,0,1,0,0,1,0).getTime(),x=new Date(g,12,31,23,59,59).getTime(),w=y,M=new Date(w).getTimezoneOffset(),A=null,C=null;w<x-864e5;){var R=new Date(w),k=R.getTimezoneOffset();k!==M&&(k<M&&(A=R),k>M&&(C=R),M=k),w+=864e5}return A&&C?{s:l(A).getTime(),e:l(C).getTime()}:!1},l=function p(g,y,x){typeof y>"u"&&(y=n.DAY,x=n.HOUR);for(var w=new Date(g.getTime()-y).getTime(),M=g.getTime()+y,A=new Date(w).getTimezoneOffset(),C=w,R=null;C<M-x;){var k=new Date(C),O=k.getTimezoneOffset();if(O!==A){R=k;break}C+=x}return y===n.DAY?p(R,n.HOUR,n.MINUTE):y===n.HOUR?p(R,n.MINUTE,n.SECOND):R},c=function(g,y,x,w){if(x!=="N/A")return x;if(y==="Asia/Beirut"){if(w.name==="Africa/Cairo"&&g[6].s===13983768e5&&g[6].e===14116788e5||w.name==="Asia/Jerusalem"&&g[6].s===13959648e5&&g[6].e===14118588e5)return 0}else if(y==="America/Santiago"){if(w.name==="America/Asuncion"&&g[6].s===14124816e5&&g[6].e===1397358e6||w.name==="America/Campo_Grande"&&g[6].s===14136912e5&&g[6].e===13925196e5)return 0}else if(y==="America/Montevideo"){if(w.name==="America/Sao_Paulo"&&g[6].s===14136876e5&&g[6].e===1392516e6)return 0}else if(y==="Pacific/Auckland"&&w.name==="Pacific/Fiji"&&g[6].s===14142456e5&&g[6].e===13961016e5)return 0;return x},u=function(g,y){for(var x=function(q){for(var X=0,j=0;j<g.length;j++)if(q.rules[j]&&g[j]){if(g[j].s>=q.rules[j].s&&g[j].e<=q.rules[j].e)X=0,X+=Math.abs(g[j].s-q.rules[j].s),X+=Math.abs(q.rules[j].e-g[j].e);else{X="N/A";break}if(X>n.MAX_SCORE){X="N/A";break}}return X=c(g,y,X,q),X},w={},M=t.olson.dst_rules.zones,A=M.length,C=n.AMBIGUITIES[y],R=0;R<A;R++){var k=M[R],O=x(M[R]);O!=="N/A"&&(w[k.name]=O)}for(var I in w)if(w.hasOwnProperty(I)){for(var U=0;U<C.length;U++)if(C[U]===I)return I}return y},h=function(g){var y=function(){for(var C=[],R=0;R<t.olson.dst_rules.years.length;R++){var k=a(t.olson.dst_rules.years[R]);C.push(k)}return C},x=function(C){for(var R=0;R<C.length;R++)if(C[R]!==!1)return!0;return!1},w=y(),M=x(w);return M?u(w,g):g},d=function(){var g=o();return g||(g=t.olson.timezones[r()],typeof n.AMBIGUITIES[g]<"u"&&(g=h(g))),{name:function(){return g},stdTimezoneOffset:function(){return-r().split(",")[0]},timezoneOffset:function(){return-s(new Date)}}};return{determine:d}})();t.olson=t.olson||{},t.olson.timezones={"-720,0":"Etc/GMT+12","-660,0":"Pacific/Pago_Pago","-660,1,s":"Pacific/Apia","-600,1":"America/Adak","-600,0":"Pacific/Honolulu","-570,0":"Pacific/Marquesas","-540,0":"Pacific/Gambier","-540,1":"America/Anchorage","-480,1":"America/Los_Angeles","-480,0":"Pacific/Pitcairn","-420,0":"America/Phoenix","-420,1":"America/Denver","-360,0":"America/Guatemala","-360,1":"America/Chicago","-360,1,s":"Pacific/Easter","-300,0":"America/Bogota","-300,1":"America/Ne
4662w_York","-270,0":"America/Caracas","-240,1":"America/Halifax","-240,0":"America/Santo_Domingo","-240,1,s":"America/Asuncion","-210,1":"America/St_Johns","-180,1":"America/Godthab","-180,0":"America/Argentina/Buenos_Aires","-180,1,s":"America/Montevideo","-120,0":"America/Noronha","-120,1":"America/Noronha","-60,1":"Atlantic/Azores","-60,0":"Atlantic/Cape_Verde","0,0":"UTC","0,1":"Europe/London","60,1":"Europe/Berlin","60,0":"Africa/Lagos","60,1,s":"Africa/Windhoek","120,1":"Asia/Beirut","120,0":"Africa/Johannesburg","180,0":"Asia/Baghdad","180,1":"Europe/Moscow","210,1":"Asia/Tehran","240,0":"Asia/Dubai","240,1":"Asia/Baku","270,0":"Asia/Kabul","300,1":"Asia/Yekaterinburg","300,0":"Asia/Karachi","330,0":"Asia/Kolkata","345,0":"Asia/Kathmandu","360,0":"Asia/Dhaka","360,1":"Asia/Omsk","390,0":"Asia/Rangoon","420,1":"Asia/Krasnoyarsk","420,0":"Asia/Jakarta","480,0":"Asia/Shanghai","480,1":"Asia/Irkutsk","525,0":"Australia/Eucla","525,1,s":"Australia/Eucla","540,1":"Asia/Yakutsk","540,0":"Asia/Tokyo","570,0":"Australia/Darwin","570,1,s":"Australia/Adelaide","600,0":"Australia/Brisbane","600,1":"Asia/Vladivostok","600,1,s":"Australia/Sydney","630,1,s":"Australia/Lord_Howe","660,1":"Asia/Kamchatka","660,0":"Pacific/Noumea","690,0":"Pacific/Norfolk","720,1,s":"Pacific/Auckland","720,0":"Pacific/Majuro","765,1,s":"Pacific/Chatham","780,0":"Pacific/Tongatapu","780,1,s":"Pacific/Apia","840,0":"Pacific/Kiritimati"},t.olson.dst_rules={years:[2008,2009,2010,2011,2012,2013,2014],zones:[{name:"Africa/Cairo",rules:[{e:12199572e5,s:12090744e5},{e:1250802e6,s:1240524e6},{e:12858804e5,s:12840696e5},!1,!1,!1,{e:14116788e5,s:1406844e6}]},{name:"Africa/Casablanca",rules:[{e:12202236e5,s:12122784e5},{e:12508092e5,s:12438144e5},{e:1281222e6,s:12727584e5},{e:13120668e5,s:13017888e5},{e:13489704e5,s:1345428e6},{e:13828392e5,s:13761e8},{e:14142888e5,s:14069448e5}]},{name:"America/Asuncion",rules:[{e:12050316e5,s:12243888e5},{e:12364812e5,s:12558384e5},{e:12709548e5,s:12860784e5},{e:13024044e5,s:1317528e6},{e:1333854e6,s:13495824e5},{e:1364094e6,s:1381032e6},{e:13955436e5,s:14124816e5}]},{name:"America/Campo_Grande",rules:[{e:12032172e5,s:12243888e5},{e:12346668e5,s:12558384e5},{e:12667212e5,s:1287288e6},{e:12981708e5,s:13187376e5},{e:13302252e5,s:1350792e6},{e:136107e7,s:13822416e5},{e:13925196e5,s:14136912e5}]},{name:"America/Goose_Bay",rules:[{e:122559486e4,s:120503526e4},{e:125704446e4,s:123648486e4},{e:128909886e4,s:126853926e4},{e:13205556e5,s:129998886e4},{e:13520052e5,s:13314456e5},{e:13834548e5,s:13628952e5},{e:14149044e5,s:13943448e5}]},{name:"America/Havana",rules:[{e:12249972e5,s:12056436e5},{e:12564468e5,s:12364884e5},{e:12885012e5,s:12685428e5},{e:13211604e5,s:13005972e5},{e:13520052e5,s:13332564e5},{e:13834548e5,s:13628916e5},{e:14149044e5,s:13943412e5}]},{name:"America/Mazatlan",rules:[{e:1225008e6,s:12074724e5},{e:12564576e5,s:1238922e6},{e:1288512e6,s:12703716e5},{e:13199616e5,s:13018212e5},{e:13514112e5,s:13332708e5},{e:13828608e5,s:13653252e5},{e:14143104e5,s:13967748e5}]},{name:"America/Mexico_City",rules:[{e:12250044e5,s:12074688e5},{e:1256454e6,s:12389184e5},{e:12885084e5,s:1270368e6},{e:1319958e6,s:13018176e5},{e:13514076e5,s:13332672e5},{e:13828572e5,s:13653216e5},{e:14143068e5,s:13967712e5}]},{name:"America/Miquelon",rules:[{e:12255984e5,s:12050388e5},{e:1257048e6,s:12364884e5},{e:12891024e5,s:12685428e5},{e:1320552e6,s:12999924e5},{e:13520016e5,s:1331442e6},{e:13834512e5,s:13628916e5},{e:14149008e5,s:13943412e5}]},{name:"America/Santa_Isabel",rules:[{e:12250116e5,s:1207476e6},{e:12564612e5,s:12389256e5},{e:12885156e5,s:12703752e5},{e:13199652e5,s:13018248e5},{e:13514148e5,s:13332744e5},{e:13828644e5,s:13653288e5},{e:1414314e6,s:13967784e5}]},{name:"America/Santiago",rules:[{e:1206846e6,s:1223784e6},{e:1237086e6,s:12552336e5},{e:127035e7,s:12866832e5},{e:13048236e5,s:13138992e5},{e:13356684e5,s:13465584e5},{e:1367118e6,s:13786128e5},{e:13985676e5,s:14100624e5}]},{name:"America/Sao_Paulo",rules:[{e:12032136e5,s:12243852e5},{e:12346632e5,s:12558348e5},{e:12667176e5,s:12872844e5},{e:12981672e5,s:1318734e6},{e:13302216e5,s:13507884e5},{e:13610664e5,s:1382238e6},{e:1392516e6,s:14136876e5}]},{name:"Asia/Amman",rules:[{e:1225404e6,s:12066552e5},{e:12568536e5,s:12381048e5},{e:12883032e5,s:12695544e5},{e:13197528e5,s:13016088e5},!1,!1,{e:14147064e5,s:13959576e5}]},{name:"Asia/Damascus",rules:[{e:12254868e5,s:120726e7},{e:125685e7,s:12381048e5},{e:12882996e5,s:12701592e5},{e:13197492e5,s:13016088e5},{e:13511988e5,s:13330584e5},{e:13826484e5,s:1364508e6},{e:14147028e5,s:13959576e5}]}
4662,{name:"Asia/Dubai",rules:[!1,!1,!1,!1,!1,!1,!1]},{name:"Asia/Gaza",rules:[{e:12199572e5,s:12066552e5},{e:12520152e5,s:12381048e5},{e:1281474e6,s:126964086e4},{e:1312146e6,s:130160886e4},{e:13481784e5,s:13330584e5},{e:13802292e5,s:1364508e6},{e:1414098e6,s:13959576e5}]},{name:"Asia/Irkutsk",rules:[{e:12249576e5,s:12068136e5},{e:12564072e5,s:12382632e5},{e:12884616e5,s:12697128e5},!1,!1,!1,!1]},{name:"Asia/Jerusalem",rules:[{e:12231612e5,s:12066624e5},{e:1254006e6,s:1238112e6},{e:1284246e6,s:12695616e5},{e:131751e7,s:1301616e6},{e:13483548e5,s:13330656e5},{e:13828284e5,s:13645152e5},{e:1414278e6,s:13959648e5}]},{name:"Asia/Kamchatka",rules:[{e:12249432e5,s:12067992e5},{e:12563928e5,s:12382488e5},{e:12884508e5,s:12696984e5},!1,!1,!1,!1]},{name:"Asia/Krasnoyarsk",rules:[{e:12249612e5,s:12068172e5},{e:12564108e5,s:12382668e5},{e:12884652e5,s:12697164e5},!1,!1,!1,!1]},{name:"Asia/Omsk",rules:[{e:12249648e5,s:12068208e5},{e:12564144e5,s:12382704e5},{e:12884688e5,s:126972e7},!1,!1,!1,!1]},{name:"Asia/Vladivostok",rules:[{e:12249504e5,s:12068064e5},{e:12564e8,s:1238256e6},{e:12884544e5,s:12697056e5},!1,!1,!1,!1]},{name:"Asia/Yakutsk",rules:[{e:1224954e6,s:120681e7},{e:12564036e5,s:12382596e5},{e:1288458e6,s:12697092e5},!1,!1,!1,!1]},{name:"Asia/Yekaterinburg",rules:[{e:12249684e5,s:12068244e5},{e:1256418e6,s:1238274e6},{e:12884724e5,s:12697236e5},!1,!1,!1,!1]},{name:"Asia/Yerevan",rules:[{e:1224972e6,s:1206828e6},{e:12564216e5,s:12382776e5},{e:1288476e6,s:12697272e5},{e:13199256e5,s:13011768e5},!1,!1,!1]},{name:"Australia/Lord_Howe",rules:[{e:12074076e5,s:12231342e5},{e:12388572e5,s:12545838e5},{e:12703068e5,s:12860334e5},{e:13017564e5,s:1317483e6},{e:1333206e6,s:13495374e5},{e:13652604e5,s:1380987e6},{e:139671e7,s:14124366e5}]},{name:"Australia/Perth",rules:[{e:12068136e5,s:12249576e5},!1,!1,!1,!1,!1,!1]},{name:"Europe/Helsinki",rules:[{e:12249828e5,s:12068388e5},{e:12564324e5,s:12382884e5},{e:12884868e5,s:1269738e6},{e:13199364e5,s:13011876e5},{e:1351386e6,s:13326372e5},{e:13828356e5,s:13646916e5},{e:14142852e5,s:13961412e5}]},{name:"Europe/Minsk",rules:[{e:12249792e5,s:12068352e5},{e:12564288e5,s:12382848e5},{e:12884832e5,s:12697344e5},!1,!1,!1,!1]},{name:"Europe/Moscow",rules:[{e:12249756e5,s:12068316e5},{e:12564252e5,s:12382812e5},{e:12884796e5,s:12697308e5},!1,!1,!1,!1]},{name:"Pacific/Apia",rules:[!1,!1,!1,{e:13017528e5,s:13168728e5},{e:13332024e5,s:13489272e5},{e:13652568e5,s:13803768e5},{e:13967064e5,s:14118264e5}]},{name:"Pacific/Fiji",rules:[!1,!1,{e:12696984e5,s:12878424e5},{e:13271544e5,s:1319292e6},{e:1358604e6,s:13507416e5},{e:139005e7,s:1382796e6},{e:14215032e5,s:14148504e5}]},{name:"Europe/London",rules:[{e:12249828e5,s:12068388e5},{e:12564324e5,s:12382884e5},{e:12884868e5,s:1269738e6},{e:13199364e5,s:13011876e5},{e:1351386e6,s:13326372e5},{e:13828356e5,s:13646916e5},{e:14142852e5,s:13961412e5}]}]},typeof EP<"u"&&typeof EP.exports<"u"?EP.exports=t:typeof define<"u"&&define!==null&&define.amd!=null?define([],function(){return t}):typeof i>"u"?window.jstz=t:i.jstz=t})()});var Iit=uo((f_e,Lit)=>{Lit.exports=Dit()});var FV=uo(()=>{(()=>{var i=!1,t=!1,e=[];function n(L){s(L)}function s(L){e.includes(L)||e.push(L),o()}function r(L){let H=e.indexOf(L);H!==-1&&e.splice(H,1)}function o(){!t&&!i&&(i=!0,queueMicrotask(a))}function a(){i=!1,t=!0;for(let L=0;L<e.length;L++)e[L]();e.length=0,t=!1}var l,c,u,h,d=!0;function p(L){d=!1,L(),d=!0}function g(L){l=L.reactive,u=L.release,c=H=>L.effect(H,{scheduler:Q=>{d?n(Q):Q()}}),h=L.raw}function y(L){c=L}function x(L){let H=()=>{};return[Q=>{let dt=c(Q);return L._x_effects||(L._x_effects=new Set,L._x_runEffects=()=>{L._x_effects.forEach(Ct=>Ct())}),L._x_effects.add(dt),H=()=>{dt!==void 0&&(L._x_effects.delete(dt),u(dt))},dt},()=>{H()}]}var w=[],M=[],A=[];function C(L){A.push(L)}function R(L,H){typeof H=="function"?(L._x_cleanups||(L._x_cleanups=[]),L._x_cleanups.push(H)):(H=L,M.push(H))}function k(L){w.push(L)}function O(L,H,Q){L._x_attributeCleanups||(L._x_attributeCleanups={}),L._x_attributeCleanups[H]||(L._x_attributeCleanups[H]=[]),L._x_attributeCleanups[H].push(Q)}function I(L,H){!L._x_attributeCleanups||Object.entries(L._x_attributeCleanups).forEac
vendor: 4,466 bytes, lines 4662-4666
4662h(([Q,dt])=>{(H===void 0||H.includes(Q))&&(dt.forEach(Ct=>Ct()),delete L._x_attributeCleanups[Q])})}var U=new MutationObserver(kt),V=!1;function q(){U.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),V=!0}function X(){_(),U.disconnect(),V=!1}var j=[],W=!1;function _(){j=j.concat(U.takeRecords()),j.length&&!W&&(W=!0,queueMicrotask(()=>{at(),W=!1}))}function at(){kt(j),j.length=0}function ct(L){if(!V)return L();X();let H=L();return q(),H}var pt=!1,Et=[];function vt(){pt=!0}function yt(){pt=!1,kt(Et),Et=[]}function kt(L){if(pt){Et=Et.concat(L);return}let H=[],Q=[],dt=new Map,Ct=new Map;for(let Rt=0;Rt<L.length;Rt++)if(!L[Rt].target._x_ignoreMutationObserver&&(L[Rt].type==="childList"&&(L[Rt].addedNodes.forEach(Ht=>Ht.nodeType===1&&H.push(Ht)),L[Rt].removedNodes.forEach(Ht=>Ht.nodeType===1&&Q.push(Ht))),L[Rt].type==="attributes")){let Ht=L[Rt].target,ue=L[Rt].attributeName,Oe=L[Rt].oldValue,Ve=()=>{dt.has(Ht)||dt.set(Ht,[]),dt.get(Ht).push({name:ue,value:Ht.getAttribute(ue)})},Mn=()=>{Ct.has(Ht)||Ct.set(Ht,[]),Ct.get(Ht).push(ue)};Ht.hasAttribute(ue)&&Oe===null?Ve():Ht.hasAttribute(ue)?(Mn(),Ve()):Mn()}Ct.forEach((Rt,Ht)=>{I(Ht,Rt)}),dt.forEach((Rt,Ht)=>{w.forEach(ue=>ue(Ht,Rt))});for(let Rt of Q)if(!H.includes(Rt)&&(M.forEach(Ht=>Ht(Rt)),Rt._x_cleanups))for(;Rt._x_cleanups.length;)Rt._x_cleanups.pop()();H.forEach(Rt=>{Rt._x_ignoreSelf=!0,Rt._x_ignore=!0});for(let Rt of H)Q.includes(Rt)||!Rt.isConnected||(delete Rt._x_ignoreSelf,delete Rt._x_ignore,A.forEach(Ht=>Ht(Rt)),Rt._x_ignore=!0,Rt._x_ignoreSelf=!0);H.forEach(Rt=>{delete Rt._x_ignoreSelf,delete Rt._x_ignore}),H=null,Q=null,dt=null,Ct=null}function Wt(L){return Bt(ee(L))}function jt(L,H,Q){return L._x_dataStack=[H,...ee(Q||L)],()=>{L._x_dataStack=L._x_dataStack.filter(dt=>dt!==H)}}function ae(L,H){let Q=L._x_dataStack[0];Object.entries(H).forEach(([dt,Ct])=>{Q[dt]=Ct})}function ee(L){return L._x_dataStack?L._x_dataStack:typeof ShadowRoot=="function"&&L instanceof ShadowRoot?ee(L.host):L.parentNode?ee(L.parentNode):[]}function Bt(L){let H=new Proxy({},{ownKeys:()=>Array.from(new Set(L.flatMap(Q=>Object.keys(Q)))),has:(Q,dt)=>L.some(Ct=>Ct.hasOwnProperty(dt)),get:(Q,dt)=>(L.find(Ct=>{if(Ct.hasOwnProperty(dt)){let Rt=Object.getOwnPropertyDescriptor(Ct,dt);if(Rt.get&&Rt.get._x_alreadyBound||Rt.set&&Rt.set._x_alreadyBound)return!0;if((Rt.get||Rt.set)&&Rt.enumerable){let Ht=Rt.get,ue=Rt.set,Oe=Rt;Ht=Ht&&Ht.bind(H),ue=ue&&ue.bind(H),Ht&&(Ht._x_alreadyBound=!0),ue&&(ue._x_alreadyBound=!0),Object.defineProperty(Ct,dt,{...Oe,get:Ht,set:ue})}return!0}return!1})||{})[dt],set:(Q,dt,Ct)=>{let Rt=L.find(Ht=>Ht.hasOwnProperty(dt));return Rt?Rt[dt]=Ct:L[L.length-1][dt]=Ct,!0}});return H}function Gt(L){let H=dt=>typeof dt=="object"&&!Array.isArray(dt)&&dt!==null,Q=(dt,Ct="")=>{Object.entries(Object.getOwnPropertyDescriptors(dt)).forEach(([Rt,{value:Ht,enumerable:ue}])=>{if(ue===!1||Ht===void 0)return;let Oe=Ct===""?Rt:`${Ct}.${Rt}`;typeof Ht=="object"&&Ht!==null&&Ht._x_interceptor?dt[Rt]=Ht.initialize(L,Oe,Rt):H(Ht)&&Ht!==dt&&!(Ht instanceof Element)&&Q(Ht,Oe)})};return Q(L)}function Qt(L,H=()=>{}){let Q={initialValue:void 0,_x_interceptor:!0,initialize(dt,Ct,Rt){return L(this.initialValue,()=>xe(dt,Ct),Ht=>Ut(dt,Ct,Ht),Ct,Rt)}};return H(Q),dt=>{if(typeof dt=="object"&&dt!==null&&dt._x_interceptor){let Ct=Q.initialize.bind(Q);Q.initialize=(Rt,Ht,ue)=>{let Oe=dt.initialize(Rt,Ht,ue);return Q.initialValue=Oe,Ct(Rt,Ht,ue)}}else Q.initialValue=dt;return Q}}function xe(L,H){return H.split(".").reduce((Q,dt)=>Q[dt],L)}function Ut(L,H,Q){if(typeof H=="string"&&(H=H.split(".")),H.length===1)L[H[0]]=Q;else{if(H.length===0)throw error;return L[H[0]]||(L[H[0]]={}),Ut(L[H[0]],H.slice(1),Q)}}var zt={};function St(L,H){zt[L]=H}function it(L,H){return Object.entries(zt).forEach(([Q,dt])=>{Object.defineProperty(L,`$${Q}`,{get(){let[Ct,Rt]=je(H);return Ct={interceptor:Qt,...Ct},R(H,Rt),dt(H,Ct)},enumerable:!1})}),L}function gt(L,H,Q,...dt){try{return Q(...dt)}catch(Ct){ft(Ct,L,H)}}function ft(L,H,Q=void 0){Object.assign(L,{el:H,expression:Q}),console.warn(`Alpine Expression Error: ${L.message}
4663
4664${Q?'Expression: "'+Q+`"
4665
4666`:""}`,H),setTimeout(()=>{throw L},0)}var de=!0;function ve(L){let H=de;de=!1,L(),de=H}function we(L,H,Q={}){let dt;return Ae(L,H)(Ct=>dt=Ct,Q),dt}function Ae(...L){return Ue(...L)}var Ue=It;function en(L){Ue=L}function It(L,H){let Q={};it(Q,L);let dt=[Q,...ee(L)];if(typeof H=="function")return Cn(dt,H);let Ct=K(dt,H,L);
4666return gt.bind(null,L,H,Ct)}function Cn(L,H){return(Q=()=>{},{scope:dt={},params:Ct=[]}={})=>{let Rt=H.apply(Bt([dt,...L]),Ct);Vt(Q,Rt)}}var mn={};function mt(L,H){if(mn[L])return mn[L];let Q=Object.getPrototypeOf(async function(){}).constructor,dt=/^[\n\s]*if.*\(.*\)/.test(L)||/^(let|const)\s/.test(L)?`(async()=>{ ${L} })()`:L,Ct=(()=>{try{return new Q(["__self","scope"],`with (scope) { __self.result = ${dt} }; __self.finished = true; return __self.result;`)}catch(Rt){return ft(Rt,H,L),Promise.resolve()}})();return mn[L]=Ct,Ct}function K(L,H,Q){let dt=mt(H,Q);return(Ct=()=>{},{scope:Rt={},params:Ht=[]}={})=>{dt.result=void 0,dt.finished=!1;let ue=Bt([Rt,...L]);if(typeof dt=="function"){let Oe=dt(dt,ue).catch(Ve=>ft(Ve,Q,H));dt.finished?(Vt(Ct,dt.result,ue,Ht,Q),dt.result=void 0):Oe.then(Ve=>{Vt(Ct,Ve,ue,Ht,Q)}).catch(Ve=>ft(Ve,Q,H)).finally(()=>dt.result=void 0)}}}function Vt(L,H,Q,dt,Ct){if(de&&typeof H=="function"){let Rt=H.apply(Q,dt);Rt instanceof Promise?Rt.then(Ht=>Vt(L,Ht,Q,dt)).catch(Ht=>ft(Ht,Ct,H)):L(Rt)}else typeof H=="object"&&H instanceof Promise?H.then(Rt=>L(Rt)):L(H)}var te="x-";function Nt(L=""){return te+L}function Se(L){te=L}var Me={};function ie(L,H){return Me[L]=H,{before(Q){if(!Me[Q]){console.warn("Cannot find directive `${directive}`. `${name}` will use the default order of execution");return}let dt=Dt.indexOf(Q)??Dt.indexOf("DEFAULT");dt>=0&&Dt.splice(dt,0,L)}}}function _t(L,H,Q){if(H=Array.from(H),L._x_virtualDirectives){let Ct=Object.entries(L._x_virtualDirectives).map(([Ht,ue])=>({name:Ht,value:ue})),Rt=Zt(Ct);Ct=Ct.map(Ht=>Rt.find(ue=>ue.name===Ht.name)?{name:`x-bind:${Ht.name}`,value:`"${Ht.value}"`}:Ht),H=H.concat(Ct)}let dt={};return H.map(J((Ct,Rt)=>dt[Ct]=Rt)).filter(At).map(rt(dt,Q)).sort(he).map(Ct=>Re(L,Ct))}function Zt(L){return Array.from(L).map(J()).filter(H=>!At(H))}var fe=!1,ce=new Map,pe=Symbol();function Fe(L){fe=!0;let H=Symbol();pe=H,ce.set(H,[]);let Q=()=>{for(;ce.get(H).length;)ce.get(H).shift()();ce.delete(H)},dt=()=>{fe=!1,Q()};L(Q),dt()}function je(L){let H=[],Q=Rt=>H.push(Rt),[dt,Ct]=x(L);return H.push(Ct),[{Alpine:Tc,effect:dt,cleanup:Q,evaluateLater:Ae.bind(Ae,L),evaluate:we.bind(we,L)},()=>H.forEach(Rt=>Rt())]}function Re(L,H){let Q=()=>{},dt=Me[H.type]||Q,[Ct,Rt]=je(L);O(L,H.original,Rt);let Ht=()=>{L._x_ignore||L._x_ignoreSelf||(dt.inline&&dt.inline(L,H,Ct),dt=dt.bind(dt,L,H,Ct),fe?ce.get(pe).push(dt):dt())};return Ht.runCleanups=Rt,Ht}var Ft=(L,H)=>({name:Q,value:dt})=>(Q.startsWith(L)&&(Q=Q.replace(L,H)),{name:Q,value:dt}),Ee=L=>L;function J(L=()=>{}){return({name:H,value:Q})=>{let{name:dt,value:Ct}=lt.reduce((Rt,Ht)=>Ht(Rt),{name:H,value:Q});return dt!==H&&L(dt,H),{name:dt,value:Ct}}}var lt=[];function xt(L){lt.push(L)}function At({name:L}){return st().test(L)}var st=()=>new RegExp(`^${te}([^:^.]+)\\b`);function rt(L,H){return({name:Q,value:dt})=>{let Ct=Q.match(st()),Rt=Q.match(/:([a-zA-Z0-9\-:]+)/),Ht=Q.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],ue=H||L[Q]||Q;return{type:Ct?Ct[1]:null,value:Rt?Rt[1]:null,modifiers:Ht.map(Oe=>Oe.replace(".","")),expression:dt,original:ue}}}var Tt="DEFAULT",Dt=["ignore","ref","data","id","radio","tabs","switch","disclosure","menu","listbox","combobox","bind","init","for","mask","model","modelable","transition","show","if",Tt,"teleport"];function he(L,H){let Q=Dt.indexOf(L.type)===-1?Tt:L.type,dt=Dt.indexOf(H.type)===-1?Tt:H.type;return Dt.indexOf(Q)-Dt.indexOf(dt)}function se(L,H,Q={}){L.dispatchEvent(new CustomEvent(H,{detail:Q,bubbles:!0,composed:!0,cancelable:!0}))}function ye(L,H){if(typeof ShadowRoot=="function"&&L instanceof ShadowRoot){Array.from(L.children).forEach(Ct=>ye(Ct,H));return}let Q=!1;if(H(L,()=>Q=!0),Q)return;let dt=L.firstElementChild;for(;dt;)ye(dt,H,!1),dt=dt.nextElementSibling}function be(L,...H){console.warn(`Alpine Warning: ${L}`,...H)}function fn(){document.body||be("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),se(document,"alpine:init"),se(document,"alpine:initializing"),q(),C(H=>Ie(H,ye)),R(H=>En(H)),k((H,Q)=>
vendor: 5,772 bytes, line 4666
4666{_t(H,Q).forEach(dt=>dt())});let L=H=>!Ti(H.parentElement,!0);Array.from(document.querySelectorAll(jn())).filter(L).forEach(H=>{Ie(H)}),se(document,"alpine:initialized")}var qe=[],xn=[];function vn(){return qe.map(L=>L())}function jn(){return qe.concat(xn).map(L=>L())}function Fn(L){qe.push(L)}function si(L){xn.push(L)}function Ti(L,H=!1){return Yi(L,Q=>{if((H?jn():vn()).some(dt=>Q.matches(dt)))return!0})}function Yi(L,H){if(L){if(H(L))return L;if(L._x_teleportBack&&(L=L._x_teleportBack),!!L.parentElement)return Yi(L.parentElement,H)}}function _s(L){return vn().some(H=>L.matches(H))}var Pt=[];function ze(L){Pt.push(L)}function Ie(L,H=ye,Q=()=>{}){Fe(()=>{H(L,(dt,Ct)=>{Q(dt,Ct),Pt.forEach(Rt=>Rt(dt,Ct)),_t(dt,dt.attributes).forEach(Rt=>Rt()),dt._x_ignore&&Ct()})})}function En(L){ye(L,H=>I(H))}var Dn=[],Xe=!1;function mi(L=()=>{}){return queueMicrotask(()=>{Xe||setTimeout(()=>{Qi()})}),new Promise(H=>{Dn.push(()=>{L(),H()})})}function Qi(){for(Xe=!1;Dn.length;)Dn.shift()()}function hi(){Xe=!0}function nt(L,H){return Array.isArray(H)?Ot(L,H.join(" ")):typeof H=="object"&&H!==null?re(L,H):typeof H=="function"?nt(L,H()):Ot(L,H)}function Ot(L,H){let Q=Rt=>Rt.split(" ").filter(Boolean),dt=Rt=>Rt.split(" ").filter(Ht=>!L.classList.contains(Ht)).filter(Boolean),Ct=Rt=>(L.classList.add(...Rt),()=>{L.classList.remove(...Rt)});return H=H===!0?H="":H||"",Ct(dt(H))}function re(L,H){let Q=ue=>ue.split(" ").filter(Boolean),dt=Object.entries(H).flatMap(([ue,Oe])=>Oe?Q(ue):!1).filter(Boolean),Ct=Object.entries(H).flatMap(([ue,Oe])=>Oe?!1:Q(ue)).filter(Boolean),Rt=[],Ht=[];return Ct.forEach(ue=>{L.classList.contains(ue)&&(L.classList.remove(ue),Ht.push(ue))}),dt.forEach(ue=>{L.classList.contains(ue)||(L.classList.add(ue),Rt.push(ue))}),()=>{Ht.forEach(ue=>L.classList.add(ue)),Rt.forEach(ue=>L.classList.remove(ue))}}function Kt(L,H){return typeof H=="object"&&H!==null?ne(L,H):Ke(L,H)}function ne(L,H){let Q={};return Object.entries(H).forEach(([dt,Ct])=>{Q[dt]=L.style[dt],dt.startsWith("--")||(dt=nn(dt)),L.style.setProperty(dt,Ct)}),setTimeout(()=>{L.style.length===0&&L.removeAttribute("style")}),()=>{Kt(L,Q)}}function Ke(L,H){let Q=L.getAttribute("style",H);return L.setAttribute("style",H),()=>{L.setAttribute("style",Q||"")}}function nn(L){return L.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function $e(L,H=()=>{}){let Q=!1;return function(){Q?H.apply(this,arguments):(Q=!0,L.apply(this,arguments))}}ie("transition",(L,{value:H,modifiers:Q,expression:dt},{evaluate:Ct})=>{typeof dt=="function"&&(dt=Ct(dt)),dt?bn(L,dt,H):We(L,Q,H)});function bn(L,H,Q){Nn(L,nt,""),{enter:dt=>{L._x_transition.enter.during=dt},"enter-start":dt=>{L._x_transition.enter.start=dt},"enter-end":dt=>{L._x_transition.enter.end=dt},leave:dt=>{L._x_transition.leave.during=dt},"leave-start":dt=>{L._x_transition.leave.start=dt},"leave-end":dt=>{L._x_transition.leave.end=dt}}[Q](H)}function We(L,H,Q){Nn(L,Kt);let dt=!H.includes("in")&&!H.includes("out")&&!Q,Ct=dt||H.includes("in")||["enter"].includes(Q),Rt=dt||H.includes("out")||["leave"].includes(Q);H.includes("in")&&!dt&&(H=H.filter((Xi,Ks)=>Ks<H.indexOf("out"))),H.includes("out")&&!dt&&(H=H.filter((Xi,Ks)=>Ks>H.indexOf("out")));let Ht=!H.includes("opacity")&&!H.includes("scale"),ue=Ht||H.includes("opacity"),Oe=Ht||H.includes("scale"),Ve=ue?0:1,Mn=Oe?Ni(H,"scale",95)/100:1,Ln=Ni(H,"delay",0),ci=Ni(H,"origin","center"),Xs="opacity, transform",Dc=Ni(H,"duration",150)/1e3,Pf=Ni(H,"duration",75)/1e3,zn="cubic-bezier(0.4, 0.0, 0.2, 1)";Ct&&(L._x_transition.enter.during={transformOrigin:ci,transitionDelay:Ln,transitionProperty:Xs,transitionDuration:`${Dc}s`,transitionTimingFunction:zn},L._x_transition.enter.start={opacity:Ve,transform:`scale(${Mn})`},L._x_transition.enter.end={opacity:1,transform:"scale(1)"}),Rt&&(L._x_transition.leave.during={transformOrigin:ci,transitionDelay:Ln,transitionProperty:Xs,transitionDuration:`${Pf}s`,transitionTimingFunction:zn},L._x_transition.leave.start={opacity:1,transform:"scale(1)"},L._x_transition.leave.end={opacity:Ve,transform:`scale(${Mn})`})}function Nn(L,H,Q={}){L._x_transition||(L._x_transition={enter:{during:Q,start:Q,end:Q},leave:{during:Q,start:Q,end:Q},in(dt=()=>{},Ct=()=>{}){pn(L,H,{during:this.enter.during,start:this.enter.start,end:this.enter.end},dt,Ct)},out(dt=()=>{},Ct=()=>{}){pn(L,H,{during:this.leave.during,start:this.leave.start,end:this.leave.end},dt,Ct)}})}window.Element.prototype._x_toggleAndCascadeWithTransitions=function(L,H,Q,dt){let Ct=document.visibilityState==="visible"?requestAnimationFrame:setTimeout,Rt=()=>Ct(Q);if(H){L._x_transition&&(L._x_transition.enter||L._x_transition.leave)?L._x_transition.enter&&(Object.entries(L._x_transition.enter.during).length||Object.entries(L._x_transition.enter.start).length||Object.entries(L._x_transition.enter.end).length)?L._x_transition.in(Q):Rt():L._x_transition?L._x_transition.in(Q):Rt();return}L._x_hidePromise=L._x_transition?new Promise((Ht,ue)=>{L._x_transition.out(()=>{},()=>Ht(dt)),L._x_transitioning.beforeCancel(()=>ue({isFromCancelledTransition:!0}))}):Promise.resolve(dt),queueMicrotask(()=>{let Ht=Hn(L);Ht?(Ht._x_hideChildren||(Ht._x_hideChildren=[]),Ht._x_hideChildren.push(L)):Ct(()=>{let ue=Oe=>{let Ve=Promise.all([Oe._x_hidePromise,...(Oe._x_hideChildren||[]).map(ue)]).then(([Mn])=>Mn());return delete Oe._x_hidePromise,delete Oe._x_hideChildren,Ve};ue(L).catch(Oe=>{if(!Oe.isFromCancelledTransition)throw Oe})})})};function Hn(L){let H=L.parentNode;if(H)return H._x_hidePromise?H:Hn(H)}function pn(L,H,{during:Q,start:dt,end:Ct}={},Rt=()=>{},Ht=()=>{}){if(L._x_transitioning&&L._x_transitioning.cancel(),Object.keys(Q).length===0&&Object.keys(dt).length===0&&Object.keys(Ct).length===0){Rt(),Ht();return}let ue,Oe,Ve;ri(L,{start(){ue=H(L,dt)},during(){Oe=H(L,Q)}
vendor: 3,994 bytes, line 4666
4666,before:Rt,end(){ue(),Ve=H(L,Ct)},after:Ht,cleanup(){Oe(),Ve()}})}function ri(L,H){let Q,dt,Ct,Rt=$e(()=>{ct(()=>{Q=!0,dt||H.before(),Ct||(H.end(),Qi()),H.after(),L.isConnected&&H.cleanup(),delete L._x_transitioning})});L._x_transitioning={beforeCancels:[],beforeCancel(Ht){this.beforeCancels.push(Ht)},cancel:$e(function(){for(;this.beforeCancels.length;)this.beforeCancels.shift()();Rt()}),finish:Rt},ct(()=>{H.start(),H.during()}),hi(),requestAnimationFrame(()=>{if(Q)return;let Ht=Number(getComputedStyle(L).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,ue=Number(getComputedStyle(L).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;Ht===0&&(Ht=Number(getComputedStyle(L).animationDuration.replace("s",""))*1e3),ct(()=>{H.before()}),dt=!0,requestAnimationFrame(()=>{Q||(ct(()=>{H.end()}),Qi(),setTimeout(L._x_transitioning.finish,Ht+ue),Ct=!0)})})}function Ni(L,H,Q){if(L.indexOf(H)===-1)return Q;let dt=L[L.indexOf(H)+1];if(!dt||H==="scale"&&isNaN(dt))return Q;if(H==="duration"){let Ct=dt.match(/([0-9]+)ms/);if(Ct)return Ct[1]}return H==="origin"&&["top","right","left","center","bottom"].includes(L[L.indexOf(H)+2])?[dt,L[L.indexOf(H)+2]].join(" "):dt}var Si=!1;function Un(L,H=()=>{}){return(...Q)=>Si?H(...Q):L(...Q)}function Ss(L){return(...H)=>Si&&L(...H)}function Ye(L,H){H._x_dataStack||(H._x_dataStack=L._x_dataStack),Si=!0,ti(()=>{ps(H)}),Si=!1}function ps(L){let H=!1;Ie(L,(Q,dt)=>{ye(Q,(Ct,Rt)=>{if(H&&_s(Ct))return Rt();H=!0,dt(Ct,Rt)})})}function ti(L){let H=c;y((Q,dt)=>{let Ct=H(Q);return u(Ct),()=>{}}),L(),y(H)}function $n(L,H,Q,dt=[]){switch(L._x_bindings||(L._x_bindings=l({})),L._x_bindings[H]=Q,H=dt.includes("camel")?xi(H):H,H){case"value":$r(L,Q);break;case"style":ea(L,Q);break;case"class":so(L,Q);break;default:Xn(L,H,Q);break}}function $r(L,H){if(L.type==="radio")L.attributes.value===void 0&&(L.value=H),window.fromModel&&(L.checked=yr(L.value,H));else if(L.type==="checkbox")Number.isInteger(H)?L.value=H:!Number.isInteger(H)&&!Array.isArray(H)&&typeof H!="boolean"&&![null,void 0].includes(H)?L.value=String(H):Array.isArray(H)?L.checked=H.some(Q=>yr(Q,L.value)):L.checked=!!H;else if(L.tagName==="SELECT")Cs(L,H);else{if(L.value===H)return;L.value=H}}function so(L,H){L._x_undoAddedClasses&&L._x_undoAddedClasses(),L._x_undoAddedClasses=nt(L,H)}function ea(L,H){L._x_undoAddedStyles&&L._x_undoAddedStyles(),L._x_undoAddedStyles=Kt(L,H)}function Xn(L,H,Q){[null,void 0,!1].includes(Q)&&xr(H)?L.removeAttribute(H):(Ro(H)&&(Q=H),Bi(L,H,Q))}function Bi(L,H,Q){L.getAttribute(H)!=Q&&L.setAttribute(H,Q)}function Cs(L,H){let Q=[].concat(H).map(dt=>dt+"");Array.from(L.options).forEach(dt=>{dt.selected=Q.includes(dt.value)})}function xi(L){return L.toLowerCase().replace(/-(\w)/g,(H,Q)=>Q.toUpperCase())}function yr(L,H){return L==H}function Ro(L){return["disabled","checked","required","readonly","hidden","open","selected","autofocus","itemscope","multiple","novalidate","allowfullscreen","allowpaymentrequest","formnovalidate","autoplay","controls","loop","muted","playsinline","default","ismap","reversed","async","defer","nomodule"].includes(L)}function xr(L){return!["aria-pressed","aria-checked","aria-expanded","aria-selected"].includes(L)}function Dl(L,H,Q){if(L._x_bindings&&L._x_bindings[H]!==void 0)return L._x_bindings[H];let dt=L.getAttribute(H);return dt===null?typeof Q=="function"?Q():Q:dt===""?!0:Ro(H)?!![H,"true"].includes(dt):dt}function Ja(L,H){var Q;return function(){var dt=this,Ct=arguments,Rt=function(){Q=null,L.apply(dt,Ct)};clearTimeout(Q),Q=setTimeout(Rt,H)}}function Mh(L,H){let Q;return function(){let dt=this,Ct=arguments;Q||(L.apply(dt,Ct),Q=!0,setTimeout(()=>Q=!1,H))}}function jg(L){L(Tc)}var Ll={},ro=!1;function Dr(L,H){if(ro||(Ll=l(Ll),ro=!0),H===void 0)return Ll[L];Ll[L]=H,typeof H=="object"&&H!==null&&H.hasOwnProperty("init")&&typeof H.init=="function"&&Ll[L].init(),Gt(Ll[L])}function Il(){return Ll}var Mc={};function Za(L,H){let Q=typeof H!="function"?()=>H:H;L instanceof Element?Wg(L,Q()):Mc[L]=Q}
4666function gf(L){return Object.entries(Mc).forEach(([H,Q])=>{Object.defineProperty(L,H,{get(){return(...dt)=>Q(...dt)}})}),L}function Wg(L,H,Q){let dt=[];for(;dt.length;)dt.pop()();let Ct=Object.entries(H).map(([Ht,ue])=>({name:Ht,value:ue})),Rt=Zt(Ct);Ct=Ct.map(Ht=>Rt.find(ue=>ue.name===Ht.name)?{name:`x-bind:${Ht.name}`,value:`"${Ht.value}"`}:Ht),_t(L,Ct,Q).map(Ht=>{dt.push(Ht.runCleanups),Ht()})}var mu={};function $g(L,H){mu[L]=H}function Gg(L,H){return Object.entries(mu).forEach(([Q,dt])=>{Object.defineProperty(L,Q,{get(){return(...Ct)=>dt.bind(H)(...Ct)},enumerable:!1})}),L}var Th={get reactive(){return l},get release(){return u},get effect(){return c},get raw(){return h},version:"3.11.1",flushAndStopDeferringMutations:yt,dontAutoEvaluateFunctions:ve,disableEffectScheduling:p,startObservingMutations:q,stopObservingMutations:X,setReactivityEngine:g,closestDataStack:ee,skipDuringClone:Un,onlyDuringClone:Ss,addRootSelector:Fn,addInitSelector:si,addScopeToNode:jt,deferMutations:vt,mapAttributes:xt,evaluateLater:Ae,interceptInit:ze,setEvaluator:en,mergeProxies:Bt,findClosest:Yi,closestRoot:Ti,destroyTree:En,interceptor:Qt,transition:pn,setStyles:Kt,mutateDom:ct,directive:ie,throttle:Mh,debounce:Ja,evaluate:we,initTree:Ie,nextTick:mi,prefixed:Nt,prefix:Se,plugin:jg,magic:St,store:Dr,start:fn,clone:Ye,bound:Dl,$data:Wt,walk:ye,data:$g,bind:Za},Tc=Th;function bu(L,H){let Q=Object.create(null),dt=L.split(",");for(let Ct=0;Ct<dt.length;Ct++)Q[dt[Ct]]=!0;return H?Ct=>!!Q[Ct.toLowerCase()]:Ct=>!!Q[Ct]}var qg={1:"TEXT",2:"CLASS",4:"STYLE",8:"PROPS",16:"FULL_PROPS",32:"HYDRATE_EVENTS",64:"STABLE_FRAGMENT",128:"KEYED_FRAGMENT",256:"UNKEYED_FRAGMENT",512:"NEED_PATCH",1024:"DYNAMIC_SLOTS",2048:"DEV_ROOT_FRAGMENT",[-1]:"HOISTED",[-2]:"BAIL"},mf={1:"STABLE",2:"DYNAMIC",3:"FORWARDED"},Ac="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Ah=bu(Ac+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),Yg=Object.freeze({}),na=Object.freeze([]),Eh=Object.assign,bf=Object.prototype.hasOwnProperty,Ol=(L,H)=>bf.call(L,H),oo=Array.isArray,ka=L=>cr(L)==="[object Map]",vu=L=>typeof L=="string",kh=L=>typeof L=="symbol",Ec=L=>L!==null&&typeof L=="object",kc=Object.prototype.toString,cr=L=>kc.call(L),Ph=L=>cr(L).slice(8,-1),Rh=L=>vu(L)&&L!=="NaN"&&L[0]!=="-"&&""+parseInt(L,10)===L,Dh=L=>{let H=Object.create(null);return Q=>H[Q]||(H[Q]=L(Q))},Ne=/-(\w)/g,Xg=Dh(L=>L.replace(Ne,(H,Q)=>Q?Q.toUpperCase():"")),wi=/\B([A-Z])/g,Pc=Dh(L=>L.replace(wi,"-$1").toLowerCase()),yu=Dh(L=>L.charAt(0).toUpperCase()+L.slice(1)),Pa=Dh(L=>L?`on${yu(L)}`:""),zi=(L,H)=>L!==H&&(L===L||H===H),ts=new WeakMap,Do=[],ao,qs=Symbol("iterate"),Ys=Symbol("Map key iterate");function vf(L){return L&&L._isEffect===!0}function yf(L,H=Yg){vf(L)&&(L=L.raw);let Q=xf(L,H);return H.lazy||Q(),Q}function Kg(L){L.active&&(Lh(L),L.options.onStop&&L.options.onStop(),L.active=!1)}var Jg=0;function xf(L,H){let Q=function(){if(!Q.active)return L();if(!Do.includes(Q)){Lh(Q);try{return Bl(),Do.push(Q),ao=Q,L()}finally{Do.pop(),Qg(),ao=Do[Do.length-1]}}};return Q.id=Jg++,Q.allowRecurse=!!H.allowRecurse,Q._isEffect=!0,Q.active=!0,Q.raw=L,Q.deps=[],Q.options=H,Q}function Lh(L){let{deps:H}=L;if(H.length){for(let Q=0;Q<H.length;Q++)H[Q].delete(L);H.length=0}}var Nl=!0,Ih=[];function Zg(){Ih.push(Nl),Nl=!1}function Bl(){Ih.push(Nl),Nl=!0}function Qg(){let L=Ih.pop();Nl=L===void 0?!0:L}function Lo(L,H,Q){if(!Nl||ao===void 0)return;let dt=ts.get(L);dt||ts.set(L,dt=new Map);let Ct=dt.get(Q);Ct||dt.set(Q,Ct=new Set),Ct.has(ao)||(Ct.add(ao),ao.deps.push(Ct),ao.options.onTrack&&ao.options.onTrack({effect:ao,target:L,type:H,key:Q}))}function lo(L,H,Q,dt,Ct,Rt){let Ht=ts.get(L);if(!Ht)return;let ue=new Set,Oe=Mn=>{Mn&&Mn.forEach(Ln=>{(Ln!==ao||Ln.allowRecurse)&&ue.add(Ln)})};if(H==="clear")Ht.forEach(Oe);else if(Q==="length"&&oo(L))Ht.forEach((Mn,Ln)=>{(Ln==="length"||Ln>=dt)&&Oe(Mn)});else switch(Q!==void 0&&Oe(Ht.get(Q)),H){case"add":oo(L)?Rh(Q)&&Oe(Ht.get("length")):(Oe(Ht.get(qs)),ka(L)&&Oe(Ht.get(Ys)));break;case"delete":oo(L)||(Oe(Ht.get(qs)),ka(L)&&Oe(Ht.get(Ys)));break;case"set":ka(L)&&Oe(Ht.get(qs));break}let Ve=Mn=>{Mn.options.onTrigger&&Mn.options.onTrigger({effect:Mn,target:L,key:Q,type:H,newValue:dt,oldValue:Ct,oldTarget:Rt}),Mn.options.scheduler?Mn.options.scheduler(Mn):Mn()};ue.forEach(Ve)}
4666var wf=bu("__proto__,__v_isRef,__isVue"),tm=new Set(Object.getOwnPropertyNames(Symbol).map(L=>Symbol[L]).filter(kh)),_f=Ul(),em=Ul(!1,!0),ia=Ul(!0),Fl=Ul(!0,!0),Qa={};["includes","indexOf","lastIndexOf"].forEach(L=>{let H=Array.prototype[L];Qa[L]=function(...Q){let dt=Ai(this);for(let Rt=0,Ht=this.length;Rt<Ht;Rt++)Lo(dt,"get",Rt+"");let Ct=H.apply(dt,Q);return Ct===-1||Ct===!1?H.apply(dt,Q.map(Ai)):Ct}}),["push","pop","shift","unshift","splice"].forEach(L=>{let H=Array.prototype[L];Qa[L]=function(...Q){Zg();let dt=H.apply(this,Q);return Qg(),dt}});function Ul(L=!1,H=!1){return function(Q,dt,Ct){if(dt==="__v_isReactive")return!L;if(dt==="__v_isReadonly")return L;if(dt==="__v_raw"&&Ct===(L?H?yS:vS:H?bS:Ov).get(Q))return Q;let Rt=oo(Q);if(!L&&Rt&&Ol(Qa,dt))return Reflect.get(Qa,dt,Ct);let Ht=Reflect.get(Q,dt,Ct);return(kh(dt)?tm.has(dt):wf(dt))||(L||Lo(Q,"get",dt),H)?Ht:ra(Ht)?!Rt||!Rh(dt)?Ht.value:Ht:Ec(Ht)?L?im(Ht):xu(Ht):Ht}}var sa=oi(),Oh=oi(!0);function oi(L=!1){return function(H,Q,dt,Ct){let Rt=H[Q];if(!L&&(dt=Ai(dt),Rt=Ai(Rt),!oo(H)&&ra(Rt)&&!ra(dt)))return Rt.value=dt,!0;let Ht=oo(H)&&Rh(Q)?Number(Q)<H.length:Ol(H,Q),ue=Reflect.set(H,Q,dt,Ct);return H===Ai(Ct)&&(Ht?zi(dt,Rt)&&lo(H,"set",Q,dt,Rt):lo(H,"add",Q,dt)),ue}}function P(L,H){let Q=Ol(L,H),dt=L[H],Ct=Reflect.deleteProperty(L,H);return Ct&&Q&&lo(L,"delete",H,void 0,dt),Ct}function B(L,H){let Q=Reflect.has(L,H);return(!kh(H)||!tm.has(H))&&Lo(L,"has",H),Q}function $(L){return Lo(L,"iterate",oo(L)?"length":qs),Reflect.ownKeys(L)}var Z={get:_f,set:sa,deleteProperty:P,has:B,ownKeys:$},wt={get:ia,set(L,H){return console.warn(`Set operation on key "${String(H)}" failed: target is readonly.`,L),!0},deleteProperty(L,H){return console.warn(`Delete operation on key "${String(H)}" failed: target is readonly.`,L),!0}},$t=Eh({},Z,{get:em,set:Oh}),qt=Eh({},wt,{get:Fl}),De=L=>Ec(L)?xu(L):L,_e=L=>Ec(L)?im(L):L,An=L=>L,Yn=L=>Reflect.getPrototypeOf(L);function On(L,H,Q=!1,dt=!1){L=L.__v_raw;let Ct=Ai(L),Rt=Ai(H);H!==Rt&&!Q&&Lo(Ct,"get",H),!Q&&Lo(Ct,"get",Rt);let{has:Ht}=Yn(Ct),ue=dt?An:Q?_e:De;if(Ht.call(Ct,H))return ue(L.get(H));if(Ht.call(Ct,Rt))return ue(L.get(Rt));L!==Ct&&L.get(H)}function li(L,H=!1){let Q=this.__v_raw,dt=Ai(Q),Ct=Ai(L);return L!==Ct&&!H&&Lo(dt,"has",L),!H&&Lo(dt,"has",Ct),L===Ct?Q.has(L):Q.has(L)||Q.has(Ct)}function Vi(L,H=!1){return L=L.__v_raw,!H&&Lo(Ai(L),"iterate",qs),Reflect.get(L,"size",L)}function Ms(L){L=Ai(L);let H=Ai(this);return Yn(H).has.call(H,L)||(H.add(L),lo(H,"add",L,L)),this}function Io(L,H){H=Ai(H);let Q=Ai(this),{has:dt,get:Ct}=Yn(Q),Rt=dt.call(Q,L);Rt?Iv(Q,dt,L):(L=Ai(L),Rt=dt.call(Q,L));let Ht=Ct.call(Q,L);return Q.set(L,H),Rt?zi(H,Ht)&&lo(Q,"set",L,H,Ht):lo(Q,"add",L,H),this}function tl(L){let H=Ai(this),{has:Q,get:dt}=Yn(H),Ct=Q.call(H,L);Ct?Iv(H,Q,L):(L=Ai(L),Ct=Q.call(H,L));let Rt=dt?dt.call(H,L):void 0,Ht=H.delete(L);return Ct&&lo(H,"delete",L,void 0,Rt),Ht}function zl(){let L=Ai(this),H=L.size!==0,Q=ka(L)?new Map(L):new Set(L),dt=L.clear();return H&&lo(L,"clear",void 0,void 0,Q),dt}function Oo(L,H){return function(Q,dt){let Ct=this,Rt=Ct.__v_raw,Ht=Ai(Rt),ue=H?An:L?_e:De;return!L&&Lo(Ht,"iterate",qs),Rt.forEach((Oe,Ve)=>Q.call(dt,ue(Oe),ue(Ve),Ct))}}function Sf(L,H,Q){return function(...dt){let Ct=this.__v_raw,Rt=Ai(Ct),Ht=ka(Rt),ue=L==="entr
4666ies"||L===Symbol.iterator&&Ht,Oe=L==="keys"&&Ht,Ve=Ct[L](...dt),Mn=Q?An:H?_e:De;return!H&&Lo(Rt,"iterate",Oe?Ys:qs),{next(){let{value:Ln,done:ci}=Ve.next();return ci?{value:Ln,done:ci}:{value:ue?[Mn(Ln[0]),Mn(Ln[1])]:Mn(Ln),done:ci}},[Symbol.iterator](){return this}}}}function Rc(L){return function(...H){{let Q=H[0]?`on key "${H[0]}" `:"";console.warn(`${yu(L)} operation ${Q}failed: target is readonly.`,Ai(this))}return L==="delete"?!1:this}}var nm={get(L){return On(this,L)},get size(){return Vi(this)},has:li,add:Ms,set:Io,delete:tl,clear:zl,forEach:Oo(!1,!1)},gS={get(L){return On(this,L,!1,!0)},get size(){return Vi(this)},has:li,add:Ms,set:Io,delete:tl,clear:zl,forEach:Oo(!1,!0)},Rv={get(L){return On(this,L,!0)},get size(){return Vi(this,!0)},has(L){return li.call(this,L,!0)},add:Rc("add"),set:Rc("set"),delete:Rc("delete"),clear:Rc("clear"),forEach:Oo(!0,!1)},Dv={get(L){return On(this,L,!0,!0)},get size(){return Vi(this,!0)},has(L){return li.call(this,L,!0)},add:Rc("add"),set:Rc("set"),delete:Rc("delete"),clear:Rc("clear"),forEach:Oo(!0,!0)},mS=["keys","values","entries",Symbol.iterator];mS.forEach(L=>{nm[L]=Sf(L,!1,!1),Rv[L]=Sf(L,!0,!1),gS[L]=Sf(L,!1,!0),Dv[L]=Sf(L,!0,!0)});function Cf(L,H){let Q=H?L?Dv:gS:L?Rv:nm;return(dt,Ct,Rt)=>Ct==="__v_isReactive"?!L:Ct==="__v_isReadonly"?L:Ct==="__v_raw"?dt:Reflect.get(Ol(Q,Ct)&&Ct in dt?Q:dt,Ct,Rt)}var PP={get:Cf(!1,!1)},RP={get:Cf(!1,!0)},Lv={get:Cf(!0,!1)},DP={get:Cf(!0,!0)};function Iv(L,H,Q){let dt=Ai(Q);if(dt!==Q&&H.call(L,dt)){let Ct=Ph(L);console.warn(`Reactive ${Ct} contains both the raw and reactive versions of the same object${Ct==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}var Ov=new WeakMap,bS=new WeakMap,vS=new WeakMap,yS=new WeakMap;function xS(L){switch(L){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Nv(L){return L.__v_skip||!Object.isExtensible(L)?0:xS(Ph(L))}function xu(L){return L&&L.__v_isReadonly?L:Bv(L,!1,Z,PP,Ov)}function im(L){return Bv(L,!0,wt,Lv,vS)}function Bv(L,H,Q,dt,Ct){if(!Ec(L))return console.warn(`value cannot be made reactive: ${String(L)}`),L;if(L.__v_raw&&!(H&&L.__v_isReactive))return L;let Rt=Ct.get(L);if(Rt)return Rt;let Ht=Nv(L);if(Ht===0)return L;let ue=new Proxy(L,Ht===2?dt:Q);return Ct.set(L,ue),ue}function Ai(L){return L&&Ai(L.__v_raw)||L}function ra(L){return!!(L&&L.__v_isRef===!0)}St("nextTick",()=>mi),St("dispatch",L=>se.bind(se,L)),St("watch",(L,{evaluateLater:H,effect:Q})=>(dt,Ct)=>{let Rt=H(dt),Ht=!0,ue,Oe=Q(()=>Rt(Ve=>{JSON.stringify(Ve),Ht?ue=Ve:queueMicrotask(()=>{Ct(Ve,ue),ue=Ve}),Ht=!1}));L._x_effects.delete(Oe)}),St("store",Il),St("data",L=>Wt(L)),St("root",L=>Ti(L)),St("refs",L=>(L._x_refs_proxy||(L._x_refs_proxy=Bt(LP(L))),L._x_refs_proxy));function LP(L){let H=[],Q=L;for(;Q;)Q._x_refs&&H.push(Q._x_refs),Q=Q.parentNode;return H}var Nh={};function Fv(L){return Nh[L]||(Nh[L]=0),++Nh[L]}function wS(L,H){return Yi(L,Q=>{if(Q._x_ids&&Q._x_ids[H])return!0})}function _S(L,H){L._x_ids||(L._x_ids={}),L._x_ids[H]||(L._x_ids[H]=Fv(H))}St("id",L=>(H,Q=null)=>{let dt=wS(L,H),Ct=dt?dt._x_ids[H]:Fv(H);return Q?`${H}-${Ct}-${Q}`:`${H}-${Ct}`}),St("el",L=>L),SS("Focus","focus","focus"),SS("Persist","persist","persist");function SS(L,H,Q){St(H,dt=>be(`You can't use [$${directiveName}] without first installing the "${L}" plugin here: https://alpinejs.dev/plugins/${Q}`,dt))}function Mf({get:L,set:H},{get:Q,set:dt}){let Ct=!0,Rt,Ht,ue,Oe,Ve=c(()=>{let Mn,Ln;Ct?(Mn=L(),dt(Mn),Ln=Q(),Ct=!1):(Mn=L(),Ln=Q(),ue=JSON.stringify(Mn),Oe=JSON.stringify(Ln),ue!==Rt?(Ln=Q(),dt(Mn),Ln=Mn):(H(Ln),Mn=Ln)),Rt=JSON.stringify(Mn),Ht=JSON.stringify(Ln)});return()=>{u(Ve)}}ie("modelable",(L,{expression:H},{effect:Q,evaluateLater:dt,cleanup:Ct})=>{let Rt=dt(H),Ht=()=>{let Mn;return Rt(Ln=>Mn=Ln),Mn},ue=dt(`${H} = __placeholder`),Oe=Mn=>ue(()=>{},{scope:{__placeholder:Mn}}),Ve=Ht();Oe(Ve),queueMicrotask(()=>{if(!L._x_model)return;L._x_removeModelListeners.default();let Mn=L._x_model.get,Ln=L._x_model.set,ci=Mf({get(){return Mn()},set(Xs){Ln(Xs)}},{get(){return Ht()},set(Xs){Oe(Xs)}});Ct(ci)})});var CS=document.createElement("div");ie("teleport",(L,{modifiers:H,expression:Q},{cleanup:dt})=>{L.tagName.toLowerCase()!=="template"&&be("x-teleport can only be used on a <template> tag",L);let Ct=Un(()=>document.querySelector(Q),()=>CS)();Ct||be(`Cannot find x-teleport element for selector: "${Q}"`);let Rt=L.content.cloneNode(!0).firstElementChild;L._x_teleport=Rt,Rt._x_teleportBack=L,L._x_forwardEvents&&L._x_forwardEvents.forEac
4666h(Ht=>{Rt.addEventListener(Ht,ue=>{ue.stopPropagation(),L.dispatchEvent(new ue.constructor(ue.type,ue))})}),jt(Rt,{},L),ct(()=>{H.includes("prepend")?Ct.parentNode.insertBefore(Rt,Ct):H.includes("append")?Ct.parentNode.insertBefore(Rt,Ct.nextSibling):Ct.appendChild(Rt),Ie(Rt),Rt._x_ignore=!0}),dt(()=>Rt.remove())});var MS=()=>{};MS.inline=(L,{modifiers:H},{cleanup:Q})=>{H.includes("self")?L._x_ignoreSelf=!0:L._x_ignore=!0,Q(()=>{H.includes("self")?delete L._x_ignoreSelf:delete L._x_ignore})},ie("ignore",MS),ie("effect",(L,{expression:H},{effect:Q})=>Q(Ae(L,H)));function el(L,H,Q,dt){let Ct=L,Rt=Oe=>dt(Oe),Ht={},ue=(Oe,Ve)=>Mn=>Ve(Oe,Mn);if(Q.includes("dot")&&(H=sm(H)),Q.includes("camel")&&(H=IP(H)),Q.includes("passive")&&(Ht.passive=!0),Q.includes("capture")&&(Ht.capture=!0),Q.includes("window")&&(Ct=window),Q.includes("document")&&(Ct=document),Q.includes("prevent")&&(Rt=ue(Rt,(Oe,Ve)=>{Ve.preventDefault(),Oe(Ve)})),Q.includes("stop")&&(Rt=ue(Rt,(Oe,Ve)=>{Ve.stopPropagation(),Oe(Ve)})),Q.includes("self")&&(Rt=ue(Rt,(Oe,Ve)=>{Ve.target===L&&Oe(Ve)})),(Q.includes("away")||Q.includes("outside"))&&(Ct=document,Rt=ue(Rt,(Oe,Ve)=>{L.contains(Ve.target)||Ve.target.isConnected!==!1&&(L.offsetWidth<1&&L.offsetHeight<1||L._x_isShown!==!1&&Oe(Ve))})),Q.includes("once")&&(Rt=ue(Rt,(Oe,Ve)=>{Oe(Ve),Ct.removeEventListener(H,Rt,Ht)})),Rt=ue(Rt,(Oe,Ve)=>{NP(H)&&BP(Ve,Q)||Oe(Ve)}),Q.includes("debounce")){let Oe=Q[Q.indexOf("debounce")+1]||"invalid-wait",Ve=co(Oe.split("ms")[0])?Number(Oe.split("ms")[0]):250;Rt=Ja(Rt,Ve)}if(Q.includes("throttle")){let Oe=Q[Q.indexOf("throttle")+1]||"invalid-wait",Ve=co(Oe.split("ms")[0])?Number(Oe.split("ms")[0]):250;Rt=Mh(Rt,Ve)}return Ct.addEventListener(H,Rt,Ht),()=>{Ct.removeEventListener(H,Rt,Ht)}}function sm(L){return L.replace(/-/g,".")}function IP(L){return L.toLowerCase().replace(/-(\w)/g,(H,Q)=>Q.toUpperCase())}function co(L){return!Array.isArray(L)&&!isNaN(L)}function OP(L){return[" ","_"].includes(L)?L:L.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}function NP(L){return["keydown","keyup"].includes(L)}function BP(L,H){let Q=H.filter(Ct=>!["window","document","prevent","stop","once"].includes(Ct));if(Q.includes("debounce")){let Ct=Q.indexOf("debounce");Q.splice(Ct,co((Q[Ct+1]||"invalid-wait").split("ms")[0])?2:1)}if(Q.includes("throttle")){let Ct=Q.indexOf("throttle");Q.splice(Ct,co((Q[Ct+1]||"invalid-wait").split("ms")[0])?2:1)}if(Q.length===0||Q.length===1&&rm(L.key).includes(Q[0]))return!1;let dt=["ctrl","shift","alt","meta","cmd","super"].filter(Ct=>Q.includes(Ct));return Q=Q.filter(Ct=>!dt.includes(Ct)),!(dt.length>0&&dt.filter(Ct=>((Ct==="cmd"||Ct==="super")&&(Ct="meta"),L[`${Ct}Key`])).length===dt.length&&rm(L.key).includes(Q[0]))}function rm(L){if(!L)return[];L=OP(L);let H={ctrl:"control",slash:"/",space:" ",spacebar:" ",cmd:"meta",esc:"escape",up:"arrow-up",down:"arrow-down",left:"arrow-left",right:"arrow-right",period:".",equal:"=",minus:"-",underscore:"_"};return H[L]=L,Object.keys(H).map(Q=>{if(H[Q]===L)return Q}).filter(Q=>Q)}ie("model",(L,{modifiers:H,expression:Q},{effect:dt,cleanup:Ct})=>{let Rt=L;H.includes("parent")&&(Rt=L.parentNode);let Ht=Ae(Rt,Q),ue;typeof Q=="string"?ue=Ae(Rt,`${Q} = __placeholder`):typeof Q=="function"&&typeof Q()=="string"?ue=Ae(Rt,`${Q()} = __placeholder`):ue=()=>{};let Oe=()=>{let ci;return Ht(Xs=>ci=Xs),Uv(ci)?ci.get():ci},Ve=ci=>{let Xs;Ht(Dc=>Xs=Dc),Uv(Xs)?Xs.set(ci):ue(()=>{},{scope:{__placeholder:ci}})};typeof Q=="string"&&L.type==="radio"&&ct(()=>{L.hasAttribute("name")||L.setAttribute("name",Q)});var Mn=L.tagName.toLowerCase()==="select"||["checkbox","radio"].includes(L.type)||H.includes("lazy")?"change":"input";let Ln=el(L,Mn,H,ci=>{Ve(TS(L,H,ci,Oe()))});if(L._x_removeModelListeners||(L._x_removeModelListeners={}),L._x_removeModelListeners.default=Ln,Ct(()=>L._x_removeModelListeners.default()),L.form){let ci=el(L.form,"reset",[],Xs=>{mi(()=>L._x_model&&L._x_model.set(L.value))});Ct(()=>ci())}L._x_model={get(){return Oe()},set(ci){Ve(ci)}},L._x_forceModelUpdate=ci=>{ci=ci===void 0?Oe():ci,ci===void 0&&typeof Q=="string"&&Q.match(/\./)&&(ci=""),window.fromModel=!0,ct(()=>$n(L,"value",ci)),delete window.fromModel},dt(()=>{let ci=Oe();H.includes("unintrusive")&&document.activeElement.isSameNode(L)||L._x_forceModelUpdate(ci)})});function TS(L,H,Q,dt){return ct(()=>{if(Q instanceof CustomEvent&&Q.detail!==void 0)return typeof Q.detail<"u"?Q.detail:Q.target.value;if(L.type==="checkbox")if(Array.isArray(dt)){let Ct=H.includes("number")?Tf(Q.target.value):Q.target.value;return Q.target.checked?dt.concat([Ct]):dt.filter(Rt=>!AS(Rt,Ct))}else return Q.target.checked;else{if(L.tagName.toLowerCase()==="select"&&L.multiple)return H.includes("number")?Array.from(Q.target.selectedOptions).map(Ct=>{let Rt=Ct.value||Ct.text;return Tf(Rt)}):Array.from(Q.target.selectedOptions).map(Ct=>Ct.value||Ct.text);{let Ct=Q.target.value;return H.includes("number")?Tf(Ct):H.includes("trim")?Ct.trim():Ct}}})}function Tf(L){let H=L?parseFloat(L):null;return FP(H)?H:L}function AS(L,H){return L==H}function FP(L){return!Array.isArray(L)&&!isNaN(L)}function Uv(L){return L!==null&&typeof L=="object"&&typeof L.get=="function"&&typeof L.set=="function"}ie("cloak",L=>queueMicrotask(()=>ct(()=>L.removeAttribute(Nt("cloak"))))),si(()=>`[${Nt("init")}]`),ie("init",Un((L,{expression:H},{evaluate:Q})=>typeof H=="string"?!!H.trim()&&Q(H,{},!1):Q(H,{},!1))),ie("text",(L,{expression:H},{effect:Q,evaluateLater:dt})=>{let Ct=dt(H);Q(()=>{Ct(Rt=>{ct(()=>{L.textContent=Rt})})})}),ie("html",(L,{expression:H},{effect:Q,evaluateLater:dt})=>{let Ct=dt(H);Q(()=>{Ct(Rt=>{ct(()=>{L.innerHTML=Rt,L._x_ignoreSelf=!0,Ie(L),delete L._x_ignoreSelf})})})}),xt(Ft(":",Ee(Nt("bind:")))),ie("bind",(L,{value:H,modifiers:Q,expression:dt,original:Ct},{effect:Rt})=>{if(!H){let ue={};gf(ue),Ae(L,dt)(Oe=>{Wg(L,Oe,Ct)},{scope:ue});return}if(H==="key")return ES(L,dt);let Ht=Ae(L,dt);Rt(()=>Ht(ue=>{ue===void 0&&typeof dt=="string"&&dt.match(/\./)&&(ue=""),ct(()=>$n(L,H,ue,Q))}))});function ES(L,H){L._x_keyExpression=H}Fn(()=>`[${Nt("data")}]`),ie("data",Un((L,{expression:H},{cleanup:Q})=>{H=H===""?"{}":H;let dt={};it(dt,L);let Ct={};Gg(Ct,dt);let Rt=we(L,H,{scope:Ct});Rt===void 0&&(Rt={}),it(Rt,L);let Ht=l(Rt);Gt(Ht);let ue=jt(L,Ht);Ht.init&&we(L,Ht.init),Q(()=>{Ht.destroy&&we(L,Ht.destroy),ue()})})),ie("show",(L,{modifiers:H,expression:Q},{effect:dt})=>{let Ct=Ae(L,Q);L._x_doHide||(L._x_doHide=()=>{ct(()=>{L.style.setProperty("display","none",H.includes("important")?"important":void 0)})}),L._x_doShow||(L._x_doShow=()=>{ct(()=>{L.style.length===1&&L.style.display==="none"?L.removeAttribute("style"):L.style.removeProperty("display")})});let Rt=()=>{L._x_doHide(),L._x_isShown=!1},Ht=()=>{L._x_doShow(),L._x_isShown=!0},ue=()=>setTimeout(Ht),Oe=$e(Ln=>Ln?Ht():Rt(),Ln=>{typeof L._x_toggleAndCascadeWithTransitions=="function"?L._x_toggleAndCascadeWithTransitions(L,Ln,Ht,Rt):Ln?ue():Rt()}),Ve,Mn=!0;dt(()=>Ct(Ln=>{!Mn&&Ln===Ve||(H.includes("immediate")&&(Ln?ue():Rt()),Oe(Ln),Ve=Ln,Mn=!1)}))}),ie("for",(L,{expression:H},{effect:Q,cleanup:dt})=>{let Ct=PS(H),Rt=Ae(L,Ct.items),Ht=Ae(L,L._x_keyExpression||"index");L._x_prevKeys=[],L._x_lookup={},Q(()=>kS(L,Ct,Rt,Ht)),dt(()=>
4666{Object.values(L._x_lookup).forEach(ue=>ue.remove()),delete L._x_prevKeys,delete L._x_lookup})});function kS(L,H,Q,dt){let Ct=Ht=>typeof Ht=="object"&&!Array.isArray(Ht),Rt=L;Q(Ht=>{Ef(Ht)&&Ht>=0&&(Ht=Array.from(Array(Ht).keys(),zn=>zn+1)),Ht===void 0&&(Ht=[]);let ue=L._x_lookup,Oe=L._x_prevKeys,Ve=[],Mn=[];if(Ct(Ht))Ht=Object.entries(Ht).map(([zn,Xi])=>{let Ks=Af(H,Xi,zn,Ht);dt(Lr=>Mn.push(Lr),{scope:{index:zn,...Ks}}),Ve.push(Ks)});else for(let zn=0;zn<Ht.length;zn++){let Xi=Af(H,Ht[zn],zn,Ht);dt(Ks=>Mn.push(Ks),{scope:{index:zn,...Xi}}),Ve.push(Xi)}let Ln=[],ci=[],Xs=[],Dc=[];for(let zn=0;zn<Oe.length;zn++){let Xi=Oe[zn];Mn.indexOf(Xi)===-1&&Xs.push(Xi)}Oe=Oe.filter(zn=>!Xs.includes(zn));let Pf="template";for(let zn=0;zn<Mn.length;zn++){let Xi=Mn[zn],Ks=Oe.indexOf(Xi);if(Ks===-1)Oe.splice(zn,0,Xi),Ln.push([Pf,zn]);else if(Ks!==zn){let Lr=Oe.splice(zn,1)[0],oa=Oe.splice(Ks-1,1)[0];Oe.splice(zn,0,oa),Oe.splice(Ks,0,Lr),ci.push([Lr,oa])}else Dc.push(Xi);Pf=Xi}for(let zn=0;zn<Xs.length;zn++){let Xi=Xs[zn];ue[Xi]._x_effects&&ue[Xi]._x_effects.forEach(r),ue[Xi].remove(),ue[Xi]=null,delete ue[Xi]}for(let zn=0;zn<ci.length;zn++){let[Xi,Ks]=ci[zn],Lr=ue[Xi],oa=ue[Ks],Bh=document.createElement("div");ct(()=>{oa.after(Bh),Lr.after(oa),oa._x_currentIfEl&&oa.after(oa._x_currentIfEl),Bh.before(Lr),Lr._x_currentIfEl&&Lr.after(Lr._x_currentIfEl),Bh.remove()}),ae(oa,Ve[Mn.indexOf(Ks)])}for(let zn=0;zn<Ln.length;zn++){let[Xi,Ks]=Ln[zn],Lr=Xi==="template"?Rt:ue[Xi];Lr._x_currentIfEl&&(Lr=Lr._x_currentIfEl);let oa=Ve[Ks],Bh=Mn[Ks],Fh=document.importNode(Rt.content,!0).firstElementChild;jt(Fh,l(oa),Rt),ct(()=>{Lr.after(Fh),Ie(Fh)}),typeof Bh=="object"&&be("x-for key cannot be an object, it must be a string or an integer",Rt),ue[Bh]=Fh}for(let zn=0;zn<Dc.length;zn++)ae(ue[Dc[zn]],Ve[Mn.indexOf(Dc[zn])]);Rt._x_prevKeys=Mn})}function PS(L){let H=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Q=/^\s*\(|\)\s*$/g,dt=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Ct=L.match(dt);if(!Ct)return;let Rt={};Rt.items=Ct[2].trim();let Ht=Ct[1].replace(Q,"").trim(),ue=Ht.match(H);return ue?(Rt.item=Ht.replace(H,"").trim(),Rt.index=ue[1].trim(),ue[2]&&(Rt.collection=ue[2].trim())):Rt.item=Ht,Rt}function Af(L,H,Q,dt){let Ct={};return/^\[.*\]$/.test(L.item)&&Array.isArray(H)?L.item.replace("[","").replace("]","").split(",").map(Rt=>Rt.trim()).forEach((Rt,Ht)=>{Ct[Rt]=H[Ht]}):/^\{.*\}$/.test(L.item)&&!Array.isArray(H)&&typeof H=="object"?L.item.replace("{","").replace("}","").split(",").map(Rt=>Rt.trim()).forEach(Rt=>{Ct[Rt]=H[Rt]}):Ct[L.item]=H,L.index&&(Ct[L.index]=Q),L.collection&&(Ct[L.collection]=dt),Ct}function Ef(L){return!Array.isArray(L)&&!isNaN(L)}function RS(){}RS.inline=(L,{expression:H},{cleanup:Q})=>{let dt=Ti(L);dt._x_refs||(dt._x_refs={}),dt._x_refs[H]=L,Q(()=>delete dt._x_refs[H])},ie("ref",RS),ie("if",(L,{expression:H},{effect:Q,cleanup:dt})=>{let Ct=Ae(L,H),Rt=()=>{if(L._x_currentIfEl)return L._x_currentIfEl;let ue=L.content.cloneNode(!0).firstElementChild;return jt(ue,{},L),ct(()=>{L.after(ue),Ie(ue)}),L._x_currentIfEl=ue,L._x_undoIf=()=>{ye(ue,Oe=>{Oe._x_effects&&Oe._x_effects.forEach(r)}),ue.remove(),delete L._x_currentIfEl},ue},Ht=()=>{!L._x_undoIf||(L._x_undoIf(),delete L._x_undoIf)};Q(()=>Ct(ue=>{ue?Rt():Ht()})),dt(()=>L._x_undoIf&&L._x_undoIf())}),ie("id",(L,{expression:H},{evaluate:Q})=>{Q(H).forEach(dt=>_S(L,dt))}),xt(Ft("@",Ee(Nt("on:")))),ie("on",Un((L,{value:H,modifiers:Q,expression:dt},{cleanup:Ct})=>{let Rt=dt?Ae(L,dt):()=>{};L.tagName.toLowerCase()==="template"&&(L._x_forwardEvents||(L._x_forwardEvents=[]),L._x_forwardEvents.includes(H)||L._x_forwardEvents.push(H));let Ht=el(L,H,Q,ue=>{Rt(()=>{},{scope:{$event:ue},params:[ue]})});Ct(()=>Ht())})),kf("Collapse","collapse","collapse"),kf("Intersect","intersect","intersect"),kf("Focus","trap","focus"),kf("Mask","mask","mask");function kf(L,H,Q){ie(H,dt=>be(`You can't use [x-${H}] without first installing the "${L}" plugin here: https://alpinejs.dev/plugins/${Q}`,dt))}Tc.setEvaluator(It),Tc.setReactivityEngine({reactive:xu,effect:yf,release:Kg,raw:Ai});var DS=Tc;window.Alpine=DS,queueMicrotask(()=>{DS.start()})})()});var VV=uo((UV,zV)=>{(function(i,t){typeof UV=="object"&&typeof zV<"u"?zV.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis<"u"?globalThis:i||self).Chart=t()})(UV,(function(){"use strict";var i=Object.freeze({__proto__:null,get Colors(){return hst},get Decimation(){return dst},get Filler(){return yst},get Legend(){return xst},get SubTitle(){return _st},get Title(){return wst},get Tooltip(){return Mst}});function t(){}let e=(()=>{let b=0;return()=>b++})();function n(b){return b==null}function s(b){if(Array.isArray&&Array.isArray(b))return!0;let f=Object.prototype.toString.call(b);
vendor: 1,309 bytes, line 4666
4666return f.slice(0,7)==="[object"&&f.slice(-6)==="Array]"}function r(b){return b!==null&&Object.prototype.toString.call(b)==="[object Object]"}function o(b){return(typeof b=="number"||b instanceof Number)&&isFinite(+b)}function a(b,f){return o(b)?b:f}function l(b,f){return b===void 0?f:b}let c=(b,f)=>typeof b=="string"&&b.endsWith("%")?parseFloat(b)/100:+b/f,u=(b,f)=>typeof b=="string"&&b.endsWith("%")?parseFloat(b)/100*f:+b;function h(b,f,m){if(b&&typeof b.call=="function")return b.apply(m,f)}function d(b,f,m,v){let S,T,E;if(s(b))if(T=b.length,v)for(S=T-1;S>=0;S--)f.call(m,b[S],S);else for(S=0;S<T;S++)f.call(m,b[S],S);else if(r(b))for(E=Object.keys(b),T=E.length,S=0;S<T;S++)f.call(m,b[E[S]],E[S])}function p(b,f){let m,v,S,T;if(!b||!f||b.length!==f.length)return!1;for(m=0,v=b.length;m<v;++m)if(S=b[m],T=f[m],S.datasetIndex!==T.datasetIndex||S.index!==T.index)return!1;return!0}function g(b){if(s(b))return b.map(g);if(r(b)){let f=Object.create(null),m=Object.keys(b),v=m.length,S=0;for(;S<v;++S)f[m[S]]=g(b[m[S]]);return f}return b}function y(b){return["__proto__","prototype","constructor"].indexOf(b)===-1}function x(b,f,m,v){if(!y(b))return;let S=f[b],T=m[b];r(S)&&r(T)?w(S,T,v):f[b]=g(T)}function w(b,f,m){let v=s(f)?f:[f],S=v.length;if(!r(b))return b;let T=(m=m||{}).merger||x,E;for(let D=0;D<S;
4666++D){if(E=v[D],!r(E))continue;let N=Object.keys(E);for(let F=0,G=N.length;F<G;++F)T(N[F],b,E,m)}return b}function M(b,f){return w(b,f,{merger:A})}function A(b,f,m){if(!y(b))return;let v=f[b],S=m[b];r(v)&&r(S)?M(v,S):Object.prototype.hasOwnProperty.call(f,b)||(f[b]=g(S))}let C={"":b=>b,x:b=>b.x,y:b=>b.y};function R(b){let f=b.split("."),m=[],v="";for(let S of f)v+=S,v.endsWith("\\")?v=v.slice(0,-1)+".":(m.push(v),v="");return m}function k(b,f){return(C[f]||(C[f]=(function(v){let S=R(v);return T=>{for(let E of S){if(E==="")break;T=T&&T[E]}return T}})(f)))(b)}function O(b){return b.charAt(0).toUpperCase()+b.slice(1)}let I=b=>b!==void 0,U=b=>typeof b=="function",V=(b,f)=>{if(b.size!==f.size)return!1;for(let m of b)if(!f.has(m))return!1;return!0};function q(b){return b.type==="mouseup"||b.type==="click"||b.type==="contextmenu"}let X=Math.PI,j=2*X,W=j+X,_=Number.POSITIVE_INFINITY,at=X/180,ct=X/2,pt=X/4,Et=2*X/3,vt=Math.log10,yt=Math.sign;function kt(b,f,m){return Math.abs(b-f)<m}function Wt(b){let f=Math.round(b);b=kt(b,f,b/1e3)?f:b;let m=Math.pow(10,Math.floor(vt(b))),v=b/m;return(v<=1?1:v<=2?2:v<=5?5:10)*m}function jt(b){let f=[],m=Math.sqrt(b),v;for(v=1;v<m;v++)b%v==0&&(f.push(v),f.push(b/v));return m===(0|m)&&f.push(m),f.sort(((S,T)=>S-T)).pop(),f}function ae(b){return!isNaN(parseFloat(b))&&isFinite(b)}function ee(b,f){let m=Math.round(b);return m-f<=b&&m+f>=b}function Bt(b,f,m){let v,S,T;for(v=0,S=b.length;v<S;v++)T=b[v][m],isNaN(T)||(f.min=Math.min(f.min,T),f.max=Math.max(f.max,T))}function Gt(b){return b*(X/180)}function Qt(b){return b*(180/X)}function xe(b){if(!o(b))return;let f=1,m=0;for(;Math.round(b*f)/f!==b;)f*=10,m++;return m}function Ut(b,f){let m=f.x-b.x,v=f.y-b.y,S=Math.sqrt(m*m+v*v),T=Math.atan2(v,m);return T<-.5*X&&(T+=j),{angle:T,distance:S}}function zt(b,f){return Math.sqrt(Math.pow(f.x-b.x,2)+Math.pow(f.y-b.y,2))}function St(b,f){return(b-f+W)%j-X}function it(b){return(b%j+j)%j}function gt(b,f,m,v){let S=it(b),T=it(f),E=it(m),D=it(T-S),N=it(E-S),F=it(S-T),G=it(S-E);return S===T||S===E||v&&T===E||D>N&&F<G}function ft(b,f,m){return Math.max(f,Math.min(m,b))}function de(b){return ft(b,-32768,32767)}function ve(b,f,m,v=1e-6){return b>=Math.min(f,m)-v&&b<=Math.max(f,m)+v}function we(b,f,m){m=m||(E=>b[E]<f);let v,S=b.length-1,T=0;for(;S-T>1;)v=T+S>>1,m(v)?T=v:S=v;return{lo:T,hi:S}}let Ae=(b,f,m,v)=>we(b,m,v?S=>{let T=b[S][f];return T<m||T===m&&b[S+1][f]===m}:S=>b[S][f]<m),Ue=(b,f,m)=>we(b,m,(v=>b[v][f]>=m));function en(b,f,m){let v=0,S=b.length;for(;v<S&&b[v]<f;)v++;for(;S>v&&b[S-1]>m;)S--;return v>0||S<b.length?b.slice(v,S):b}let It=["push","pop","shift","splice","unshift"];function Cn(b,f){b._chartjs?b._chartjs.listeners.push(f):(Object.defineProperty(b,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[f]}}),It.forEach((m=>{let v="_onData"+O(m),S=b[m];Object.defineProperty(b,m,{configurable:!0,enumerable:!1,value(...T){let E=S.apply(this,T);return b._chartjs.listeners.forEach((D=>{typeof D[v]=="function"&&D[v](...T)})),E}})})))}function mn(b,f){let m=b._chartjs;if(!m)return;let v=m.listeners,S=v.indexOf(f);S!==-1&&v.splice(S,1),v.length>0||(It.forEach((T=>{delete b[T]})),delete b._chartjs)}function mt(b){let f=new Set(b);return f.size===b.length?b:Array.from(f)}let K=typeof window>"u"?function(b){return b()}:window.requestAnimationFrame;function Vt(b,f){let m=[],v=!1;return function(...S){m=S,v||(v=!0,K.call(window,(()=>{v=!1,b.apply(f,m)})))}}function te(b,f){let m;return function(...v){return f?(clearTimeout(m),m=setTimeout(b,f,v)):b.apply(this,v),f}}let Nt=b=>b==="start"?"left":b==="end"?"right":"center",Se=(b,f,m)=>b==="start"?f:b==="end"?m:(f+m)/2,Me=(b,f,m,v)=>b===(v?"left":"right")?m:b==="center"?(f+m)/2:f;function ie(b,f,m){let v=f.length,S=0,T=v;if(b._sorted){let{iScale:E,_parsed:D}=b,N=E.axis,{min:F,max:G,minDefined:z,maxDefined:Y}=E.getUserBounds();z&&(S=ft(Math.min(Ae(D,E.axis,F).lo,m?v:Ae(f,N,E.getPixelForValue(F)).lo),0,v-1)),T=Y?ft(Math.max(Ae(D,E.axis,G,!0).hi+1,m?0:Ae(f,N,E.getPixelForValue(G),!0).hi+1),S,v)-S:v-S}return{start:S,count:T}}function _t(b){let{xScale:f,yScale:m,_scaleRanges:v}=b,S={xmin:f.min,xmax:f.max,ymin:m.min,ymax:m.max};if(!v)return b._scaleRanges=S,!0;let T=v.xmin!==f.min||v.xmax!==f.max||v.ymin!==m.min||v.ymax!==m.max;return Object.assign(v,S),T}class Zt{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(f,m,v,S){let T=m.listeners[S],E=m.duration;T.forEach((D=>D({chart:f,initial:m.initial,numSteps:E,currentStep:Math.min(v-m.start,E)})))}_refresh(){this._request||(this._running=!0,this._request=K.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(f=Date.now()){let m=0;
4666this._charts.forEach(((v,S)=>{if(!v.running||!v.items.length)return;let T=v.items,E,D=T.length-1,N=!1;for(;D>=0;--D)E=T[D],E._active?(E._total>v.duration&&(v.duration=E._total),E.tick(f),N=!0):(T[D]=T[T.length-1],T.pop());N&&(S.draw(),this._notify(S,v,f,"progress")),T.length||(v.running=!1,this._notify(S,v,f,"complete"),v.initial=!1),m+=T.length})),this._lastDate=f,m===0&&(this._running=!1)}_getAnims(f){let m=this._charts,v=m.get(f);return v||(v={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},m.set(f,v)),v}listen(f,m,v){this._getAnims(f).listeners[m].push(v)}add(f,m){m&&m.length&&this._getAnims(f).items.push(...m)}has(f){return this._getAnims(f).items.length>0}start(f){let m=this._charts.get(f);m&&(m.running=!0,m.start=Date.now(),m.duration=m.items.reduce(((v,S)=>Math.max(v,S._duration)),0),this._refresh())}running(f){if(!this._running)return!1;let m=this._charts.get(f);return!!(m&&m.running&&m.items.length)}stop(f){let m=this._charts.get(f);if(!m||!m.items.length)return;let v=m.items,S=v.length-1;for(;S>=0;--S)v[S].cancel();m.items=[],this._notify(f,m,Date.now(),"complete")}remove(f){return this._charts.delete(f)}}var fe=new Zt;function ce(b){return b+.5|0}let pe=(b,f,m)=>Math.max(Math.min(b,m),f);function Fe(b){return pe(ce(2.55*b),0,255)}function je(b){return pe(ce(255*b),0,255)}function Re(b){return pe(ce(b/2.55)/100,0,1)}function Ft(b){return pe(ce(100*b),0,100)}let Ee={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},J=[..."0123456789ABCDEF"],lt=b=>J[15&b],xt=b=>J[(240&b)>>4]+J[15&b],At=b=>(240&b)>>4==(15&b);function st(b){var f=(m=>At(m.r)&&At(m.g)&&At(m.b)&&At(m.a))(b)?lt:xt;return b?"#"+f(b.r)+f(b.g)+f(b.b)+((m,v)=>m<255?v(m):"")(b.a,f):void 0}let rt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Tt(b,f,m){let v=f*Math.min(m,1-m),S=(T,E=(T+b/30)%12)=>m-v*Math.max(Math.min(E-3,9-E,1),-1);return[S(0),S(8),S(4)]}function Dt(b,f,m){let v=(S,T=(S+b/60)%6)=>m-m*f*Math.max(Math.min(T,4-T,1),0);return[v(5),v(3),v(1)]}function he(b,f,m){let v=Tt(b,1,.5),S;for(f+m>1&&(S=1/(f+m),f*=S,m*=S),S=0;S<3;S++)v[S]*=1-f-m,v[S]+=f;return v}function se(b){let f=b.r/255,m=b.g/255,v=b.b/255,S=Math.max(f,m,v),T=Math.min(f,m,v),E=(S+T)/2,D,N,F;return S!==T&&(F=S-T,N=E>.5?F/(2-S-T):F/(S+T),D=(function(G,z,Y,tt,ht){return G===ht?(z-Y)/tt+(z<Y?6:0):z===ht?(Y-G)/tt+2:(G-z)/tt+4})(f,m,v,F,S),D=60*D+.5),[0|D,N||0,E]}function ye(b,f,m,v){return(Array.isArray(f)?b(f[0],f[1],f[2]):b(f,m,v)).map(je)}function be(b,f,m){return ye(Tt,b,f,m)}function fn(b){return(b%360+360)%360}function qe(b){let f=rt.exec(b),m,v=255;if(!f)return;f[5]!==m&&(v=f[6]?Fe(+f[5]):je(+f[5]));let S=fn(+f[2]),T=+f[3]/100,E=+f[4]/100;return m=f[1]==="hwb"?(function(D,N,F){return ye(he,D,N,F)})(S,T,E):f[1]==="hsv"?(function(D,N,F){return ye(Dt,D,N,F)})(S,T,E):be(S,T,E),{r:m[0],g:m[1],b:m[2],a:v}}let xn={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},vn={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"},jn;function Fn(b){jn||(jn=(function(){let m={},v=Object.keys(vn),S=Object.keys(xn),T,E,D,N,F;for(T=0;T<v.length;T++){for(N=F=v[T],E=0;E<S.length;E++)D=S[E],F=F.replace(D,xn[D]);D=parseInt(vn[N],16),m[F]=[D>>16&255,D>>8&255,255&D]}return m})(),jn.transparent=[0,0,0,0]);let f=jn[b.toLowerCase()];return f&&{r:f[0],g:f[1],b:f[2],a:f.length===4?f[3]:255}}let si=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,Ti=b=>
4666b<=.0031308?12.92*b:1.055*Math.pow(b,1/2.4)-.055,Yi=b=>b<=.04045?b/12.92:Math.pow((b+.055)/1.055,2.4);function _s(b,f,m){if(b){let v=se(b);v[f]=Math.max(0,Math.min(v[f]+v[f]*m,f===0?360:1)),v=be(v),b.r=v[0],b.g=v[1],b.b=v[2]}}function Pt(b,f){return b&&Object.assign(f||{},b)}function ze(b){var f={r:0,g:0,b:0,a:255};return Array.isArray(b)?b.length>=3&&(f={r:b[0],g:b[1],b:b[2],a:255},b.length>3&&(f.a=je(b[3]))):(f=Pt(b,{r:0,g:0,b:0,a:1})).a=je(f.a),f}function Ie(b){return b.charAt(0)==="r"?(function(f){let m=si.exec(f),v,S,T,E=255;if(m){if(m[7]!==v){let D=+m[7];E=m[8]?Fe(D):pe(255*D,0,255)}return v=+m[1],S=+m[3],T=+m[5],v=255&(m[2]?Fe(v):pe(v,0,255)),S=255&(m[4]?Fe(S):pe(S,0,255)),T=255&(m[6]?Fe(T):pe(T,0,255)),{r:v,g:S,b:T,a:E}}})(b):qe(b)}class En{constructor(f){if(f instanceof En)return f;let m=typeof f,v;var S,T,E;m==="object"?v=ze(f):m==="string"&&(E=(S=f).length,S[0]==="#"&&(E===4||E===5?T={r:255&17*Ee[S[1]],g:255&17*Ee[S[2]],b:255&17*Ee[S[3]],a:E===5?17*Ee[S[4]]:255}:E!==7&&E!==9||(T={r:Ee[S[1]]<<4|Ee[S[2]],g:Ee[S[3]]<<4|Ee[S[4]],b:Ee[S[5]]<<4|Ee[S[6]],a:E===9?Ee[S[7]]<<4|Ee[S[8]]:255})),v=T||Fn(f)||Ie(f)),this._rgb=v,this._valid=!!v}get valid(){return this._valid}get rgb(){var f=Pt(this._rgb);return f&&(f.a=Re(f.a)),f}set rgb(f){this._rgb=ze(f)}rgbString(){return this._valid?(f=this._rgb)&&(f.a<255?`rgba(${f.r}, ${f.g}, ${f.b}, ${Re(f.a)})`:`rgb(${f.r}, ${f.g}, ${f.b})`):void 0;var f}hexString(){return this._valid?st(this._rgb):void 0}hslString(){return this._valid?(function(f){if(!f)return;let m=se(f),v=m[0],S=Ft(m[1]),T=Ft(m[2]);return f.a<255?`hsla(${v}, ${S}%, ${T}%, ${Re(f.a)})`:`hsl(${v}, ${S}%, ${T}%)`})(this._rgb):void 0}mix(f,m){if(f){let v=this.rgb,S=f.rgb,T,E=m===T?.5:m,D=2*E-1,N=v.a-S.a,F=((D*N==-1?D:(D+N)/(1+D*N))+1)/2;T=1-F,v.r=255&F*v.r+T*S.r+.5,v.g=255&F*v.g+T*S.g+.5,v.b=255&F*v.b+T*S.b+.5,v.a=E*v.a+(1-E)*S.a,this.rgb=v}return this}interpolate(f,m){return f&&(this._rgb=(function(v,S,T){let E=Yi(Re(v.r)),D=Yi(Re(v.g)),N=Yi(Re(v.b));return{r:je(Ti(E+T*(Yi(Re(S.r))-E))),g:je(Ti(D+T*(Yi(Re(S.g))-D))),b:je(Ti(N+T*(Yi(Re(S.b))-N))),a:v.a+T*(S.a-v.a)}})(this._rgb,f._rgb,m)),this}clone(){return new En(this.rgb)}alpha(f){return this._rgb.a=je(f),this}clearer(f){return this._rgb.a*=1-f,this}greyscale(){let f=this._rgb,m=ce(.3*f.r+.59*f.g+.11*f.b);return f.r=f.g=f.b=m,this}opaquer(f){return this._rgb.a*=1+f,this}negate(){let f=this._rgb;return f.r=255-f.r,f.g=255-f.g,f.b=255-f.b,this}lighten(f){return _s(this._rgb,2,f),this}darken(f){return _s(this._rgb,2,-f),this}saturate(f){return _s(this._rgb,1,f),this}desaturate(f){return _s(this._rgb,1,-f),this}rotate(f){return(function(m,v){var S=se(m);S[0]=fn(S[0]+v),S=be(S),m.r=S[0],m.g=S[1],m.b=S[2]})(this._rgb,f),this}}function Dn(b){if(b&&typeof b=="object"){let f=b.toString();return f==="[object CanvasPattern]"||f==="[object CanvasGradient]"}return!1}function Xe(b){return Dn(b)?b:new En(b)}function mi(b){return Dn(b)?b:new En(b).saturate(.5).darken(.1).hexString()}let Qi=["x","y","borderWidth","radius","tension"],hi=["color","borderColor","backgroundColor"],nt=new Map;function Ot(b,f,m){return(function(v,S){S=S||{};let T=v+JSON.stringify(S),E=nt.get(T);return E||(E=new Intl.NumberFormat(v,S),nt.set(T,E)),E})(f,m).format(b)}let re={values:b=>s(b)?b:""+b,numeric(b,f,m){if(b===0)return"0";let v=this.chart.options.locale,S,T=b;if(m.length>1){let F=Math.max(Math.abs(m[0].value),Math.abs(m[m.length-1].value));(F<1e-4||F>1e15)&&(S="scientific"),T=(function(G,z){let Y=z.length>3?z[2].value-z[1].value:z[1].value-z[0].value;return Math.abs(Y)>=1&&G!==Math.floor(G)&&(Y=G-Math.floor(G)),Y})(b,m)}let E=vt(Math.abs(T)),D=isNaN(E)?1:Math.max(Math.min(-1*Math.floor(E),20),0),N={notation:S,minimumFractionDigits:D,maximumFractionDigits:D};return Object.assign(N,this.options.ticks.format),Ot(b,v,N)},logarithmic(b,f,m){if(b===0)return"0";let v=m[f].significand||b/Math.pow(10,Math.floor(vt(b)));return[1,2,3,5,10,15].includes(v)||f>.8*m.length?re.numeric.call(this,b,f,m):""}};var Kt={formatters:re};let ne=Object.create(null),Ke=Object.create(null);function nn(b,f){if(!f)return b;let m=f.split(".");for(let v=0,S=m.length;v<S;++v){let T=m[v];b=b[T]||(b[T]=Object.create(null))}return b}function $e(b,f,m){return typeof f=="string"?w(nn(b,f),m):w(nn(b,""),f)}class bn{constructor(f,m){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=v=>v.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={}
4666,this.hoverBackgroundColor=(v,S)=>mi(S.backgroundColor),this.hoverBorderColor=(v,S)=>mi(S.borderColor),this.hoverColor=(v,S)=>mi(S.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(f),this.apply(m)}set(f,m){return $e(this,f,m)}get(f){return nn(this,f)}describe(f,m){return $e(Ke,f,m)}override(f,m){return $e(ne,f,m)}route(f,m,v,S){let T=nn(this,f),E=nn(this,v),D="_"+m;Object.defineProperties(T,{[D]:{value:T[m],writable:!0},[m]:{enumerable:!0,get(){let N=this[D],F=E[S];return r(N)?Object.assign({},F,N):l(N,F)},set(N){this[D]=N}}})}apply(f){f.forEach((m=>m(this)))}}var We=new bn({_scriptable:b=>!b.startsWith("on"),_indexable:b=>b!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(b){b.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),b.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:f=>f!=="onProgress"&&f!=="onComplete"&&f!=="fn"}),b.set("animations",{colors:{type:"color",properties:hi},numbers:{type:"number",properties:Qi}}),b.describe("animations",{_fallback:"animation"}),b.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:f=>0|f}}}})},function(b){b.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(b){b.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(f,m)=>m.lineWidth,tickColor:(f,m)=>m.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Kt.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),b.route("scale.ticks","color","","color"),b.route("scale.grid","color","","borderColor"),b.route("scale.border","color","","borderColor"),b.route("scale.title","color","","color"),b.describe("scale",{_fallback:!1,_scriptable:f=>!f.startsWith("before")&&!f.startsWith("after")&&f!=="callback"&&f!=="parser",_indexable:f=>f!=="borderDash"&&f!=="tickBorderDash"&&f!=="dash"}),b.describe("scales",{_fallback:"scale"}),b.describe("scale.ticks",{_scriptable:f=>f!=="backdropPadding"&&f!=="callback",_indexable:f=>f!=="backdropPadding"})}]);function Nn(){return typeof window<"u"&&typeof document<"u"}function Hn(b){let f=b.parentNode;return f&&f.toString()==="[object ShadowRoot]"&&(f=f.host),f}function pn(b,f,m){let v;return typeof b=="string"?(v=parseInt(b,10),b.indexOf("%")!==-1&&(v=v/100*f.parentNode[m])):v=b,v}let ri=b=>b.ownerDocument.defaultView.getComputedStyle(b,null);function Ni(b,f){return ri(b).getPropertyValue(f)}let Si=["top","right","bottom","left"];function Un(b,f,m){let v={};m=m?"-"+m:"";for(let S=0;S<4;S++){let T=Si[S];v[T]=parseFloat(b[f+"-"+T+m])||0}return v.width=v.left+v.right,v.height=v.top+v.bottom,v}let Ss=(b,f,m)=>(b>0||f>0)&&(!m||!m.shadowRoot);function Ye(b,f){if("native"in b)return b;let{canvas:m,currentDevicePixelRatio:v}=f,S=ri(m),T=S.boxSizing==="border-box",E=Un(S,"padding"),D=Un(S,"border","width"),{x:N,y:F,box:G}=(function(ot,ut){let Lt=ot.touches,Jt=Lt&&Lt.length?Lt[0]:ot,{offsetX:Xt,offsetY:Yt}=Jt,me,Te,He=!1;if(Ss(Xt,Yt,ot.target))me=Xt,Te=Yt;else{let Je=ut.getBoundingClientRect();me=Jt.clientX-Je.left,Te=Jt.clientY-Je.top,He=!0}return{x:me,y:Te,box:He}})(b,m),z=E.left+(G&&D.left),Y=E.top+(G&&D.top),{width:tt,height:ht}=f;return T&&(tt-=E.width+D.width,ht-=E.height+D.height),{x:Math.round((N-z)/tt*m.width/v),y:Math.round((F-Y)/ht*m.height/v)}}let ps=b=>Math.round(10*b)/10;function ti(b,f,m,v){let S=ri(b),T=Un(S,"margin"),E=pn(S.maxWidth,b,"clientWidth")||_,D=pn(S.maxHeight,b,"clientHeight")||_,N=(function(z,Y,tt){let ht,ot;if(Y===void 0||tt===void 0){let ut=Hn(z);if(ut){let Lt=ut.getBoundingClientRect(),Jt=ri(ut),Xt=Un(Jt,"border","width"),Yt=Un(Jt,"padding");
4666Y=Lt.width-Yt.width-Xt.width,tt=Lt.height-Yt.height-Xt.height,ht=pn(Jt.maxWidth,ut,"clientWidth"),ot=pn(Jt.maxHeight,ut,"clientHeight")}else Y=z.clientWidth,tt=z.clientHeight}return{width:Y,height:tt,maxWidth:ht||_,maxHeight:ot||_}})(b,f,m),{width:F,height:G}=N;if(S.boxSizing==="content-box"){let z=Un(S,"border","width"),Y=Un(S,"padding");F-=Y.width+z.width,G-=Y.height+z.height}return F=Math.max(0,F-T.width),G=Math.max(0,v?F/v:G-T.height),F=ps(Math.min(F,E,N.maxWidth)),G=ps(Math.min(G,D,N.maxHeight)),F&&!G&&(G=ps(F/2)),(f!==void 0||m!==void 0)&&v&&N.height&&G>N.height&&(G=N.height,F=ps(Math.floor(G*v))),{width:F,height:G}}function $n(b,f,m){let v=f||1,S=Math.floor(b.height*v),T=Math.floor(b.width*v);b.height=Math.floor(b.height),b.width=Math.floor(b.width);let E=b.canvas;return E.style&&(m||!E.style.height&&!E.style.width)&&(E.style.height=`${b.height}px`,E.style.width=`${b.width}px`),(b.currentDevicePixelRatio!==v||E.height!==S||E.width!==T)&&(b.currentDevicePixelRatio=v,E.height=S,E.width=T,b.ctx.setTransform(v,0,0,v,0,0),!0)}let $r=(function(){let b=!1;try{let f={get passive(){return b=!0,!1}};window.addEventListener("test",null,f),window.removeEventListener("test",null,f)}catch{}return b})();function so(b,f){let m=Ni(b,f),v=m&&m.match(/^(\d+)(\.\d+)?px$/);return v?+v[1]:void 0}function ea(b){return!b||n(b.size)||n(b.family)?null:(b.style?b.style+" ":"")+(b.weight?b.weight+" ":"")+b.size+"px "+b.family}function Xn(b,f,m,v,S){let T=f[S];return T||(T=f[S]=b.measureText(S).width,m.push(S)),T>v&&(v=T),v}function Bi(b,f,m,v){let S=(v=v||{}).data=v.data||{},T=v.garbageCollect=v.garbageCollect||[];v.font!==f&&(S=v.data={},T=v.garbageCollect=[],v.font=f),b.save(),b.font=f;let E=0,D=m.length,N,F,G,z,Y;for(N=0;N<D;N++)if(z=m[N],z==null||s(z)){if(s(z))for(F=0,G=z.length;F<G;F++)Y=z[F],Y==null||s(Y)||(E=Xn(b,S,T,E,Y))}else E=Xn(b,S,T,E,z);b.restore();let tt=T.length/2;if(tt>m.length){for(N=0;N<tt;N++)delete S[T[N]];T.splice(0,tt)}return E}function Cs(b,f,m){let v=b.currentDevicePixelRatio,S=m!==0?Math.max(m/2,.5):0;return Math.round((f-S)*v)/v+S}function xi(b,f){(f=f||b.getContext("2d")).save(),f.resetTransform(),f.clearRect(0,0,b.width,b.height),f.restore()}function yr(b,f,m,v){Ro(b,f,m,v,null)}function Ro(b,f,m,v,S){let T,E,D,N,F,G,z,Y,tt=f.pointStyle,ht=f.rotation,ot=f.radius,ut=(ht||0)*at;if(tt&&typeof tt=="object"&&(T=tt.toString(),T==="[object HTMLImageElement]"||T==="[object HTMLCanvasElement]"))return b.save(),b.translate(m,v),b.rotate(ut),b.drawImage(tt,-tt.width/2,-tt.height/2,tt.width,tt.height),void b.restore();if(!(isNaN(ot)||ot<=0)){switch(b.beginPath(),tt){default:S?b.ellipse(m,v,S/2,ot,0,0,j):b.arc(m,v,ot,0,j),b.closePath();break;case"triangle":G=S?S/2:ot,b.moveTo(m+Math.sin(ut)*G,v-Math.cos(ut)*ot),ut+=Et,b.lineTo(m+Math.sin(ut)*G,v-Math.cos(ut)*ot),ut+=Et,b.lineTo(m+Math.sin(ut)*G,v-Math.cos(ut)*ot),b.closePath();break;case"rectRounded":F=.516*ot,N=ot-F,E=Math.cos(ut+pt)*N,z=Math.cos(ut+pt)*(S?S/2-F:N),D=Math.sin(ut+pt)*N,Y=Math.sin(ut+pt)*(S?S/2-F:N),b.arc(m-z,v-D,F,ut-X,ut-ct),b.arc(m+Y,v-E,F,ut-ct,ut),b.arc(m+z,v+D,F,ut,ut+ct),b.arc(m-Y,v+E,F,ut+ct,ut+X),b.closePath();break;case"rect":if(!ht){N=Math.SQRT1_2*ot,G=S?S/2:N,b.rect(m-G,v-N,2*G,2*N);break}ut+=pt;case"rectRot":z=Math.cos(ut)*(S?S/2:ot),E=Math.cos(ut)*ot,D=Math.sin(ut)*ot,Y=Math.sin(ut)*(S?S/2:ot),b.moveTo(m-z,v-D),b.lineTo(m+Y,v-E),b.lineTo(m+z,v+D),b.lineTo(m-Y,v+E),b.closePath();break;case"crossRot":ut+=pt;case"cross":z=Math.cos(ut)*(S?S/2:ot),E=Math.cos(ut)*ot,D=Math.sin(ut)*ot,Y=Math.sin(ut)*(S?S/2:ot),b.moveTo(m-z,v-D),b.lineTo(m+z,v+D),b.moveTo(m+Y,v-E),b.lineTo(m-Y,v+E);break;case"star":z=Math.cos(ut)*(S?S/2:ot),E=Math.cos(ut)*ot,D=Math.sin(ut)*ot,Y=Math.sin(ut)*(S?S/2:ot),b.moveTo(m-z,v-D),b.lineTo(m+z,v+D),b.moveTo(m+Y,v-E),b.lineTo(m-Y,v+E),ut+=pt,z=Math.cos(ut)*(S?S/2:ot),E=Math.cos(ut)*ot,D=Math.sin(ut)*ot,Y=Math.sin(ut)*(S?S/2:ot),b.moveTo(m-z,v-D),b.lineTo(m+z,v+D),b.moveTo(m+Y,v-E),b.lineTo(m-Y,v+E);break;case"line":E=S?S/2:Math.cos(ut)*ot,D=Math.sin(ut)*ot,b.moveTo(m-E,v-D),b.lineTo(m+E,v+D);break;case"dash":b.moveTo(m,v),b.lineTo(m+Math.cos(ut)*(S?S/2:ot),v+Math.sin(ut)*ot);break;case!1:b.closePath()}b.fill(),f.borderWidth>0&&b.stroke()}}function xr(b,f,m){return m=m||.5,!f||b&&b.x>f.left-m&&b.x<f.right+m&&b.y>f.top-m&&b.y<f.bottom+m}function Dl(b,f){b.save(),b.beginPath(),b.rect(f.left,f.top,f.right-f.left,f.bottom-f.top),b.clip()}
4666function Ja(b){b.restore()}function Mh(b,f,m,v,S){if(!f)return b.lineTo(m.x,m.y);if(S==="middle"){let T=(f.x+m.x)/2;b.lineTo(T,f.y),b.lineTo(T,m.y)}else S==="after"!=!!v?b.lineTo(f.x,m.y):b.lineTo(m.x,f.y);b.lineTo(m.x,m.y)}function jg(b,f,m,v){if(!f)return b.lineTo(m.x,m.y);b.bezierCurveTo(v?f.cp1x:f.cp2x,v?f.cp1y:f.cp2y,v?m.cp2x:m.cp1x,v?m.cp2y:m.cp1y,m.x,m.y)}function Ll(b,f,m,v,S){if(S.strikethrough||S.underline){let T=b.measureText(v),E=f-T.actualBoundingBoxLeft,D=f+T.actualBoundingBoxRight,N=m-T.actualBoundingBoxAscent,F=m+T.actualBoundingBoxDescent,G=S.strikethrough?(N+F)/2:F;b.strokeStyle=b.fillStyle,b.beginPath(),b.lineWidth=S.decorationWidth||2,b.moveTo(E,G),b.lineTo(D,G),b.stroke()}}function ro(b,f){let m=b.fillStyle;b.fillStyle=f.color,b.fillRect(f.left,f.top,f.width,f.height),b.fillStyle=m}function Dr(b,f,m,v,S,T={}){let E=s(f)?f:[f],D=T.strokeWidth>0&&T.strokeColor!=="",N,F;for(b.save(),b.font=S.string,(function(G,z){z.translation&&G.translate(z.translation[0],z.translation[1]),n(z.rotation)||G.rotate(z.rotation),z.color&&(G.fillStyle=z.color),z.textAlign&&(G.textAlign=z.textAlign),z.textBaseline&&(G.textBaseline=z.textBaseline)})(b,T),N=0;N<E.length;++N)F=E[N],T.backdrop&&ro(b,T.backdrop),D&&(T.strokeColor&&(b.strokeStyle=T.strokeColor),n(T.strokeWidth)||(b.lineWidth=T.strokeWidth),b.strokeText(F,m,v,T.maxWidth)),b.fillText(F,m,v,T.maxWidth),Ll(b,m,v,F,T),v+=Number(S.lineHeight);b.restore()}function Il(b,f){let{x:m,y:v,w:S,h:T,radius:E}=f;b.arc(m+E.topLeft,v+E.topLeft,E.topLeft,-ct,X,!0),b.lineTo(m,v+T-E.bottomLeft),b.arc(m+E.bottomLeft,v+T-E.bottomLeft,E.bottomLeft,X,ct,!0),b.lineTo(m+S-E.bottomRight,v+T),b.arc(m+S-E.bottomRight,v+T-E.bottomRight,E.bottomRight,ct,0,!0),b.lineTo(m+S,v+E.topRight),b.arc(m+S-E.topRight,v+E.topRight,E.topRight,0,-ct,!0),b.lineTo(m+E.topLeft,v)}function Mc(b,f=[""],m,v,S=(()=>b[0])){let T=m||b;v===void 0&&(v=mf("_fallback",b));let E={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:b,_rootScopes:T,_fallback:v,_getTarget:S,override:D=>Mc([D,...b],f,T,v)};return new Proxy(E,{deleteProperty:(D,N)=>(delete D[N],delete D._keys,delete b[0][N],!0),get:(D,N)=>$g(D,N,(()=>(function(F,G,z,Y){let tt;for(let ht of G)if(tt=mf(Wg(ht,F),z),tt!==void 0)return mu(F,tt)?bu(z,Y,F,tt):tt})(N,f,b,D))),getOwnPropertyDescriptor:(D,N)=>Reflect.getOwnPropertyDescriptor(D._scopes[0],N),getPrototypeOf:()=>Reflect.getPrototypeOf(b[0]),has:(D,N)=>Ac(D).includes(N),ownKeys:D=>Ac(D),set(D,N,F){let G=D._storage||(D._storage=S());return D[N]=G[N]=F,delete D._keys,!0}})}function Za(b,f,m,v){let S={_cacheable:!1,_proxy:b,_context:f,_subProxy:m,_stack:new Set,_descriptors:gf(b,v),setContext:T=>Za(b,T,m,v),override:T=>Za(b.override(T),f,m,v)};return new Proxy(S,{deleteProperty:(T,E)=>(delete T[E],delete b[E],!0),get:(T,E,D)=>$g(T,E,(()=>(function(N,F,G){let{_proxy:z,_context:Y,_subProxy:tt,_descriptors:ht}=N,ot=z[F];return U(ot)&&ht.isScriptable(F)&&(ot=(function(ut,Lt,Jt,Xt){let{_proxy:Yt,_context:me,_subProxy:Te,_stack:He}=Jt;if(He.has(ut))throw new Error("Recursion detected: "+Array.from(He).join("->")+"->"+ut);He.add(ut);let Je=Lt(me,Te||Xt);return He.delete(ut),mu(ut,Je)&&(Je=bu(Yt._scopes,Yt,ut,Je)),Je})(F,ot,N,G)),s(ot)&&ot.length&&(ot=(function(ut,Lt,Jt,Xt){let{_proxy:Yt,_context:me,_subProxy:Te,_descriptors:He}=Jt;if(me.index!==void 0&&Xt(ut))return Lt[me.index%Lt.length];if(r(Lt[0])){let Je=Lt,cn=Yt._scopes.filter((sn=>sn!==Je));Lt=[];for(let sn of Je){let wn=bu(cn,Yt,ut,sn);Lt.push(Za(wn,me,Te&&Te[ut],He))}}return Lt})(F,ot,N,ht.isIndexable)),mu(F,ot)&&(ot=Za(ot,Y,tt&&tt[F],ht)),ot})(T,E,D))),getOwnPropertyDescriptor:(T,E)=>T._descriptors.allKeys?Reflect.has(b,E)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(b,E),getPrototypeOf:()=>Reflect.getPrototypeOf(b),has:(T,E)=>Reflect.has(b,E),ownKeys:()=>Reflect.ownKeys(b),set:(T,E,D)=>(b[E]=D,delete T[E],!0)})}function gf(b,f={scriptable:!0,indexable:!0}){let{_scriptable:m=f.scriptable,_indexable:v=f.indexable,_allKeys:S=f.allKeys}=b;return{allKeys:S,scriptable:m,indexable:v,isScriptable:U(m)?m:()=>m,isIndexable:U(v)?v:()=>v}}let Wg=(b,f)=>b?b+O(f):f,mu=(b,f)=>r(f)&&b!=="adapters"&&(Object.getPrototypeOf(f)===null||f.constructor===Object);function $g(b,f,m){if(Object.prototype.hasOwnProperty.call(b,f))return b[f];let v=m();return b[f]=v,v}function Gg(b,f,m){return U(b)?b(f,m):b}let Th=(b,f)=>b===!0?f:typeof b=="string"?k(f,b):void 0;function Tc(b,f,m,v,S){for(let T of f){let E=Th(m,T);if(E){b.add(E);let D=Gg(E._fallback,m,S);if(D!==void 0&&D!==m&&D!==v)return D}else if(E===!1&&v!==void 0&&m!==v)return null}return!1}function bu(b,f,m,v){let S=f._rootScopes,T=Gg(f._fallback,m,v),E=[...b,...S],D=new Set;D.add(v);let N=qg(D,E,m,T||m,v);return N!==null&&(T===void 0||T===m||(N=qg(D,E,T,N,v),N!==null))&&Mc(Array.from(D),[""],S,T,(()=>(function(F,G,z){let Y=F._getTarget();G in Y||(Y[G]={});let tt=Y[G];return s(tt)&&r(z)?z:tt||{}})(f,m,v)))}function qg(b,f,m,v,S){for(;m;)m=Tc(b,f,m,v,S);return m}function mf(b,f){for(let m of f){if(!m)continue;let v=m[b];if(v!==void 0)return v}}function Ac(b){let f=b._keys;return f||(f=b._keys=(function(m){let v=new Set;for(let S of m)for(let T of Object.keys(S).filter((E=>!E.startsWith("_"))))v.add(T);return Array.from(v)})(b._scopes)),f}function Ah(b,f,m,v){let{iScale:S}=b,{key:T="r"}=this._parsing,E=new Array(v),D,N,F,G;for(D=0,N=v;D<N;++D)F=D+m,G=f[F],E[D]={r:S.parse(k(G,T),F)};return E}let Yg=Number.EPSILON||1e-14,na=(b,f)=>f<b.length&&!b[f].skip&&b[f],Eh=b=>b==="x"?"y":"x";
4666function bf(b,f,m,v){let S=b.skip?f:b,T=f,E=m.skip?f:m,D=zt(T,S),N=zt(E,T),F=D/(D+N),G=N/(D+N);F=isNaN(F)?0:F,G=isNaN(G)?0:G;let z=v*F,Y=v*G;return{previous:{x:T.x-z*(E.x-S.x),y:T.y-z*(E.y-S.y)},next:{x:T.x+Y*(E.x-S.x),y:T.y+Y*(E.y-S.y)}}}function Ol(b,f="x"){let m=Eh(f),v=b.length,S=Array(v).fill(0),T=Array(v),E,D,N,F=na(b,0);for(E=0;E<v;++E)if(D=N,N=F,F=na(b,E+1),N){if(F){let G=F[f]-N[f];S[E]=G!==0?(F[m]-N[m])/G:0}T[E]=D?F?yt(S[E-1])!==yt(S[E])?0:(S[E-1]+S[E])/2:S[E-1]:S[E]}(function(G,z,Y){let tt=G.length,ht,ot,ut,Lt,Jt,Xt=na(G,0);for(let Yt=0;Yt<tt-1;++Yt)Jt=Xt,Xt=na(G,Yt+1),Jt&&Xt&&(kt(z[Yt],0,Yg)?Y[Yt]=Y[Yt+1]=0:(ht=Y[Yt]/z[Yt],ot=Y[Yt+1]/z[Yt],Lt=Math.pow(ht,2)+Math.pow(ot,2),Lt<=9||(ut=3/Math.sqrt(Lt),Y[Yt]=ht*ut*z[Yt],Y[Yt+1]=ot*ut*z[Yt])))})(b,S,T),(function(G,z,Y="x"){let tt=Eh(Y),ht=G.length,ot,ut,Lt,Jt=na(G,0);for(let Xt=0;Xt<ht;++Xt){if(ut=Lt,Lt=Jt,Jt=na(G,Xt+1),!Lt)continue;let Yt=Lt[Y],me=Lt[tt];ut&&(ot=(Yt-ut[Y])/3,Lt[`cp1${Y}`]=Yt-ot,Lt[`cp1${tt}`]=me-ot*z[Xt]),Jt&&(ot=(Jt[Y]-Yt)/3,Lt[`cp2${Y}`]=Yt+ot,Lt[`cp2${tt}`]=me+ot*z[Xt])}})(b,T,f)}function oo(b,f,m){return Math.max(Math.min(b,m),f)}function ka(b,f,m,v,S){let T,E,D,N;if(f.spanGaps&&(b=b.filter((F=>!F.skip))),f.cubicInterpolationMode==="monotone")Ol(b,S);else{let F=v?b[b.length-1]:b[0];for(T=0,E=b.length;T<E;++T)D=b[T],N=bf(F,D,b[Math.min(T+1,E-(v?0:1))%E],f.tension),D.cp1x=N.previous.x,D.cp1y=N.previous.y,D.cp2x=N.next.x,D.cp2y=N.next.y,F=D}f.capBezierPoints&&(function(F,G){let z,Y,tt,ht,ot,ut=xr(F[0],G);for(z=0,Y=F.length;z<Y;++z)ot=ht,ht=ut,ut=z<Y-1&&xr(F[z+1],G),ht&&(tt=F[z],ot&&(tt.cp1x=oo(tt.cp1x,G.left,G.right),tt.cp1y=oo(tt.cp1y,G.top,G.bottom)),ut&&(tt.cp2x=oo(tt.cp2x,G.left,G.right),tt.cp2y=oo(tt.cp2y,G.top,G.bottom)))})(b,m)}let vu=b=>b===0||b===1,kh=(b,f,m)=>-Math.pow(2,10*(b-=1))*Math.sin((b-f)*j/m),Ec=(b,f,m)=>Math.pow(2,-10*b)*Math.sin((b-f)*j/m)+1,kc={linear:b=>b,easeInQuad:b=>b*b,easeOutQuad:b=>-b*(b-2),easeInOutQuad:b=>(b/=.5)<1?.5*b*b:-.5*(--b*(b-2)-1),easeInCubic:b=>b*b*b,easeOutCubic:b=>(b-=1)*b*b+1,easeInOutCubic:b=>(b/=.5)<1?.5*b*b*b:.5*((b-=2)*b*b+2),easeInQuart:b=>b*b*b*b,easeOutQuart:b=>-((b-=1)*b*b*b-1),easeInOutQuart:b=>(b/=.5)<1?.5*b*b*b*b:-.5*((b-=2)*b*b*b-2),easeInQuint:b=>b*b*b*b*b,easeOutQuint:b=>(b-=1)*b*b*b*b+1,easeInOutQuint:b=>(b/=.5)<1?.5*b*b*b*b*b:.5*((b-=2)*b*b*b*b+2),easeInSine:b=>1-Math.cos(b*ct),easeOutSine:b=>Math.sin(b*ct),easeInOutSine:b=>-.5*(Math.cos(X*b)-1),easeInExpo:b=>b===0?0:Math.pow(2,10*(b-1)),easeOutExpo:b=>b===1?1:1-Math.pow(2,-10*b),easeInOutExpo:b=>vu(b)?b:b<.5?.5*Math.pow(2,10*(2*b-1)):.5*(2-Math.pow(2,-10*(2*b-1))),easeInCirc:b=>b>=1?b:-(Math.sqrt(1-b*b)-1),easeOutCirc:b=>Math.sqrt(1-(b-=1)*b),easeInOutCirc:b=>(b/=.5)<1?-.5*(Math.sqrt(1-b*b)-1):.5*(Math.sqrt(1-(b-=2)*b)+1),easeInElastic:b=>vu(b)?b:kh(b,.075,.3),easeOutElastic:b=>vu(b)?b:Ec(b,.075,.3),easeInOutElastic(b){return vu(b)?b:b<.5?.5*kh(2*b,.1125,.45):.5+.5*Ec(2*b-1,.1125,.45)},easeInBack(b){return b*b*((1.70158+1)*b-1.70158)},easeOutBack(b){return(b-=1)*b*((1.70158+1)*b+1.70158)+1},easeInOutBack(b){let f=1.70158;return(b/=.5)<1?b*b*((1+(f*=1.525))*b-f)*.5:.5*((b-=2)*b*((1+(f*=1.525))*b+f)+2)},easeInBounce:b=>1-kc.easeOutBounce(1-b),easeOutBounce(b){return b<1/2.75?7.5625*b*b:b<2/2.75?7.5625*(b-=1.5/2.75)*b+.75:b<2.5/2.75?7.5625*(b-=2.25/2.75)*b+.9375:7.5625*(b-=2.625/2.75)*b+.984375},easeInOutBounce:b=>b<.5?.5*kc.easeInBounce(2*b):.5*kc.easeOutBounce(2*b-1)+.5};function cr(b,f,m,v){return{x:b.x+m*(f.x-b.x),y:b.y+m*(f.y-b.y)}}function Ph(b,f,m,v){return{x:b.x+m*(f.x-b.x),y:v==="middle"?m<.5?b.y:f.y:v==="after"?m<1?b.y:f.y:m>0?f.y:b.y}}function Rh(b,f,m,v){let S={x:b.cp2x,y:b.cp2y},T={x:f.cp1x,y:f.cp1y},E=cr(b,S,m),D=cr(S,T,m),N=cr(T,f,m),F=cr(E,D,m),G=cr(D,N,m);return cr(F,G,m)}let Dh=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Ne=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Xg(b,f){let m=(""+b).match(Dh);if(!m||m[1]==="normal")return 1.2*f;switch(b=+m[2],m[3]){case"px":return b;case"%":b/=100}return f*b}let wi=b=>+b||0;function Pc(b,f){let m={},v=r(f),S=v?Object.keys(f):f,T=r(b)?v?E=>l(b[E],b[f[E]]):E=>b[E]:()=>b;for(let E of S)m[E]=wi(T(E));return m}function yu(b){return Pc(b,{top:"y",right:"x",bottom:"y",left:"x"})}function Pa(b){return Pc(b,["topLeft","topRight","bottomLeft","bottomRight"])}function zi(b){let f=yu(b);return f.width=f.left+f.right,f.height=f.top+f.bottom,f}function ts(b,f){b=b||{},f=f||We.font;let m=l(b.size,f.size);typeof m=="string"&&(m=parseInt(m,10));let v=l(b.style,f.style);v&&!(""+v).match(Ne)&&(console.warn('Invalid font style specified: "'+v+'"'),v=void 0);let S={family:l(b.family,f.family),lineHeight:Xg(l(b.lineHeight,f.lineHeight),m),size:m,style:v,weight:l(b.weight,f.weight),string:""};return S.string=ea(S),S}function Do(b,f,m,v){let S,T,E,D=!0;for(S=0,T=b.length;S<T;++S)if(E=b[S],E!==void 0&&(f!==void 0&&typeof E=="function"&&(E=E(f),D=!1),m!==void 0&&s(E)&&(E=E[m%E.length],D=!1),E!==void 0))return v&&!D&&(v.cac
4666heable=!1),E}function ao(b,f,m){let{min:v,max:S}=b,T=u(f,(S-v)/2),E=(D,N)=>m&&D===0?0:D+N;return{min:E(v,-Math.abs(T)),max:E(S,T)}}function qs(b,f){return Object.assign(Object.create(b),f)}function Ys(b,f,m){return b?(function(v,S){return{x:T=>v+v+S-T,setWidth(T){S=T},textAlign:T=>T==="center"?T:T==="right"?"left":"right",xPlus:(T,E)=>T-E,leftForLtr:(T,E)=>T-E}})(f,m):{x:v=>v,setWidth(v){},textAlign:v=>v,xPlus:(v,S)=>v+S,leftForLtr:(v,S)=>v}}function vf(b,f){let m,v;f!=="ltr"&&f!=="rtl"||(m=b.canvas.style,v=[m.getPropertyValue("direction"),m.getPropertyPriority("direction")],m.setProperty("direction",f,"important"),b.prevTextDirection=v)}function yf(b,f){f!==void 0&&(delete b.prevTextDirection,b.canvas.style.setProperty("direction",f[0],f[1]))}function Kg(b){return b==="angle"?{between:gt,compare:St,normalize:it}:{between:ve,compare:(f,m)=>f-m,normalize:f=>f}}function Jg({start:b,end:f,count:m,loop:v,style:S}){return{start:b%m,end:f%m,loop:v&&(f-b+1)%m==0,style:S}}function xf(b,f,m){if(!m)return[b];let{property:v,start:S,end:T}=m,E=f.length,{compare:D,between:N,normalize:F}=Kg(v),{start:G,end:z,loop:Y,style:tt}=(function(Te,He,Je){let{property:cn,start:sn,end:wn}=Je,{between:yn,normalize:an}=Kg(cn),gn=He.length,un,Wn,{start:Hi,end:Ei,loop:Gr}=Te;if(Gr){for(Hi+=gn,Ei+=gn,un=0,Wn=gn;un<Wn&&yn(an(He[Hi%gn][cn]),sn,wn);++un)Hi--,Ei--;Hi%=gn,Ei%=gn}return Ei<Hi&&(Ei+=gn),{start:Hi,end:Ei,loop:Gr,style:Te.style}})(b,f,m),ht=[],ot,ut,Lt,Jt=!1,Xt=null,Yt=()=>Jt||N(S,Lt,ot)&&D(S,Lt)!==0,me=()=>!Jt||D(T,ot)===0||N(T,Lt,ot);for(let Te=G,He=G;Te<=z;++Te)ut=f[Te%E],ut.skip||(ot=F(ut[v]),ot!==Lt&&(Jt=N(ot,S,T),Xt===null&&Yt()&&(Xt=D(ot,S)===0?Te:He),Xt!==null&&me()&&(ht.push(Jg({start:Xt,end:Te,loop:Y,count:E,style:tt})),Xt=null),He=Te,Lt=ot));return Xt!==null&&ht.push(Jg({start:Xt,end:z,loop:Y,count:E,style:tt})),ht}function Lh(b,f){let m=[],v=b.segments;for(let S=0;S<v.length;S++){let T=xf(v[S],b.points,f);T.length&&m.push(...T)}return m}function Nl(b,f){let m=b.points,v=b.options.spanGaps,S=m.length;if(!S)return[];let T=!!b._loop,{start:E,end:D}=(function(N,F,G,z){let Y=0,tt=F-1;if(G&&!z)for(;Y<F&&!N[Y].skip;)Y++;for(;Y<F&&N[Y].skip;)Y++;for(Y%=F,G&&(tt+=Y);tt>Y&&N[tt%F].skip;)tt--;return tt%=F,{start:Y,end:tt}})(m,S,T,v);return v===!0?Ih(b,[{start:E,end:D,loop:T}],m,f):Ih(b,(function(N,F,G,z){let Y=N.length,tt=[],ht,ot=F,ut=N[F];for(ht=F+1;ht<=G;++ht){let Lt=N[ht%Y];Lt.skip||Lt.stop?ut.skip||(z=!1,tt.push({start:F%Y,end:(ht-1)%Y,loop:z}),F=ot=Lt.stop?ht:null):(ot=ht,ut.skip&&(F=ht)),ut=Lt}return ot!==null&&tt.push({start:F%Y,end:ot%Y,loop:z}),tt})(m,E,D<E?D+S:D,!!b._fullLoop&&E===0&&D===S-1),m,f)}function Ih(b,f,m,v){return v&&v.setContext&&m?(function(S,T,E,D){let N=S._chart.getContext(),F=Zg(S.options),{_datasetIndex:G,options:{spanGaps:z}}=S,Y=E.length,tt=[],ht=F,ot=T[0].start,ut=ot;function Lt(Jt,Xt,Yt,me){let Te=z?-1:1;if(Jt!==Xt){for(Jt+=Y;E[Jt%Y].skip;)Jt-=Te;for(;E[Xt%Y].skip;)Xt+=Te;Jt%Y!=Xt%Y&&(tt.push({start:Jt%Y,end:Xt%Y,loop:Yt,style:me}),ht=me,ot=Xt%Y)}}for(let Jt of T){ot=z?ot:Jt.start;let Xt,Yt=E[ot%Y];for(ut=ot+1;ut<=Jt.end;ut++){let me=E[ut%Y];Xt=Zg(D.setContext(qs(N,{type:"segment",p0:Yt,p1:me,p0DataIndex:(ut-1)%Y,p1DataIndex:ut%Y,datasetIndex:G}))),Bl(Xt,ht)&&Lt(ot,ut-1,Jt.loop,ht),Yt=me,ht=Xt}ot<ut-1&&Lt(ot,ut-1,Jt.loop,ht)}return tt})(b,f,m,v):f}function Zg(b){return{backgroundColor:b.backgroundColor,borderCapStyle:b.borderCapStyle,borderDash:b.borderDash,borderDashOffset:b.borderDashOffset,borderJoinStyle:b.borderJoinStyle,borderWidth:b.borderWidth,borderColor:b.borderColor}}function Bl(b,f){if(!f)return!1;let m=[],v=function(S,T){return Dn(T)?(m.includes(T)||m.push(T),m.indexOf(T)):T};return JSON.stringify(b,v)!==JSON.stringify(f,v)}var Qg=Object.freeze({__proto__:null,HALF_PI:ct,INFINITY:_,PI:X,PITAU:W,QUARTER_PI:pt,RAD_PER_DEG:at,TAU:j,TWO_THIRDS_PI:Et,_addGrace:ao,_alignPixel:Cs,_alignStartEnd:Se,_angleBetween:gt,_angleDiff:St,_arrayUnique:mt,_attachContext:Za,_bezierCurveTo:jg,_bezierInterpolation:Rh,_boundSegment:xf,_boundSegments:Lh,_capitalize:O,_computeSegments:Nl,_createResolver:Mc,_decimalPlaces:xe,_deprecated:function(b,f,m,v){f!==void 0&&console.warn(b+': "'+m+'" is deprecated. Please use "'+v+'" instead')},_descriptors:gf,_elementsEqual:p,_factorize:jt,_filterBetween:en,_getParentNode:Hn,_getStartAndCountOfVisiblePoints:ie,_int16Range:de,_isBetween:ve,_isClickEvent:q,_isDomSupp
4666orted:Nn,_isPointInArea:xr,_limitValue:ft,_longestText:Bi,_lookup:we,_lookupByKey:Ae,_measureText:Xn,_merger:x,_mergerIf:A,_normalizeAngle:it,_parseObjectDataRadialScale:Ah,_pointInLine:cr,_readValueToProps:Pc,_rlookupByKey:Ue,_scaleRangesChanged:_t,_setMinAndMaxByKey:Bt,_splitKey:R,_steppedInterpolation:Ph,_steppedLineTo:Mh,_textX:Me,_toLeftRightCenter:Nt,_updateBezierControlPoints:ka,addRoundedRectPath:Il,almostEquals:kt,almostWhole:ee,callback:h,clearCanvas:xi,clipArea:Dl,clone:g,color:Xe,createContext:qs,debounce:te,defined:I,distanceBetweenPoints:zt,drawPoint:yr,drawPointLegend:Ro,each:d,easingEffects:kc,finiteOrDefault:a,fontString:function(b,f,m){return f+" "+b+"px "+m},formatNumber:Ot,getAngleFromPoint:Ut,getHoverColor:mi,getMaximumSize:ti,getRelativePosition:Ye,getRtlAdapter:Ys,getStyle:Ni,isArray:s,isFinite:o,isFunction:U,isNullOrUndef:n,isNumber:ae,isObject:r,isPatternOrGradient:Dn,listenArrayEvents:Cn,log10:vt,merge:w,mergeIf:M,niceNum:Wt,noop:t,overrideTextDirection:vf,readUsedSize:so,renderText:Dr,requestAnimFrame:K,resolve:Do,resolveObjectKey:k,restoreTextDirection:yf,retinaScale:$n,setsEqual:V,sign:yt,splineCurve:bf,splineCurveMonotone:Ol,supportsEventListenerOptions:$r,throttled:Vt,toDegrees:Qt,toDimension:u,toFont:ts,toFontString:ea,toLineHeight:Xg,toPadding:zi,toPercentage:c,toRadians:Gt,toTRBL:yu,toTRBLCorners:Pa,uid:e,unclipArea:Ja,unlistenArrayEvents:mn,valueOrDefault:l});function Lo(b,f,m,v){let{controller:S,data:T,_sorted:E}=b,D=S._cachedMeta.iScale;if(D&&f===D.axis&&f!=="r"&&E&&T.length){let N=D._reversePixels?Ue:Ae;if(!v)return N(T,f,m);if(S._sharedOptions){let F=T[0],G=typeof F.getRange=="function"&&F.getRange(f);if(G){let z=N(T,f,m-G),Y=N(T,f,m+G);return{lo:z.lo,hi:Y.hi}}}}return{lo:0,hi:T.length-1}}function lo(b,f,m,v,S){let T=b.getSortedVisibleDatasetMetas(),E=m[f];for(let D=0,N=T.length;D<N;++D){let{index:F,data:G}=T[D],{lo:z,hi:Y}=Lo(T[D],f,E,S);for(let tt=z;tt<=Y;++tt){let ht=G[tt];ht.skip||v(ht,F,tt)}}}function wf(b,f,m,v,S){let T=[];return!S&&!b.isPointInArea(f)||lo(b,m,f,(function(E,D,N){(S||xr(E,b.chartArea,0))&&E.inRange(f.x,f.y,v)&&T.push({element:E,datasetIndex:D,index:N})}),!0),T}function tm(b,f,m,v,S,T){let E=[],D=(function(F){let G=F.indexOf("x")!==-1,z=F.indexOf("y")!==-1;return function(Y,tt){let ht=G?Math.abs(Y.x-tt.x):0,ot=z?Math.abs(Y.y-tt.y):0;return Math.sqrt(Math.pow(ht,2)+Math.pow(ot,2))}})(m),N=Number.POSITIVE_INFINITY;return lo(b,m,f,(function(F,G,z){let Y=F.inRange(f.x,f.y,S);if(v&&!Y)return;let tt=F.getCenterPoint(S);if(!(T||b.isPointInArea(tt))&&!Y)return;let ht=D(f,tt);ht<N?(E=[{element:F,datasetIndex:G,index:z}],N=ht):ht===N&&E.push({element:F,datasetIndex:G,index:z})})),E}function _f(b,f,m,v,S,T){return T||b.isPointInArea(f)?m!=="r"||v?tm(b,f,m,v,S,T):(function(E,D,N,F){let G=[];return lo(E,N,D,(function(z,Y,tt){let{startAngle:ht,endAngle:ot}=z.getProps(["startAngle","endAngle"],F),{angle:ut}=Ut(z,{x:D.x,y:D.y});gt(ut,ht,ot)&&G.push({element:z,datasetIndex:Y,index:tt})})),G})(b,f,m,S):[]}function em(b,f,m,v,S){let T=[],E=m==="x"?"inXRange":"inYRange",D=!1;return lo(b,m,f,((N,F,G)=>{N[E](f[m],S)&&(T.push({element:N,datasetIndex:F,index:G}),D=D||N.inRange(f.x,f.y,S))})),v&&!D?[]:T}var ia={evaluateInteractionItems:lo,modes:{index(b,f,m,v){let S=Ye(f,b),T=m.axis||"x",E=m.includeInvisible||!1,D=m.intersect?wf(b,S,T,v,E):_f(b,S,T,!1,v,E),N=[];return D.length?(b.getSortedVisibleDatasetMetas().forEach((F=>{let G=D[0].index,z=F.data[G];z&&!z.skip&&N.push({element:z,datasetIndex:F.index,index:G})})),N):[]},dataset(b,f,m,v){let S=Ye(f,b),T=m.axis||"xy",E=m.includeInvisible||!1,D=m.intersect?wf(b,S,T,v,E):_f(b,S,T,!1,v,E);if(D.length>0){let N=D[0].datasetIndex,F=b.getDatasetMeta(N).data;D=[];for(let G=0;G<F.length;++G)D.push({element:F[G],datasetIndex:N,index:G})}return D},point:(b,f,m,v)=>wf(b,Ye(f,b),m.axis||"xy",v,m.includeInvisible||!1),nearest(b,f,m,v){let S=Ye(f,b),T=m.axis||"xy",E=m.includeInvisible||!1;return _f(b,S,T,m.intersect,v,E)},x:(b,f,m,v)=>em(b,Ye(f,b),"x",m.intersect,v),y:(b,f,m,v)=>em(b,Ye(f,b),"y",m.intersect,v)}};let Fl=["left","top","right","bottom"];
4666function Qa(b,f){return b.filter((m=>m.pos===f))}function Ul(b,f){return b.filter((m=>Fl.indexOf(m.pos)===-1&&m.box.axis===f))}function sa(b,f){return b.sort(((m,v)=>{let S=f?v:m,T=f?m:v;return S.weight===T.weight?S.index-T.index:S.weight-T.weight}))}function Oh(b,f){let m=(function(N){let F={};for(let G of N){let{stack:z,pos:Y,stackWeight:tt}=G;if(!z||!Fl.includes(Y))continue;let ht=F[z]||(F[z]={count:0,placed:0,weight:0,size:0});ht.count++,ht.weight+=tt}return F})(b),{vBoxMaxWidth:v,hBoxMaxHeight:S}=f,T,E,D;for(T=0,E=b.length;T<E;++T){D=b[T];let{fullSize:N}=D.box,F=m[D.stack],G=F&&D.stackWeight/F.weight;D.horizontal?(D.width=G?G*v:N&&f.availableWidth,D.height=S):(D.width=v,D.height=G?G*S:N&&f.availableHeight)}return m}function oi(b,f,m,v){return Math.max(b[m],f[m])+Math.max(b[v],f[v])}function P(b,f){b.top=Math.max(b.top,f.top),b.left=Math.max(b.left,f.left),b.bottom=Math.max(b.bottom,f.bottom),b.right=Math.max(b.right,f.right)}function B(b,f,m,v){let{pos:S,box:T}=m,E=b.maxPadding;if(!r(S)){m.size&&(b[S]-=m.size);let z=v[m.stack]||{size:0,count:1};z.size=Math.max(z.size,m.horizontal?T.height:T.width),m.size=z.size/z.count,b[S]+=m.size}T.getPadding&&P(E,T.getPadding());let D=Math.max(0,f.outerWidth-oi(E,b,"left","right")),N=Math.max(0,f.outerHeight-oi(E,b,"top","bottom")),F=D!==b.w,G=N!==b.h;return b.w=D,b.h=N,m.horizontal?{same:F,other:G}:{same:G,other:F}}function $(b,f){let m=f.maxPadding;function v(S){let T={left:0,top:0,right:0,bottom:0};return S.forEach((E=>{T[E]=Math.max(f[E],m[E])})),T}return v(b?["left","right"]:["top","bottom"])}function Z(b,f,m,v){let S=[],T,E,D,N,F,G;for(T=0,E=b.length,F=0;T<E;++T){D=b[T],N=D.box,N.update(D.width||f.w,D.height||f.h,$(D.horizontal,f));let{same:z,other:Y}=B(f,m,D,v);F|=z&&S.length,G=G||Y,N.fullSize||S.push(D)}return F&&Z(S,f,m,v)||G}function wt(b,f,m,v,S){b.top=m,b.left=f,b.right=f+v,b.bottom=m+S,b.width=v,b.height=S}function $t(b,f,m,v){let S=m.padding,{x:T,y:E}=f;for(let D of b){let N=D.box,F=v[D.stack]||{count:1,placed:0,weight:1},G=D.stackWeight/F.weight||1;if(D.horizontal){let z=f.w*G,Y=F.size||N.height;I(F.start)&&(E=F.start),N.fullSize?wt(N,S.left,E,m.outerWidth-S.right-S.left,Y):wt(N,f.left+F.placed,E,z,Y),F.start=E,F.placed+=z,E=N.bottom}else{let z=f.h*G,Y=F.size||N.width;I(F.start)&&(T=F.start),N.fullSize?wt(N,T,S.top,Y,m.outerHeight-S.bottom-S.top):wt(N,T,f.top+F.placed,Y,z),F.start=T,F.placed+=z,T=N.right}}f.x=T,f.y=E}var qt={addBox(b,f){b.boxes||(b.boxes=[]),f.fullSize=f.fullSize||!1,f.position=f.position||"top",f.weight=f.weight||0,f._layers=f._layers||function(){return[{z:0,draw(m){f.draw(m)}}]},b.boxes.push(f)},removeBox(b,f){let m=b.boxes?b.boxes.indexOf(f):-1;m!==-1&&b.boxes.splice(m,1)},configure(b,f,m){f.fullSize=m.fullSize,f.position=m.position,f.weight=m.weight},update(b,f,m,v){if(!b)return;let S=zi(b.options.layout.padding),T=Math.max(f-S.width,0),E=Math.max(m-S.height,0),D=(function(ot){let ut=(function(Je){let cn=[],sn,wn,yn,an,gn,un;for(sn=0,wn=(Je||[]).length;sn<wn;++sn)yn=Je[sn],{position:an,options:{stack:gn,stackWeight:un=1}}=yn,cn.push({index:sn,box:yn,pos:an,horizontal:yn.isHorizontal(),weight:yn.weight,stack:gn&&an+gn,stackWeight:un});return cn})(ot),Lt=sa(ut.filter((Je=>Je.box.fullSize)),!0),Jt=sa(Qa(ut,"left"),!0),Xt=sa(Qa(ut,"right")),Yt=sa(Qa(ut,"top"),!0),me=sa(Qa(ut,"bottom")),Te=Ul(ut,"x"),He=Ul(ut,"y");return{fullSize:Lt,leftAndTop:Jt.concat(Yt),rightAndBottom:Xt.concat(He).concat(me).concat(Te),chartArea:Qa(ut,"chartArea"),vertical:Jt.concat(Xt).concat(He),horizontal:Yt.concat(me).concat(Te)}})(b.boxes),N=D.vertical,F=D.horizontal;d(b.boxes,(ot=>{typeof ot.beforeLayout=="function"&&ot.beforeLayout()}));let G=N.reduce(((ot,ut)=>ut.box.options&&ut.box.options.display===!1?ot:ot+1),0)||1,z=Object.freeze({outerWidth:f,outerHeight:m,padding:S,availableWidth:T,availableHeight:E,vBoxMaxWidth:T/2/G,hBoxMaxHeight:E/2}),Y=Object.assign({},S);P(Y,zi(v));let tt=Object.assign({maxPadding:Y,w:T,h:E,x:S.left,y:S.top},S),ht=Oh(N.concat(F),z);Z(D.fullSize,tt,z,ht),Z(N,tt,z,ht),Z(F,tt,z,ht)&&Z(N,tt,z,ht),(function(ot){let ut=ot.maxPadding;function Lt(Jt){let Xt=Math.max(ut[Jt]-ot[Jt],0);return ot[Jt]+=Xt,Xt}ot.y+=Lt("top"),ot.x+=Lt("left"),Lt("right"),Lt("bottom")})(tt),$t(D.leftAndTop,tt,z,ht),tt.x+=tt.w,tt.y+=tt.h,$t(D.rightAndBottom,tt,z,ht),b.chartArea={left:tt.left,top:tt.top,right:tt.left+tt.w,bottom:tt.top+tt.h,height:tt.h,width:tt.w},d(D.chartArea,(ot=>{let ut=ot.box;Object.assign(ut,b.chartArea),ut.update(tt.w,tt.h,{left:0,top:0,right:0,bottom:0})}))}};class De{acquireContext(f,m){}releaseContext(f){return!1}
4666addEventListener(f,m,v){}removeEventListener(f,m,v){}getDevicePixelRatio(){return 1}getMaximumSize(f,m,v,S){return m=Math.max(0,m||f.width),v=v||f.height,{width:m,height:Math.max(0,S?Math.floor(m/S):v)}}isAttached(f){return!0}updateConfig(f){}}class _e extends De{acquireContext(f){return f&&f.getContext&&f.getContext("2d")||null}updateConfig(f){f.options.animation=!1}}let An="$chartjs",Yn={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},On=b=>b===null||b==="",li=!!$r&&{passive:!0};function Vi(b,f,m){b.canvas.removeEventListener(f,m,li)}function Ms(b,f){for(let m of b)if(m===f||m.contains(f))return!0}function Io(b,f,m){let v=b.canvas,S=new MutationObserver((T=>{let E=!1;for(let D of T)E=E||Ms(D.addedNodes,v),E=E&&!Ms(D.removedNodes,v);E&&m()}));return S.observe(document,{childList:!0,subtree:!0}),S}function tl(b,f,m){let v=b.canvas,S=new MutationObserver((T=>{let E=!1;for(let D of T)E=E||Ms(D.removedNodes,v),E=E&&!Ms(D.addedNodes,v);E&&m()}));return S.observe(document,{childList:!0,subtree:!0}),S}let zl=new Map,Oo=0;function Sf(){let b=window.devicePixelRatio;b!==Oo&&(Oo=b,zl.forEach(((f,m)=>{m.currentDevicePixelRatio!==b&&f()})))}function Rc(b,f,m){let v=b.canvas,S=v&&Hn(v);if(!S)return;let T=Vt(((D,N)=>{let F=S.clientWidth;m(D,N),F<S.clientWidth&&m()}),window),E=new ResizeObserver((D=>{let N=D[0],F=N.contentRect.width,G=N.contentRect.height;F===0&&G===0||T(F,G)}));return E.observe(S),(function(D,N){zl.size||window.addEventListener("resize",Sf),zl.set(D,N)})(b,T),E}function nm(b,f,m){m&&m.disconnect(),f==="resize"&&(function(v){zl.delete(v),zl.size||window.removeEventListener("resize",Sf)})(b)}function gS(b,f,m){let v=b.canvas,S=Vt((T=>{b.ctx!==null&&m((function(E,D){let N=Yn[E.type]||E.type,{x:F,y:G}=Ye(E,D);return{type:N,chart:D,native:E,x:F!==void 0?F:null,y:G!==void 0?G:null}})(T,b))}),b);return(function(T,E,D){T.addEventListener(E,D,li)})(v,f,S),S}class Rv extends De{acquireContext(f,m){let v=f&&f.getContext&&f.getContext("2d");return v&&v.canvas===f?((function(S,T){let E=S.style,D=S.getAttribute("height"),N=S.getAttribute("width");if(S[An]={initial:{height:D,width:N,style:{display:E.display,height:E.height,width:E.width}}},E.display=E.display||"block",E.boxSizing=E.boxSizing||"border-box",On(N)){let F=so(S,"width");F!==void 0&&(S.width=F)}if(On(D))if(S.style.height==="")S.height=S.width/(T||2);else{let F=so(S,"height");F!==void 0&&(S.height=F)}})(f,m),v):null}releaseContext(f){let m=f.canvas;if(!m[An])return!1;let v=m[An].initial;["height","width"].forEach((T=>{let E=v[T];n(E)?m.removeAttribute(T):m.setAttribute(T,E)}));let S=v.style||{};return Object.keys(S).forEach((T=>{m.style[T]=S[T]})),m.width=m.width,delete m[An],!0}addEventListener(f,m,v){this.removeEventListener(f,m);let S=f.$proxies||(f.$proxies={}),T={attach:Io,detach:tl,resize:Rc}[m]||gS;S[m]=T(f,m,v)}removeEventListener(f,m){let v=f.$proxies||(f.$proxies={}),S=v[m];S&&(({attach:nm,detach:nm,resize:nm}[m]||Vi)(f,m,S),v[m]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(f,m,v,S){return ti(f,m,v,S)}isAttached(f){let m=Hn(f);return!(!m||!m.isConnected)}}function Dv(b){return!Nn()||typeof OffscreenCanvas<"u"&&b instanceof OffscreenCanvas?_e:Rv}var mS=Object.freeze({__proto__:null,BasePlatform:De,BasicPlatform:_e,DomPlatform:Rv,_detectPlatform:Dv});let Cf="transparent",PP={boolean:(b,f,m)=>m>.5?f:b,color(b,f,m){let v=Xe(b||Cf),S=v.valid&&Xe(f||Cf);return S&&S.valid?S.mix(v,m).hexString():f},number:(b,f,m)=>b+(f-b)*m};class RP{constructor(f,m,v,S){let T=m[v];S=Do([f.to,S,T,f.from]);let E=Do([f.from,T,S]);this._active=!0,this._fn=f.fn||PP[f.type||typeof E],this._easing=kc[f.easing]||kc.linear,this._start=Math.floor(Date.now()+(f.delay||0)),this._duration=this._total=Math.floor(f.duration),this._loop=!!f.loop,this._target=m,this._prop=v,this._from=E,this._to=S,this._promises=void 0}active(){return this._active}update(f,m,v){if(this._active){this._notify(!1);let S=this._target[this._prop],T=v-this._start,E=this._duration-T;this._start=v,this._duration=Math.floor(Math.max(E,f.duration)),this._total+=T,this._loop=!!f.loop,this._to=Do([f.to,m,S,f.from]),this._from=Do([f.from,S,m])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(f){let m=f-this._start,v=this._duration,S=this._prop,T=this._from,E=this._loop,D=this._to,N;if(this._active=T!==D&&(E||m<v),!this._active)return this._target[S]=D,void this._notify(!0);m<0?this._target[S]=T:(N=m/v%2,N=E&&N>1?2-N:N,N=this._easing(Math.min(1,Math.max(0,N))),this._target[S]=this._fn(T,D,N))}wait(){let f=this._promises||(this._promises=[]);return new Promise(((m,v)=>{f.push({res:m,rej:v})}))}_notify(f){let m=f?"res":"rej",v=this._promises||[];for(let S=0;S<v.length;S++)v[S][m]()}}class Lv{constructor(f,m){this._chart=f,this._properties=new Map,this.configure(m)}configure(f){if(!r(f))return;let m=Object.keys(We.animation),v=this._properties;Object.getOwnPropertyNames(f).forEach((S=>{let T=f[S];if(!r(T))return;let E={};for(let D of m)E[D]=T[D];
4666(s(T.properties)&&T.properties||[S]).forEach((D=>{D!==S&&v.has(D)||v.set(D,E)}))}))}_animateOptions(f,m){let v=m.options,S=(function(E,D){if(!D)return;let N=E.options;return N?(N.$shared&&(E.options=N=Object.assign({},N,{$shared:!1,$animations:{}})),N):void(E.options=D)})(f,v);if(!S)return[];let T=this._createAnimations(S,v);return v.$shared&&(function(E,D){let N=[],F=Object.keys(D);for(let G=0;G<F.length;G++){let z=E[F[G]];z&&z.active()&&N.push(z.wait())}return Promise.all(N)})(f.options.$animations,v).then((()=>{f.options=v}),(()=>{})),T}_createAnimations(f,m){let v=this._properties,S=[],T=f.$animations||(f.$animations={}),E=Object.keys(m),D=Date.now(),N;for(N=E.length-1;N>=0;--N){let F=E[N];if(F.charAt(0)==="$")continue;if(F==="options"){S.push(...this._animateOptions(f,m));continue}let G=m[F],z=T[F],Y=v.get(F);if(z){if(Y&&z.active()){z.update(Y,G,D);continue}z.cancel()}Y&&Y.duration?(T[F]=z=new RP(Y,f,F,G),S.push(z)):f[F]=G}return S}update(f,m){if(this._properties.size===0)return void Object.assign(f,m);let v=this._createAnimations(f,m);return v.length?(fe.add(this._chart,v),!0):void 0}}function DP(b,f){let m=b&&b.options||{},v=m.reverse,S=m.min===void 0?f:0,T=m.max===void 0?f:0;return{start:v?T:S,end:v?S:T}}function Iv(b,f){let m=[],v=b._getSortedDatasetMetas(f),S,T;for(S=0,T=v.length;S<T;++S)m.push(v[S].index);return m}function Ov(b,f,m,v={}){let S=b.keys,T=v.mode==="single",E,D,N,F;if(f!==null){for(E=0,D=S.length;E<D;++E){if(N=+S[E],N===m){if(v.all)continue;break}F=b.values[N],o(F)&&(T||f===0||yt(f)===yt(F))&&(f+=F)}return f}}function bS(b,f){let m=b&&b.options.stacked;return m||m===void 0&&f.stack!==void 0}function vS(b,f,m){let v=b[f]||(b[f]={});return v[m]||(v[m]={})}function yS(b,f,m,v){for(let S of f.getMatchingVisibleMetas(v).reverse()){let T=b[S.index];if(m&&T>0||!m&&T<0)return S.index}return null}function xS(b,f){let{chart:m,_cachedMeta:v}=b,S=m._stacks||(m._stacks={}),{iScale:T,vScale:E,index:D}=v,N=T.axis,F=E.axis,G=(function(tt,ht,ot){return`${tt.id}.${ht.id}.${ot.stack||ot.type}`})(T,E,v),z=f.length,Y;for(let tt=0;tt<z;++tt){let ht=f[tt],{[N]:ot,[F]:ut}=ht;Y=(ht._stacks||(ht._stacks={}))[F]=vS(S,G,ot),Y[D]=ut,Y._top=yS(Y,E,!0,v.type),Y._bottom=yS(Y,E,!1,v.type),(Y._visualValues||(Y._visualValues={}))[D]=ut}}function Nv(b,f){let m=b.scales;return Object.keys(m).filter((v=>m[v].axis===f)).shift()}function xu(b,f){let m=b.controller.index,v=b.vScale&&b.vScale.axis;if(v){f=f||b._parsed;for(let S of f){let T=S._stacks;if(!T||T[v]===void 0||T[v][m]===void 0)return;delete T[v][m],T[v]._visualValues!==void 0&&T[v]._visualValues[m]!==void 0&&delete T[v]._visualValues[m]}}}let im=b=>b==="reset"||b==="none",Bv=(b,f)=>f?b:Object.assign({},b);class Ai{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(f,m){this.chart=f,this._ctx=f.ctx,this.index=m,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let f=this._cachedMeta;this.configure(),this.linkScales(),f._stacked=bS(f.vScale,f),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(f){this.index!==f&&xu(this._cachedMeta),this.index=f}linkScales(){let f=this.chart,m=this._cachedMeta,v=this.getDataset(),S=(z,Y,tt,ht)=>z==="x"?Y:z==="r"?ht:tt,T=m.xAxisID=l(v.xAxisID,Nv(f,"x")),E=m.yAxisID=l(v.yAxisID,Nv(f,"y")),D=m.rAxisID=l(v.rAxisID,Nv(f,"r")),N=m.indexAxis,F=m.iAxisID=S(N,T,E,D),G=m.vAxisID=S(N,E,T,D);m.xScale=this.getScaleForId(T),m.yScale=this.getScaleForId(E),m.rScale=this.getScaleForId(D),m.iScale=this.getScaleForId(F),m.vScale=this.getScaleForId(G)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(f){return this.chart.scales[f]}_getOtherScale(f){let m=this._cachedMeta;return f===m.iScale?m.vScale:m.iScale}reset(){this._update("reset")}_destroy(){let f=this._cachedMeta;this._data&&mn(this._data,this),f._stacked&&xu(f)}_dataCheck(){let f=this.getDataset(),m=f.data||(f.data=[]),v=this._data;if(r(m))this._data=(function(S){let T=Object.keys(S),E=new Array(T.length),D,N,F;for(D=0,N=T.length;D<N;++D)F=T[D],E[D]={x:F,y:S[F]};return E})(m);else if(v!==m){if(v){mn(v,this);let S=this._cachedMeta;xu(S),S._parsed=[]}m&&Object.isExtensible(m)&&Cn(m,this),this._syncList=[],this._data=m}}addElements(){let f=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(f.dataset=new this.datasetElementType)}buildOrUpdateElements(f){let m=this._cachedMeta,v=this.getDataset(),S=!1;this._dataCheck();let T=m._stacked;m._stacked=bS(m.vScale,m),m.stack!==v.stack&&(S=!0,xu(m),m.stack=v.stack),this._resyncElements(f),(S||T!==m._stacked)&&xS(this,m._parsed)}configure(){let f=this.chart.config,m=f.datasetScopeKeys(this._type),v=f.getOptionScopes(this.getDataset(),m,!0);this.options=f.createResolver(v,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(f,m){let{_cachedMeta:v,_data:S}=this,{iScale:T,_stacked:E}=v,D=T.axis,N,F,G,z=f===0&&m===S.length||v._sorted,Y=f>0&&v._parsed[f-1];if(this._parsing===!1)v._parsed=S,v._sorted=!0,G=S;else{G=s(S[f])?this.parseArrayData(v,S,f,m):r(S[f])?this.parseObjectData(v,S,f,m):this.parsePrimitiveData(v,S,f,m);let tt=()=>F[D]===null||Y&&F[D]<Y[D];for(N=0;N<m;++N)v._parsed[N+f]=F=G[N],z&&(tt()&&(z=!1),Y=F);v._sorted=z}E&&xS(this,G)}parsePrimitiveData(f,m,v,S){let{iScale:T,vScale:E}=f,D=T.axis,N=E.axis,F=T.getLabels(),G=T===E,z=new Array(S),Y,tt,ht;for(Y=0,tt=S;Y<tt;++Y)ht=Y+v,z[Y]={[D]:G||T.parse(F[ht],ht),[N]:E.parse(m[ht],ht)};return z}parseArrayData(f,m,v,S){let{xScale:T,yScale:E}=f,D=new Array(S),N,F,G,z;for(N=0,F=S;N<F;++N)G=N+v,z=m[G],D[N]={x:T.parse(z[0],G),y:E.parse(z[1],G)};return D}parseObjectData(f,m,v,S){let{xScale:T,yScale:E}=f,{xAxisKey:D="x",yAxisKey:N="y"}=this._parsing,F=new Array(S),G,z,Y,tt;for(G=0,z=S;G<z;++G)Y=G+v,tt=m[Y],F[G]={x:T.parse(k(tt,D),Y),y:E.parse(k(tt,N),Y)};return F}getParsed(f){return this._cachedMeta._parsed[f]}getDataElement(f){return this._cachedMeta.data[f]}applyStack(f,m,v){let S=this.chart,T=this._cachedMeta,E=m[f.axis];return Ov({keys:Iv(S,!0),values:m._stacks[f.axis]._visualValues},E,T.index,{mode:v})}
4666updateRangeFromParsed(f,m,v,S){let T=v[m.axis],E=T===null?NaN:T,D=S&&v._stacks[m.axis];S&&D&&(S.values=D,E=Ov(S,T,this._cachedMeta.index)),f.min=Math.min(f.min,E),f.max=Math.max(f.max,E)}getMinMax(f,m){let v=this._cachedMeta,S=v._parsed,T=v._sorted&&f===v.iScale,E=S.length,D=this._getOtherScale(f),N=((ot,ut,Lt)=>ot&&!ut.hidden&&ut._stacked&&{keys:Iv(Lt,!0),values:null})(m,v,this.chart),F={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:G,max:z}=(function(ot){let{min:ut,max:Lt,minDefined:Jt,maxDefined:Xt}=ot.getUserBounds();return{min:Jt?ut:Number.NEGATIVE_INFINITY,max:Xt?Lt:Number.POSITIVE_INFINITY}})(D),Y,tt;function ht(){tt=S[Y];let ot=tt[D.axis];return!o(tt[f.axis])||G>ot||z<ot}for(Y=0;Y<E&&(ht()||(this.updateRangeFromParsed(F,f,tt,N),!T));++Y);if(T){for(Y=E-1;Y>=0;--Y)if(!ht()){this.updateRangeFromParsed(F,f,tt,N);break}}return F}getAllParsedValues(f){let m=this._cachedMeta._parsed,v=[],S,T,E;for(S=0,T=m.length;S<T;++S)E=m[S][f.axis],o(E)&&v.push(E);return v}getMaxOverflow(){return!1}getLabelAndValue(f){let m=this._cachedMeta,v=m.iScale,S=m.vScale,T=this.getParsed(f);return{label:v?""+v.getLabelForValue(T[v.axis]):"",value:S?""+S.getLabelForValue(T[S.axis]):""}}_update(f){let m=this._cachedMeta;this.update(f||"default"),m._clip=(function(v){let S,T,E,D;return r(v)?(S=v.top,T=v.right,E=v.bottom,D=v.left):S=T=E=D=v,{top:S,right:T,bottom:E,left:D,disabled:v===!1}})(l(this.options.clip,(function(v,S,T){if(T===!1)return!1;let E=DP(v,T),D=DP(S,T);return{top:D.end,right:E.end,bottom:D.start,left:E.start}})(m.xScale,m.yScale,this.getMaxOverflow())))}update(f){}draw(){let f=this._ctx,m=this.chart,v=this._cachedMeta,S=v.data||[],T=m.chartArea,E=[],D=this._drawStart||0,N=this._drawCount||S.length-D,F=this.options.drawActiveElementsOnTop,G;for(v.dataset&&v.dataset.draw(f,T,D,N),G=D;G<D+N;++G){let z=S[G];z.hidden||(z.active&&F?E.push(z):z.draw(f,T))}for(G=0;G<E.length;++G)E[G].draw(f,T)}getStyle(f,m){let v=m?"active":"default";return f===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(v):this.resolveDataElementOptions(f||0,v)}getContext(f,m,v){let S=this.getDataset(),T;if(f>=0&&f<this._cachedMeta.data.length){let E=this._cachedMeta.data[f];T=E.$context||(E.$context=(function(D,N,F){return qs(D,{active:!1,dataIndex:N,parsed:void 0,raw:void 0,element:F,index:N,mode:"default",type:"data"})})(this.getContext(),f,E)),T.parsed=this.getParsed(f),T.raw=S.data[f],T.index=T.dataIndex=f}else T=this.$context||(this.$context=(function(E,D){return qs(E,{active:!1,dataset:void 0,datasetIndex:D,index:D,mode:"default",type:"dataset"})})(this.chart.getContext(),this.index)),T.dataset=S,T.index=T.datasetIndex=this.index;return T.active=!!m,T.mode=v,T}resolveDatasetElementOptions(f){return this._resolveElementOptions(this.datasetElementType.id,f)}resolveDataElementOptions(f,m){return this._resolveElementOptions(this.dataElementType.id,m,f)}_resolveElementOptions(f,m="default",v){let S=m==="active",T=this._cachedDataOpts,E=f+"-"+m,D=T[E],N=this.enableOptionSharing&&I(v);if(D)return Bv(D,N);let F=this.chart.config,G=F.datasetElementScopeKeys(this._type,f),z=S?[`${f}Hover`,"hover",f,""]:[f,""],Y=F.getOptionScopes(this.getDataset(),G),tt=Object.keys(We.elements[f]),ht=F.resolveNamedOptions(Y,tt,(()=>this.getContext(v,S,m)),z);return ht.$shared&&(ht.$shared=N,T[E]=Object.freeze(Bv(ht,N))),ht}_resolveAnimations(f,m,v){let S=this.chart,T=this._cachedDataOpts,E=`animation-${m}`,D=T[E];if(D)return D;let N;if(S.options.animation!==!1){let G=this.chart.config,z=G.datasetAnimationScopeKeys(this._type,m),Y=G.getOptionScopes(this.getDataset(),z);N=G.createResolver(Y,this.getContext(f,v,m))}let F=new Lv(S,N&&N.animations);return N&&N._cacheable&&(T[E]=Object.freeze(F)),F}getSharedOptions(f){if(f.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},f))}includeOptions(f,m){return!m||im(f)||this.chart._animationsDisabled}_getSharedOptions(f,m){let v=this.resolveDataElementOptions(f,m),S=this._sharedOptions,T=this.getSharedOptions(v),E=this.includeOptions(m,T)||T!==S;return this.updateSharedOptions(T,m,v),{sharedOptions:T,includeOptions:E}}updateElement(f,m,v,S){im(S)?Object.assign(f,v):this._resolveAnimations(m,S).update(f,v)}updateSharedOptions(f,m,v){f&&!im(m)&&this._resolveAnimations(void 0,m).update(f,v)}_setStyle(f,m,v,S){f.active=S;let T=this.getStyle(m,S);
4666this._resolveAnimations(m,v,S).update(f,{options:!S&&this.getSharedOptions(T)||T})}removeHoverStyle(f,m,v){this._setStyle(f,v,"active",!1)}setHoverStyle(f,m,v){this._setStyle(f,v,"active",!0)}_removeDatasetHoverStyle(){let f=this._cachedMeta.dataset;f&&this._setStyle(f,void 0,"active",!1)}_setDatasetHoverStyle(){let f=this._cachedMeta.dataset;f&&this._setStyle(f,void 0,"active",!0)}_resyncElements(f){let m=this._data,v=this._cachedMeta.data;for(let[D,N,F]of this._syncList)this[D](N,F);this._syncList=[];let S=v.length,T=m.length,E=Math.min(T,S);E&&this.parse(0,E),T>S?this._insertElements(S,T-S,f):T<S&&this._removeElements(T,S-T)}_insertElements(f,m,v=!0){let S=this._cachedMeta,T=S.data,E=f+m,D,N=F=>{for(F.length+=m,D=F.length-1;D>=E;D--)F[D]=F[D-m]};for(N(T),D=f;D<E;++D)T[D]=new this.dataElementType;this._parsing&&N(S._parsed),this.parse(f,m),v&&this.updateElements(T,f,m,"reset")}updateElements(f,m,v,S){}_removeElements(f,m){let v=this._cachedMeta;if(this._parsing){let S=v._parsed.splice(f,m);v._stacked&&xu(v,S)}v.data.splice(f,m)}_sync(f){if(this._parsing)this._syncList.push(f);else{let[m,v,S]=f;this[m](v,S)}this.chart._dataChanges.push([this.index,...f])}_onDataPush(){let f=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-f,f])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(f,m){m&&this._sync(["_removeElements",f,m]);let v=arguments.length-2;v&&this._sync(["_insertElements",f,v])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}class ra{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(f){let{x:m,y:v}=this.getProps(["x","y"],f);return{x:m,y:v}}hasValue(){return ae(this.x)&&ae(this.y)}getProps(f,m){let v=this.$animations;if(!m||!v)return this;let S={};return f.forEach((T=>{S[T]=v[T]&&v[T].active()?v[T]._to:this[T]})),S}}function LP(b,f){let m=b.options.ticks,v=(function(z){let Y=z.options.offset,tt=z._tickSize(),ht=z._length/tt+(Y?0:1),ot=z._maxLength/tt;return Math.floor(Math.min(ht,ot))})(b),S=Math.min(m.maxTicksLimit||v,v),T=m.major.enabled?(function(z){let Y=[],tt,ht;for(tt=0,ht=z.length;tt<ht;tt++)z[tt].major&&Y.push(tt);return Y})(f):[],E=T.length,D=T[0],N=T[E-1],F=[];if(E>S)return(function(z,Y,tt,ht){let ot,ut=0,Lt=tt[0];for(ht=Math.ceil(ht),ot=0;ot<z.length;ot++)ot===Lt&&(Y.push(z[ot]),ut++,Lt=tt[ut*ht])})(f,F,T,E/S),F;let G=(function(z,Y,tt){let ht=(function(Lt){let Jt=Lt.length,Xt,Yt;if(Jt<2)return!1;for(Yt=Lt[0],Xt=1;Xt<Jt;++Xt)if(Lt[Xt]-Lt[Xt-1]!==Yt)return!1;return Yt})(z),ot=Y.length/tt;if(!ht)return Math.max(ot,1);let ut=jt(ht);for(let Lt=0,Jt=ut.length-1;Lt<Jt;Lt++){let Xt=ut[Lt];if(Xt>ot)return Xt}return Math.max(ot,1)})(T,f,S);if(E>0){let z,Y,tt=E>1?Math.round((N-D)/(E-1)):null;for(Nh(f,F,G,n(tt)?0:D-tt,D),z=0,Y=E-1;z<Y;z++)Nh(f,F,G,T[z],T[z+1]);return Nh(f,F,G,N,n(tt)?f.length:N+tt),F}return Nh(f,F,G),F}function Nh(b,f,m,v,S){let T=l(v,0),E=Math.min(l(S,b.length),b.length),D,N,F,G=0;for(m=Math.ceil(m),S&&(D=S-v,m=D/Math.floor(D/m)),F=T;F<0;)G++,F=Math.round(T+G*m);for(N=Math.max(T,0);N<E;N++)N===F&&(f.push(b[N]),G++,F=Math.round(T+G*m))}let Fv=(b,f,m)=>f==="top"||f==="left"?b[f]+m:b[f]-m,wS=(b,f)=>Math.min(f||b,b);function _S(b,f){let m=[],v=b.length/f,S=b.length,T=0;for(;T<S;T+=v)m.push(b[Math.floor(T)]);return m}function SS(b,f,m){let v=b.ticks.length,S=Math.min(f,v-1),T=b._startPixel,E=b._endPixel,D=1e-6,N,F=b.getPixelForTick(S);if(!(m&&(N=v===1?Math.max(F-T,E-F):f===0?(b.getPixelForTick(1)-F)/2:(F-b.getPixelForTick(S-1))/2,F+=S<f?N:-N,F<T-D||F>E+D)))return F}function Mf(b){return b.drawTicks?b.tickLength:0}function CS(b,f){if(!b.display)return 0;let m=ts(b.font,f),v=zi(b.padding);return(s(b.text)?b.text.length:1)*m.lineHeight+v.height}function MS(b,f,m){let v=Nt(b);return(m&&f!=="right"||!m&&f==="right")&&(v=(S=>S==="left"?"right":S==="right"?"left":S)(v)),v}class el extends ra{constructor(f){super(),this.id=f.id,this.type=f.type,this.options=void 0,this.ctx=f.ctx,this.chart=f.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(f){this.options=f.setContext(this.getContext()),this.axis=f.axis,this._userMin=this.parse(f.min),this._userMax=this.parse(f.max),this._suggestedMin=this.parse(f.suggestedMin),this._suggestedMax=this.parse(f.suggestedMax)}parse(f,m){return f}getUserBounds(){let{_userMin:f,_userMax:m,_suggestedMin:v,_suggestedMax:S}=this;return f=a(f,Number.POSITIVE_INFINITY),m=a(m,Number.NEGATIVE_INFINITY),v=a(v,Number.POSITIVE_INFINITY),S=a(S,Number.NEGATIVE_INFINITY),{min:a(f,v),max:a(m,S),minDefined:o(f),maxDefined:o(m)}}getMinMax(f){let m,{min:v,max:S,minDefined:T,maxDefined:E}=this.getUserBounds();if(T&&E)return{min:v,max:S};let D=this.getMatchingVisibleMetas();for(let N=0,F=D.length;N<F;++N)m=D[N].controller.getMinMax(this,f),T||(v=Math.min(v,m.min)),E||(S=Math.max(S,m.max));return v=E&&v>S?S:v,S=T&&v>S?v:S,{min:a(v,a(S,v)),max:a(S,a(v,S))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let f=this.chart.data;return this.options.labels||(this.isHorizontal()?f.xLabels:f.yLabels)||f.labels||[]}
vendor: 10,623 bytes, line 4666
4666getLabelItems(f=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(f))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){h(this.options.beforeUpdate,[this])}update(f,m,v){let{beginAtZero:S,grace:T,ticks:E}=this.options,D=E.sampleSize;this.beforeUpdate(),this.maxWidth=f,this.maxHeight=m,this._margins=v=Object.assign({left:0,right:0,top:0,bottom:0},v),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+v.left+v.right:this.height+v.top+v.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ao(this,T,S),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let N=D<this.ticks.length;this._convertTicksToLabels(N?_S(this.ticks,D):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),E.display&&(E.autoSkip||E.source==="auto")&&(this.ticks=LP(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),N&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let f,m,v=this.options.reverse;this.isHorizontal()?(f=this.left,m=this.right):(f=this.top,m=this.bottom,v=!v),this._startPixel=f,this._endPixel=m,this._reversePixels=v,this._length=m-f,this._alignToPixels=this.options.alignToPixels}afterUpdate(){h(this.options.afterUpdate,[this])}beforeSetDimensions(){h(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){h(this.options.afterSetDimensions,[this])}_callHooks(f){this.chart.notifyPlugins(f,this.getContext()),h(this.options[f],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){h(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(f){let m=this.options.ticks,v,S,T;for(v=0,S=f.length;v<S;v++)T=f[v],T.label=h(m.callback,[T.value,v,f],this)}afterTickToLabelConversion(){h(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){h(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let f=this.options,m=f.ticks,v=wS(this.ticks.length,f.ticks.maxTicksLimit),S=m.minRotation||0,T=m.maxRotation,E,D,N,F=S;if(!this._isVisible()||!m.display||S>=T||v<=1||!this.isHorizontal())return void(this.labelRotation=S);let G=this._getLabelSizes(),z=G.widest.width,Y=G.highest.height,tt=ft(this.chart.width-z,0,this.maxWidth);E=f.offset?this.maxWidth/v:tt/(v-1),z+6>E&&(E=tt/(v-(f.offset?.5:1)),D=this.maxHeight-Mf(f.grid)-m.padding-CS(f.title,this.chart.options.font),N=Math.sqrt(z*z+Y*Y),F=Qt(Math.min(Math.asin(ft((G.highest.height+6)/E,-1,1)),Math.asin(ft(D/N,-1,1))-Math.asin(ft(Y/N,-1,1)))),F=Math.max(S,Math.min(T,F))),this.labelRotation=F}afterCalculateLabelRotation(){h(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){h(this.options.beforeFit,[this])}fit(){let f={width:0,height:0},{chart:m,options:{ticks:v,title:S,grid:T}}=this,E=this._isVisible(),D=this.isHorizontal();if(E){let N=CS(S,m.options.font);if(D?(f.width=this.maxWidth,f.height=Mf(T)+N):(f.height=this.maxHeight,f.width=Mf(T)+N),v.display&&this.ticks.length){let{first:F,last:G,widest:z,highest:Y}=this._getLabelSizes(),tt=2*v.padding,ht=Gt(this.labelRotation),ot=Math.cos(ht),ut=Math.sin(ht);if(D){let Lt=v.mirror?0:ut*z.width+ot*Y.height;f.height=Math.min(this.maxHeight,f.height+Lt+tt)}else{let Lt=v.mirror?0:ot*z.width+ut*Y.height;f.width=Math.min(this.maxWidth,f.width+Lt+tt)}this._calculatePadding(F,G,ut,ot)}}this._handleMargins(),D?(this.width=this._length=m.width-this._margins.left-this._margins.right,this.height=f.height):(this.width=f.width,this.height=this._length=m.height-this._margins.top-this._margins.bottom)}_calculatePadding(f,m,v,S){let{ticks:{align:T,padding:E},position:D}=this.options,N=this.labelRotation!==0,F=D!=="top"&&this.axis==="x";if(this.isHorizontal()){let G=this.getPixelForTick(0)-this.left,z=this.right-this.getPixelForTick(this.ticks.length-1),Y=0,tt=0;N?F?(Y=S*f.width,tt=v*m.height):(Y=v*f.height,tt=S*m.width):T==="start"?tt=m.width:T==="end"?Y=f.width:T!=="inner"&&(Y=f.width/2,tt=m.width/2),this.paddingLeft=Math.max((Y-G+E)*this.width/(this.width-G),0),this.paddingRight=Math.max((tt-z+E)*this.width/(this.width-z),0)}else{let G=m.height/2,z=f.height/2;T==="start"?(G=0,z=f.height):T==="end"&&(G=m.height,z=0),this.paddingTop=G+E,this.paddingBottom=z+E}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){h(this.options.afterFit,[this])}isHorizontal(){let{axis:f,position:m}=this.options;return m==="top"||m==="bottom"||f==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(f){let m,v;for(this.beforeTickToLabelConversion(),this.generateTickLabels(f),m=0,v=f.length;m<v;m++)n(f[m].label)&&(f.splice(m,1),v--,m--);this.afterTickToLabelConversion()}_getLabelSizes(){let f=this._labelSizes;if(!f){let m=this.options.ticks.sampleSize,v=this.ticks;m<v.length&&(v=_S(v,m)),this._labelSizes=f=this._computeLabelSizes(v,v.length,this.options.ticks.maxTicksLimit)}return f}_computeLabelSizes(f,m,v){let{ctx:S,_longestTextCache:T}=this,E=[],D=[],N=Math.floor(m/wS(m,v)),F,G,z,Y,tt,ht,ot,ut,Lt,Jt,Xt,Yt=0,me=0;for(F=0;F<m;F+=N){if(Y=f[F].label,tt=this._resolveTickFontOptions(F),S.font=ht=tt.string,ot=T[ht]=T[ht]||{data:{},gc:[]},ut=tt.lineHeight,Lt=Jt=0,n(Y)||s(Y)){if(s(Y))for(G=0,z=Y.length;G<z;++G)Xt=Y[G],n(Xt)||s(Xt)||(Lt=Xn(S,ot.data,ot.gc,Lt,Xt),Jt+=ut)}else Lt=Xn(S,ot.data,ot.gc,Lt,Y),Jt=ut;E.push(Lt),D.push(Jt),Yt=Math.max(Lt,Yt),me=Math.max(Jt,me)}(function(cn,sn){d(cn,(wn=>{let yn=wn.gc,an=yn.length/2,gn;if(an>sn){for(gn=0;gn<an;++gn)delete wn.data[yn[gn]];yn.splice(0,an)}}))})(T,m);let Te=E.indexOf(Yt),He=D.indexOf(me),Je=cn=>({width:E[cn]||0,height:D[cn]||0});return{first:Je(0),last:Je(m-1),widest:Je(Te),highest:Je(He),widths:E,heights:D}}getLabelForValue(f){return f}getPixelForValue(f,m){return NaN}getValueForPixel(f){}getPixelForTick(f){let m=this.ticks;return f<0||f>m.length-1?null:this.getPixelForValue(m[f].value)}getPixelForDecimal(f){this._reversePixels&&(f=1-f);let m=this._startPixel+f*this._length;return de(this._alignToPixels?Cs(this.chart,m,0):m)}getDecimalForPixel(f){let m=(f-this._startPixel)/this._length;return this._reversePixels?1-m:m}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:f,max:m}=this;return f<0&&m<0?m:f>0&&m>0?f:0}getContext(f){let m=this.ticks||[];if(f>=0&&f<m.length){let v=m[f];return v.$context||(v.$context=(function(S,T,E){return qs(S,{tick:E,index:T,type:"tick"})})(this.getContext(),f,v))}return this.$context||(this.$context=qs(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){let f=this.options.ticks,m=Gt(this.labelRotation),v=Math.abs(Math.cos(m)),S=Math.abs(Math.sin(m)),T=this._getLabelSizes(),E=f.autoSkipPadding||0,D=T?T.widest.width+E:0,N=T?T.highest.height+E:0;return this.isHorizontal()?N*v>D*S?D/v:N/S:N*S<D*v?N/v:D/S}_isVisible(){let f=this.options.display;return f!=="auto"?!!f:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(f){let m=this.axis,v=this.chart,S=this.options,{grid:T,position:E,border:D}=S,N=T.offset,F=this.isHorizontal(),G=this.ticks.length+(N?1:0),z=Mf(T),Y=[],tt=D.setContext(this.getContext()),ht=tt.display?tt.width:0,ot=ht/2,ut=function(un){return Cs(v,un,ht)},Lt,Jt,Xt,Yt,me,Te,He,Je,cn,sn,wn,yn;if(E==="top")Lt=ut(this.bottom),Te=this.bottom-z,Je=Lt-ot,sn=ut(f.top)+ot,yn=f.bottom;else if(E==="bottom")Lt=ut(this.top),sn=f.top,yn=ut(f.bottom)-ot,Te=Lt+ot,Je=this.top+z;else if(E==="left")Lt=ut(this.right),me=this.right-z,He=Lt-ot,cn=ut(f.left)+ot,wn=f.right;else if(E==="right")Lt=ut(this.left),cn=f.left,wn=ut(f.right)-ot,me=Lt+ot,He=this.left+z;else if(m==="x"){if(E==="center")Lt=ut((f.top+f.bottom)/2+.5);else if(r(E)){let un=Object.keys(E)[0],Wn=E[un];Lt=ut(this.chart.scales[un].getPixelForValue(Wn))}sn=f.top,yn=f.bottom,Te=Lt+ot,Je=Te+z}else if(m==="y"){if(E==="center")Lt=ut((f.left+f.right)/2);else if(r(E)){let un=Object.keys(E)[0],Wn=E[un];Lt=ut(this.chart.scales[un].getPixelForValue(Wn))}me=Lt-ot,He=me-z,cn=f.left,wn=f.right}let an=l(S.ticks.maxTicksLimit,G),gn=Math.max(1,Math.ceil(G/an));for(Jt=0;Jt<G;Jt+=gn){let un=this.getContext(Jt),Wn=T.setContext(un),Hi=D.setContext(un),Ei=Wn.lineWidth,Gr=Wn.color,Ra=Hi.dash||[],Da=Hi.dashOffset,nl=Wn.tickWidth,Vl=Wn.tickColor,_u=Wn.tickBorderDash||[],Hl=Wn.tickBorderDashOffset;Xt=SS(this,Jt,N),Xt!==void 0&&(Yt=Cs(v,Xt,Ei),F?me=He=cn=wn=Yt:Te=Je=sn=yn=Yt,Y.push({tx1:me,ty1:Te,tx2:He,ty2:Je,x1:cn,y1:sn,x2:wn,y2:yn,width:Ei,color:Gr,borderDash:Ra,borderDashOffset:Da,tickWidth:nl,tickColor:Vl,tickBorderDash:_u,tickBorderDashOffset:Hl}))}return this._ticksLength=G,this._borderValue=Lt,Y}_computeLabelItems(f){let m=this.axis,v=this.options,{position:S,ticks:T}=v,E=this.isHorizontal(),D=this.ticks,{align:N,crossAlign:F,padding:G,mirror:z}=T,Y=Mf(v.grid),tt=Y+G,ht=z?-G:tt,ot=-Gt(this.labelRotation),ut=[],Lt,Jt,Xt,Yt,me,Te,He,Je,cn,sn,wn,yn,an="middle";if(S==="top")Te=this.bottom-ht,He=this._getXAxisLabelAlignment();else if(S==="bottom")Te=this.top+ht,He=this._getXAxisLabelAlignment();else if(S==="left"){let un=this._getYAxisLabelAlignment(Y);He=un.textAlign,me=un.x}else if(S==="right"){let un=this._getYAxisLabelAlignment(Y);He=un.textAlign,me=un.x}else if(m==="x"){if(S==="center")Te=(f.top+f.bottom)/2+tt;else if(r(S)){let un=Object.keys(S)[0],Wn=S[un];Te=this.chart.scales[un].getPixelForValue(Wn)+tt}He=this._getXAxisLabelAlignment()}else if(m==="y"){if(S==="center")me=(f.left+f.right)/2-tt;else if(r(S)){let un=Object.keys(S)[0],Wn=S[un];me=this.chart.scales[un].getPixelForValue(Wn)}He=this._getYAxisLabelAlignment(Y).textAlign}m==="y"&&(N==="start"?an="top":N==="end"&&(an="bottom"));let gn=this._getLabelSizes();for(Lt=0,Jt=D.length;
4666Lt<Jt;++Lt){Xt=D[Lt],Yt=Xt.label;let un=T.setContext(this.getContext(Lt));Je=this.getPixelForTick(Lt)+T.labelOffset,cn=this._resolveTickFontOptions(Lt),sn=cn.lineHeight,wn=s(Yt)?Yt.length:1;let Wn=wn/2,Hi=un.color,Ei=un.textStrokeColor,Gr=un.textStrokeWidth,Ra,Da=He;if(E?(me=Je,He==="inner"&&(Da=Lt===Jt-1?this.options.reverse?"left":"right":Lt===0?this.options.reverse?"right":"left":"center"),yn=S==="top"?F==="near"||ot!==0?-wn*sn+sn/2:F==="center"?-gn.highest.height/2-Wn*sn+sn:-gn.highest.height+sn/2:F==="near"||ot!==0?sn/2:F==="center"?gn.highest.height/2-Wn*sn:gn.highest.height-wn*sn,z&&(yn*=-1),ot===0||un.showLabelBackdrop||(me+=sn/2*Math.sin(ot))):(Te=Je,yn=(1-wn)*sn/2),un.showLabelBackdrop){let nl=zi(un.backdropPadding),Vl=gn.heights[Lt],_u=gn.widths[Lt],Hl=yn-nl.top,Su=0-nl.left;switch(an){case"middle":Hl-=Vl/2;break;case"bottom":Hl-=Vl}switch(He){case"center":Su-=_u/2;break;case"right":Su-=_u}Ra={left:Su,top:Hl,width:_u+nl.width,height:Vl+nl.height,color:un.backdropColor}}ut.push({label:Yt,font:cn,textOffset:yn,options:{rotation:ot,color:Hi,strokeColor:Ei,strokeWidth:Gr,textAlign:Da,textBaseline:an,translation:[me,Te],backdrop:Ra}})}return ut}_getXAxisLabelAlignment(){let{position:f,ticks:m}=this.options;if(-Gt(this.labelRotation))return f==="top"?"left":"right";let v="center";return m.align==="start"?v="left":m.align==="end"?v="right":m.align==="inner"&&(v="inner"),v}_getYAxisLabelAlignment(f){let{position:m,ticks:{crossAlign:v,mirror:S,padding:T}}=this.options,E=f+T,D=this._getLabelSizes().widest.width,N,F;return m==="left"?S?(F=this.right+T,v==="near"?N="left":v==="center"?(N="center",F+=D/2):(N="right",F+=D)):(F=this.right-E,v==="near"?N="right":v==="center"?(N="center",F-=D/2):(N="left",F=this.left)):m==="right"?S?(F=this.left+T,v==="near"?N="right":v==="center"?(N="center",F-=D/2):(N="left",F-=D)):(F=this.left+E,v==="near"?N="left":v==="center"?(N="center",F+=D/2):(N="right",F=this.right)):N="right",{textAlign:N,x:F}}_computeLabelArea(){if(this.options.ticks.mirror)return;let f=this.chart,m=this.options.position;return m==="left"||m==="right"?{top:0,left:this.left,bottom:f.height,right:this.right}
4666:m==="top"||m==="bottom"?{top:this.top,left:0,bottom:this.bottom,right:f.width}:void 0}drawBackground(){let{ctx:f,options:{backgroundColor:m},left:v,top:S,width:T,height:E}=this;m&&(f.save(),f.fillStyle=m,f.fillRect(v,S,T,E),f.restore())}getLineWidthForValue(f){let m=this.options.grid;if(!this._isVisible()||!m.display)return 0;let v=this.ticks.findIndex((S=>S.value===f));return v>=0?m.setContext(this.getContext(v)).lineWidth:0}drawGrid(f){let m=this.options.grid,v=this.ctx,S=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(f)),T,E,D=(N,F,G)=>{G.width&&G.color&&(v.save(),v.lineWidth=G.width,v.strokeStyle=G.color,v.setLineDash(G.borderDash||[]),v.lineDashOffset=G.borderDashOffset,v.beginPath(),v.moveTo(N.x,N.y),v.lineTo(F.x,F.y),v.stroke(),v.restore())};if(m.display)for(T=0,E=S.length;T<E;++T){let N=S[T];m.drawOnChartArea&&D({x:N.x1,y:N.y1},{x:N.x2,y:N.y2},N),m.drawTicks&&D({x:N.tx1,y:N.ty1},{x:N.tx2,y:N.ty2},{color:N.tickColor,width:N.tickWidth,borderDash:N.tickBorderDash,borderDashOffset:N.tickBorderDashOffset})}}drawBorder(){let{chart:f,ctx:m,options:{border:v,grid:S}}=this,T=v.setContext(this.getContext()),E=v.display?T.width:0;if(!E)return;let D=S.setContext(this.getContext(0)).lineWidth,N=this._borderValue,F,G,z,Y;this.isHorizontal()?(F=Cs(f,this.left,E)-E/2,G=Cs(f,this.right,D)+D/2,z=Y=N):(z=Cs(f,this.top,E)-E/2,Y=Cs(f,this.bottom,D)+D/2,F=G=N),m.save(),m.lineWidth=T.width,m.strokeStyle=T.color,m.beginPath(),m.moveTo(F,z),m.lineTo(G,Y),m.stroke(),m.restore()}drawLabels(f){if(!this.options.ticks.display)return;let m=this.ctx,v=this._computeLabelArea();v&&Dl(m,v);let S=this.getLabelItems(f);for(let T of S){let E=T.options,D=T.font;Dr(m,T.label,0,T.textOffset,D,E)}v&&Ja(m)}drawTitle(){let{ctx:f,options:{position:m,title:v,reverse:S}}=this;if(!v.display)return;let T=ts(v.font),E=zi(v.padding),D=v.align,N=T.lineHeight/2;m==="bottom"||m==="center"||r(m)?(N+=E.bottom,s(v.text)&&(N+=T.lineHeight*(v.text.length-1))):N+=E.top;let{titleX:F,titleY:G,maxWidth:z,rotation:Y}=(function(tt,ht,ot,ut){let{top:Lt,left:Jt,bottom:Xt,right:Yt,chart:me}=tt,{chartArea:Te,scales:He}=me,Je,cn,sn,wn=0,yn=Xt-Lt,an=Yt-Jt;if(tt.isHorizontal()){if(cn=Se(ut,Jt,Yt),r(ot)){let gn=Object.keys(ot)[0],un=ot[gn];sn=He[gn].getPixelForValue(un)+yn-ht}else sn=ot==="center"?(Te.bottom+Te.top)/2+yn-ht:Fv(tt,ot,ht);Je=Yt-Jt}else{if(r(ot)){let gn=Object.keys(ot)[0],un=ot[gn];cn=He[gn].getPixelForValue(un)-an+ht}else cn=ot==="center"?(Te.left+Te.right)/2-an+ht:Fv(tt,ot,ht);sn=Se(ut,Xt,Lt),wn=ot==="left"?-ct:ct}return{titleX:cn,titleY:sn,maxWidth:Je,rotation:wn}})(this,N,m,D);Dr(f,v.text,0,0,T,{color:v.color,maxWidth:z,rotation:Y,textAlign:MS(D,m,S),textBaseline:"middle",translation:[F,G]})}draw(f){this._isVisible()&&(this.drawBackground(),this.drawGrid(f),this.drawBorder(),this.drawTitle(),this.drawLabels(f))}_layers(){let f=this.options,m=f.ticks&&f.ticks.z||0,v=l(f.grid&&f.grid.z,-1),S=l(f.border&&f.border.z,0);return this._isVisible()&&this.draw===el.prototype.draw?[{z:v,draw:T=>{this.drawBackground(),this.drawGrid(T),this.drawTitle()}},{z:S,draw:()=>{this.drawBorder()}},{z:m,draw:T=>{this.drawLabels(T)}}]:[{z:m,draw:T=>{this.draw(T)}}]}getMatchingVisibleMetas(f){let m=this.chart.getSortedVisibleDatasetMetas(),v=this.axis+"AxisID",S=[],T,E;for(T=0,E=m.length;T<E;++T){let D=m[T];D[v]!==this.id||f&&D.type!==f||S.push(D)}return S}_resolveTickFontOptions(f){return ts(this.options.ticks.setContext(this.getContext(f)).font)}_maxDigits(){let f=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/f}}class sm{constructor(f,m,v){this.type=f,this.scope=m,this.override=v,this.items=Object.create(null)}isForType(f){return Object.prototype.isPrototypeOf.call(this.type.prototype,f.prototype)}register(f){let m=Object.getPrototypeOf(f),v;(function(D){return"id"in D&&"defaults"in D})(m)&&(v=this.register(m));let S=this.items,T=f.id,E=this.scope+"."+T;if(!T)throw new Error("class does not have id: "+f);return T in S||(S[T]=f,(function(D,N,F){let G=w(Object.create(null),[F?We.get(F):{},We.get(N),D.defaults]);We.set(N,G),D.defaultRoutes&&(function(z,Y){Object.keys(Y).forEach((tt=>{let ht=tt.split("."),ot=ht.pop(),ut=[z].concat(ht).join("."),Lt=Y[tt].split("."),Jt=Lt.pop(),Xt=Lt.join(".");We.route(ut,ot,Xt,Jt)}))})(N,D.defaultRoutes),D.descriptors&&We.describe(N,D.descriptors)})(f,E,v),this.override&&We.override(f.id,f.overrides)),E}get(f){return this.items[f]}unregister(f){let m=this.items,v=f.id,S=this.scope;v in m&&delete m[v],S&&v in We[S]&&(delete We[S][v],this.override&&delete ne[v])}}class IP{constructor(){this.controllers=new sm(Ai,"datasets",!0),this.elements=new sm(ra,"elements"),this.plugins=new sm(Object,"plugins"),this.scales=new sm(el,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...f){this._each("register",f)}remove(...f){this._each("unregister",f)}addControllers(...f){this._each("register",f,this.controllers)}addElements(...f){this._each("register",f,this.elements)}addPlugins(...f){this._each("register",f,this.plugins)}addScales(...f){this._each("register",f,this.scales)}getController(f){return this._get(f,this.controllers,"controller")}getElement(f){return this._get(f,this.elements,"element")}getPlugin(f){return this._get(f,this.plugins,"plugin")}getScale(f){return this._get(f,this.scales,"scale")}
4666removeControllers(...f){this._each("unregister",f,this.controllers)}removeElements(...f){this._each("unregister",f,this.elements)}removePlugins(...f){this._each("unregister",f,this.plugins)}removeScales(...f){this._each("unregister",f,this.scales)}_each(f,m,v){[...m].forEach((S=>{let T=v||this._getRegistryForType(S);v||T.isForType(S)||T===this.plugins&&S.id?this._exec(f,T,S):d(S,(E=>{let D=v||this._getRegistryForType(E);this._exec(f,D,E)}))}))}_exec(f,m,v){let S=O(f);h(v["before"+S],[],v),m[f](v),h(v["after"+S],[],v)}_getRegistryForType(f){for(let m=0;m<this._typedRegistries.length;m++){let v=this._typedRegistries[m];if(v.isForType(f))return v}return this.plugins}_get(f,m,v){let S=m.get(f);if(S===void 0)throw new Error('"'+f+'" is not a registered '+v+".");return S}}var co=new IP;class OP{constructor(){this._init=[]}notify(f,m,v,S){m==="beforeInit"&&(this._init=this._createDescriptors(f,!0),this._notify(this._init,f,"install"));let T=S?this._descriptors(f).filter(S):this._descriptors(f),E=this._notify(T,f,m,v);return m==="afterDestroy"&&(this._notify(T,f,"stop"),this._notify(this._init,f,"uninstall")),E}_notify(f,m,v,S){S=S||{};for(let T of f){let E=T.plugin;if(h(E[v],[m,S,T.options],E)===!1&&S.cancelable)return!1}return!0}invalidate(){n(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(f){if(this._cache)return this._cache;let m=this._cache=this._createDescriptors(f);return this._notifyStateChanges(f),m}_createDescriptors(f,m){let v=f&&f.config,S=l(v.options&&v.options.plugins,{}),T=(function(E){let D={},N=[],F=Object.keys(co.plugins.items);for(let z=0;z<F.length;z++)N.push(co.getPlugin(F[z]));let G=E.plugins||[];for(let z=0;z<G.length;z++){let Y=G[z];N.indexOf(Y)===-1&&(N.push(Y),D[Y.id]=!0)}return{plugins:N,localIds:D}})(v);return S!==!1||m?(function(E,{plugins:D,localIds:N},F,G){let z=[],Y=E.getContext();for(let tt of D){let ht=tt.id,ot=NP(F[ht],G);ot!==null&&z.push({plugin:tt,options:BP(E.config,{plugin:tt,local:N[ht]},ot,Y)})}return z})(f,T,S,m):[]}_notifyStateChanges(f){let m=this._oldCache||[],v=this._cache,S=(T,E)=>T.filter((D=>!E.some((N=>D.plugin.id===N.plugin.id))));this._notify(S(m,v),f,"stop"),this._notify(S(v,m),f,"start")}}function NP(b,f){return f||b!==!1?b===!0?{}:b:null}function BP(b,{plugin:f,local:m},v,S){let T=b.pluginScopeKeys(f),E=b.getOptionScopes(v,T);return m&&f.defaults&&E.push(f.defaults),b.createResolver(E,S,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function rm(b,f){let m=We.datasets[b]||{};return((f.datasets||{})[b]||{}).indexAxis||f.indexAxis||m.indexAxis||"x"}function TS(b){if(b==="x"||b==="y"||b==="r")return b}function Tf(b,...f){if(TS(b))return b;for(let v of f){let S=v.axis||((m=v.position)==="top"||m==="bottom"?"x":m==="left"||m==="right"?"y":void 0)||b.length>1&&TS(b[0].toLowerCase());if(S)return S}var m;throw new Error(`Cannot determine type of '${b}' axis. Please provide 'axis' or 'position' option.`)}function AS(b,f,m){if(m[f+"AxisID"]===b)return{axis:f}}function FP(b,f){let m=ne[b.type]||{scales:{}},v=f.scales||{},S=rm(b.type,f),T=Object.create(null);return Object.keys(v).forEach((E=>{let D=v[E];if(!r(D))return console.error(`Invalid scale configuration for scale: ${E}`);if(D._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${E}`);let N=Tf(E,D,(function(z,Y){if(Y.data&&Y.data.datasets){let tt=Y.data.datasets.filter((ht=>ht.xAxisID===z||ht.yAxisID===z));if(tt.length)return AS(z,"x",tt[0])||AS(z,"y",tt[0])}return{}})(E,b),We.scales[D.type]),F=(function(z,Y){return z===Y?"_index_":"_value_"})(N,S),G=m.scales||{};T[E]=M(Object.create(null),[{axis:N},D,G[N],G[F]])})),b.data.datasets.forEach((E=>{let D=E.type||b.type,N=E.indexAxis||rm(D,f),F=(ne[D]||{}).scales||{};Object.keys(F).forEach((G=>{let z=(function(tt,ht){let ot=tt;return tt==="_index_"?ot=ht:tt==="_value_"&&(ot=ht==="x"?"y":"x"),ot})(G,N),Y=E[z+"AxisID"]||z;T[Y]=T[Y]||Object.create(null),M(T[Y],[{axis:z},v[Y],F[G]])}))})),Object.keys(T).forEach((E=>{let D=T[E];M(D,[We.scales[D.type],We.scale])})),T}function Uv(b){let f=b.options||(b.options={});f.plugins=l(f.plugins,{}),f.scales=FP(b,f)}function ES(b){return(b=b||{}).datasets=b.datasets||[],b.labels=b.labels||[],b}let kS=new Map,PS=new Set;function Af(b,f){let m=kS.get(b);return m||(m=f(),kS.set(b,m),PS.add(m)),m}let Ef=(b,f,m)=>{let v=k(f,m);v!==void 0&&b.add(v)};class RS{constructor(f){this._config=(function(m){return(m=m||{}).data=ES(m.data),Uv(m),m})(f),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(f){this._config.type=f}get data(){return this._config.data}set data(f){this._config.data=ES(f)}get options(){return this._config.options}set options(f){this._config.options=f}get plugins(){return this._config.plugins}update(){let f=this._config;this.clearCache(),Uv(f)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(f){return Af(f,(()=>[[`datasets.${f}`,""]]))}datasetAnimationScopeKeys(f,m){return Af(`${f}.transition.${m}`,(()=>[[`datasets.${f}.transitions.${m}`,`transitions.${m}`],[`datasets.${f}`,""]]))}datasetElementScopeKeys(f,m){return Af(`${f}-${m}`,(()=>[[`datasets.${f}.elements.${m}`,`datasets.${f}`,`elements.${m}`,""]]))}pluginScopeKeys(f){let m=f.id;return Af(`${this.type}-plugin-${m}`,(()=>[[`plugins.${m}`,...f.additionalOptionScopes||[]]]))}_cachedScopes(f,m){let v=this._scopeCache,S=v.get(f);return S&&!m||(S=new Map,v.set(f,S)),S}getOptionScopes(f,m,v){let{options:S,type:T}=this,E=this._cachedScopes(f,v),D=E.get(m);
4666if(D)return D;let N=new Set;m.forEach((G=>{f&&(N.add(f),G.forEach((z=>Ef(N,f,z)))),G.forEach((z=>Ef(N,S,z))),G.forEach((z=>Ef(N,ne[T]||{},z))),G.forEach((z=>Ef(N,We,z))),G.forEach((z=>Ef(N,Ke,z)))}));let F=Array.from(N);return F.length===0&&F.push(Object.create(null)),PS.has(m)&&E.set(m,F),F}chartOptionScopes(){let{options:f,type:m}=this;return[f,ne[m]||{},We.datasets[m]||{},{type:m},We,Ke]}resolveNamedOptions(f,m,v,S=[""]){let T={$shared:!0},{resolver:E,subPrefixes:D}=kf(this._resolverCache,f,S),N=E;(function(F,G){let{isScriptable:z,isIndexable:Y}=gf(F);for(let tt of G){let ht=z(tt),ot=Y(tt),ut=(ot||ht)&&F[tt];if(ht&&(U(ut)||DS(ut))||ot&&s(ut))return!0}return!1})(E,m)&&(T.$shared=!1,N=Za(E,v=U(v)?v():v,this.createResolver(f,v,D)));for(let F of m)T[F]=N[F];return T}createResolver(f,m,v=[""],S){let{resolver:T}=kf(this._resolverCache,f,v);return r(m)?Za(T,m,void 0,S):T}}function kf(b,f,m){let v=b.get(f);v||(v=new Map,b.set(f,v));let S=m.join(),T=v.get(S);return T||(T={resolver:Mc(f,m),subPrefixes:m.filter((E=>!E.toLowerCase().includes("hover")))},v.set(S,T)),T}let DS=b=>r(b)&&Object.getOwnPropertyNames(b).reduce(((f,m)=>f||U(b[m])),!1),L=["top","bottom","left","right","chartArea"];function H(b,f){return b==="top"||b==="bottom"||L.indexOf(b)===-1&&f==="x"}function Q(b,f){return function(m,v){return m[b]===v[b]?m[f]-v[f]:m[b]-v[b]}}function dt(b){let f=b.chart,m=f.options.animation;f.notifyPlugins("afterRender"),h(m&&m.onComplete,[b],f)}function Ct(b){let f=b.chart,m=f.options.animation;h(m&&m.onProgress,[b],f)}function Rt(b){return Nn()&&typeof b=="string"?b=document.getElementById(b):b&&b.length&&(b=b[0]),b&&b.canvas&&(b=b.canvas),b}let Ht={},ue=b=>{let f=Rt(b);return Object.values(Ht).filter((m=>m.canvas===f)).pop()};function Oe(b,f,m){let v=Object.keys(b);for(let S of v){let T=+S;if(T>=f){let E=b[S];delete b[S],(m>0||T>f)&&(b[T+m]=E)}}}class Ve{static defaults=We;static instances=Ht;static overrides=ne;static registry=co;static version="4.3.0";static getChart=ue;static register(...f){co.add(...f),Mn()}static unregister(...f){co.remove(...f),Mn()}constructor(f,m){let v=this.config=new RS(m),S=Rt(f),T=ue(S);if(T)throw new Error("Canvas is already in use. Chart with ID '"+T.id+"' must be destroyed before the canvas with ID '"+T.canvas.id+"' can be reused.");let E=v.createResolver(v.chartOptionScopes(),this.getContext());this.platform=new(v.platform||Dv(S)),this.platform.updateConfig(v);let D=this.platform.acquireContext(S,E.aspectRatio),N=D&&D.canvas,F=N&&N.height,G=N&&N.width;this.id=e(),this.ctx=D,this.canvas=N,this.width=G,this.height=F,this._options=E,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new OP,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=te((z=>this.update(z)),E.resizeDelay||0),this._dataChanges=[],Ht[this.id]=this,D&&N?(fe.listen(this,"complete",dt),fe.listen(this,"progress",Ct),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){let{options:{aspectRatio:f,maintainAspectRatio:m},width:v,height:S,_aspectRatio:T}=this;return n(f)?m&&T?T:S?v/S:null:f}get data(){return this.config.data}set data(f){this.config.data=f}get options(){return this._options}set options(f){this.config.options=f}get registry(){return co}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():$n(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return xi(this.canvas,this.ctx),this}stop(){return fe.stop(this),this}resize(f,m){fe.running(this)?this._resizeBeforeDraw={width:f,height:m}:this._resize(f,m)}_resize(f,m){let v=this.options,S=this.canvas,T=v.maintainAspectRatio&&this.aspectRatio,E=this.platform.getMaximumSize(S,f,m,T),D=v.devicePixelRatio||this.platform.getDevicePixelRatio(),N=this.width?"resize":"attach";this.width=E.width,this.height=E.height,this._aspectRatio=this.aspectRatio,$n(this,D,!0)&&(this.notifyPlugins("resize",{size:E}),h(v.onResize,[this,E],this),this.attached&&this._doResize(N)&&this.render())}ensureScalesHaveIDs(){d(this.options.scales||{},((f,m)=>{f.id=m}))}buildOrUpdateScales(){let f=this.options,m=f.scales,v=this.scales,S=Object.keys(v).reduce(((E,D)=>(E[D]=!1,E)),{}),T=[];m&&(T=T.concat(Object.keys(m).map((E=>{let D=m[E],N=Tf(E,D),F=N==="r",G=N==="x";return{options:D,dposition:F?"chartArea":G?"bottom":"left",dtype:F?"radialLinear":G?"category":"linear"}})))),d(T,(E=>{let D=E.options,N=D.id,F=Tf(N,D),G=l(D.type,E.dtype);D.position!==void 0&&H(D.position,F)===H(E.dposition)||(D.position=E.dposition),S[N]=!0;let z=null;
4666N in v&&v[N].type===G?z=v[N]:(z=new(co.getScale(G))({id:N,type:G,ctx:this.ctx,chart:this}),v[z.id]=z),z.init(D,f)})),d(S,((E,D)=>{E||delete v[D]})),d(v,(E=>{qt.configure(this,E,E.options),qt.addBox(this,E)}))}_updateMetasets(){let f=this._metasets,m=this.data.datasets.length,v=f.length;if(f.sort(((S,T)=>S.index-T.index)),v>m){for(let S=m;S<v;++S)this._destroyDatasetMeta(S);f.splice(m,v-m)}this._sortedMetasets=f.slice(0).sort(Q("order","index"))}_removeUnreferencedMetasets(){let{_metasets:f,data:{datasets:m}}=this;f.length>m.length&&delete this._stacks,f.forEach(((v,S)=>{m.filter((T=>T===v._dataset)).length===0&&this._destroyDatasetMeta(S)}))}buildOrUpdateControllers(){let f=[],m=this.data.datasets,v,S;for(this._removeUnreferencedMetasets(),v=0,S=m.length;v<S;v++){let T=m[v],E=this.getDatasetMeta(v),D=T.type||this.config.type;if(E.type&&E.type!==D&&(this._destroyDatasetMeta(v),E=this.getDatasetMeta(v)),E.type=D,E.indexAxis=T.indexAxis||rm(D,this.options),E.order=T.order||0,E.index=v,E.label=""+T.label,E.visible=this.isDatasetVisible(v),E.controller)E.controller.updateIndex(v),E.controller.linkScales();else{let N=co.getController(D),{datasetElementType:F,dataElementType:G}=We.datasets[D];Object.assign(N,{dataElementType:co.getElement(G),datasetElementType:F&&co.getElement(F)}),E.controller=new N(this,v),f.push(E.controller)}}return this._updateMetasets(),f}_resetElements(){d(this.data.datasets,((f,m)=>{this.getDatasetMeta(m).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(f){let m=this.config;m.update();let v=this._options=m.createResolver(m.chartOptionScopes(),this.getContext()),S=this._animationsDisabled=!v.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:f,cancelable:!0})===!1)return;let T=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let E=0;for(let F=0,G=this.data.datasets.length;F<G;F++){let{controller:z}=this.getDatasetMeta(F),Y=!S&&T.indexOf(z)===-1;z.buildOrUpdateElements(Y),E=Math.max(+z.getMaxOverflow(),E)}E=this._minPadding=v.layout.autoPadding?E:0,this._updateLayout(E),S||d(T,(F=>{F.reset()})),this._updateDatasets(f),this.notifyPlugins("afterUpdate",{mode:f}),this._layers.sort(Q("z","_idx"));let{_active:D,_lastEvent:N}=this;N?this._eventHandler(N,!0):D.length&&this._updateHoverStyles(D,D,!0),this.render()}_updateScales(){d(this.scales,(f=>{qt.removeBox(this,f)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let f=this.options,m=new Set(Object.keys(this._listeners)),v=new Set(f.events);V(m,v)&&!!this._responsiveListeners===f.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:f}=this,m=this._getUniformDataChanges()||[];for(let{method:v,start:S,count:T}of m)Oe(f,S,v==="_removeElements"?-T:T)}_getUniformDataChanges(){let f=this._dataChanges;if(!f||!f.length)return;this._dataChanges=[];let m=this.data.datasets.length,v=T=>new Set(f.filter((E=>E[0]===T)).map(((E,D)=>D+","+E.splice(1).join(",")))),S=v(0);for(let T=1;T<m;T++)if(!V(S,v(T)))return;return Array.from(S).map((T=>T.split(","))).map((T=>({method:T[1],start:+T[2],count:+T[3]})))}_updateLayout(f){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;qt.update(this,this.width,this.height,f);let m=this.chartArea,v=m.width<=0||m.height<=0;this._layers=[],d(this.boxes,(S=>{v&&S.position==="chartArea"||(S.configure&&S.configure(),this._layers.push(...S._layers()))}),this),this._layers.forEach(((S,T)=>{S._idx=T})),this.notifyPlugins("afterLayout")}_updateDatasets(f){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:f,cancelable:!0})!==!1){for(let m=0,v=this.data.datasets.length;m<v;++m)this.getDatasetMeta(m).controller.configure();for(let m=0,v=this.data.datasets.length;m<v;++m)this._updateDataset(m,U(f)?f({datasetIndex:m}):f);this.notifyPlugins("afterDatasetsUpdate",{mode:f})}}_updateDataset(f,m){let v=this.getDatasetMeta(f),S={meta:v,index:f,mode:m,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",S)!==!1&&(v.controller._update(m),S.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",S))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(fe.has(this)?this.attached&&!fe.running(this)&&fe.start(this):(this.draw(),dt({chart:this})))}draw(){let f;if(this._resizeBeforeDraw){let{width:v,height:S}=this._resizeBeforeDraw;this._resize(v,S),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let m=this._layers;for(f=0;f<m.length&&m[f].z<=0;++f)m[f].draw(this.chartArea);for(this._drawDatasets();f<m.length;++f)m[f].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(f){let m=this._sortedMetasets,v=[],S,T;for(S=0,T=m.length;S<T;++S){let E=m[S];f&&!E.visible||v.push(E)}return v}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let f=this.getSortedVisibleDatasetMetas();for(let m=f.length-1;m>=0;--m)this._drawDataset(f[m]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(f){let m=this.ctx,v=f._clip,S=!v.disabled,T=(function(D){let{xScale:N,yScale:F}=D;if(N&&F)return{left:N.left,right:N.right,top:F.top,bottom:F.bottom}})(f)||this.chartArea,E={meta:f,index:f.index,cancelable:!0};
4666this.notifyPlugins("beforeDatasetDraw",E)!==!1&&(S&&Dl(m,{left:v.left===!1?0:T.left-v.left,right:v.right===!1?this.width:T.right+v.right,top:v.top===!1?0:T.top-v.top,bottom:v.bottom===!1?this.height:T.bottom+v.bottom}),f.controller.draw(),S&&Ja(m),E.cancelable=!1,this.notifyPlugins("afterDatasetDraw",E))}isPointInArea(f){return xr(f,this.chartArea,this._minPadding)}getElementsAtEventForMode(f,m,v,S){let T=ia.modes[m];return typeof T=="function"?T(this,f,v,S):[]}getDatasetMeta(f){let m=this.data.datasets[f],v=this._metasets,S=v.filter((T=>T&&T._dataset===m)).pop();return S||(S={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:m&&m.order||0,index:f,_dataset:m,_parsed:[],_sorted:!1},v.push(S)),S}getContext(){return this.$context||(this.$context=qs(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(f){let m=this.data.datasets[f];if(!m)return!1;let v=this.getDatasetMeta(f);return typeof v.hidden=="boolean"?!v.hidden:!m.hidden}setDatasetVisibility(f,m){this.getDatasetMeta(f).hidden=!m}toggleDataVisibility(f){this._hiddenIndices[f]=!this._hiddenIndices[f]}getDataVisibility(f){return!this._hiddenIndices[f]}_updateVisibility(f,m,v){let S=v?"show":"hide",T=this.getDatasetMeta(f),E=T.controller._resolveAnimations(void 0,S);I(m)?(T.data[m].hidden=!v,this.update()):(this.setDatasetVisibility(f,v),E.update(T,{visible:v}),this.update((D=>D.datasetIndex===f?S:void 0)))}hide(f,m){this._updateVisibility(f,m,!1)}show(f,m){this._updateVisibility(f,m,!0)}_destroyDatasetMeta(f){let m=this._metasets[f];m&&m.controller&&m.controller._destroy(),delete this._metasets[f]}_stop(){let f,m;for(this.stop(),fe.remove(this),f=0,m=this.data.datasets.length;f<m;++f)this._destroyDatasetMeta(f)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:f,ctx:m}=this;this._stop(),this.config.clearCache(),f&&(this.unbindEvents(),xi(f,m),this.platform.releaseContext(m),this.canvas=null,this.ctx=null),delete Ht[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...f){return this.canvas.toDataURL(...f)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let f=this._listeners,m=this.platform,v=(T,E)=>{m.addEventListener(this,T,E),f[T]=E},S=(T,E,D)=>{T.offsetX=E,T.offsetY=D,this._eventHandler(T)};d(this.options.events,(T=>v(T,S)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let f=this._responsiveListeners,m=this.platform,v=(N,F)=>{m.addEventListener(this,N,F),f[N]=F},S=(N,F)=>{f[N]&&(m.removeEventListener(this,N,F),delete f[N])},T=(N,F)=>{this.canvas&&this.resize(N,F)},E,D=()=>{S("attach",D),this.attached=!0,this.resize(),v("resize",T),v("detach",E)};E=()=>{this.attached=!1,S("resize",T),this._stop(),this._resize(0,0),v("attach",D)},m.isAttached(this.canvas)?D():E()}unbindEvents(){d(this._listeners,((f,m)=>{this.platform.removeEventListener(this,m,f)})),this._listeners={},d(this._responsiveListeners,((f,m)=>{this.platform.removeEventListener(this,m,f)})),this._responsiveListeners=void 0}updateHoverStyle(f,m,v){let S=v?"set":"remove",T,E,D,N;for(m==="dataset"&&(T=this.getDatasetMeta(f[0].datasetIndex),T.controller["_"+S+"DatasetHoverStyle"]()),D=0,N=f.length;D<N;++D){E=f[D];let F=E&&this.getDatasetMeta(E.datasetIndex).controller;F&&F[S+"HoverStyle"](E.element,E.datasetIndex,E.index)}}getActiveElements(){return this._active||[]}setActiveElements(f){let m=this._active||[],v=f.map((({datasetIndex:S,index:T})=>{let E=this.getDatasetMeta(S);if(!E)throw new Error("No dataset found at index "+S);return{datasetIndex:S,element:E.data[T],index:T}}));!p(v,m)&&(this._active=v,this._lastEvent=null,this._updateHoverStyles(v,m))}notifyPlugins(f,m,v){return this._plugins.notify(this,f,m,v)}isPluginEnabled(f){return this._plugins._cache.filter((m=>m.plugin.id===f)).length===1}_updateHoverStyles(f,m,v){let S=this.options.hover,T=(N,F)=>N.filter((G=>!F.some((z=>G.datasetIndex===z.datasetIndex&&G.index===z.index)))),E=T(m,f),D=v?f:T(f,m);E.length&&this.updateHoverStyle(E,S.mode,!1),D.length&&S.mode&&this.updateHoverStyle(D,S.mode,!0)}_eventHandler(f,m){let v={event:f,replay:m,cancelable:!0,inChartArea:this.isPointInArea(f)},S=E=>(E.options.events||this.options.events).includes(f.native.type);if(this.notifyPlugins("beforeEvent",v,S)===!1)return;let T=this._handleEvent(f,m,v.inChartArea);return v.cancelable=!1,this.notifyPlugins("afterEvent",v,S),(T||v.changed)&&this.render(),this}_handleEvent(f,m,v){let{_active:S=[],options:T}=this,E=m,D=this._getActiveElements(f,S,v,E),N=q(f),F=(function(z,Y,tt,ht){return tt&&z.type!=="mouseout"?ht?Y:z:null})(f,this._lastEvent,v,N);v&&(this._lastEvent=null,h(T.onHover,[f,D,this],this),N&&h(T.onClick,[f,D,this],this));let G=!p(D,S);return(G||m)&&(this._active=D,this._updateHoverStyles(D,S,m)),this._lastEvent=F,G}_getActiveElements(f,m,v,S){if(f.type==="mouseout")return[];if(!v)return m;let T=this.options.hover;return this.getElementsAtEventForMode(f,T.mode,T,S)}}function Mn(){return d(Ve.instances,(b=>b._plugins.invalidate()))}function Ln(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ci{static override(f){Object.assign(ci.prototype,f)}options;constructor(f){this.options=f||{}}init(){}formats(){return Ln()}parse(){return Ln()}format(){return Ln()}add(){return Ln()}diff(){return Ln()}startOf(){return Ln()}endOf(){return Ln()}}var Xs={_date:ci};function Dc(b){let f=b.iScale,m=(function(F,G){if(!F._cache.$bar){let z=F.getMatchingVisibleMetas(G),Y=[];for(let tt=0,ht=z.length;tt<ht;
4666tt++)Y=Y.concat(z[tt].controller.getAllParsedValues(F));F._cache.$bar=mt(Y.sort(((tt,ht)=>tt-ht)))}return F._cache.$bar})(f,b.type),v,S,T,E,D=f._length,N=()=>{T!==32767&&T!==-32768&&(I(E)&&(D=Math.min(D,Math.abs(T-E)||D)),E=T)};for(v=0,S=m.length;v<S;++v)T=f.getPixelForValue(m[v]),N();for(E=void 0,v=0,S=f.ticks.length;v<S;++v)T=f.getPixelForTick(v),N();return D}function Pf(b,f,m,v){return s(b)?(function(S,T,E,D){let N=E.parse(S[0],D),F=E.parse(S[1],D),G=Math.min(N,F),z=Math.max(N,F),Y=G,tt=z;Math.abs(G)>Math.abs(z)&&(Y=z,tt=G),T[E.axis]=tt,T._custom={barStart:Y,barEnd:tt,start:N,end:F,min:G,max:z}})(b,f,m,v):f[m.axis]=m.parse(b,v),f}function zn(b,f,m,v){let S=b.iScale,T=b.vScale,E=S.getLabels(),D=S===T,N=[],F,G,z,Y;for(F=m,G=m+v;F<G;++F)Y=f[F],z={},z[S.axis]=D||S.parse(E[F],F),N.push(Pf(Y,z,T,F));return N}function Xi(b){return b&&b.barStart!==void 0&&b.barEnd!==void 0}function Ks(b,f,m,v){let S=f.borderSkipped,T={};if(!S)return void(b.borderSkipped=T);if(S===!0)return void(b.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});let{start:E,end:D,reverse:N,top:F,bottom:G}=(function(z){let Y,tt,ht,ot,ut;return z.horizontal?(Y=z.base>z.x,tt="left",ht="right"):(Y=z.base<z.y,tt="bottom",ht="top"),Y?(ot="end",ut="start"):(ot="start",ut="end"),{start:tt,end:ht,reverse:Y,top:ot,bottom:ut}})(b);S==="middle"&&m&&(b.enableBorderRadius=!0,(m._top||0)===v?S=F:(m._bottom||0)===v?S=G:(T[Lr(G,E,D,N)]=!0,S=F)),T[Lr(S,E,D,N)]=!0,b.borderSkipped=T}function Lr(b,f,m,v){var S,T,E;return v?(E=m,b=oa(b=(S=b)===(T=f)?E:S===E?T:S,m,f)):b=oa(b,f,m),b}function oa(b,f,m){return b==="start"?f:b==="end"?m:b}function Bh(b,{inflateAmount:f},m){b.inflateAmount=f==="auto"?m===1?.33:0:f}class Fh extends Ai{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:f=>f!=="spacing",_indexable:f=>f!=="spacing"&&!f.startsWith("borderDash")&&!f.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(f){let m=f.data;if(m.labels.length&&m.datasets.length){let{labels:{pointStyle:v,color:S}}=f.legend.options;return m.labels.map(((T,E)=>{let D=f.getDatasetMeta(0).controller.getStyle(E);return{text:T,fillStyle:D.backgroundColor,strokeStyle:D.borderColor,fontColor:S,lineWidth:D.borderWidth,pointStyle:v,hidden:!f.getDataVisibility(E),index:E}}))}return[]}},onClick(f,m,v){v.chart.toggleDataVisibility(m.index),v.chart.update()}}}};constructor(f,m){super(f,m),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(f,m){let v=this.getDataset().data,S=this._cachedMeta;if(this._parsing===!1)S._parsed=v;else{let T,E,D=N=>+v[N];if(r(v[f])){let{key:N="value"}=this._parsing;D=F=>+k(v[F],N)}for(T=f,E=f+m;T<E;++T)S._parsed[T]=D(T)}}_getRotation(){return Gt(this.options.rotation-90)}_getCircumference(){return Gt(this.options.circumference)}_getRotationExtents(){let f=j,m=-j;for(let v=0;v<this.chart.data.datasets.length;++v)if(this.chart.isDatasetVisible(v)&&this.chart.getDatasetMeta(v).type===this._type){let S=this.chart.getDatasetMeta(v).controller,T=S._getRotation(),E=S._getCircumference();f=Math.min(f,T),m=Math.max(m,T+E)}return{rotation:f,circumference:m-f}}update(f){let m=this.chart,{chartArea:v}=m,S=this._cachedMeta,T=S.data,E=this.getMaxBorderWidth()+this.getMaxOffset(T)+this.options.spacing,D=Math.max((Math.min(v.width,v.height)-E)/2,0),N=Math.min(c(this.options.cutout,D),1),F=this._getRingWeight(this.index),{circumference:G,rotation:z}=this._getRotationExtents(),{ratioX:Y,ratioY:tt,offsetX:ht,offsetY:ot}=(function(me,Te,He){let Je=1,cn=1,sn=0,wn=0;if(Te<j){let yn=me,an=yn+Te,gn=Math.cos(yn),un=Math.sin(yn),Wn=Math.cos(an),Hi=Math.sin(an),Ei=(_u,Hl,Su)=>gt(_u,yn,an,!0)?1:Math.max(Hl,Hl*He,Su,Su*He),Gr=(_u,Hl,Su)=>gt(_u,yn,an,!0)?-1:Math.min(Hl,Hl*He,Su,Su*He),Ra=Ei(0,gn,Wn),Da=Ei(ct,un,Hi),nl=Gr(X,gn,Wn),Vl=Gr(X+ct,un,Hi);Je=(Ra-nl)/2,cn=(Da-Vl)/2,sn=-(Ra+nl)/2,wn=-(Da+Vl)/2}return{ratioX:Je,ratioY:cn,offsetX:sn,offsetY:wn}})(z,G,N),ut=(v.width-E)/Y,Lt=(v.height-E)/tt,Jt=Math.max(Math.min(ut,Lt)/2,0),Xt=u(this.options.radius,Jt),Yt=(Xt-Math.max(Xt*N,0))/this._getVisibleDatasetWeightTotal();this.offsetX=ht*Xt,this.offsetY=ot*Xt,S.total=this.calculateTotal(),this.outerRadius=Xt-Yt*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-Yt*F,0),this.updateElements(T,0,T.length,f)}_circumference(f,m){let v=this.options,S=this._cachedMeta,T=this._getCircumference();return m&&v.animation.animateRotate||!this.chart.getDataVisibility(f)||S._parsed[f]===null||S.data[f].hidden?0:this.calculateCircumference(S._parsed[f]*T/j)}updateElements(f,m,v,S){let T=S==="reset",E=this.chart,D=E.chartArea,N=E.options.animation,F=(D.left+D.right)/2,G=(D.top+D.bottom)/2,z=T&&N.animateScale,Y=z?0:this.innerRadius,tt=z?0:this.outerRadius,{sharedOptions:ht,includeOptions:ot}=this._getSharedOptions(m,S),ut,Lt=this._getRotation();for(ut=0;ut<m;++ut)Lt+=this._circumference(ut,T);for(ut=m;ut<m+v;++ut){let Jt=this._circumference(ut,T),Xt=f[ut],Yt={x:F+this.offsetX,y:G+this.offsetY,startAngle:Lt,endAngle:Lt+Jt,circumference:Jt,outerRadius:tt,innerRadius:Y};ot&&(Yt.options=ht||this.resolveDataElementOptions(ut,Xt.active?"active":S)),Lt+=Jt,this.updateElement(Xt,ut,Yt,S)}}calculateTotal(){let f=this._cachedMeta,m=f.data,v,S=0;for(v=0;v<m.length;v++){let T=f._parsed[v];T===null||isNaN(T)||!this.chart.getDataVisibility(v)||m[v].hidden||(S+=Math.abs(T))}return S}calculateCircumference(f){let m=this._cachedMeta.total;return m>0&&!isNaN(f)?j*(Math.abs(f)/m):0}
4666getLabelAndValue(f){let m=this._cachedMeta,v=this.chart,S=v.data.labels||[],T=Ot(m._parsed[f],v.options.locale);return{label:S[f]||"",value:T}}getMaxBorderWidth(f){let m=0,v=this.chart,S,T,E,D,N;if(!f){for(S=0,T=v.data.datasets.length;S<T;++S)if(v.isDatasetVisible(S)){E=v.getDatasetMeta(S),f=E.data,D=E.controller;break}}if(!f)return 0;for(S=0,T=f.length;S<T;++S)N=D.resolveDataElementOptions(S),N.borderAlign!=="inner"&&(m=Math.max(m,N.borderWidth||0,N.hoverBorderWidth||0));return m}getMaxOffset(f){let m=0;for(let v=0,S=f.length;v<S;++v){let T=this.resolveDataElementOptions(v);m=Math.max(m,T.offset||0,T.hoverOffset||0)}return m}_getRingWeightOffset(f){let m=0;for(let v=0;v<f;++v)this.chart.isDatasetVisible(v)&&(m+=this._getRingWeight(v));return m}_getRingWeight(f){return Math.max(l(this.chart.data.datasets[f].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class KV extends Ai{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(f){let m=f.data;if(m.labels.length&&m.datasets.length){let{labels:{pointStyle:v,color:S}}=f.legend.options;return m.labels.map(((T,E)=>{let D=f.getDatasetMeta(0).controller.getStyle(E);return{text:T,fillStyle:D.backgroundColor,strokeStyle:D.borderColor,fontColor:S,lineWidth:D.borderWidth,pointStyle:v,hidden:!f.getDataVisibility(E),index:E}}))}return[]}},onClick(f,m,v){v.chart.toggleDataVisibility(m.index),v.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(f,m){super(f,m),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(f){let m=this._cachedMeta,v=this.chart,S=v.data.labels||[],T=Ot(m._parsed[f].r,v.options.locale);return{label:S[f]||"",value:T}}parseObjectData(f,m,v,S){return Ah.bind(this)(f,m,v,S)}update(f){let m=this._cachedMeta.data;this._updateRadius(),this.updateElements(m,0,m.length,f)}getMinMax(){let f=this._cachedMeta,m={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return f.data.forEach(((v,S)=>{let T=this.getParsed(S).r;!isNaN(T)&&this.chart.getDataVisibility(S)&&(T<m.min&&(m.min=T),T>m.max&&(m.max=T))})),m}_updateRadius(){let f=this.chart,m=f.chartArea,v=f.options,S=Math.min(m.right-m.left,m.bottom-m.top),T=Math.max(S/2,0),E=(T-Math.max(v.cutoutPercentage?T/100*v.cutoutPercentage:1,0))/f.getVisibleDatasetCount();this.outerRadius=T-E*this.index,this.innerRadius=this.outerRadius-E}updateElements(f,m,v,S){let T=S==="reset",E=this.chart,D=E.options.animation,N=this._cachedMeta.rScale,F=N.xCenter,G=N.yCenter,z=N.getIndexAngle(0)-.5*X,Y,tt=z,ht=360/this.countVisibleElements();for(Y=0;Y<m;++Y)tt+=this._computeAngle(Y,S,ht);for(Y=m;Y<m+v;Y++){let ot=f[Y],ut=tt,Lt=tt+this._computeAngle(Y,S,ht),Jt=E.getDataVisibility(Y)?N.getDistanceFromCenterForValue(this.getParsed(Y).r):0;tt=Lt,T&&(D.animateScale&&(Jt=0),D.animateRotate&&(ut=Lt=z));let Xt={x:F,y:G,innerRadius:0,outerRadius:Jt,startAngle:ut,endAngle:Lt,options:this.resolveDataElementOptions(Y,ot.active?"active":S)};this.updateElement(ot,Y,Xt,S)}}countVisibleElements(){let f=this._cachedMeta,m=0;return f.data.forEach(((v,S)=>{!isNaN(this.getParsed(S).r)&&this.chart.getDataVisibility(S)&&m++})),m}_computeAngle(f,m,v){return this.chart.getDataVisibility(f)?Gt(this.resolveDataElementOptions(f,m).angle||v):0}}var JV=Object.freeze({__proto__:null,BarController:class extends Ai{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(b,f,m,v){return zn(b,f,m,v)}parseArrayData(b,f,m,v){return zn(b,f,m,v)}parseObjectData(b,f,m,v){let{iScale:S,vScale:T}=b,{xAxisKey:E="x",yAxisKey:D="y"}=this._parsing,N=S.axis==="x"?E:D,F=T.axis==="x"?E:D,G=[],z,Y,tt,ht;for(z=m,Y=m+v;z<Y;++z)ht=f[z],tt={}
4666,tt[S.axis]=S.parse(k(ht,N),z),G.push(Pf(k(ht,F),tt,T,z));return G}updateRangeFromParsed(b,f,m,v){super.updateRangeFromParsed(b,f,m,v);let S=m._custom;S&&f===this._cachedMeta.vScale&&(b.min=Math.min(b.min,S.min),b.max=Math.max(b.max,S.max))}getMaxOverflow(){return 0}getLabelAndValue(b){let f=this._cachedMeta,{iScale:m,vScale:v}=f,S=this.getParsed(b),T=S._custom,E=Xi(T)?"["+T.start+", "+T.end+"]":""+v.getLabelForValue(S[v.axis]);return{label:""+m.getLabelForValue(S[m.axis]),value:E}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(b){let f=this._cachedMeta;this.updateElements(f.data,0,f.data.length,b)}updateElements(b,f,m,v){let S=v==="reset",{index:T,_cachedMeta:{vScale:E}}=this,D=E.getBasePixel(),N=E.isHorizontal(),F=this._getRuler(),{sharedOptions:G,includeOptions:z}=this._getSharedOptions(f,v);for(let Y=f;Y<f+m;Y++){let tt=this.getParsed(Y),ht=S||n(tt[E.axis])?{base:D,head:D}:this._calculateBarValuePixels(Y),ot=this._calculateBarIndexPixels(Y,F),ut=(tt._stacks||{})[E.axis],Lt={horizontal:N,base:ht.base,enableBorderRadius:!ut||Xi(tt._custom)||T===ut._top||T===ut._bottom,x:N?ht.head:ot.center,y:N?ot.center:ht.head,height:N?ot.size:Math.abs(ht.size),width:N?Math.abs(ht.size):ot.size};z&&(Lt.options=G||this.resolveDataElementOptions(Y,b[Y].active?"active":v));let Jt=Lt.options||b[Y].options;Ks(Lt,Jt,ut,T),Bh(Lt,Jt,F.ratio),this.updateElement(b[Y],Y,Lt,v)}}_getStacks(b,f){let{iScale:m}=this._cachedMeta,v=m.getMatchingVisibleMetas(this._type).filter((D=>D.controller.options.grouped)),S=m.options.stacked,T=[],E=D=>{let N=D.controller.getParsed(f),F=N&&N[D.vScale.axis];if(n(F)||isNaN(F))return!0};for(let D of v)if((f===void 0||!E(D))&&((S===!1||T.indexOf(D.stack)===-1||S===void 0&&D.stack===void 0)&&T.push(D.stack),D.index===b))break;return T.length||T.push(void 0),T}_getStackCount(b){return this._getStacks(void 0,b).length}_getStackIndex(b,f,m){let v=this._getStacks(b,m),S=f!==void 0?v.indexOf(f):-1;return S===-1?v.length-1:S}_getRuler(){let b=this.options,f=this._cachedMeta,m=f.iScale,v=[],S,T;for(S=0,T=f.data.length;S<T;++S)v.push(m.getPixelForValue(this.getParsed(S)[m.axis],S));let E=b.barThickness;return{min:E||Dc(f),pixels:v,start:m._startPixel,end:m._endPixel,stackCount:this._getStackCount(),scale:m,grouped:b.grouped,ratio:E?1:b.categoryPercentage*b.barPercentage}}_calculateBarValuePixels(b){let{_cachedMeta:{vScale:f,_stacked:m,index:v},options:{base:S,minBarLength:T}}=this,E=S||0,D=this.getParsed(b),N=D._custom,F=Xi(N),G,z,Y=D[f.axis],tt=0,ht=m?this.applyStack(f,D,m):Y;ht!==Y&&(tt=ht-Y,ht=Y),F&&(Y=N.barStart,ht=N.barEnd-N.barStart,Y!==0&&yt(Y)!==yt(N.barEnd)&&(tt=0),tt+=Y);let ot=n(S)||F?tt:S,ut=f.getPixelForValue(ot);if(G=this.chart.getDataVisibility(b)?f.getPixelForValue(tt+ht):ut,z=G-ut,Math.abs(z)<T){z=(function(me,Te,He){return me!==0?yt(me):(Te.isHorizontal()?1:-1)*(Te.min>=He?1:-1)})(z,f,E)*T,Y===E&&(ut-=z/2);let Lt=f.getPixelForDecimal(0),Jt=f.getPixelForDecimal(1),Xt=Math.min(Lt,Jt),Yt=Math.max(Lt,Jt);ut=Math.max(Math.min(ut,Yt),Xt),G=ut+z,m&&!F&&(D._stacks[f.axis]._visualValues[v]=f.getValueForPixel(G)-f.getValueForPixel(ut))}if(ut===f.getPixelForValue(E)){let Lt=yt(z)*f.getLineWidthForValue(E)/2;ut+=Lt,z-=Lt}return{size:z,base:ut,head:G,center:G+z/2}}_calculateBarIndexPixels(b,f){let m=f.scale,v=this.options,S=v.skipNull,T=l(v.maxBarThickness,1/0),E,D;if(f.grouped){let N=S?this._getStackCount(b):f.stackCount,F=v.barThickness==="flex"?(function(z,Y,tt,ht){let ot=Y.pixels,ut=ot[z],Lt=z>0?ot[z-1]:null,Jt=z<ot.length-1?ot[z+1]:null,Xt=tt.categoryPercentage;Lt===null&&(Lt=ut-(Jt===null?Y.end-Y.start:Jt-ut)),Jt===null&&(Jt=ut+ut-Lt);let Yt=ut-(ut-Math.min(Lt,Jt))/2*Xt;return{chunk:Math.abs(Jt-Lt)/2*Xt/ht,ratio:tt.barPercentage,start:Yt}})(b,f,v,N):(function(z,Y,tt,ht){let ot=tt.barThickness,ut,Lt;return n(ot)?(ut=Y.min*tt.categoryPercentage,Lt=tt.barPercentage):(ut=ot*ht,Lt=1),{chunk:ut/ht,ratio:Lt,start:Y.pixels[z]-ut/2}})(b,f,v,N),G=this._getStackIndex(this.index,this._cachedMeta.stack,S?b:void 0);E=F.start+F.chunk*G+F.chunk/2,D=Math.min(T,F.chunk*F.ratio)}else E=m.getPixelForValue(this.getParsed(b)[m.axis],b),D=Math.min(T,f.min*f.ratio);return{base:E-D/2,head:E+D/2,center:E,size:D}}draw(){let b=this._cachedMeta,f=b.vScale,m=b.data,v=m.length,S=0;for(;S<v;++S)this.getParsed(S)[f.axis]!==null&&m[S].draw(this._ctx)}},BubbleController:class extends Ai{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(b,f,m,v){let S=super.parsePrimitiveData(b,f,m,v);for(let T=0;T<S.length;T++)S[T]._custom=this.resolveDataElementOptions(T+m).radius;return S}parseArrayData(b,f,m,v){let S=super.parseArrayData(b,f,m,v);for(let T=0;T<S.length;T++){let E=f[m+T];S[T]._custom=l(E[2],this.resolveDataElementOptions(T+m).radius)}return S}parseObjectData(b,f,m,v){let S=super.parseObjectData(b,f,m,v);for(let T=0;T<S.length;T++){let E=f[m+T];S[T]._custom=l(E&&E.r&&+E.r,this.resolveDataElementOptions(T+m).radius)}return S}getMaxOverflow(){let b=this._cachedMeta.data,f=0;for(let m=b.length-1;m>=0;--m)f=Math.max(f,b[m].size(this.resolveDataElementOptions(m))/2);return f>0&&f}getLabelAndValue(b){let f=this._cachedMeta,m=this.chart.data.labels||[],{xScale:v,yScale:S}=f,T=this.getParsed(b),E=v.getLabelForValue(T.x),D=S.getLabelForValue(T.y),N=T._custom;return{label:m[b]||"",value:"("+E+", "+D+(N?", "+N:"")+")"}}update(b){let f=this._cachedMeta.data;this.updateElements(f,0,f.length,b)}updateElements(b,f,m,v){let S=v==="reset",{iScale:T,vScale:E}=this._cachedMeta,{sharedOptions:D,includeOptions:N}=this._getSharedOptions(f,v),F=T.axis,G=E.axis;for(let z=f;z<f+m;z++){let Y=b[z],tt=!S&&this.getParsed(z),ht={},ot=ht[F]=S?T.getPixelForDecimal(.5):T.getPixelForValue(tt[F]),ut=ht[G]=S?E.getBasePixel():E.getPixelForValue(tt[G]);ht.skip=isNaN(ot)||isNaN(ut),N&&(ht.options=D||this.resolveDataElementOptions(z,Y.active?"active":v),S&&(ht.options.radius=0)),this.updateElement(Y,z,ht,v)}}resolveDataElementOptions(b,f){let m=this.getParsed(b),v=super.resolveDataElementOptions(b,f);v.$shared&&(v=Object.assign({},v,{$shared:!1}));let S=v.radius;
4666return f!=="active"&&(v.radius=0),v.radius+=l(m&&m._custom,S),v}},DoughnutController:Fh,LineController:class extends Ai{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(b){let f=this._cachedMeta,{dataset:m,data:v=[],_dataset:S}=f,T=this.chart._animationsDisabled,{start:E,count:D}=ie(f,v,T);this._drawStart=E,this._drawCount=D,_t(f)&&(E=0,D=v.length),m._chart=this.chart,m._datasetIndex=this.index,m._decimated=!!S._decimated,m.points=v;let N=this.resolveDatasetElementOptions(b);this.options.showLine||(N.borderWidth=0),N.segment=this.options.segment,this.updateElement(m,void 0,{animated:!T,options:N},b),this.updateElements(v,E,D,b)}updateElements(b,f,m,v){let S=v==="reset",{iScale:T,vScale:E,_stacked:D,_dataset:N}=this._cachedMeta,{sharedOptions:F,includeOptions:G}=this._getSharedOptions(f,v),z=T.axis,Y=E.axis,{spanGaps:tt,segment:ht}=this.options,ot=ae(tt)?tt:Number.POSITIVE_INFINITY,ut=this.chart._animationsDisabled||S||v==="none",Lt=f+m,Jt=b.length,Xt=f>0&&this.getParsed(f-1);for(let Yt=0;Yt<Jt;++Yt){let me=b[Yt],Te=ut?me:{};if(Yt<f||Yt>=Lt){Te.skip=!0;continue}let He=this.getParsed(Yt),Je=n(He[Y]),cn=Te[z]=T.getPixelForValue(He[z],Yt),sn=Te[Y]=S||Je?E.getBasePixel():E.getPixelForValue(D?this.applyStack(E,He,D):He[Y],Yt);Te.skip=isNaN(cn)||isNaN(sn)||Je,Te.stop=Yt>0&&Math.abs(He[z]-Xt[z])>ot,ht&&(Te.parsed=He,Te.raw=N.data[Yt]),G&&(Te.options=F||this.resolveDataElementOptions(Yt,me.active?"active":v)),ut||this.updateElement(me,Yt,Te,v),Xt=He}}getMaxOverflow(){let b=this._cachedMeta,f=b.dataset,m=f.options&&f.options.borderWidth||0,v=b.data||[];if(!v.length)return m;let S=v[0].size(this.resolveDataElementOptions(0)),T=v[v.length-1].size(this.resolveDataElementOptions(v.length-1));return Math.max(m,S,T)/2}draw(){let b=this._cachedMeta;b.dataset.updateControlPoints(this.chart.chartArea,b.iScale.axis),super.draw()}},PieController:class extends Fh{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:KV,RadarController:class extends Ai{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(b){let f=this._cachedMeta.vScale,m=this.getParsed(b);return{label:f.getLabels()[b],value:""+f.getLabelForValue(m[f.axis])}}parseObjectData(b,f,m,v){return Ah.bind(this)(b,f,m,v)}update(b){let f=this._cachedMeta,m=f.dataset,v=f.data||[],S=f.iScale.getLabels();if(m.points=v,b!=="resize"){let T=this.resolveDatasetElementOptions(b);this.options.showLine||(T.borderWidth=0);let E={_loop:!0,_fullLoop:S.length===v.length,options:T};this.updateElement(m,void 0,E,b)}this.updateElements(v,0,v.length,b)}updateElements(b,f,m,v){let S=this._cachedMeta.rScale,T=v==="reset";for(let E=f;E<f+m;E++){let D=b[E],N=this.resolveDataElementOptions(E,D.active?"active":v),F=S.getPointPositionForValue(E,this.getParsed(E).r),G=T?S.xCenter:F.x,z=T?S.yCenter:F.y,Y={x:G,y:z,angle:F.angle,skip:isNaN(G)||isNaN(z),options:N};this.updateElement(D,E,Y,v)}}},ScatterController:class extends Ai{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(b){let f=this._cachedMeta,m=this.chart.data.labels||[],{xScale:v,yScale:S}=f,T=this.getParsed(b),E=v.getLabelForValue(T.x),D=S.getLabelForValue(T.y);return{label:m[b]||"",value:"("+E+", "+D+")"}}update(b){let f=this._cachedMeta,{data:m=[]}=f,v=this.chart._animationsDisabled,{start:S,count:T}=ie(f,m,v);if(this._drawStart=S,this._drawCount=T,_t(f)&&(S=0,T=m.length),this.options.showLine){let{dataset:E,_dataset:D}=f;E._chart=this.chart,E._datasetIndex=this.index,E._decimated=!!D._decimated,E.points=m;let N=this.resolveDatasetElementOptions(b);N.segment=this.options.segment,this.updateElement(E,void 0,{animated:!v,options:N},b)}this.updateElements(m,S,T,b)}addElements(){let{showLine:b}=this.options;!this.datasetElementType&&b&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(b,f,m,v){let S=v==="reset",{iScale:T,vScale:E,_stacked:D,_dataset:N}=this._cachedMeta,F=this.resolveDataElementOptions(f,v),G=this.getSharedOptions(F),z=this.includeOptions(v,G),Y=T.axis,tt=E.axis,{spanGaps:ht,segment:ot}=this.options,ut=ae(ht)?ht:Number.POSITIVE_INFINITY,Lt=this.chart._animationsDisabled||S||v==="none",Jt=f>0&&this.getParsed(f-1);for(let Xt=f;Xt<f+m;++Xt){let Yt=b[Xt],me=this.getParsed(Xt),Te=Lt?Yt:{},He=n(me[tt]),Je=Te[Y]=T.getPixelForValue(me[Y],Xt),cn=Te[tt]=S||He?E.getBasePixel():E.getPixelForValue(D?this.applyStack(E,me,D):me[tt],Xt);Te.skip=isNaN(Je)||isNaN(cn)||He,Te.stop=Xt>0&&Math.abs(me[Y]-Jt[Y])>ut,ot&&(Te.parsed=me,Te.raw=N.data[Xt]),z&&(Te.options=G||this.resolveDataElementOptions(Xt,Yt.active?"active":v)),Lt||this.updateElement(Yt,Xt,Te,v),Jt=me}this.updateSharedOptions(G,v,F)}getMaxOverflow(){let b=this._cachedMeta,f=b.data||[];if(!this.options.showLine){let E=0;for(let D=f.length-1;D>=0;--D)E=Math.max(E,f[D].size(this.resolveDataElementOptions(D))/2);return E>0&&E}let m=b.dataset,v=m.options&&m.options.borderWidth||0;if(!f.length)return v;let S=f[0].size(this.resolveDataElementOptions(0)),T=f[f.length-1].size(this.resolveDataElementOptions(f.length-1));return Math.max(v,S,T)/2}}});function Wit(b,f,m,v){let S=Pc(b.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]),T=(m-f)/2,E=Math.min(T,v*f/2),D=N=>{let F=(m-Math.min(T,N))*v/2;return ft(N,0,Math.min(T,F))};return{outerStart:D(S.outerStart),outerEnd:D(S.outerEnd),innerStart:ft(S.innerStart,0,E),innerEnd:ft(S.innerEnd,0,E)}}function om(b,f,m,v){return{x:m+b*Math.cos(f),y:v+b*Math.sin(f)}}function LS(b,f,m,v,S,T){let{x:E,y:D,startAngle:N,pixelMargin:F,innerRadius:G}=f,z=Math.max(f.outerRadius+v+m-F,0),Y=G>
46660?G+v+m+F:0,tt=0,ht=S-N;if(v){let gn=((G>0?G-v:0)+(z>0?z-v:0))/2;tt=(ht-(gn!==0?ht*gn/(gn+v):ht))/2}let ot=(ht-Math.max(.001,ht*z-m/X)/z)/2,ut=N+ot+tt,Lt=S-ot-tt,{outerStart:Jt,outerEnd:Xt,innerStart:Yt,innerEnd:me}=Wit(f,Y,z,Lt-ut),Te=z-Jt,He=z-Xt,Je=ut+Jt/Te,cn=Lt-Xt/He,sn=Y+Yt,wn=Y+me,yn=ut+Yt/sn,an=Lt-me/wn;if(b.beginPath(),T){let gn=(Je+cn)/2;if(b.arc(E,D,z,Je,gn),b.arc(E,D,z,gn,cn),Xt>0){let Ei=om(He,cn,E,D);b.arc(Ei.x,Ei.y,Xt,cn,Lt+ct)}let un=om(wn,Lt,E,D);if(b.lineTo(un.x,un.y),me>0){let Ei=om(wn,an,E,D);b.arc(Ei.x,Ei.y,me,Lt+ct,an+Math.PI)}let Wn=(Lt-me/Y+(ut+Yt/Y))/2;if(b.arc(E,D,Y,Lt-me/Y,Wn,!0),b.arc(E,D,Y,Wn,ut+Yt/Y,!0),Yt>0){let Ei=om(sn,yn,E,D);b.arc(Ei.x,Ei.y,Yt,yn+Math.PI,ut-ct)}let Hi=om(Te,ut,E,D);if(b.lineTo(Hi.x,Hi.y),Jt>0){let Ei=om(Te,Je,E,D);b.arc(Ei.x,Ei.y,Jt,ut-ct,Je)}}else{b.moveTo(E,D);let gn=Math.cos(Je)*z+E,un=Math.sin(Je)*z+D;b.lineTo(gn,un);let Wn=Math.cos(cn)*z+E,Hi=Math.sin(cn)*z+D;b.lineTo(Wn,Hi)}b.closePath()}function $it(b,f,m,v,S){let{fullCircles:T,startAngle:E,circumference:D,options:N}=f,{borderWidth:F,borderJoinStyle:G,borderDash:z,borderDashOffset:Y}=N,tt=N.borderAlign==="inner";if(!F)return;b.setLineDash(z||[]),b.lineDashOffset=Y,tt?(b.lineWidth=2*F,b.lineJoin=G||"round"):(b.lineWidth=F,b.lineJoin=G||"bevel");let ht=f.endAngle;if(T){LS(b,f,m,v,ht,S);for(let ot=0;ot<T;++ot)b.stroke();isNaN(D)||(ht=E+(D%j||j))}tt&&(function(ot,ut,Lt){let{startAngle:Jt,pixelMargin:Xt,x:Yt,y:me,outerRadius:Te,innerRadius:He}=ut,Je=Xt/Te;ot.beginPath(),ot.arc(Yt,me,Te,Jt-Je,Lt+Je),He>Xt?(Je=Xt/He,ot.arc(Yt,me,He,Lt+Je,Jt-Je,!0)):ot.arc(Yt,me,Xt,Lt+ct,Jt-ct),ot.closePath(),ot.clip()})(b,f,ht),T||(LS(b,f,m,v,ht,S),b.stroke())}function ZV(b,f,m=f){b.lineCap=l(m.borderCapStyle,f.borderCapStyle),b.setLineDash(l(m.borderDash,f.borderDash)),b.lineDashOffset=l(m.borderDashOffset,f.borderDashOffset),b.lineJoin=l(m.borderJoinStyle,f.borderJoinStyle),b.lineWidth=l(m.borderWidth,f.borderWidth),b.strokeStyle=l(m.borderColor,f.borderColor)}function Git(b,f,m){b.lineTo(m.x,m.y)}function QV(b,f,m={}){let v=b.length,{start:S=0,end:T=v-1}=m,{start:E,end:D}=f,N=Math.max(S,E),F=Math.min(T,D),G=S<E&&T<E||S>D&&T>D;return{count:v,start:N,loop:f.loop,ilen:F<N&&!G?v+F-N:F-N}}function qit(b,f,m,v){let{points:S,options:T}=f,{count:E,start:D,loop:N,ilen:F}=QV(S,m,v),G=(function(ut){return ut.stepped?Mh:ut.tension||ut.cubicInterpolationMode==="monotone"?jg:Git})(T),z,Y,tt,{move:ht=!0,reverse:ot}=v||{};for(z=0;z<=F;++z)Y=S[(D+(ot?F-z:z))%E],Y.skip||(ht?(b.moveTo(Y.x,Y.y),ht=!1):G(b,tt,Y,ot,T.stepped),tt=Y);return N&&(Y=S[(D+(ot?F:0))%E],G(b,tt,Y,ot,T.stepped)),!!N}function Yit(b,f,m,v){let S=f.points,{count:T,start:E,ilen:D}=QV(S,m,v),{move:N=!0,reverse:F}=v||{},G,z,Y,tt,ht,ot,ut=0,Lt=0,Jt=Yt=>(E+(F?D-Yt:Yt))%T,Xt=()=>{tt!==ht&&(b.lineTo(ut,ht),b.lineTo(ut,tt),b.lineTo(ut,ot))};for(N&&(z=S[Jt(0)],b.moveTo(z.x,z.y)),G=0;G<=D;++G){if(z=S[Jt(G)],z.skip)continue;let Yt=z.x,me=z.y,Te=0|Yt;Te===Y?(me<tt?tt=me:me>ht&&(ht=me),ut=(Lt*ut+Yt)/++Lt):(Xt(),b.lineTo(Yt,me),Y=Te,Lt=0,tt=ht=me),ot=me}Xt()}function UP(b){let f=b.options,m=f.borderDash&&f.borderDash.length;return b._decimated||b._loop||f.tension||f.cubicInterpolationMode==="monotone"||f.stepped||m?qit:Yit}let Xit=typeof Path2D=="function";function Kit(b,f,m,v){Xit&&!f.options.segment?(function(S,T,E,D){let N=T._path;N||(N=T._path=new Path2D,T.path(N,E,D)&&N.closePath()),ZV(S,T.options),S.stroke(N)})(b,f,m,v):(function(S,T,E,D){let{segments:N,options:F}=T,G=UP(T);for(let z of N)ZV(S,F,z.style),S.beginPath(),G(S,T,z,{start:E,end:E+D-1})&&S.closePath(),S.stroke()})(b,f,m,v)}class IS extends ra{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:f=>f!=="borderDash"&&f!=="fill"};constructor(f){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,f&&Object.assign(this,f)}updateControlPoints(f,m){let v=this.options;if((v.tension||v.cubicInterpolationMode==="monotone")&&!v.stepped&&!this._pointsUpdated){let S=v.spanGaps?this._loop:this._fullLoop;ka(this._points,v,f,S,m),this._pointsUpdated=!0}}set points(f){this._points=f,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Nl(this,this.options.segment))}first(){let f=this.segments,m=this.points;return f.length&&m[f[0].start]}last(){let f=this.segments,m=this.points,v=f.length;return v&&m[f[v-1].end]}interpolate(f,m){let v=this.options,S=f[m],T=this.points,E=Lh(this,{property:m,start:S,end:S});if(!E.length)return;let D=[],N=(function(z){return z.stepped?Ph:z.tension||z.cubicInterpolationMode==="monotone"?Rh:cr})(v),F,G;for(F=0,G=E.length;F<G;++F){let{start:z,end:Y}=E[F],tt=T[z],ht=T[Y];if(tt===ht){D.push(tt);continue}let ot=N(tt,ht,Math.abs((S-tt[m])/(ht[m]-tt[m])),v.stepped);ot[m]=f[m],D.push(ot)}return D.length===1?D[0]:D}pathSegment(f,m,v){return UP(this)(f,this,m,v)}path(f,m,v){let S=this.segments,T=UP(this),E=this._loop;m=m||0,v=v||this.points.length-m;for(let D of S)E&=T(f,this,D,{start:m,end:m+v-1});return!!E}draw(f,m,v,S){let T=this.options||{};(this.points||[]).length&&T.borderWidth&&(f.save(),Kit(f,this,v,S),f.restore(
4666)),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function tH(b,f,m,v){let S=b.options,{[m]:T}=b.getProps([m],v);return Math.abs(f-T)<S.radius+S.hitRadius}function eH(b,f){let{x:m,y:v,base:S,width:T,height:E}=b.getProps(["x","y","base","width","height"],f),D,N,F,G,z;return b.horizontal?(z=E/2,D=Math.min(m,S),N=Math.max(m,S),F=v-z,G=v+z):(z=T/2,D=m-z,N=m+z,F=Math.min(v,S),G=Math.max(v,S)),{left:D,top:F,right:N,bottom:G}}function Uh(b,f,m,v){return b?0:ft(f,m,v)}function Jit(b){let f=eH(b),m=f.right-f.left,v=f.bottom-f.top,S=(function(E,D,N){let F=E.options.borderWidth,G=E.borderSkipped,z=yu(F);return{t:Uh(G.top,z.top,0,N),r:Uh(G.right,z.right,0,D),b:Uh(G.bottom,z.bottom,0,N),l:Uh(G.left,z.left,0,D)}})(b,m/2,v/2),T=(function(E,D,N){let{enableBorderRadius:F}=E.getProps(["enableBorderRadius"]),G=E.options.borderRadius,z=Pa(G),Y=Math.min(D,N),tt=E.borderSkipped,ht=F||r(G);return{topLeft:Uh(!ht||tt.top||tt.left,z.topLeft,0,Y),topRight:Uh(!ht||tt.top||tt.right,z.topRight,0,Y),bottomLeft:Uh(!ht||tt.bottom||tt.left,z.bottomLeft,0,Y),bottomRight:Uh(!ht||tt.bottom||tt.right,z.bottomRight,0,Y)}})(b,m/2,v/2);return{outer:{x:f.left,y:f.top,w:m,h:v,radius:T},inner:{x:f.left+S.l,y:f.top+S.t,w:m-S.l-S.r,h:v-S.t-S.b,radius:{topLeft:Math.max(0,T.topLeft-Math.max(S.t,S.l)),topRight:Math.max(0,T.topRight-Math.max(S.t,S.r)),bottomLeft:Math.max(0,T.bottomLeft-Math.max(S.b,S.l)),bottomRight:Math.max(0,T.bottomRight-Math.max(S.b,S.r))}}}}function zP(b,f,m,v){let S=f===null,T=m===null,E=b&&!(S&&T)&&eH(b,v);return E&&(S||ve(f,E.left,E.right))&&(T||ve(m,E.top,E.bottom))}function Zit(b,f){b.rect(f.x,f.y,f.w,f.h)}function VP(b,f,m={}){let v=b.x!==m.x?-f:0,S=b.y!==m.y?-f:0,T=(b.x+b.w!==m.x+m.w?f:0)-v,E=(b.y+b.h!==m.y+m.h?f:0)-S;return{x:b.x+v,y:b.y+S,w:b.w+T,h:b.h+E,radius:b.radius}}var HP=Object.freeze({__proto__:null,ArcElement:class extends ra{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:b=>b!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(b){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,b&&Object.assign(this,b)}inRange(b,f,m){let v=this.getProps(["x","y"],m),{angle:S,distance:T}=Ut(v,{x:b,y:f}),{startAngle:E,endAngle:D,innerRadius:N,outerRadius:F,circumference:G}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],m),z=(this.options.spacing+this.options.borderWidth)/2,Y=l(G,D-E)>=j||gt(S,E,D),tt=ve(T,N+z,F+z);return Y&&tt}getCenterPoint(b){let{x:f,y:m,startAngle:v,endAngle:S,innerRadius:T,outerRadius:E}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],b),{offset:D,spacing:N}=this.options,F=(v+S)/2,G=(T+E+N+D)/2;return{x:f+Math.cos(F)*G,y:m+Math.sin(F)*G}}tooltipPosition(b){return this.getCenterPoint(b)}draw(b){let{options:f,circumference:m}=this,v=(f.offset||0)/4,S=(f.spacing||0)/2,T=f.circular;if(this.pixelMargin=f.borderAlign==="inner"?.33:0,this.fullCircles=m>j?Math.floor(m/j):0,m===0||this.innerRadius<0||this.outerRadius<0)return;b.save();let E=(this.startAngle+this.endAngle)/2;b.translate(Math.cos(E)*v,Math.sin(E)*v);let D=v*(1-Math.sin(Math.min(X,m||0)));
4666b.fillStyle=f.backgroundColor,b.strokeStyle=f.borderColor,(function(N,F,G,z,Y){let{fullCircles:tt,startAngle:ht,circumference:ot}=F,ut=F.endAngle;if(tt){LS(N,F,G,z,ut,Y);for(let Lt=0;Lt<tt;++Lt)N.fill();isNaN(ot)||(ut=ht+(ot%j||j))}LS(N,F,G,z,ut,Y),N.fill()})(b,this,D,S,T),$it(b,this,D,S,T),b.restore()}},BarElement:class extends ra{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(b){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,b&&Object.assign(this,b)}draw(b){let{inflateAmount:f,options:{borderColor:m,backgroundColor:v}}=this,{inner:S,outer:T}=Jit(this),E=(D=T.radius).topLeft||D.topRight||D.bottomLeft||D.bottomRight?Il:Zit;var D;b.save(),T.w===S.w&&T.h===S.h||(b.beginPath(),E(b,VP(T,f,S)),b.clip(),E(b,VP(S,-f,T)),b.fillStyle=m,b.fill("evenodd")),b.beginPath(),E(b,VP(S,f)),b.fillStyle=v,b.fill(),b.restore()}inRange(b,f,m){return zP(this,b,f,m)}inXRange(b,f){return zP(this,b,null,f)}inYRange(b,f){return zP(this,null,b,f)}getCenterPoint(b){let{x:f,y:m,base:v,horizontal:S}=this.getProps(["x","y","base","horizontal"],b);return{x:S?(f+v)/2:f,y:S?m:(m+v)/2}}getRange(b){return b==="x"?this.width/2:this.height/2}},LineElement:IS,PointElement:class extends ra{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(b){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,b&&Object.assign(this,b)}inRange(b,f,m){let v=this.options,{x:S,y:T}=this.getProps(["x","y"],m);return Math.pow(b-S,2)+Math.pow(f-T,2)<Math.pow(v.hitRadius+v.radius,2)}inXRange(b,f){return tH(this,b,"x",f)}inYRange(b,f){return tH(this,b,"y",f)}getCenterPoint(b){let{x:f,y:m}=this.getProps(["x","y"],b);return{x:f,y:m}}size(b){let f=(b=b||this.options||{}).radius||0;return f=Math.max(f,f&&b.hoverRadius||0),2*(f+(f&&b.borderWidth||0))}draw(b,f){let m=this.options;this.skip||m.radius<.1||!xr(this,f,this.size(m)/2)||(b.strokeStyle=m.borderColor,b.lineWidth=m.borderWidth,b.fillStyle=m.backgroundColor,yr(b,m,this.x,this.y))}getRange(){let b=this.options||{};return b.radius+b.hitRadius}}});function Qit(b,f,m,v){let S=b.indexOf(f);return S===-1?((T,E,D,N)=>(typeof E=="string"?(D=T.push(E)-1,N.unshift({index:D,label:E})):isNaN(E)&&(D=null),D))(b,f,m,v):S!==b.lastIndexOf(f)?m:S}function nH(b){let f=this.getLabels();return b>=0&&b<f.length?f[b]:b}function iH(b,f,{horizontal:m,minRotation:v}){let S=Gt(v),T=(m?Math.sin(S):Math.cos(S))||.001,E=.75*f*(""+b).length;return Math.min(f/T,E)}class OS extends el{constructor(f){super(f),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(f,m){return n(f)||(typeof f=="number"||f instanceof Number)&&!isFinite(+f)?null:+f}handleTickRangeOptions(){let{beginAtZero:f}=this.options,{minDefined:m,maxDefined:v}=this.getUserBounds(),{min:S,max:T}=this,E=N=>S=m?S:N,D=N=>T=v?T:N;if(f){let N=yt(S),F=yt(T);N<0&&F<0?D(0):N>0&&F>0&&E(0)}if(S===T){let N=T===0?1:Math.abs(.05*T);D(T+N),f||E(S-N)}this.min=S,this.max=T}getTickLimit(){let f=this.options.ticks,m,{maxTicksLimit:v,stepSize:S}=f;return S?(m=Math.ceil(this.max/S)-Math.floor(this.min/S)+1,m>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${S} would result generating up to ${m} ticks. Limiting to 1000.`),m=1e3)):(m=this.computeTickLimit(),v=v||11),v&&(m=Math.min(v,m)),m}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let f=this.options,m=f.ticks,v=this.getTickLimit();v=Math.max(2,v);let S=(function(T,E){let D=[],{bounds:N,step:F,min:G,max:z,precision:Y,count:tt,maxTicks:ht,maxDigits:ot,includeBounds:ut}=T,Lt=F||1,Jt=ht-1,{min:Xt,max:Yt}=E,me=!n(G),Te=!n(z),He=!n(tt),Je=(Yt-Xt)/(ot+1),cn,sn,wn,yn,an=Wt((Yt-Xt)/Jt/Lt)*Lt;if(an<1e-14&&!me&&!Te)return[{value:Xt},{value:Yt}];yn=Math.ceil(Yt/an)-Math.floor(Xt/an),yn>Jt&&(an=Wt(yn*an/Jt/Lt)*Lt),n(Y)||(cn=Math.pow(10,Y),an=Math.ceil(an*cn)/cn),N==="ticks"?(sn=Math.floor(Xt/an)*an,wn=Math.ceil(Yt/an)*an):(sn=Xt,wn=Yt),me&&Te&&F&&ee((z-G)/F,an/1e3)?(yn=Math.round(Math.min((z-G)/an,ht)),an=(z-G)/yn,sn=G,wn=z):He?(sn=me?G:sn,wn=Te?z:wn,yn=tt-1,an=(wn-sn)/yn):(yn=(wn-sn)/an,yn=kt(yn,Math.round(yn),an/1e3)?Math.round(yn):Math.ceil(yn));let gn=Math.max(xe(an),xe(sn));cn=Math.pow(10,n(Y)?gn:Y),sn=Math.round(sn*cn)/cn,wn=Math.round(wn*cn)/cn;let un=0;for(me&&(ut&&sn!==G?(D.push({value:G}),sn<G&&un++,kt(Math.round((sn+un*an)*cn)/cn,G,iH(G,Je,T))&&un++):sn<G&&un++);un<yn;++un){let Wn=Math.round((sn+un*an)*cn)/cn;if(Te&&Wn>z)break;D.push({value:Wn})}return Te&&ut&&wn!==z?D.length&&kt(D[D.length-1].value,z,iH(z,Je,T))?D[D.length-1].value=z:D.push({value:z}):Te&&wn!==z||D.push({value:wn}
4666),D})({maxTicks:v,bounds:f.bounds,min:f.min,max:f.max,precision:m.precision,step:m.stepSize,count:m.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:m.minRotation||0,includeBounds:m.includeBounds!==!1},this._range||this);return f.bounds==="ticks"&&Bt(S,this,"value"),f.reverse?(S.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),S}configure(){let f=this.ticks,m=this.min,v=this.max;if(super.configure(),this.options.offset&&f.length){let S=(v-m)/Math.max(f.length-1,1)/2;m-=S,v+=S}this._startValue=m,this._endValue=v,this._valueRange=v-m}getLabelForValue(f){return Ot(f,this.chart.options.locale,this.options.ticks.format)}}class tst extends OS{static id="linear";static defaults={ticks:{callback:Kt.formatters.numeric}};determineDataLimits(){let{min:f,max:m}=this.getMinMax(!0);this.min=o(f)?f:0,this.max=o(m)?m:1,this.handleTickRangeOptions()}computeTickLimit(){let f=this.isHorizontal(),m=f?this.width:this.height,v=Gt(this.options.ticks.minRotation),S=(f?Math.sin(v):Math.cos(v))||.001,T=this._resolveTickFontOptions(0);return Math.ceil(m/Math.min(40,T.lineHeight/S))}getPixelForValue(f){return f===null?NaN:this.getPixelForDecimal((f-this._startValue)/this._valueRange)}getValueForPixel(f){return this._startValue+this.getDecimalForPixel(f)*this._valueRange}}let zv=b=>Math.floor(vt(b)),Rf=(b,f)=>Math.pow(10,zv(b)+f);function sH(b){return b/Math.pow(10,zv(b))===1}function rH(b,f,m){let v=Math.pow(10,m),S=Math.floor(b/v);return Math.ceil(f/v)-S}function est(b,{min:f,max:m}){f=a(b.min,f);let v=[],S=zv(f),T=(function(ht,ot){let ut=zv(ot-ht);for(;rH(ht,ot,ut)>10;)ut++;for(;rH(ht,ot,ut)<10;)ut--;return Math.min(ut,zv(ht))})(f,m),E=T<0?Math.pow(10,Math.abs(T)):1,D=Math.pow(10,T),N=S>T?Math.pow(10,S):0,F=Math.round((f-N)*E)/E,G=Math.floor((f-N)/D/10)*D*10,z=Math.floor((F-G)/Math.pow(10,T)),Y=a(b.min,Math.round((N+G+z*Math.pow(10,T))*E)/E);for(;Y<m;)v.push({value:Y,major:sH(Y),significand:z}),z>=10?z=z<15?15:20:z++,z>=20&&(T++,z=2,E=T>=0?1:E),Y=Math.round((N+G+z*Math.pow(10,T))*E)/E;let tt=a(b.max,Y);return v.push({value:tt,major:sH(tt),significand:z}),v}class nst extends el{static id="logarithmic";static defaults={ticks:{callback:Kt.formatters.logarithmic,major:{enabled:!0}}};constructor(f){super(f),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(f,m){let v=OS.prototype.parse.apply(this,[f,m]);if(v!==0)return o(v)&&v>0?v:null;this._zero=!0}determineDataLimits(){let{min:f,max:m}=this.getMinMax(!0);this.min=o(f)?Math.max(0,f):null,this.max=o(m)?Math.max(0,m):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!o(this._userMin)&&(this.min=f===Rf(this.min,0)?Rf(this.min,-1):Rf(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:f,maxDefined:m}=this.getUserBounds(),v=this.min,S=this.max,T=D=>v=f?v:D,E=D=>S=m?S:D;v===S&&(v<=0?(T(1),E(10)):(T(Rf(v,-1)),E(Rf(S,1)))),v<=0&&T(Rf(S,-1)),S<=0&&E(Rf(v,1)),this.min=v,this.max=S}buildTicks(){let f=this.options,m=est({min:this._userMin,max:this._userMax},this);return f.bounds==="ticks"&&Bt(m,this,"value"),f.reverse?(m.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),m}getLabelForValue(f){return f===void 0?"0":Ot(f,this.chart.options.locale,this.options.ticks.format)}configure(){let f=this.min;super.configure(),this._startValue=vt(f),this._valueRange=vt(this.max)-vt(f)}getPixelForValue(f){return f!==void 0&&f!==0||(f=this.min),f===null||isNaN(f)?NaN:this.getPixelForDecimal(f===this.min?0:(vt(f)-this._startValue)/this._valueRange)}getValueForPixel(f){let m=this.getDecimalForPixel(f);return Math.pow(10,this._startValue+m*this._valueRange)}}function jP(b){let f=b.ticks;if(f.display&&b.display){let m=zi(f.backdropPadding);return l(f.font&&f.font.size,We.font.size)+m.height}return 0}function oH(b,f,m,v,S){return b===v||b===S?{start:f-m/2,end:f+m/2}:b<v||b>S?{start:f-m,end:f}:{start:f,end:f+m}}function ist(b){let f={l:b.left+b._padding.left,r:b.right-b._padding.right,t:b.top+b._padding.top,b:b.bottom-b._padding.bottom},m=Object.assign({},f),v=[],S=[],T=b._pointLabels.length,E=b.options.pointLabels,D=E.centerPointLabels?X/T:0;for(let z=0;z<T;z++){let Y=E.setContext(b.getPointLabelContext(z));S[z]=Y.padding;let tt=b.getPointPosition(z,b.drawingArea+S[z],D),ht=ts(Y.font),ot=(N=b.ctx,F=ht,G=s(G=b._pointLabels[z])?G:[G],{w:Bi(N,F.string,G),h:G.length*F.lineHeight});v[z]=ot;let ut=it(b.getIndexAngle(z)+D),Lt=Math.round(Qt(ut));sst(m,f,ut,oH(Lt,tt.x,ot.w,0,180),oH(Lt,tt.y,ot.h,90,270))}var N,F,G;b.setCenterPoint(f.l-m.l,m.r-f.r,f.t-m.t,m.b-f.b),b._pointLabelItems=(function(z,Y,tt){let ht=[],ot=z._pointLabels.length,ut=z.options,{centerPointLabels:Lt,display:Jt}=ut.pointLabels,Xt={extra:jP(ut)/2,additionalAngle:Lt?X/ot:0},Yt;for(let me=0;me<ot;me++){Xt.padding=tt[me],Xt.size=Y[me];let Te=rst(z,me,Xt);ht.push(Te),Jt==="auto"&&(Te.visible=ost(Te,Yt),Te.visible&&(Yt=Te))}return ht})(b,v,S)}function sst(b,f,m,v,S){let T=Math.abs(Math.sin(m)),E=Math.abs(Math.cos(m)),D=0,N=0;v.start<f.l?(D=(f.l-v.start)/T,b.l=Math.min(b.l,f.l-D)):v.end>f.r&&(D=(v.end-f.r)/T,b.r=Math.max(b.r,f.r+D)),S.start<f.t?(N=(f.t-S.start)/E,b.t=Math.min(b.t,f.t-N)):S.end>f.b&&(N=(S.end-f.b)/E,b.b=Math.max(b.b,f.b+N))}function rst(b,f,m){let v=b.drawingArea,{extra:S,additionalAngle:T,padding:E,size:D}=m,N=b.getPointPosition(f,v+S+E,T),F=Math.round(Qt(it(N.angle+ct))),G=(function(tt,ht,ot){return ot===90||ot===270?tt-=ht/2:(ot>270||ot<90)&&(tt-=ht),tt})(N.y,D.h,F),z=(function(tt){return tt===0||tt===180?"center":tt<180?"left":"right"})(F),Y=(function(tt,ht,ot){return ot==="right"?tt-=ht:ot==="center"&&(tt-=ht/2),tt})(N.x,D.w,z);return{visible:!0,x:N.x,y:G,textAlign:z,left:Y,top:G,right:Y+D.w,bottom:G+D.h}}function ost(b,f){if(!f)return!0;let{left:m,top:v,right:S,bottom:T}=b;return!(xr({x:m,y:v},f)||xr({x:m,y:T},f)||xr({x:S,y:v},f)||xr({x:S,y:T},f))}function ast(b,f,m){let{left:v,top:S,right:T,bottom:E}=m,{backdropColor:D}=f;if(!n(D)){let N=Pa(f.borderRadius),F=zi(f.backdropPadding);b.fillStyle=D;let G=v-F.left,z=S-F.top,Y=T-v+F.width,tt=E-S+F.height;
4666Object.values(N).some((ht=>ht!==0))?(b.beginPath(),Il(b,{x:G,y:z,w:Y,h:tt,radius:N}),b.fill()):b.fillRect(G,z,Y,tt)}}function aH(b,f,m,v){let{ctx:S}=b;if(m)S.arc(b.xCenter,b.yCenter,f,0,j);else{let T=b.getPointPosition(0,f);S.moveTo(T.x,T.y);for(let E=1;E<v;E++)T=b.getPointPosition(E,f),S.lineTo(T.x,T.y)}}class lst extends OS{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Kt.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:f=>f,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(f){super(f),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let f=this._padding=zi(jP(this.options)/2),m=this.width=this.maxWidth-f.width,v=this.height=this.maxHeight-f.height;this.xCenter=Math.floor(this.left+m/2+f.left),this.yCenter=Math.floor(this.top+v/2+f.top),this.drawingArea=Math.floor(Math.min(m,v)/2)}determineDataLimits(){let{min:f,max:m}=this.getMinMax(!1);this.min=o(f)&&!isNaN(f)?f:0,this.max=o(m)&&!isNaN(m)?m:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/jP(this.options))}generateTickLabels(f){OS.prototype.generateTickLabels.call(this,f),this._pointLabels=this.getLabels().map(((m,v)=>{let S=h(this.options.pointLabels.callback,[m,v],this);return S||S===0?S:""})).filter(((m,v)=>this.chart.getDataVisibility(v)))}fit(){let f=this.options;f.display&&f.pointLabels.display?ist(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(f,m,v,S){this.xCenter+=Math.floor((f-m)/2),this.yCenter+=Math.floor((v-S)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(f,m,v,S))}getIndexAngle(f){return it(f*(j/(this._pointLabels.length||1))+Gt(this.options.startAngle||0))}getDistanceFromCenterForValue(f){if(n(f))return NaN;let m=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-f)*m:(f-this.min)*m}getValueForDistanceFromCenter(f){if(n(f))return NaN;let m=f/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-m:this.min+m}getPointLabelContext(f){let m=this._pointLabels||[];if(f>=0&&f<m.length){let v=m[f];return(function(S,T,E){return qs(S,{label:E,index:T,type:"pointLabel"})})(this.getContext(),f,v)}}getPointPosition(f,m,v=0){let S=this.getIndexAngle(f)-ct+v;return{x:Math.cos(S)*m+this.xCenter,y:Math.sin(S)*m+this.yCenter,angle:S}}getPointPositionForValue(f,m){return this.getPointPosition(f,this.getDistanceFromCenterForValue(m))}getBasePosition(f){return this.getPointPositionForValue(f||0,this.getBaseValue())}getPointLabelPosition(f){let{left:m,top:v,right:S,bottom:T}=this._pointLabelItems[f];return{left:m,top:v,right:S,bottom:T}}drawBackground(){let{backgroundColor:f,grid:{circular:m}}=this.options;if(f){let v=this.ctx;v.save(),v.beginPath(),aH(this,this.getDistanceFromCenterForValue(this._endValue),m,this._pointLabels.length),v.closePath(),v.fillStyle=f,v.fill(),v.restore()}}drawGrid(){let f=this.ctx,m=this.options,{angleLines:v,grid:S,border:T}=m,E=this._pointLabels.length,D,N,F;if(m.pointLabels.display&&(function(G,z){let{ctx:Y,options:{pointLabels:tt}}=G;
4666for(let ht=z-1;ht>=0;ht--){let ot=G._pointLabelItems[ht];if(!ot.visible)continue;let ut=tt.setContext(G.getPointLabelContext(ht));ast(Y,ut,ot);let Lt=ts(ut.font),{x:Jt,y:Xt,textAlign:Yt}=ot;Dr(Y,G._pointLabels[ht],Jt,Xt+Lt.lineHeight/2,Lt,{color:ut.color,textAlign:Yt,textBaseline:"middle"})}})(this,E),S.display&&this.ticks.forEach(((G,z)=>{if(z!==0){N=this.getDistanceFromCenterForValue(G.value);let Y=this.getContext(z),tt=S.setContext(Y),ht=T.setContext(Y);(function(ot,ut,Lt,Jt,Xt){let Yt=ot.ctx,me=ut.circular,{color:Te,lineWidth:He}=ut;!me&&!Jt||!Te||!He||Lt<0||(Yt.save(),Yt.strokeStyle=Te,Yt.lineWidth=He,Yt.setLineDash(Xt.dash),Yt.lineDashOffset=Xt.dashOffset,Yt.beginPath(),aH(ot,Lt,me,Jt),Yt.closePath(),Yt.stroke(),Yt.restore())})(this,tt,N,E,ht)}})),v.display){for(f.save(),D=E-1;D>=0;D--){let G=v.setContext(this.getPointLabelContext(D)),{color:z,lineWidth:Y}=G;Y&&z&&(f.lineWidth=Y,f.strokeStyle=z,f.setLineDash(G.borderDash),f.lineDashOffset=G.borderDashOffset,N=this.getDistanceFromCenterForValue(m.ticks.reverse?this.min:this.max),F=this.getPointPosition(D,N),f.beginPath(),f.moveTo(this.xCenter,this.yCenter),f.lineTo(F.x,F.y),f.stroke())}f.restore()}}drawBorder(){}drawLabels(){let f=this.ctx,m=this.options,v=m.ticks;if(!v.display)return;let S=this.getIndexAngle(0),T,E;f.save(),f.translate(this.xCenter,this.yCenter),f.rotate(S),f.textAlign="center",f.textBaseline="middle",this.ticks.forEach(((D,N)=>{if(N===0&&!m.reverse)return;let F=v.setContext(this.getContext(N)),G=ts(F.font);if(T=this.getDistanceFromCenterForValue(this.ticks[N].value),F.showLabelBackdrop){f.font=G.string,E=f.measureText(D.label).width,f.fillStyle=F.backdropColor;let z=zi(F.backdropPadding);f.fillRect(-E/2-z.left,-T-G.size/2-z.top,E+z.width,G.size+z.height)}
4666Dr(f,D.label,0,-T,G,{color:F.color})})),f.restore()}drawTitle(){}}let NS={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},aa=Object.keys(NS);function cst(b,f){return b-f}function lH(b,f){if(n(f))return null;let m=b._adapter,{parser:v,round:S,isoWeekday:T}=b._parseOpts,E=f;return typeof v=="function"&&(E=v(E)),o(E)||(E=typeof v=="string"?m.parse(E,v):m.parse(E)),E===null?null:(S&&(E=S!=="week"||!ae(T)&&T!==!0?m.startOf(E,S):m.startOf(E,"isoWeek",T)),+E)}function cH(b,f,m,v){let S=aa.length;for(let T=aa.indexOf(b);T<S-1;++T){let E=NS[aa[T]],D=E.steps?E.steps:Number.MAX_SAFE_INTEGER;if(E.common&&Math.ceil((m-f)/(D*E.size))<=v)return aa[T]}return aa[S-1]}function uH(b,f,m){if(m){if(m.length){let{lo:v,hi:S}=we(m,f);b[m[v]>=f?m[v]:m[S]]=!0}}else b[f]=!0}function hH(b,f,m){let v=[],S={},T=f.length,E,D;for(E=0;E<T;++E)D=f[E],S[D]=E,v.push({value:D,major:!1});return T!==0&&m?(function(N,F,G,z){let Y=N._adapter,tt=+Y.startOf(F[0].value,z),ht=F[F.length-1].value,ot,ut;for(ot=tt;ot<=ht;ot=+Y.add(ot,1,z))ut=G[ot],ut>=0&&(F[ut].major=!0);return F})(b,v,S,m):v}class WP extends el{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(f){super(f),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(f,m={}){let v=f.time||(f.time={}),S=this._adapter=new Xs._date(f.adapters.date);S.init(m),M(v.displayFormats,S.formats()),this._parseOpts={parser:v.parser,round:v.round,isoWeekday:v.isoWeekday},super.init(f),this._normalized=m.normalized}parse(f,m){return f===void 0?null:lH(this,f)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let f=this.options,m=this._adapter,v=f.time.unit||"day",{min:S,max:T,minDefined:E,maxDefined:D}=this.getUserBounds();function N(F){E||isNaN(F.min)||(S=Math.min(S,F.min)),D||isNaN(F.max)||(T=Math.max(T,F.max))}E&&D||(N(this._getLabelBounds()),f.bounds==="ticks"&&f.ticks.source==="labels"||N(this.getMinMax(!1))),S=o(S)&&!isNaN(S)?S:+m.startOf(Date.now(),v),T=o(T)&&!isNaN(T)?T:+m.endOf(Date.now(),v)+1,this.min=Math.min(S,T-1),this.max=Math.max(S+1,T)}_getLabelBounds(){let f=this.getLabelTimestamps(),m=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;return f.length&&(m=f[0],v=f[f.length-1]),{min:m,max:v}}buildTicks(){let f=this.options,m=f.time,v=f.ticks,S=v.source==="labels"?this.getLabelTimestamps():this._generate();f.bounds==="ticks"&&S.length&&(this.min=this._userMin||S[0],this.max=this._userMax||S[S.length-1]);let T=this.min,E=en(S,T,this.max);return this._unit=m.unit||(v.autoSkip?cH(m.minUnit,this.min,this.max,this._getLabelCapacity(T)):(function(D,N,F,G,z){for(let Y=aa.length-1;Y>=aa.indexOf(F);Y--){let tt=aa[Y];if(NS[tt].common&&D._adapter.diff(z,G,tt)>=N-1)return tt}return aa[F?aa.indexOf(F):0]})(this,E.length,m.minUnit,this.min,this.max)),this._majorUnit=v.major.enabled&&this._unit!=="year"?(function(D){for(let N=aa.indexOf(D)+1,F=aa.length;N<F;++N)if(NS[aa[N]].common)return aa[N]})(this._unit):void 0,this.initOffsets(S),f.reverse&&E.reverse(),hH(this,E,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((f=>+f.value)))}initOffsets(f=[]){let m,v,S=0,T=0;this.options.offset&&f.length&&(m=this.getDecimalForValue(f[0]),S=f.length===1?1-m:(this.getDecimalForValue(f[1])-m)/2,v=this.getDecimalForValue(f[f.length-1]),T=f.length===1?v:(v-this.getDecimalForValue(f[f.length-2]))/2);let E=f.length<3?.5:.25;S=ft(S,0,E),T=ft(T,0,E),this._offsets={start:S,end:T,factor:1/(S+1+T)}}_generate(){let f=this._adapter,m=this.min,v=this.max,S=this.options,T=S.time,E=T.unit||cH(T.minUnit,m,v,this._getLabelCapacity(m)),D=l(S.ticks.stepSize,1),N=E==="week"&&T.isoWeekday,F=ae(N)||N===!0,G={},z,Y,tt=m;if(F&&(tt=+f.startOf(tt,"isoWeek",N)),tt=+f.startOf(tt,F?"day":E),f.diff(v,m,E)>1e5*D)throw new Error(m+" and "+v+" are too far apart with stepSize of "+D+" "+E);let ht=S.ticks.source==="data"&&this.getDataTimestamps();for(z=tt,Y=0;z<v;z=+f.add(z,D,E),Y++)uH(G,z,ht);return z!==v&&S.bounds!=="ticks"&&Y!==1||uH(G,z,ht),Object.keys(G).sort(((ot,ut)=>ot-ut)).map((ot=>+ot))}getLabelForValue(f){let m=this._adapter,v=this.options.time;return v.tooltipFormat?m.format(f,v.tooltipFormat):m.format(f,v.displayFormats.datetime)}format(f,m){let v=this.options.time.displayFormats,S=this._unit,T=m||v[S];return this._adapter.format(f,T)}
4666_tickFormatFunction(f,m,v,S){let T=this.options,E=T.ticks.callback;if(E)return h(E,[f,m,v],this);let D=T.time.displayFormats,N=this._unit,F=this._majorUnit,G=N&&D[N],z=F&&D[F],Y=v[m],tt=F&&z&&Y&&Y.major;return this._adapter.format(f,S||(tt?z:G))}generateTickLabels(f){let m,v,S;for(m=0,v=f.length;m<v;++m)S=f[m],S.label=this._tickFormatFunction(S.value,m,f)}getDecimalForValue(f){return f===null?NaN:(f-this.min)/(this.max-this.min)}getPixelForValue(f){let m=this._offsets,v=this.getDecimalForValue(f);return this.getPixelForDecimal((m.start+v)*m.factor)}getValueForPixel(f){let m=this._offsets,v=this.getDecimalForPixel(f)/m.factor-m.end;return this.min+v*(this.max-this.min)}_getLabelSize(f){let m=this.options.ticks,v=this.ctx.measureText(f).width,S=Gt(this.isHorizontal()?m.maxRotation:m.minRotation),T=Math.cos(S),E=Math.sin(S),D=this._resolveTickFontOptions(0).size;return{w:v*T+D*E,h:v*E+D*T}}_getLabelCapacity(f){let m=this.options.time,v=m.displayFormats,S=v[m.unit]||v.millisecond,T=this._tickFormatFunction(f,0,hH(this,[f],this._majorUnit),S),E=this._getLabelSize(T),D=Math.floor(this.isHorizontal()?this.width/E.w:this.height/E.h)-1;return D>0?D:1}getDataTimestamps(){let f,m,v=this._cache.data||[];if(v.length)return v;let S=this.getMatchingVisibleMetas();if(this._normalized&&S.length)return this._cache.data=S[0].controller.getAllParsedValues(this);for(f=0,m=S.length;f<m;++f)v=v.concat(S[f].controller.getAllParsedValues(this));return this._cache.data=this.normalize(v)}getLabelTimestamps(){let f=this._cache.labels||[],m,v;if(f.length)return f;let S=this.getLabels();for(m=0,v=S.length;m<v;++m)f.push(lH(this,S[m]));return this._cache.labels=this._normalized?f:this.normalize(f)}normalize(f){return mt(f.sort(cst))}}function BS(b,f,m){let v,S,T,E,D=0,N=b.length-1;m?(f>=b[D].pos&&f<=b[N].pos&&({lo:D,hi:N}=Ae(b,"pos",f)),{pos:v,time:T}=b[D],{pos:S,time:E}=b[N]):(f>=b[D].time&&f<=b[N].time&&({lo:D,hi:N}=Ae(b,"time",f)),{time:v,pos:T}=b[D],{time:S,pos:E}=b[N]);let F=S-v;return F?T+(E-T)*(f-v)/F:T}var dH=Object.freeze({__proto__:null,CategoryScale:class extends el{static id="category";static defaults={ticks:{callback:nH}};constructor(b){super(b),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(b){let f=this._addedLabels;if(f.length){let m=this.getLabels();for(let{index:v,label:S}of f)m[v]===S&&m.splice(v,1);this._addedLabels=[]}super.init(b)}parse(b,f){if(n(b))return null;let m=this.getLabels();return((v,S)=>v===null?null:ft(Math.round(v),0,S))(f=isFinite(f)&&m[f]===b?f:Qit(m,b,l(f,b),this._addedLabels),m.length-1)}determineDataLimits(){let{minDefined:b,maxDefined:f}=this.getUserBounds(),{min:m,max:v}=this.getMinMax(!0);this.options.bounds==="ticks"&&(b||(m=0),f||(v=this.getLabels().length-1)),this.min=m,this.max=v}buildTicks(){let b=this.min,f=this.max,m=this.options.offset,v=[],S=this.getLabels();S=b===0&&f===S.length-1?S:S.slice(b,f+1),this._valueRange=Math.max(S.length-(m?0:1),1),this._startValue=this.min-(m?.5:0);for(let T=b;T<=f;T++)v.push({value:T});return v}getLabelForValue(b){return nH.call(this,b)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(b){return typeof b!="number"&&(b=this.parse(b)),b===null?NaN:this.getPixelForDecimal((b-this._startValue)/this._valueRange)}getPixelForTick(b){let f=this.ticks;return b<0||b>f.length-1?null:this.getPixelForValue(f[b].value)}getValueForPixel(b){return Math.round(this._startValue+this.getDecimalForPixel(b)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:tst,LogarithmicScale:nst,RadialLinearScale:lst,TimeScale:WP,TimeSeriesScale:class extends WP{static id="timeseries";static defaults=WP.defaults;constructor(b){super(b),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let b=this._getTimestampsForTable(),f=this._table=this.buildLookupTable(b);this._minPos=BS(f,this.min),this._tableRange=BS(f,this.max)-this._minPos,super.initOffsets(b)}buildLookupTable(b){let{min:f,max:m}=this,v=[],S=[],T,E,D,N,F;for(T=0,E=b.length;T<E;++T)N=b[T],N>=f&&N<=m&&v.push(N);if(v.length<2)return[{time:f,pos:0},{time:m,pos:1}];for(T=0,E=v.length;T<E;++T)F=v[T+1],D=v[T-1],N=v[T],Math.round((F+D)/2)!==N&&S.push({time:N,pos:T/(E-1)});return S}_getTimestampsForTable(){let b=this._cache.all||[];if(b.length)return b;let f=this.getDataTimestamps(),m=this.getLabelTimestamps();return b=f.length&&m.length?this.normalize(f.concat(m)):f.length?f:m,b=this._cache.all=b,b}getDecimalForValue(b){return(BS(this._table,b)-this._minPos)/this._tableRange}getValueForPixel(b){let f=this._offsets,m=this.getDecimalForPixel(b)/f.factor-f.end;return BS(this._table,m*this._tableRange+this._minPos,!0)}}});let $P=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],fH=$P.map((b=>b.replace("rgb(","rgba(").replace(")",", 0.5)")));function pH(b){return $P[b%$P.length]}function gH(b){return fH[b%fH.length]}function ust(b){let f=0;return(m,v)=>{let S=b.getDatasetMeta(v).controller;S instanceof Fh?f=(function(T,E){return T.backgroundColor=T.data.map((()=>pH(E++))),E})(m,f):S instanceof KV?f=(function(T,E){return T.backgroundColor=T.data.map((()=>gH(E++))),E})(m,f):S&&(f=(function(T,E){return T.borderColor=pH(E),T.backgroundColor=gH(E),++E})(m,f))}}function mH(b){let f;for(f in b)if(b[f].borderColor||b[f].backgroundColor)return!0;return!1}var hst={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(b,f,m){if(!m.enabled)return;let{data:{datasets:v},options:S}=b.config,{elements:T}=S;
4666if(!m.forceOverride&&(mH(v)||(E=S)&&(E.borderColor||E.backgroundColor)||T&&mH(T)))return;var E;let D=ust(b);v.forEach(D)}};function bH(b){if(b._decimated){let f=b._data;delete b._decimated,delete b._data,Object.defineProperty(b,"data",{configurable:!0,enumerable:!0,writable:!0,value:f})}}function vH(b){b.data.datasets.forEach((f=>{bH(f)}))}var dst={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(b,f,m)=>{if(!m.enabled)return void vH(b);let v=b.width;b.data.datasets.forEach(((S,T)=>{let{_data:E,indexAxis:D}=S,N=b.getDatasetMeta(T),F=E||S.data;if(Do([D,b.options.indexAxis])==="y"||!N.controller.supportsDecimation)return;let G=b.scales[N.xAxisID];if(G.type!=="linear"&&G.type!=="time"||b.options.parsing)return;let{start:z,count:Y}=(function(ht,ot){let ut=ot.length,Lt,Jt=0,{iScale:Xt}=ht,{min:Yt,max:me,minDefined:Te,maxDefined:He}=Xt.getUserBounds();return Te&&(Jt=ft(Ae(ot,Xt.axis,Yt).lo,0,ut-1)),Lt=He?ft(Ae(ot,Xt.axis,me).hi+1,Jt,ut)-Jt:ut-Jt,{start:Jt,count:Lt}})(N,F);if(Y<=(m.threshold||4*v))return void bH(S);let tt;switch(n(E)&&(S._data=F,delete S.data,Object.defineProperty(S,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(ht){this._data=ht}})),m.algorithm){case"lttb":tt=(function(ht,ot,ut,Lt,Jt){let Xt=Jt.samples||Lt;if(Xt>=ut)return ht.slice(ot,ot+ut);let Yt=[],me=(ut-2)/(Xt-2),Te=0,He=ot+ut-1,Je,cn,sn,wn,yn,an=ot;for(Yt[Te++]=ht[an],Je=0;Je<Xt-2;Je++){let gn,un=0,Wn=0,Hi=Math.floor((Je+1)*me)+1+ot,Ei=Math.min(Math.floor((Je+2)*me)+1,ut)+ot,Gr=Ei-Hi;for(gn=Hi;gn<Ei;gn++)un+=ht[gn].x,Wn+=ht[gn].y;un/=Gr,Wn/=Gr;let Ra=Math.floor(Je*me)+1+ot,Da=Math.min(Math.floor((Je+1)*me)+1,ut)+ot,{x:nl,y:Vl}=ht[an];for(sn=wn=-1,gn=Ra;gn<Da;gn++)wn=.5*Math.abs((nl-un)*(ht[gn].y-Vl)-(nl-ht[gn].x)*(Wn-Vl)),wn>sn&&(sn=wn,cn=ht[gn],yn=gn);Yt[Te++]=cn,an=yn}return Yt[Te++]=ht[He],Yt})(F,z,Y,v,m);break;case"min-max":tt=(function(ht,ot,ut,Lt){let Jt,Xt,Yt,me,Te,He,Je,cn,sn,wn,yn=0,an=0,gn=[],un=ot+ut-1,Wn=ht[ot].x,Hi=ht[un].x-Wn;for(Jt=ot;Jt<ot+ut;++Jt){Xt=ht[Jt],Yt=(Xt.x-Wn)/Hi*Lt,me=Xt.y;let Ei=0|Yt;if(Ei===Te)me<sn?(sn=me,He=Jt):me>wn&&(wn=me,Je=Jt),yn=(an*yn+Xt.x)/++an;else{let Gr=Jt-1;if(!n(He)&&!n(Je)){let Ra=Math.min(He,Je),Da=Math.max(He,Je);Ra!==cn&&Ra!==Gr&&gn.push({...ht[Ra],x:yn}),Da!==cn&&Da!==Gr&&gn.push({...ht[Da],x:yn})}Jt>0&&Gr!==cn&&gn.push(ht[Gr]),gn.push(Xt),Te=Ei,an=0,sn=wn=me,He=Je=cn=Jt}}return gn})(F,z,Y,v);break;default:throw new Error(`Unsupported decimation algorithm '${m.algorithm}'`)}S._decimated=tt}))},destroy(b){vH(b)}};function GP(b,f,m,v){if(v)return;let S=f[b],T=m[b];return b==="angle"&&(S=it(S),T=it(T)),{property:b,start:S,end:T}}function qP(b,f,m){for(;f>b;f--){let v=m[f];if(!isNaN(v.x)&&!isNaN(v.y))break}return f}function yH(b,f,m,v){return b&&f?v(b[m],f[m]):b?b[m]:f?f[m]:0}function xH(b,f){let m=[],v=!1;return s(b)?(v=!0,m=b):m=(function(S,T){let{x:E=null,y:D=null}=S||{},N=T.points,F=[];return T.segments.forEach((({start:G,end:z})=>{z=qP(G,z,N);let Y=N[G],tt=N[z];D!==null?(F.push({x:Y.x,y:D}),F.push({x:tt.x,y:D})):E!==null&&(F.push({x:E,y:Y.y}),F.push({x:E,y:tt.y}))})),F})(b,f),m.length?new IS({points:m,options:{tension:0},_loop:v,_fullLoop:v}):null}function wH(b){return b&&b.fill!==!1}function fst(b,f,m){let v=b[f].fill,S=[f],T;if(!m)return v;for(;v!==!1&&S.indexOf(v)===-1;){if(!o(v))return v;if(T=b[v],!T)return!1;if(T.visible)return v;S.push(v),v=T.fill}return!1}function pst(b,f,m){let v=(function(T){let E=T.options,D=E.fill,N=l(D&&D.target,D);return N===void 0&&(N=!!E.backgroundColor),N===!1||N===null?!1:N===!0?"origin":N})(b);if(r(v))return!isNaN(v.value)&&v;let S=parseFloat(v);return o(S)&&Math.floor(S)===S?(function(T,E,D,N){return T!=="-"&&T!=="+"||(D=E+D),D===E||D<0||D>=N?!1:D})(v[0],f,S,m):["origin","start","end","stack","shape"].indexOf(v)>=0&&v}function gst(b,f,m){let v=[];for(let S=0;S<m.length;S++){let T=m[S],{first:E,last:D,point:N}=mst(T,f,"x");if(!(!N||E&&D)){if(E)v.unshift(N);else if(b.push(N),!D)break}}b.push(...v)}function mst(b,f,m){let v=b.interpolate(f,m);if(!v)return{};let S=v[m],T=b.segments,E=b.points,D=!1,N=!1;for(let F=0;F<T.length;F++){let G=T[F],z=E[G.start][m],Y=E[G.end][m];if(ve(S,z,Y)){D=S===z,N=S===Y;break}}return{first:D,last:N,point:v}}class _H{constructor(f){this.x=f.x,this.y=f.y,this.radius=f.radius}
4666pathSegment(f,m,v){let{x:S,y:T,radius:E}=this;return m=m||{start:0,end:j},f.arc(S,T,E,m.end,m.start,!0),!v.bounds}interpolate(f){let{x:m,y:v,radius:S}=this,T=f.angle;return{x:m+Math.cos(T)*S,y:v+Math.sin(T)*S,angle:T}}}function bst(b){let{chart:f,fill:m,line:v}=b;if(o(m))return(function(T,E){let D=T.getDatasetMeta(E);return D&&T.isDatasetVisible(E)?D.dataset:null})(f,m);if(m==="stack")return(function(T){let{scale:E,index:D,line:N}=T,F=[],G=N.segments,z=N.points,Y=(function(tt,ht){let ot=[],ut=tt.getMatchingVisibleMetas("line");for(let Lt=0;Lt<ut.length;Lt++){let Jt=ut[Lt];if(Jt.index===ht)break;Jt.hidden||ot.unshift(Jt.dataset)}return ot})(E,D);Y.push(xH({x:null,y:E.bottom},N));for(let tt=0;tt<G.length;tt++){let ht=G[tt];for(let ot=ht.start;ot<=ht.end;ot++)gst(F,z[ot],Y)}return new IS({points:F,options:{}})})(b);if(m==="shape")return!0;let S=(function(T){return(T.scale||{}).getPointPositionForValue?(function(D){let{scale:N,fill:F}=D,G=N.options,z=N.getLabels().length,Y=G.reverse?N.max:N.min,tt=(function(ot,ut,Lt){let Jt;return Jt=ot==="start"?Lt:ot==="end"?ut.options.reverse?ut.min:ut.max:r(ot)?ot.value:ut.getBaseValue(),Jt})(F,N,Y),ht=[];if(G.grid.circular){let ot=N.getPointPositionForValue(0,Y);return new _H({x:ot.x,y:ot.y,radius:N.getDistanceFromCenterForValue(tt)})}for(let ot=0;ot<z;++ot)ht.push(N.getPointPositionForValue(ot,tt));return ht})(T):(function(D){let{scale:N={},fill:F}=D,G=(function(z,Y){let tt=null;return z==="start"?tt=Y.bottom:z==="end"?tt=Y.top:r(z)?tt=Y.getPixelForValue(z.value):Y.getBasePixel&&(tt=Y.getBasePixel()),tt})(F,N);if(o(G)){let z=N.isHorizontal();return{x:z?G:null,y:z?null:G}}return null})(T)})(b);return S instanceof _H?S:xH(S,v)}function YP(b,f,m){let v=bst(f),{line:S,scale:T,axis:E}=f,D=S.options,N=D.fill,F=D.backgroundColor,{above:G=F,below:z=F}=N||{};v&&S.points.length&&(Dl(b,m),(function(Y,tt){let{line:ht,target:ot,above:ut,below:Lt,area:Jt,scale:Xt}=tt,Yt=ht._loop?"angle":tt.axis;Y.save(),Yt==="x"&&Lt!==ut&&(SH(Y,ot,Jt.top),CH(Y,{line:ht,target:ot,color:ut,scale:Xt,property:Yt}),Y.restore(),Y.save(),SH(Y,ot,Jt.bottom)),CH(Y,{line:ht,target:ot,color:Lt,scale:Xt,property:Yt}),Y.restore()})(b,{line:S,target:v,above:G,below:z,area:m,scale:T,axis:E}),Ja(b))}function SH(b,f,m){let{segments:v,points:S}=f,T=!0,E=!1;b.beginPath();for(let D of v){let{start:N,end:F}=D,G=S[N],z=S[qP(N,F,S)];T?(b.moveTo(G.x,G.y),T=!1):(b.lineTo(G.x,m),b.lineTo(G.x,G.y)),E=!!f.pathSegment(b,D,{move:E}),E?b.closePath():b.lineTo(z.x,m)}b.lineTo(f.first().x,m),b.closePath(),b.clip()}function CH(b,f){let{line:m,target:v,property:S,color:T,scale:E}=f,D=(function(N,F,G){let z=N.segments,Y=N.points,tt=F.points,ht=[];for(let ot of z){let{start:ut,end:Lt}=ot;Lt=qP(ut,Lt,Y);let Jt=GP(G,Y[ut],Y[Lt],ot.loop);if(!F.segments){ht.push({source:ot,target:Jt,start:Y[ut],end:Y[Lt]});continue}let Xt=Lh(F,Jt);for(let Yt of Xt){let me=GP(G,tt[Yt.start],tt[Yt.end],Yt.loop),Te=xf(ot,Y,me);for(let He of Te)ht.push({source:He,target:Yt,start:{[G]:yH(Jt,me,"start",Math.max)},end:{[G]:yH(Jt,me,"end",Math.min)}})}}return ht})(m,v,S);for(let{source:N,target:F,start:G,end:z}of D){let{style:{backgroundColor:Y=T}={}}=N,tt=v!==!0;b.save(),b.fillStyle=Y,vst(b,E,tt&&GP(S,G,z)),b.beginPath();let ht=!!m.pathSegment(b,N),ot;if(tt){ht?b.closePath():MH(b,v,z,S);let ut=!!v.pathSegment(b,F,{move:ht,reverse:!0});ot=ht&&ut,ot||MH(b,v,G,S)}b.closePath(),b.fill(ot?"evenodd":"nonzero"),b.restore()}}function vst(b,f,m){let{top:v,bottom:S}=f.chart.chartArea,{property:T,start:E,end:D}=m||{};T==="x"&&(b.beginPath(),b.rect(E,v,D-E,S-v),b.clip())}function MH(b,f,m,v){let S=f.interpolate(m,v);S&&b.lineTo(S.x,S.y)}var yst={id:"filler",afterDatasetsUpdate(b,f,m){let v=(b.data.datasets||[]).length,S=[],T,E,D,N;for(E=0;E<v;++E)T=b.getDatasetMeta(E),D=T.dataset,N=null,D&&D.options&&D instanceof IS&&(N={visible:b.isDatasetVisible(E),index:E,fill:pst(D,E,v),chart:b,axis:T.controller.options.indexAxis,scale:T.vScale,line:D}),T.$filler=N,S.push(N);for(E=0;E<v;++E)N=S[E],N&&N.fill!==!1&&(N.fill=fst(S,E,m.propagate))},beforeDraw(b,f,m){let v=m.drawTime==="beforeDraw",S=b.getSortedVisibleDatasetMetas(),T=b.chartArea;for(let E=S.length-1;E>=0;--E){let D=S[E].$filler;D&&(D.line.updateControlPoints(T,D.axis),v&&D.fill&&YP(b.ctx,D,T))}},beforeDatasetsDraw(b,f,m){if(m.drawTime!=="beforeDatasetsDraw")return;let v=b.getSortedVisibleDatasetMetas();for(let S=v.length-1;S>=0;--S){let T=v[S].$filler;wH(T)&&YP(b.ctx,T,b.chartArea)}},beforeDatasetDraw(b,f,m){let v=f.meta.$filler;wH(v)&&m.drawTime==="beforeDatasetDraw"&&YP(b.ctx,v,b.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};let TH=(b,f)=>{let{boxHeight:m=f,boxWidth:v=f}=b;return b.usePointStyle&&(m=Math.min(m,f),v=b.pointStyleWidth||Math.min(v,f)),{boxWidth:v,boxHeight:m,itemHeight:Math.max(f,m)}};class AH extends ra{constructor(f){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=f.chart,this.options=f.o
4666ptions,this.ctx=f.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(f,m,v){this.maxWidth=f,this.maxHeight=m,this._margins=v,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let f=this.options.labels||{},m=h(f.generateLabels,[this.chart],this)||[];f.filter&&(m=m.filter((v=>f.filter(v,this.chart.data)))),f.sort&&(m=m.sort(((v,S)=>f.sort(v,S,this.chart.data)))),this.options.reverse&&m.reverse(),this.legendItems=m}fit(){let{options:f,ctx:m}=this;if(!f.display)return void(this.width=this.height=0);let v=f.labels,S=ts(v.font),T=S.size,E=this._computeTitleHeight(),{boxWidth:D,itemHeight:N}=TH(v,T),F,G;m.font=S.string,this.isHorizontal()?(F=this.maxWidth,G=this._fitRows(E,T,D,N)+10):(G=this.maxHeight,F=this._fitCols(E,S,D,N)+10),this.width=Math.min(F,f.maxWidth||this.maxWidth),this.height=Math.min(G,f.maxHeight||this.maxHeight)}_fitRows(f,m,v,S){let{ctx:T,maxWidth:E,options:{labels:{padding:D}}}=this,N=this.legendHitBoxes=[],F=this.lineWidths=[0],G=S+D,z=f;T.textAlign="left",T.textBaseline="middle";let Y=-1,tt=-G;return this.legendItems.forEach(((ht,ot)=>{let ut=v+m/2+T.measureText(ht.text).width;(ot===0||F[F.length-1]+ut+2*D>E)&&(z+=G,F[F.length-(ot>0?0:1)]=0,tt+=G,Y++),N[ot]={left:0,top:tt,row:Y,width:ut,height:S},F[F.length-1]+=ut+D})),z}_fitCols(f,m,v,S){let{ctx:T,maxHeight:E,options:{labels:{padding:D}}}=this,N=this.legendHitBoxes=[],F=this.columnSizes=[],G=E-f,z=D,Y=0,tt=0,ht=0,ot=0;return this.legendItems.forEach(((ut,Lt)=>{let{itemWidth:Jt,itemHeight:Xt}=(function(Yt,me,Te,He,Je){let cn=(function(wn,yn,an,gn){let un=wn.text;return un&&typeof un!="string"&&(un=un.reduce(((Wn,Hi)=>Wn.length>Hi.length?Wn:Hi))),yn+an.size/2+gn.measureText(un).width})(He,Yt,me,Te),sn=(function(wn,yn,an){let gn=wn;return typeof yn.text!="string"&&(gn=EH(yn,an)),gn})(Je,He,me.lineHeight);return{itemWidth:cn,itemHeight:sn}})(v,m,T,ut,S);Lt>0&&tt+Xt+2*D>G&&(z+=Y+D,F.push({width:Y,height:tt}),ht+=Y+D,ot++,Y=tt=0),N[Lt]={left:ht,top:tt,col:ot,width:Jt,height:Xt},Y=Math.max(Y,Jt),tt+=Xt+D})),z+=Y,F.push({width:Y,height:tt}),z}adjustHitBoxes(){if(!this.options.display)return;let f=this._computeTitleHeight(),{legendHitBoxes:m,options:{align:v,labels:{padding:S},rtl:T}}=this,E=Ys(T,this.left,this.width);if(this.isHorizontal()){let D=0,N=Se(v,this.left+S,this.right-this.lineWidths[D]);for(let F of m)D!==F.row&&(D=F.row,N=Se(v,this.left+S,this.right-this.lineWidths[D])),F.top+=this.top+f+S,F.left=E.leftForLtr(E.x(N),F.width),N+=F.width+S}else{let D=0,N=Se(v,this.top+f+S,this.bottom-this.columnSizes[D].height);for(let F of m)F.col!==D&&(D=F.col,N=Se(v,this.top+f+S,this.bottom-this.columnSizes[D].height)),F.top=N,F.left+=this.left+S,F.left=E.leftForLtr(E.x(F.left),F.width),N+=F.height+S}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let f=this.ctx;Dl(f,this),this._draw(),Ja(f)}}_draw(){let{options:f,columnSizes:m,lineWidths:v,ctx:S}=this,{align:T,labels:E}=f,D=We.color,N=Ys(f.rtl,this.left,this.width),F=ts(E.font),{padding:G}=E,z=F.size,Y=z/2,tt;this.drawTitle(),S.textAlign=N.textAlign("left"),S.textBaseline="middle",S.lineWidth=.5,S.font=F.string;let{boxWidth:ht,boxHeight:ot,itemHeight:ut}=TH(E,z),Lt=this.isHorizontal(),Jt=this._computeTitleHeight();tt=Lt?{x:Se(T,this.left+G,this.right-v[0]),y:this.top+G+Jt,line:0}:{x:this.left+G,y:Se(T,this.top+Jt+G,this.bottom-m[0].height),line:0},vf(this.ctx,f.textDirection);let Xt=ut+G;this.legendItems.forEach(((Yt,me)=>{S.strokeStyle=Yt.fontColor,S.fillStyle=Yt.fontColor;let Te=S.measureText(Yt.text).width,He=N.textAlign(Yt.textAlign||(Yt.textAlign=E.textAlign)),Je=ht+Y+Te,cn=tt.x,sn=tt.y;if(N.setWidth(this.width),Lt?me>
46660&&cn+Je+G>this.right&&(sn=tt.y+=Xt,tt.line++,cn=tt.x=Se(T,this.left+G,this.right-v[tt.line])):me>0&&sn+Xt>this.bottom&&(cn=tt.x=cn+m[tt.line].width+G,tt.line++,sn=tt.y=Se(T,this.top+Jt+G,this.bottom-m[tt.line].height)),(function(wn,yn,an){if(isNaN(ht)||ht<=0||isNaN(ot)||ot<0)return;S.save();let gn=l(an.lineWidth,1);if(S.fillStyle=l(an.fillStyle,D),S.lineCap=l(an.lineCap,"butt"),S.lineDashOffset=l(an.lineDashOffset,0),S.lineJoin=l(an.lineJoin,"miter"),S.lineWidth=gn,S.strokeStyle=l(an.strokeStyle,D),S.setLineDash(l(an.lineDash,[])),E.usePointStyle){let un={radius:ot*Math.SQRT2/2,pointStyle:an.pointStyle,rotation:an.rotation,borderWidth:gn},Wn=N.xPlus(wn,ht/2);Ro(S,un,Wn,yn+Y,E.pointStyleWidth&&ht)}else{let un=yn+Math.max((z-ot)/2,0),Wn=N.leftForLtr(wn,ht),Hi=Pa(an.borderRadius);S.beginPath(),Object.values(Hi).some((Ei=>Ei!==0))?Il(S,{x:Wn,y:un,w:ht,h:ot,radius:Hi}):S.rect(Wn,un,ht,ot),S.fill(),gn!==0&&S.stroke()}S.restore()})(N.x(cn),sn,Yt),cn=Me(He,cn+ht+Y,Lt?cn+Je:this.right,f.rtl),(function(wn,yn,an){Dr(S,an.text,wn,yn+ut/2,F,{strikethrough:an.hidden,textAlign:N.textAlign(an.textAlign)})})(N.x(cn),sn,Yt),Lt)tt.x+=Je+G;else if(typeof Yt.text!="string"){let wn=F.lineHeight;tt.y+=EH(Yt,wn)}else tt.y+=Xt})),yf(this.ctx,f.textDirection)}drawTitle(){let f=this.options,m=f.title,v=ts(m.font),S=zi(m.padding);if(!m.display)return;let T=Ys(f.rtl,this.left,this.width),E=this.ctx,D=m.position,N=v.size/2,F=S.top+N,G,z=this.left,Y=this.width;if(this.isHorizontal())Y=Math.max(...this.lineWidths),G=this.top+F,z=Se(f.align,z,this.right-Y);else{let ht=this.columnSizes.reduce(((ot,ut)=>Math.max(ot,ut.height)),0);G=F+Se(f.align,this.top,this.bottom-ht-f.labels.padding-this._computeTitleHeight())}let tt=Se(D,z,z+Y);E.textAlign=T.textAlign(Nt(D)),E.textBaseline="middle",E.strokeStyle=m.color,E.fillStyle=m.color,E.font=v.string,Dr(E,m.text,tt,G,v)}_computeTitleHeight(){let f=this.options.title,m=ts(f.font),v=zi(f.padding);return f.display?m.lineHeight+v.height:0}_getLegendItemAt(f,m){let v,S,T;if(ve(f,this.left,this.right)&&ve(m,this.top,this.bottom)){for(T=this.legendHitBoxes,v=0;v<T.length;++v)if(S=T[v],ve(f,S.left,S.left+S.width)&&ve(m,S.top,S.top+S.height))return this.legendItems[v]}return null}handleEvent(f){let m=this.options;if(!(function(E,D){return!!((E==="mousemove"||E==="mouseout")&&(D.onHover||D.onLeave)||D.onClick&&(E==="click"||E==="mouseup"))})(f.type,m))return;let v=this._getLegendItemAt(f.x,f.y);if(f.type==="mousemove"||f.type==="mouseout"){let E=this._hoveredItem,D=(T=v,(S=E)!==null&&T!==null&&S.datasetIndex===T.datasetIndex&&S.index===T.index);E&&!D&&h(m.onLeave,[f,E,this],this),this._hoveredItem=v,v&&!D&&h(m.onHover,[f,v,this],this)}else v&&h(m.onClick,[f,v,this],this);var S,T}}function EH(b,f){return f*(b.text?b.text.length+.5:0)}var xst={id:"legend",_element:AH,start(b,f,m){let v=b.legend=new AH({ctx:b.ctx,options:m,chart:b});qt.configure(b,v,m),qt.addBox(b,v)},stop(b){qt.removeBox(b,b.legend),delete b.legend},beforeUpdate(b,f,m){let v=b.legend;qt.configure(b,v,m),v.options=m},afterUpdate(b){let f=b.legend;f.buildLabels(),f.adjustHitBoxes()},afterEvent(b,f){f.replay||b.legend.handleEvent(f.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(b,f,m){let v=f.datasetIndex,S=m.chart;S.isDatasetVisible(v)?(S.hide(v),f.hidden=!0):(S.show(v),f.hidden=!1)},onHover:null,onLeave:null,labels:{color:b=>b.chart.options.color,boxWidth:40,padding:10,generateLabels(b){let f=b.data.datasets,{labels:{usePointStyle:m,pointStyle:v,textAlign:S,color:T,useBorderRadius:E,borderRadius:D}}=b.legend.options;return b._getSortedDatasetMetas().map((N=>{let F=N.controller.getStyle(m?0:void 0),G=zi(F.borderWidth);return{text:f[N.index].label,fillStyle:F.backgroundColor,fontColor:T,hidden:!N.visible,lineCap:F.borderCapStyle,lineDash:F.borderDash,lineDashOffset:F.borderDashOffset,lineJoin:F.borderJoinStyle,lineWidth:(G.width+G.height)/4,strokeStyle:F.borderColor,pointStyle:v||F.pointStyle,rotation:F.rotation,textAlign:S||F.textAlign,borderRadius:E&&(D||F.borderRadius),datasetIndex:N.index}}),this)}},title:{color:b=>b.chart.options.color,display:!1,position:"center",text:""}}
4666,descriptors:{_scriptable:b=>!b.startsWith("on"),labels:{_scriptable:b=>!["generateLabels","filter","sort"].includes(b)}}};class XP extends ra{constructor(f){super(),this.chart=f.chart,this.options=f.options,this.ctx=f.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(f,m){let v=this.options;if(this.left=0,this.top=0,!v.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=f,this.height=this.bottom=m;let S=s(v.text)?v.text.length:1;this._padding=zi(v.padding);let T=S*ts(v.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=T:this.width=T}isHorizontal(){let f=this.options.position;return f==="top"||f==="bottom"}_drawArgs(f){let{top:m,left:v,bottom:S,right:T,options:E}=this,D=E.align,N,F,G,z=0;return this.isHorizontal()?(F=Se(D,v,T),G=m+f,N=T-v):(E.position==="left"?(F=v+f,G=Se(D,S,m),z=-.5*X):(F=T-f,G=Se(D,m,S),z=.5*X),N=S-m),{titleX:F,titleY:G,maxWidth:N,rotation:z}}draw(){let f=this.ctx,m=this.options;if(!m.display)return;let v=ts(m.font),S=v.lineHeight/2+this._padding.top,{titleX:T,titleY:E,maxWidth:D,rotation:N}=this._drawArgs(S);Dr(f,m.text,0,0,v,{color:m.color,maxWidth:D,rotation:N,textAlign:Nt(m.align),textBaseline:"middle",translation:[T,E]})}}var wst={id:"title",_element:XP,start(b,f,m){(function(v,S){let T=new XP({ctx:v.ctx,options:S,chart:v});qt.configure(v,T,S),qt.addBox(v,T),v.titleBlock=T})(b,m)},stop(b){let f=b.titleBlock;qt.removeBox(b,f),delete b.titleBlock},beforeUpdate(b,f,m){let v=b.titleBlock;qt.configure(b,v,m),v.options=m},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};let FS=new WeakMap;var _st={id:"subtitle",start(b,f,m){let v=new XP({ctx:b.ctx,options:m,chart:b});qt.configure(b,v,m),qt.addBox(b,v),FS.set(b,v)},stop(b){qt.removeBox(b,FS.get(b)),FS.delete(b)},beforeUpdate(b,f,m){let v=FS.get(b);qt.configure(b,v,m),v.options=m},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};let Vv={average(b){if(!b.length)return!1;let f,m,v=0,S=0,T=0;for(f=0,m=b.length;f<m;++f){let E=b[f].element;if(E&&E.hasValue()){let D=E.tooltipPosition();v+=D.x,S+=D.y,++T}}return{x:v/T,y:S/T}},nearest(b,f){if(!b.length)return!1;let m,v,S,T=f.x,E=f.y,D=Number.POSITIVE_INFINITY;for(m=0,v=b.length;m<v;++m){let N=b[m].element;if(N&&N.hasValue()){let F=zt(f,N.getCenterPoint());F<D&&(D=F,S=N)}}if(S){let N=S.tooltipPosition();T=N.x,E=N.y}return{x:T,y:E}}};function Lc(b,f){return f&&(s(f)?Array.prototype.push.apply(b,f):b.push(f)),b}function wu(b){return(typeof b=="string"||b instanceof String)&&b.indexOf(`
4667`)>-1?b.split(`
4668`):b}function Sst(b,f){let{element:m,datasetIndex:v,index:S}=f,T=b.getDatasetMeta(v).controller,{label:E,value:D}=T.getLabelAndValue(S);return{chart:b,label:E,parsed:T.getParsed(S),raw:b.data.datasets[v].data[S],formattedValue:D,dataset:T.getDataset(),dataIndex:S,datasetIndex:v,element:m}}function kH(b,f){let m=b.chart.ctx,{body:v,footer:S,title:T}=b,{boxWidth:E,boxHeight:D}=f,N=ts(f.bodyFont),F=ts(f.titleFont),G=ts(f.footerFont),z=T.length,Y=S.length,tt=v.length,ht=zi(f.padding),ot=ht.height,ut=0,Lt=v.reduce(((Yt,me)=>Yt+me.before.length+me.lines.length+me.after.length),0);Lt+=b.beforeBody.length+b.afterBody.length,z&&(ot+=z*F.lineHeight+(z-1)*f.titleSpacing+f.titleMarginBottom),Lt&&(ot+=tt*(f.displayColors?Math.max(D,N.lineHeight):N.lineHeight)+(Lt-tt)*N.lineHeight+(Lt-1)*f.bodySpacing),Y&&(ot+=f.footerMarginTop+Y*G.lineHeight+(Y-1)*f.footerSpacing);let Jt=0,Xt=function(Yt){ut=Math.max(ut,m.measureText(Yt).width+Jt)};return m.save(),m.font=F.string,d(b.title,Xt),m.font=N.string,d(b.beforeBody.concat(b.afterBody),Xt),Jt=f.displayColors?E+2+f.boxPadding:0,d(v,(Yt=>{d(Yt.before,Xt),d(Yt.lines,Xt),d(Yt.after,Xt)}
4668)),Jt=0,m.font=G.string,d(b.footer,Xt),m.restore(),ut+=ht.width,{width:ut,height:ot}}function Cst(b,f,m,v){let{x:S,width:T}=m,{width:E,chartArea:{left:D,right:N}}=b,F="center";return v==="center"?F=S<=(D+N)/2?"left":"right":S<=T/2?F="left":S>=E-T/2&&(F="right"),(function(G,z,Y,tt){let{x:ht,width:ot}=tt,ut=Y.caretSize+Y.caretPadding;return G==="left"&&ht+ot+ut>z.width||G==="right"&&ht-ot-ut<0||void 0})(F,b,f,m)&&(F="center"),F}function PH(b,f,m){let v=m.yAlign||f.yAlign||(function(S,T){let{y:E,height:D}=T;return E<D/2?"top":E>S.height-D/2?"bottom":"center"})(b,m);return{xAlign:m.xAlign||f.xAlign||Cst(b,f,m,v),yAlign:v}}function RH(b,f,m,v){let{caretSize:S,caretPadding:T,cornerRadius:E}=b,{xAlign:D,yAlign:N}=m,F=S+T,{topLeft:G,topRight:z,bottomLeft:Y,bottomRight:tt}=Pa(E),ht=(function(ut,Lt){let{x:Jt,width:Xt}=ut;return Lt==="right"?Jt-=Xt:Lt==="center"&&(Jt-=Xt/2),Jt})(f,D),ot=(function(ut,Lt,Jt){let{y:Xt,height:Yt}=ut;return Lt==="top"?Xt+=Jt:Xt-=Lt==="bottom"?Yt+Jt:Yt/2,Xt})(f,N,F);return N==="center"?D==="left"?ht+=F:D==="right"&&(ht-=F):D==="left"?ht-=Math.max(G,Y)+S:D==="right"&&(ht+=Math.max(z,tt)+S),{x:ft(ht,0,v.width-f.width),y:ft(ot,0,v.height-f.height)}}function US(b,f,m){let v=zi(m.padding);return f==="center"?b.x+b.width/2:f==="right"?b.x+b.width-v.right:b.x+v.left}function DH(b){return Lc([],wu(b))}function LH(b,f){let m=f&&f.dataset&&f.dataset.tooltip&&f.dataset.tooltip.callbacks;return m?b.override(m):b}let IH={beforeTitle:t,title(b){if(b.length>0){let f=b[0],m=f.chart.data.labels,v=m?m.length:0;if(this&&this.options&&this.options.mode==="dataset")return f.dataset.label||"";if(f.label)return f.label;if(v>0&&f.dataIndex<v)return m[f.dataIndex]}return""},afterTitle:t,beforeBody:t,beforeLabel:t,label(b){if(this&&this.options&&this.options.mode==="dataset")return b.label+": "+b.formattedValue||b.formattedValue;let f=b.dataset.label||"";f&&(f+=": ");let m=b.formattedValue;return n(m)||(f+=m),f},labelColor(b){let f=b.chart.getDatasetMeta(b.datasetIndex).controller.getStyle(b.dataIndex);return{borderColor:f.borderColor,backgroundColor:f.backgroundColor,borderWidth:f.borderWidth,borderDash:f.borderDash,borderDashOffset:f.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(b){let f=b.chart.getDatasetMeta(b.datasetIndex).controller.getStyle(b.dataIndex);return{pointStyle:f.pointStyle,rotation:f.rotation}},afterLabel:t,afterBody:t,beforeFooter:t,footer:t,afterFooter:t};function la(b,f,m,v){let S=b[f].call(m,v);return S===void 0?IH[f].call(m,v):S}class OH extends ra{static positioners=Vv;constructor(f){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=f.chart,this.options=f.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(f){this.options=f,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let f=this._cachedAnimations;if(f)return f;let m=this.chart,v=this.options.setContext(this.getContext()),S=v.enabled&&m.options.animation&&v.animations,T=new Lv(this.chart,S);return S._cacheable&&(this._cachedAnimations=Object.freeze(T)),T}getContext(){return this.$context||(this.$context=(f=this.chart.getContext(),m=this,v=this._tooltipItems,qs(f,{tooltip:m,tooltipItems:v,type:"tooltip"})));var f,m,v}getTitle(f,m){let{callbacks:v}=m,S=la(v,"beforeTitle",this,f),T=la(v,"title",this,f),E=la(v,"afterTitle",this,f),D=[];return D=Lc(D,wu(S)),D=Lc(D,wu(T)),D=Lc(D,wu(E)),D}getBeforeBody(f,m){return DH(la(m.callbacks,"beforeBody",this,f))}getBody(f,m){let{callbacks:v}=m,S=[];return d(f,(T=>{let E={before:[],lines:[],after:[]},D=LH(v,T);Lc(E.before,wu(la(D,"beforeLabel",this,T))),Lc(E.lines,la(D,"label",this,T)),Lc(E.after,wu(la(D,"afterLabel",this,T))),S.push(E)})),S}getAfterBody(f,m){return DH(la(m.callbacks,"afterBody",this,f))}getFooter(f,m){let{callbacks:v}=m,S=la(v,"beforeFooter",this,f),T=la(v,"footer",this,f),E=la(v,"afterFooter",this,f),D=[];return D=Lc(D,wu(S)),D=Lc(D,wu(T)),D=Lc(D,wu(E)),D}_createItems(f){let m=this._active,v=this.chart.data,S=[],T=[],E=[],D,N,F=[];for(D=0,N=m.length;D<N;++D)F.push(Sst(this.chart,m[D]));return f.filter&&(F=F.filter(((G,z,Y)=>f.filter(G,z,Y,v)))),f.itemSort&&(F=F.sort(((G,z)=>f.itemSort(G,z,v)))),d(F,(G=>{let z=LH(f.callbacks,G);S.push(la(z,"labelColor",this,G)),T.push(la(z,"labelPointStyle",this,G)),E.push(la(z,"labelTextColor",this,G))})),this.labelColors=S,this.labelPointStyles=T,this.labelTextColors=E,this.dataPoints=F,F}update(f,m){let v=this.options.setContext(this.getContext()),S=this._active,T,E=[];if(S.length){let D=Vv[v.position].call(this,S,this._eventPosition);E=this._createItems(v),this.title=this.getTitle(E,v),this.beforeBody=this.getBeforeBody(E,v),this.body=this.getBody(E,v),this.afterBody=this.getAfterBody(E,v),this.footer=this.getFooter(E,v);let N=this._size=kH(this,v),F=Object.assign({},D,N),G=PH(this.chart,v,F),z=RH(v,F,G,this.chart);this.xAlign=G.xAlign,this.yAlign=G.yAlign,T={opacity:1,x:z.x,y:z.y,width:N.width,height:N.height,caretX:D.x,caretY:D.y}}else this.opacity!==0&&(T={opacity:0}
vendor: 4,983 bytes, line 4668
4668);this._tooltipItems=E,this.$context=void 0,T&&this._resolveAnimations().update(this,T),f&&v.external&&v.external.call(this,{chart:this.chart,tooltip:this,replay:m})}drawCaret(f,m,v,S){let T=this.getCaretPosition(f,v,S);m.lineTo(T.x1,T.y1),m.lineTo(T.x2,T.y2),m.lineTo(T.x3,T.y3)}getCaretPosition(f,m,v){let{xAlign:S,yAlign:T}=this,{caretSize:E,cornerRadius:D}=v,{topLeft:N,topRight:F,bottomLeft:G,bottomRight:z}=Pa(D),{x:Y,y:tt}=f,{width:ht,height:ot}=m,ut,Lt,Jt,Xt,Yt,me;return T==="center"?(Yt=tt+ot/2,S==="left"?(ut=Y,Lt=ut-E,Xt=Yt+E,me=Yt-E):(ut=Y+ht,Lt=ut+E,Xt=Yt-E,me=Yt+E),Jt=ut):(Lt=S==="left"?Y+Math.max(N,G)+E:S==="right"?Y+ht-Math.max(F,z)-E:this.caretX,T==="top"?(Xt=tt,Yt=Xt-E,ut=Lt-E,Jt=Lt+E):(Xt=tt+ot,Yt=Xt+E,ut=Lt+E,Jt=Lt-E),me=Xt),{x1:ut,x2:Lt,x3:Jt,y1:Xt,y2:Yt,y3:me}}drawTitle(f,m,v){let S=this.title,T=S.length,E,D,N;if(T){let F=Ys(v.rtl,this.x,this.width);for(f.x=US(this,v.titleAlign,v),m.textAlign=F.textAlign(v.titleAlign),m.textBaseline="middle",E=ts(v.titleFont),D=v.titleSpacing,m.fillStyle=v.titleColor,m.font=E.string,N=0;N<T;++N)m.fillText(S[N],F.x(f.x),f.y+E.lineHeight/2),f.y+=E.lineHeight+D,N+1===T&&(f.y+=v.titleMarginBottom-D)}}_drawColorBox(f,m,v,S,T){let E=this.labelColors[v],D=this.labelPointStyles[v],{boxHeight:N,boxWidth:F}=T,G=ts(T.bodyFont),z=US(this,"left",T),Y=S.x(z),tt=N<G.lineHeight?(G.lineHeight-N)/2:0,ht=m.y+tt;if(T.usePointStyle){let ot={radius:Math.min(F,N)/2,pointStyle:D.pointStyle,rotation:D.rotation,borderWidth:1},ut=S.leftForLtr(Y,F)+F/2,Lt=ht+N/2;f.strokeStyle=T.multiKeyBackground,f.fillStyle=T.multiKeyBackground,yr(f,ot,ut,Lt),f.strokeStyle=E.borderColor,f.fillStyle=E.backgroundColor,yr(f,ot,ut,Lt)}else{f.lineWidth=r(E.borderWidth)?Math.max(...Object.values(E.borderWidth)):E.borderWidth||1,f.strokeStyle=E.borderColor,f.setLineDash(E.borderDash||[]),f.lineDashOffset=E.borderDashOffset||0;let ot=S.leftForLtr(Y,F),ut=S.leftForLtr(S.xPlus(Y,1),F-2),Lt=Pa(E.borderRadius);Object.values(Lt).some((Jt=>Jt!==0))?(f.beginPath(),f.fillStyle=T.multiKeyBackground,Il(f,{x:ot,y:ht,w:F,h:N,radius:Lt}),f.fill(),f.stroke(),f.fillStyle=E.backgroundColor,f.beginPath(),Il(f,{x:ut,y:ht+1,w:F-2,h:N-2,radius:Lt}),f.fill()):(f.fillStyle=T.multiKeyBackground,f.fillRect(ot,ht,F,N),f.strokeRect(ot,ht,F,N),f.fillStyle=E.backgroundColor,f.fillRect(ut,ht+1,F-2,N-2))}f.fillStyle=this.labelTextColors[v]}drawBody(f,m,v){let{body:S}=this,{bodySpacing:T,bodyAlign:E,displayColors:D,boxHeight:N,boxWidth:F,boxPadding:G}=v,z=ts(v.bodyFont),Y=z.lineHeight,tt=0,ht=Ys(v.rtl,this.x,this.width),ot=function(Je){m.fillText(Je,ht.x(f.x+tt),f.y+Y/2),f.y+=Y+T},ut=ht.textAlign(E),Lt,Jt,Xt,Yt,me,Te,He;for(m.textAlign=E,m.textBaseline="middle",m.font=z.string,f.x=US(this,ut,v),m.fillStyle=v.bodyColor,d(this.beforeBody,ot),tt=D&&ut!=="right"?E==="center"?F/2+G:F+2+G:0,Yt=0,Te=S.length;Yt<Te;++Yt){for(Lt=S[Yt],Jt=this.labelTextColors[Yt],m.fillStyle=Jt,d(Lt.before,ot),Xt=Lt.lines,D&&Xt.length&&(this._drawColorBox(m,f,Yt,ht,v),Y=Math.max(z.lineHeight,N)),me=0,He=Xt.length;me<He;++me)ot(Xt[me]),Y=z.lineHeight;d(Lt.after,ot)}tt=0,Y=z.lineHeight,d(this.afterBody,ot),f.y-=T}drawFooter(f,m,v){let S=this.footer,T=S.length,E,D;if(T){let N=Ys(v.rtl,this.x,this.width);for(f.x=US(this,v.footerAlign,v),f.y+=v.footerMarginTop,m.textAlign=N.textAlign(v.footerAlign),m.textBaseline="middle",E=ts(v.footerFont),m.fillStyle=v.footerColor,m.font=E.string,D=0;D<T;++D)m.fillText(S[D],N.x(f.x),f.y+E.lineHeight/2),f.y+=E.lineHeight+v.footerSpacing}}drawBackground(f,m,v,S){let{xAlign:T,yAlign:E}=this,{x:D,y:N}=f,{width:F,height:G}=v,{topLeft:z,topRight:Y,bottomLeft:tt,bottomRight:ht}=Pa(S.cornerRadius);m.fillStyle=S.backgroundColor,m.strokeStyle=S.borderColor,m.lineWidth=S.borderWidth,m.beginPath(),m.moveTo(D+z,N),E==="top"&&this.drawCaret(f,m,v,S),m.lineTo(D+F-Y,N),m.quadraticCurveTo(D+F,N,D+F,N+Y),E==="center"&&T==="right"&&this.drawCaret(f,m,v,S),m.lineTo(D+F,N+G-ht),m.quadraticCurveTo(D+F,N+G,D+F-ht,N+G),E==="bottom"&&this.drawCaret(f,m,v,S),m.lineTo(D+tt,N+G),m.quadraticCurveTo(D,N+G,D,N+G-tt),E==="center"&&T==="left"&&this.drawCaret(f,m,v,S),m.lineTo(D,N+z),m.quadraticCurveTo(D,N,D+z,N),m.closePath(),m.fill(),S.borderWidth>0&&m.stroke()}_updateAnimationTarget(f){let m=this.chart,v=this.$animations,S=v&&v.x,T=v&&v.y;if(S||T){let E=Vv[f.position].call(this,this._active,this._eventPosition);if(!E)return;let D=this._size=kH(this,f),N=Object.assign({},E,this._size),F=PH(m,f,N),G=RH(f,N,F,m);S._to===G.x&&T._to===G.y||(this.xAlign=F.xAlign,this.yAlign=F.yAlign,this.width=D.width,this.height=D.height,this.caretX=E.x,this.caretY=E.y,this._resolveAnimations().update(this,G))}}_willRender(){return!!this.opacity}draw(f){let m=this.options.setContext(this.getContext()),v=this.opacity;if(!v)return;this._updateAnimationTarget(m);let S={width:this.width,height:this.height},T={x:this.x,y:this.y};v=Math.abs(v)<.001?0:v;let E=zi(m.padding),D=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;
4668m.enabled&&D&&(f.save(),f.globalAlpha=v,this.drawBackground(T,f,S,m),vf(f,m.textDirection),T.y+=E.top,this.drawTitle(T,f,m),this.drawBody(T,f,m),this.drawFooter(T,f,m),yf(f,m.textDirection),f.restore())}getActiveElements(){return this._active||[]}setActiveElements(f,m){let v=this._active,S=f.map((({datasetIndex:D,index:N})=>{let F=this.chart.getDatasetMeta(D);if(!F)throw new Error("Cannot find a dataset at index "+D);return{datasetIndex:D,element:F.data[N],index:N}})),T=!p(v,S),E=this._positionChanged(S,m);(T||E)&&(this._active=S,this._eventPosition=m,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(f,m,v=!0){if(m&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let S=this.options,T=this._active||[],E=this._getActiveElements(f,T,m,v),D=this._positionChanged(E,f),N=m||!p(E,T)||D;return N&&(this._active=E,(S.enabled||S.external)&&(this._eventPosition={x:f.x,y:f.y},this.update(!0,m))),N}_getActiveElements(f,m,v,S){let T=this.options;if(f.type==="mouseout")return[];if(!S)return m;let E=this.chart.getElementsAtEventForMode(f,T.mode,T,v);return T.reverse&&E.reverse(),E}_positionChanged(f,m){let{caretX:v,caretY:S,options:T}=this,E=Vv[T.position].call(this,f,m);return E!==!1&&(v!==E.x||S!==E.y)}}var Mst={id:"tooltip",_element:OH,positioners:Vv,afterInit(b,f,m){m&&(b.tooltip=new OH({chart:b,options:m}))},beforeUpdate(b,f,m){b.tooltip&&b.tooltip.initialize(m)},reset(b,f,m){b.tooltip&&b.tooltip.initialize(m)},afterDraw(b){let f=b.tooltip;if(f&&f._willRender()){let m={tooltip:f};if(b.notifyPlugins("beforeTooltipDraw",{...m,cancelable:!0})===!1)return;f.draw(b.ctx),b.notifyPlugins("afterTooltipDraw",m)}},afterEvent(b,f){if(b.tooltip){let m=f.replay;b.tooltip.handleEvent(f.event,m,f.inChartArea)&&(f.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(b,f)=>f.bodyFont.size,boxWidth:(b,f)=>f.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:IH},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:b=>b!=="filter"&&b!=="itemSort"&&b!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};return Ve.register(JV,dH,HP,i),Ve.helpers={...Qg},Ve._adapters=Xs,Ve.Animation=RP,Ve.Animations=Lv,Ve.animator=fe,Ve.controllers=co.controllers.items,Ve.DatasetController=Ai,Ve.Element=ra,Ve.elements=HP,Ve.Interaction=ia,Ve.layouts=qt,Ve.platforms=mS,Ve.Scale=el,Ve.Ticks=Kt,Object.assign(Ve,JV,dH,HP,i,mS),Ve.Chart=Ve,typeof window<"u"&&(window.Chart=Ve),Ve}))});var Oit=uo(()=>{console.log("hello world")});var L3t,HV=_n(()=>{L3t=NH({
4668"./locale/fr.js":()=>Oit()
4668})});var WV=uo((jV,Pv)=>{HV();(function(i,t){typeof jV=="object"&&typeof Pv<"u"?Pv.exports=t():typeof define=="function"&&define.amd?define(t):i.moment=t()})(jV,(function(){"use strict";var i,t;function e(){return i.apply(null,arguments)}function n(P){return P instanceof Array||Object.prototype.toString.call(P)==="[object Array]"}function s(P){return P!=null&&Object.prototype.toString.call(P)==="[object Object]"}function r(P,B){return Object.prototype.hasOwnProperty.call(P,B)}function o(P){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(P).length===0;var B;for(B in P)if(r(P,B))return!1;return!0}function a(P){return P===void 0}function l(P){return typeof P=="number"||Object.prototype.toString.call(P)==="[object Number]"}function c(P){return P instanceof Date||Object.prototype.toString.call(P)==="[object Date]"}function u(P,B){var $,Z=[],wt=P.length;for($=0;$<wt;++$)Z.push(B(P[$],$));return Z}function h(P,B){for(var $ in B)r(B,$)&&(P[$]=B[$]);return r(B,"toString")&&(P.toString=B.toString),r(B,"valueOf")&&(P.valueOf=B.valueOf),P}function d(P,B,$,Z){return ti(P,B,$,Z,!0).utc()}function p(P){return P._pf==null&&(P._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),P._pf}function g(P){if(P._isValid==null){var B=p(P),$=t.call(B.parsedDateParts,(function(wt){return wt!=null})),Z=!isNaN(P._d.getTime())&&B.overflow<0&&!B.empty&&!B.invalidEra&&!B.invalidMonth&&!B.invalidWeekday&&!B.weekdayMismatch&&!B.nullInput&&!B.invalidFormat&&!B.userInvalidated&&(!B.meridiem||B.meridiem&&$);if(P._strict&&(Z=Z&&B.charsLeftOver===0&&B.unusedTokens.length===0&&B.bigHour===void 0),Object.isFrozen!=null&&Object.isFrozen(P))return Z;P._isValid=Z}return P._isValid}function y(P){var B=d(NaN);return P!=null?h(p(B),P):p(B).userInvalidated=!0,B}t=Array.prototype.some?Array.prototype.some:function(P){var B,$=Object(this),Z=$.length>>>0;for(B=0;B<Z;B++)if(B in $&&P.call(this,$[B],B,$))return!0;return!1};var x=e.momentProperties=[],w=!1;function M(P,B){var $,Z,wt,$t=x.length;if(a(B._isAMomentObject)||(P._isAMomentObject=B._isAMomentObject),a(B._i)||(P._i=B._i),a(B._f)||(P._f=B._f),a(B._l)||(P._l=B._l),a(B._strict)||(P._strict=B._strict),a(B._tzm)||(P._tzm=B._tzm),a(B._isUTC)||(P._isUTC=B._isUTC),a(B._offset)||(P._offset=B._offset),a(B._pf)||(P._pf=p(B)),a(B._locale)||(P._locale=B._locale),$t>0)for($=0;$<$t;$++)a(wt=B[Z=x[$]])||(P[Z]=wt);return P}function A(P){M(this,P),this._d=new Date(P._d!=null?P._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),w===!1&&(w=!0,e.updateOffset(this),w=!1)}function C(P){return P instanceof A||P!=null&&P._isAMomentObject!=null}function R(P){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+P)}function k(P,B){var $=!0;return h((function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,P),$){var Z,wt,$t,qt=[],De=arguments.length;for(wt=0;wt<De;wt++){if(Z="",typeof arguments[wt]=="object"){for($t in Z+=`
4669[`+wt+"] ",arguments[0])r(arguments[0],$t)&&(Z+=$t+": "+arguments[0][$t]+", ");Z=Z.slice(0,-2)}else Z=arguments[wt];qt.push(Z)}R(P+`
4670Arguments: `+Array.prototype.slice.call(qt).join("")+`
4671`+new Error().stack),$=!1}return B.apply(this,arguments)}),B)}var O,I={};function U(P,B){e.deprecationHandler!=null&&e.deprecationHandler(P,B),I[P]||(R(B),I[P]=!0)}function V(P){return typeof Function<"u"&&P instanceof Function||Object.prototype.toString.call(P)==="[object Function]"}function q(P,B){var $,Z=h({},P);for($ in B)r(B,$)&&(s(P[$])&&s(B[$])?(Z[$]={},h(Z[$],P[$]),h(Z[$],B[$])):B[$]!=null?Z[$]=B[$]:delete Z[$]);for($ in P)r(P,$)&&!r(B,$)&&s(P[$])&&(Z[$]=h({},Z[$]));return Z}function X(P){P!=null&&this.set(P)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null,O=Object.keys?Object.keys:function(P){var B,$=[];for(B in P)r(P,B)&&$.push(B);return $};function j(P,B,$){var Z=""+Math.abs(P),wt=B-Z.length;return(P>=0?$?"+":"":"-")+Math.pow(10,Math.max(0,wt)).toString().substr(1)+Z}var W=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}
4671|x|X|zz?|ZZ?|.)/g,_=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,at={},ct={};function pt(P,B,$,Z){var wt=Z;typeof Z=="string"&&(wt=function(){return this[Z]()}),P&&(ct[P]=wt),B&&(ct[B[0]]=function(){return j(wt.apply(this,arguments),B[1],B[2])}),$&&(ct[$]=function(){return this.localeData().ordinal(wt.apply(this,arguments),P)})}function Et(P,B){return P.isValid()?(B=vt(B,P.localeData()),at[B]=at[B]||(function($){var Z,wt,$t,qt=$.match(W);for(Z=0,wt=qt.length;Z<wt;Z++)ct[qt[Z]]?qt[Z]=ct[qt[Z]]:qt[Z]=($t=qt[Z]).match(/\[[\s\S]/)?$t.replace(/^\[|\]$/g,""):$t.replace(/\\/g,"");return function(De){var _e,An="";for(_e=0;_e<wt;_e++)An+=V(qt[_e])?qt[_e].call(De,$):qt[_e];return An}})(B),at[B](P)):P.localeData().invalidDate()}function vt(P,B){var $=5;function Z(wt){return B.longDateFormat(wt)||wt}for(_.lastIndex=0;$>=0&&_.test(P);)P=P.replace(_,Z),_.lastIndex=0,$-=1;return P}var yt={};function kt(P,B){var $=P.toLowerCase();yt[$]=yt[$+"s"]=yt[B]=P}function Wt(P){return typeof P=="string"?yt[P]||yt[P.toLowerCase()]:void 0}function jt(P){var B,$,Z={};for($ in P)r(P,$)&&(B=Wt($))&&(Z[B]=P[$]);return Z}var ae={};function ee(P,B){ae[P]=B}function Bt(P){return P%4==0&&P%100!=0||P%400==0}function Gt(P){return P<0?Math.ceil(P)||0:Math.floor(P)}function Qt(P){var B=+P,$=0;return B!==0&&isFinite(B)&&($=Gt(B)),$}function xe(P,B){return function($){return $!=null?(zt(this,P,$),e.updateOffset(this,B),this):Ut(this,P)}}function Ut(P,B){return P.isValid()?P._d["get"+(P._isUTC?"UTC":"")+B]():NaN}function zt(P,B,$){P.isValid()&&!isNaN($)&&(B==="FullYear"&&Bt(P.year())&&P.month()===1&&P.date()===29?($=Qt($),P._d["set"+(P._isUTC?"UTC":"")+B]($,P.month(),pe($,P.month()))):P._d["set"+(P._isUTC?"UTC":"")+B]($))}var St,it=/\d/,gt=/\d\d/,ft=/\d{3}/,de=/\d{4}/,ve=/[+-]?\d{6}/,we=/\d\d?/,Ae=/\d\d\d\d?/,Ue=/\d\d\d\d\d\d?/,en=/\d{1,3}/,It=/\d{1,4}/,Cn=/[+-]?\d{1,6}/,mn=/\d+/,mt=/[+-]?\d+/,K=/Z|[+-]\d\d:?\d\d/gi,Vt=/Z|[+-]\d\d(?::?\d\d)?/gi,te=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function Nt(P,B,$){St[P]=V(B)?B:function(Z,wt){return Z&&$?$:B}}function Se(P,B){return r(St,P)?St[P](B._strict,B._locale):new RegExp(Me(P.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function($,Z,wt,$t,qt){return Z||wt||$t||qt}))))}function Me(P){return P.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}St={};var ie={};function _t(P,B){var $,Z,wt=B;for(typeof P=="string"&&(P=[P]),l(B)&&(wt=function($t,qt){qt[B]=Qt($t)}),Z=P.length,$=0;$<Z;$++)ie[P[$]]=wt}function Zt(P,B){_t(P,(function($,Z,wt,$t){wt._w=wt._w||{},B($,wt._w,wt,$t)}))}function fe(P,B,$){B!=null&&r(ie,P)&&ie[P](B,$._a,$,P)}var ce;function pe(P,B){if(isNaN(P)||isNaN(B))return NaN;var $,Z=(B%($=12)+$)%$;return P+=(B-Z)/12,Z===1?Bt(P)?29:28:31-Z%7%2}ce=Array.prototype.indexOf?Array.prototype.indexOf:function(P){var B;for(B=0;B<this.length;++B)if(this[B]===P)return B;return-1},pt("M",["MM",2],"Mo",(function(){return this.month()+1})),pt("MMM",0,0,(function(P){return this.localeData().monthsShort(this,P)})),pt("MMMM",0,0,(function(P){return this.localeData().months(this,P)})),kt("month","M"),ee("month",8),Nt("M",we),Nt("MM",we,gt),Nt("MMM",(function(P,B){return B.monthsShortRegex(P)})),Nt("MMMM",(function(P,B){return B.monthsRegex(P)})),_t(["M","MM"],(function(P,B){B[1]=Qt(P)-1})),_t(["MMM","MMMM"],(function(P,B,$,Z){var wt=$._locale.monthsParse(P,Z,$._strict);wt!=null?B[1]=wt:p($).invalidMonth=P}));var Fe="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),je="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Re=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ft=te,Ee=te;function J(P,B,$){var Z,wt,$t,qt=P.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],Z=0;Z<12;++Z)$t=d([2e3,Z]),this._shortMonthsParse[Z]=this.monthsShort($t,"").toLocaleLowerCase(),this._longMonthsParse[Z]=this.months($t,"").toLocaleLowerCase();return $?B==="MMM"?(wt=ce.call(this._shortMonthsParse,qt))!==-1?wt:null:(wt=ce.call(this._longMonthsParse,qt))!==-1?wt:null:B==="MMM"?(wt=ce.call(this._shortMonthsParse,qt))!==-1||(wt=ce.call(this._longMonthsParse,qt))!==-1?wt:null:(wt=ce.call(this._longMonthsParse,qt))!==-1||(wt=ce.call(this._shortMonthsParse,qt))!==-1?wt:null}function lt(P,B){var $;if(!P.isValid())return P;
vendor: 5,756 bytes, line 4671
4671if(typeof B=="string"){if(/^\d+$/.test(B))B=Qt(B);else if(!l(B=P.localeData().monthsParse(B)))return P}return $=Math.min(P.date(),pe(P.year(),B)),P._d["set"+(P._isUTC?"UTC":"")+"Month"](B,$),P}function xt(P){return P!=null?(lt(this,P),e.updateOffset(this,!0),this):Ut(this,"Month")}function At(){function P(qt,De){return De.length-qt.length}var B,$,Z=[],wt=[],$t=[];for(B=0;B<12;B++)$=d([2e3,B]),Z.push(this.monthsShort($,"")),wt.push(this.months($,"")),$t.push(this.months($,"")),$t.push(this.monthsShort($,""));for(Z.sort(P),wt.sort(P),$t.sort(P),B=0;B<12;B++)Z[B]=Me(Z[B]),wt[B]=Me(wt[B]);for(B=0;B<24;B++)$t[B]=Me($t[B]);this._monthsRegex=new RegExp("^("+$t.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+wt.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+Z.join("|")+")","i")}function st(P){return Bt(P)?366:365}pt("Y",0,0,(function(){var P=this.year();return P<=9999?j(P,4):"+"+P})),pt(0,["YY",2],0,(function(){return this.year()%100})),pt(0,["YYYY",4],0,"year"),pt(0,["YYYYY",5],0,"year"),pt(0,["YYYYYY",6,!0],0,"year"),kt("year","y"),ee("year",1),Nt("Y",mt),Nt("YY",we,gt),Nt("YYYY",It,de),Nt("YYYYY",Cn,ve),Nt("YYYYYY",Cn,ve),_t(["YYYYY","YYYYYY"],0),_t("YYYY",(function(P,B){B[0]=P.length===2?e.parseTwoDigitYear(P):Qt(P)})),_t("YY",(function(P,B){B[0]=e.parseTwoDigitYear(P)})),_t("Y",(function(P,B){B[0]=parseInt(P,10)})),e.parseTwoDigitYear=function(P){return Qt(P)+(Qt(P)>68?1900:2e3)};var rt=xe("FullYear",!0);function Tt(P,B,$,Z,wt,$t,qt){var De;return P<100&&P>=0?(De=new Date(P+400,B,$,Z,wt,$t,qt),isFinite(De.getFullYear())&&De.setFullYear(P)):De=new Date(P,B,$,Z,wt,$t,qt),De}function Dt(P){var B,$;return P<100&&P>=0?(($=Array.prototype.slice.call(arguments))[0]=P+400,B=new Date(Date.UTC.apply(null,$)),isFinite(B.getUTCFullYear())&&B.setUTCFullYear(P)):B=new Date(Date.UTC.apply(null,arguments)),B}function he(P,B,$){var Z=7+B-$;return-((7+Dt(P,0,Z).getUTCDay()-B)%7)+Z-1}function se(P,B,$,Z,wt){var $t,qt,De=1+7*(B-1)+(7+$-Z)%7+he(P,Z,wt);return De<=0?qt=st($t=P-1)+De:De>st(P)?($t=P+1,qt=De-st(P)):($t=P,qt=De),{year:$t,dayOfYear:qt}}function ye(P,B,$){var Z,wt,$t=he(P.year(),B,$),qt=Math.floor((P.dayOfYear()-$t-1)/7)+1;return qt<1?Z=qt+be(wt=P.year()-1,B,$):qt>be(P.year(),B,$)?(Z=qt-be(P.year(),B,$),wt=P.year()+1):(wt=P.year(),Z=qt),{week:Z,year:wt}}function be(P,B,$){var Z=he(P,B,$),wt=he(P+1,B,$);return(st(P)-Z+wt)/7}pt("w",["ww",2],"wo","week"),pt("W",["WW",2],"Wo","isoWeek"),kt("week","w"),kt("isoWeek","W"),ee("week",5),ee("isoWeek",5),Nt("w",we),Nt("ww",we,gt),Nt("W",we),Nt("WW",we,gt),Zt(["w","ww","W","WW"],(function(P,B,$,Z){B[Z.substr(0,1)]=Qt(P)}));function fn(P,B){return P.slice(B,7).concat(P.slice(0,B))}pt("d",0,"do","day"),pt("dd",0,0,(function(P){return this.localeData().weekdaysMin(this,P)})),pt("ddd",0,0,(function(P){return this.localeData().weekdaysShort(this,P)})),pt("dddd",0,0,(function(P){return this.localeData().weekdays(this,P)})),pt("e",0,0,"weekday"),pt("E",0,0,"isoWeekday"),kt("day","d"),kt("weekday","e"),kt("isoWeekday","E"),ee("day",11),ee("weekday",11),ee("isoWeekday",11),Nt("d",we),Nt("e",we),Nt("E",we),Nt("dd",(function(P,B){return B.weekdaysMinRegex(P)})),Nt("ddd",(function(P,B){return B.weekdaysShortRegex(P)})),Nt("dddd",(function(P,B){return B.weekdaysRegex(P)})),Zt(["dd","ddd","dddd"],(function(P,B,$,Z){var wt=$._locale.weekdaysParse(P,Z,$._strict);wt!=null?B.d=wt:p($).invalidWeekday=P})),Zt(["d","e","E"],(function(P,B,$,Z){B[Z]=Qt(P)}));var qe="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),xn="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),vn="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),jn=te,Fn=te,si=te;function Ti(P,B,$){var Z,wt,$t,qt=P.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],Z=0;Z<7;++Z)$t=d([2e3,1]).day(Z),this._minWeekdaysParse[Z]=this.weekdaysMin($t,"").toLocaleLowerCase(),this._shortWeekdaysParse[Z]=this.weekdaysShort($t,"").toLocaleLowerCase(),this._weekdaysParse[Z]=this.weekdays($t,"").toLocaleLowerCase();return $?B==="dddd"?(wt=ce.call(this._weekdaysParse,qt))!==-1?wt:null:B==="ddd"?(wt=ce.call(this._shortWeekdaysParse,qt))!==-1?wt:null:(wt=ce.call(this._minWeekdaysParse,qt))!==-1?wt:null:B==="dddd"?(wt=ce.call(this._weekdaysParse,qt))!==-1||(wt=ce.call(this._shortWeekdaysParse,qt))!==-1||(wt=ce.call(this._minWeekdaysParse,qt))!==-1?wt:null:B==="ddd"?(wt=ce.call(this._shortWeekdaysParse,qt))!==-1||(wt=ce.call(this._weekdaysParse,qt))!==-1||(wt=ce.call(this._minWeekdaysParse,qt))!==-1?wt:null:(wt=ce.call(this._minWeekdaysParse,qt))!==-1||(wt=ce.call(this._weekdaysParse,qt))!==-1||(wt=ce.call(this._shortWeekdaysParse,qt))!==-1?wt:null}function Yi(){function P(Yn,On){return On.length-Yn.length}var B,$,Z,wt,$t,qt=[],De=[],_e=[],An=[];for(B=0;B<7;B++)$=d([2e3,1]).day(B),Z=Me(this.weekdaysMin($,"")),wt=Me(this.weekdaysShort($,"")),$t=Me(this.weekdays($,"")),qt.push(Z),De.push(wt),_e.push($t),An.push(Z),An.push(wt),An.push($t);qt.sort(P),De.sort(P),_e.sort(P),An.sort(P),this._weekdaysRegex=new RegExp("^("+An.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+_e.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+De.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+qt.join("|")+")","i")}function _s(){return this.hours()%12||12}function Pt(P,B){pt(P,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),B)}))}function ze(P,B){return B._meridiemParse}pt("H",["HH",2],0,"hour"),pt("h",["hh",2],0,_s),pt("k",["kk",2],0,(function(){return this.hours()||24})),pt("hmm",0,0,(function(){return""+_s.apply(this)+j(this.minutes(),2)}
4671)),pt("hmmss",0,0,(function(){return""+_s.apply(this)+j(this.minutes(),2)+j(this.seconds(),2)})),pt("Hmm",0,0,(function(){return""+this.hours()+j(this.minutes(),2)})),pt("Hmmss",0,0,(function(){return""+this.hours()+j(this.minutes(),2)+j(this.seconds(),2)})),Pt("a",!0),Pt("A",!1),kt("hour","h"),ee("hour",13),Nt("a",ze),Nt("A",ze),Nt("H",we),Nt("h",we),Nt("k",we),Nt("HH",we,gt),Nt("hh",we,gt),Nt("kk",we,gt),Nt("hmm",Ae),Nt("hmmss",Ue),Nt("Hmm",Ae),Nt("Hmmss",Ue),_t(["H","HH"],3),_t(["k","kk"],(function(P,B,$){var Z=Qt(P);B[3]=Z===24?0:Z})),_t(["a","A"],(function(P,B,$){$._isPm=$._locale.isPM(P),$._meridiem=P})),_t(["h","hh"],(function(P,B,$){B[3]=Qt(P),p($).bigHour=!0})),_t("hmm",(function(P,B,$){var Z=P.length-2;B[3]=Qt(P.substr(0,Z)),B[4]=Qt(P.substr(Z)),p($).bigHour=!0})),_t("hmmss",(function(P,B,$){var Z=P.length-4,wt=P.length-2;B[3]=Qt(P.substr(0,Z)),B[4]=Qt(P.substr(Z,2)),B[5]=Qt(P.substr(wt)),p($).bigHour=!0})),_t("Hmm",(function(P,B,$){var Z=P.length-2;B[3]=Qt(P.substr(0,Z)),B[4]=Qt(P.substr(Z))})),_t("Hmmss",(function(P,B,$){var Z=P.length-4,wt=P.length-2;B[3]=Qt(P.substr(0,Z)),B[4]=Qt(P.substr(Z,2)),B[5]=Qt(P.substr(wt))}));var Ie=xe("Hours",!0),En,Dn={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Fe,monthsShort:je,week:{dow:0,doy:6},weekdays:qe,weekdaysMin:vn,weekdaysShort:xn,meridiemParse:/[ap]\.?m?\.?/i},Xe={},mi={};function Qi(P,B){var $,Z=Math.min(P.length,B.length);for($=0;$<Z;$+=1)if(P[$]!==B[$])return $;return Z}function hi(P){return P&&P.toLowerCase().replace("_","-")}function nt(P){var B=null;if(Xe[P]===void 0&&typeof Pv<"u"&&Pv&&Pv.exports&&(function($){return $.match("^[^/\\\\]*$")!=null})(P))try{B=En._abbr,L3t("./locale/"+P),Ot(B)}catch{Xe[P]=null}return Xe[P]}function Ot(P,B){var $;return P&&(($=a(B)?Kt(P):re(P,B))?En=$:typeof console<"u"&&console.warn&&console.warn("Locale "+P+" not found. Did you forget to load it?")),En._abbr}function re(P,B){if(B!==null){var $,Z=Dn;if(B.abbr=P,Xe[P]!=null)U("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),Z=Xe[P]._config;else if(B.parentLocale!=null)if(Xe[B.parentLocale]!=null)Z=Xe[B.parentLocale]._config;else{if(($=nt(B.parentLocale))==null)return mi[B.parentLocale]||(mi[B.parentLocale]=[]),mi[B.parentLocale].push({name:P,config:B}),null;Z=$._config}return Xe[P]=new X(q(Z,B)),mi[P]&&mi[P].forEach((function(wt){re(wt.name,wt.config)})),Ot(P),Xe[P]}return delete Xe[P],null}function Kt(P){var B;if(P&&P._locale&&P._locale._abbr&&(P=P._locale._abbr),!P)return En;if(!n(P)){if(B=nt(P))return B;P=[P]}return(function($){for(var Z,wt,$t,qt,De=0;De<$.length;){for(Z=(qt=hi($[De]).split("-")).length,wt=(wt=hi($[De+1]))?wt.split("-"):null;Z>0;){if($t=nt(qt.slice(0,Z).join("-")))return $t;if(wt&&wt.length>=Z&&Qi(qt,wt)>=Z-1)break;Z--}De++}return En})(P)}function ne(P){var B,$=P._a;return $&&p(P).overflow===-2&&(B=$[1]<0||$[1]>11?1:$[2]<1||$[2]>pe($[0],$[1])?2:$[3]<0||$[3]>24||$[3]===24&&($[4]!==0||$[5]!==0||$[6]!==0)?3:$[4]<0||$[4]>59?4:$[5]<0||$[5]>59?5:$[6]<0||$[6]>999?6:-1,p(P)._overflowDayOfYear&&(B<0||B>2)&&(B=2),p(P)._overflowWeeks&&B===-1&&(B=7),p(P)._overflowWeekday&&B===-1&&(B=8),p(P).overflow=B),P}var Ke=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,nn=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,$e=/Z|[+-]\d\d(?::?\d\d)?/,bn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],We=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Nn=/^\/?Date\((-?\d+)/i,Hn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,pn={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function ri(P){var B,$,Z,wt,$t,qt,De=P._i,_e=Ke.exec(De)||nn.exec(De),An=bn.length,Yn=We.length;if(_e){for(p(P).iso=!0,B=0,$=An;B<$;
4671B++)if(bn[B][1].exec(_e[1])){wt=bn[B][0],Z=bn[B][2]!==!1;break}if(wt==null)return void(P._isValid=!1);if(_e[3]){for(B=0,$=Yn;B<$;B++)if(We[B][1].exec(_e[3])){$t=(_e[2]||" ")+We[B][0];break}if($t==null)return void(P._isValid=!1)}if(!Z&&$t!=null)return void(P._isValid=!1);if(_e[4]){if(!$e.exec(_e[4]))return void(P._isValid=!1);qt="Z"}P._f=wt+($t||"")+(qt||""),Ye(P)}else P._isValid=!1}function Ni(P){var B=parseInt(P,10);return B<=49?2e3+B:B<=999?1900+B:B}function Si(P){var B,$,Z,wt,$t,qt,De,_e,An=Hn.exec(P._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(An){if($=An[4],Z=An[3],wt=An[2],$t=An[5],qt=An[6],De=An[7],_e=[Ni($),je.indexOf(Z),parseInt(wt,10),parseInt($t,10),parseInt(qt,10)],De&&_e.push(parseInt(De,10)),B=_e,!(function(Yn,On,li){return!Yn||xn.indexOf(Yn)===new Date(On[0],On[1],On[2]).getDay()||(p(li).weekdayMismatch=!0,li._isValid=!1,!1)})(An[1],B,P))return;P._a=B,P._tzm=(function(Yn,On,li){if(Yn)return pn[Yn];if(On)return 0;var Vi=parseInt(li,10),Ms=Vi%100;return(Vi-Ms)/100*60+Ms})(An[8],An[9],An[10]),P._d=Dt.apply(null,P._a),P._d.setUTCMinutes(P._d.getUTCMinutes()-P._tzm),p(P).rfc2822=!0}else P._isValid=!1}function Un(P,B,$){return P??B??$}function Ss(P){var B,$,Z,wt,$t,qt=[];if(!P._d){for(Z=(function(De){var _e=new Date(e.now());return De._useUTC?[_e.getUTCFullYear(),_e.getUTCMonth(),_e.getUTCDate()]:[_e.getFullYear(),_e.getMonth(),_e.getDate()]})(P),P._w&&P._a[2]==null&&P._a[1]==null&&(function(De){var _e,An,Yn,On,li,Vi,Ms,Io,tl;(_e=De._w).GG!=null||_e.W!=null||_e.E!=null?(li=1,Vi=4,An=Un(_e.GG,De._a[0],ye($n(),1,4).year),Yn=Un(_e.W,1),((On=Un(_e.E,1))<1||On>7)&&(Io=!0)):(li=De._locale._week.dow,Vi=De._locale._week.doy,tl=ye($n(),li,Vi),An=Un(_e.gg,De._a[0],tl.year),Yn=Un(_e.w,tl.week),_e.d!=null?((On=_e.d)<0||On>6)&&(Io=!0):_e.e!=null?(On=_e.e+li,(_e.e<0||_e.e>6)&&(Io=!0)):On=li),Yn<1||Yn>be(An,li,Vi)?p(De)._overflowWeeks=!0:Io!=null?p(De)._overflowWeekday=!0:(Ms=se(An,Yn,On,li,Vi),De._a[0]=Ms.year,De._dayOfYear=Ms.dayOfYear)})(P),P._dayOfYear!=null&&($t=Un(P._a[0],Z[0]),(P._dayOfYear>st($t)||P._dayOfYear===0)&&(p(P)._overflowDayOfYear=!0),$=Dt($t,0,P._dayOfYear),P._a[1]=$.getUTCMonth(),P._a[2]=$.getUTCDate()),B=0;B<3&&P._a[B]==null;++B)P._a[B]=qt[B]=Z[B];for(;B<7;B++)P._a[B]=qt[B]=P._a[B]==null?B===2?1:0:P._a[B];P._a[3]===24&&P._a[4]===0&&P._a[5]===0&&P._a[6]===0&&(P._nextDay=!0,P._a[3]=0),P._d=(P._useUTC?Dt:Tt).apply(null,qt),wt=P._useUTC?P._d.getUTCDay():P._d.getDay(),P._tzm!=null&&P._d.setUTCMinutes(P._d.getUTCMinutes()-P._tzm),P._nextDay&&(P._a[3]=24),P._w&&P._w.d!==void 0&&P._w.d!==wt&&(p(P).weekdayMismatch=!0)}}function Ye(P){if(P._f!==e.ISO_8601)if(P._f!==e.RFC_2822){P._a=[],p(P).empty=!0;var B,$,Z,wt,$t,qt,De,_e=""+P._i,An=_e.length,Yn=0;for(De=(Z=vt(P._f,P._locale).match(W)||[]).length,B=0;B<De;B++)wt=Z[B],($=(_e.match(Se(wt,P))||[])[0])&&(($t=_e.substr(0,_e.indexOf($))).length>0&&p(P).unusedInput.push($t),_e=_e.slice(_e.indexOf($)+$.length),Yn+=$.length),ct[wt]?($?p(P).empty=!1:p(P).unusedTokens.push(wt),fe(wt,$,P)):P._strict&&!$&&p(P).unusedTokens.push(wt);p(P).charsLeftOver=An-Yn,_e.length>0&&p(P).unusedInput.push(_e),P._a[3]<=12&&p(P).bigHour===!0&&P._a[3]>0&&(p(P).bigHour=void 0),p(P).parsedDateParts=P._a.slice(0),p(P).meridiem=P._meridiem,P._a[3]=(function(On,li,Vi){var Ms;return Vi==null?li:On.meridiemHour!=null?On.meridiemHour(li,Vi):(On.isPM!=null&&((Ms=On.isPM(Vi))&&li<12&&(li+=12),Ms||li!==12||(li=0)),li)})(P._locale,P._a[3],P._meridiem),(qt=p(P).era)!==null&&(P._a[0]=P._locale.erasConvertYear(qt,P._a[0])),Ss(P),ne(P)}else Si(P);else ri(P)}function ps(P){var B=P._i,$=P._f;return P._locale=P._locale||Kt(P._l),B===null||$===void 0&&B===""?y({nullInput:!0}):(typeof B=="string"&&(P._i=B=P._locale.preparse(B)),C(B)?new A(ne(B)):(c(B)?P._d=B:n($)?(function(Z){var wt,$t,qt,De,_e,An,Yn=!1,On=Z._f.length;if(On===0)return p(Z).invalidFormat=!0,void(Z._d=new Date(NaN));for(De=0;De<On;De++)_e=0,An=!1,wt=M({},Z),Z._useUTC!=null&&(wt._useUTC=Z._useUTC),wt._f=Z._f[De],Ye(wt),g(wt)&&(An=!0),_e+=p(wt).charsLeftOver,_e+=10*p(wt).unusedTokens.length,p(wt).score=_e,Yn?_e<qt&&(qt=_e,$t=wt):(qt==null||_e<qt||An)&&(qt=_e,$t=wt,An&&(Yn=!0));h(Z,$t||wt)})(P):$?Ye(P):(function(Z){var wt=Z._i;a(wt)?Z._d=new Date(e.now()):c(wt)?Z._d=new Date(wt.valueOf()):typeof wt=="string"?(function($t){var qt=Nn.exec($t._i);qt===null?(ri($t),$t._isValid===!1&&(delete $t._isValid,Si($t),$t._isValid===!1&&(delete $t._isValid,$t._strict?$t._isValid=!1:e.createFromInputFallback($t)))):$t._d=new Date(+qt[1])})(Z):n(wt)?(Z._a=u(wt.slice(0),(function($t){return parseInt($t,10)}
4671)),Ss(Z)):s(wt)?(function($t){if(!$t._d){var qt=jt($t._i),De=qt.day===void 0?qt.date:qt.day;$t._a=u([qt.year,qt.month,De,qt.hour,qt.minute,qt.second,qt.millisecond],(function(_e){return _e&&parseInt(_e,10)})),Ss($t)}})(Z):l(wt)?Z._d=new Date(wt):e.createFromInputFallback(Z)})(P),g(P)||(P._d=null),P))}function ti(P,B,$,Z,wt){var $t,qt={};return B!==!0&&B!==!1||(Z=B,B=void 0),$!==!0&&$!==!1||(Z=$,$=void 0),(s(P)&&o(P)||n(P)&&P.length===0)&&(P=void 0),qt._isAMomentObject=!0,qt._useUTC=qt._isUTC=wt,qt._l=$,qt._i=P,qt._f=B,qt._strict=Z,($t=new A(ne(ps(qt))))._nextDay&&($t.add(1,"d"),$t._nextDay=void 0),$t}function $n(P,B,$,Z){return ti(P,B,$,Z,!1)}e.createFromInputFallback=k("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",(function(P){P._d=new Date(P._i+(P._useUTC?" UTC":""))})),e.ISO_8601=function(){},e.RFC_2822=function(){};var $r=k("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var P=$n.apply(null,arguments);return this.isValid()&&P.isValid()?P<this?this:P:y()})),so=k("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var P=$n.apply(null,arguments);return this.isValid()&&P.isValid()?P>this?this:P:y()}));function ea(P,B){var $,Z;if(B.length===1&&n(B[0])&&(B=B[0]),!B.length)return $n();for($=B[0],Z=1;Z<B.length;++Z)B[Z].isValid()&&!B[Z][P]($)||($=B[Z]);return $}var Xn=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Bi(P){var B=jt(P),$=B.year||0,Z=B.quarter||0,wt=B.month||0,$t=B.week||B.isoWeek||0,qt=B.day||0,De=B.hour||0,_e=B.minute||0,An=B.second||0,Yn=B.millisecond||0;this._isValid=(function(On){var li,Vi,Ms=!1,Io=Xn.length;for(li in On)if(r(On,li)&&(ce.call(Xn,li)===-1||On[li]!=null&&isNaN(On[li])))return!1;for(Vi=0;Vi<Io;++Vi)if(On[Xn[Vi]]){if(Ms)return!1;parseFloat(On[Xn[Vi]])!==Qt(On[Xn[Vi]])&&(Ms=!0)}return!0})(B),this._milliseconds=+Yn+1e3*An+6e4*_e+1e3*De*60*60,this._days=+qt+7*$t,this._months=+wt+3*Z+12*$,this._data={},this._locale=Kt(),this._bubble()}function Cs(P){return P instanceof Bi}function xi(P){return P<0?-1*Math.round(-1*P):Math.round(P)}function yr(P,B){pt(P,0,0,(function(){var $=this.utcOffset(),Z="+";return $<0&&($=-$,Z="-"),Z+j(~~($/60),2)+B+j(~~$%60,2)}))}yr("Z",":"),yr("ZZ",""),Nt("Z",Vt),Nt("ZZ",Vt),_t(["Z","ZZ"],(function(P,B,$){$._useUTC=!0,$._tzm=xr(Vt,P)}));var Ro=/([\+\-]|\d\d)/gi;function xr(P,B){var $,Z,wt=(B||"").match(P);return wt===null?null:(Z=60*($=((wt[wt.length-1]||[])+"").match(Ro)||["-",0,0])[1]+Qt($[2]))===0?0:$[0]==="+"?Z:-Z}function Dl(P,B){var $,Z;return B._isUTC?($=B.clone(),Z=(C(P)||c(P)?P.valueOf():$n(P).valueOf())-$.valueOf(),$._d.setTime($._d.valueOf()+Z),e.updateOffset($,!1),$):$n(P).local()}function Ja(P){return-Math.round(P._d.getTimezoneOffset())}function Mh(){return!!this.isValid()&&this._isUTC&&this._offset===0}e.updateOffset=function(){};var jg=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Ll=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function ro(P,B){var $,Z,wt,$t=P,qt=null;return Cs(P)?$t={ms:P._milliseconds,d:P._days,M:P._months}:l(P)||!isNaN(+P)?($t={},B?$t[B]=+P:$t.milliseconds=+P):(qt=jg.exec(P))?($=qt[1]==="-"?-1:1,$t={y:0,d:Qt(qt[2])*$,h:Qt(qt[3])*$,m:Qt(qt[4])*$,s:Qt(qt[5])*$,ms:Qt(xi(1e3*qt[6]))*$}):(qt=Ll.exec(P))?($=qt[1]==="-"?-1:1,$t={y:Dr(qt[2],$),M:Dr(qt[3],$),w:Dr(qt[4],$),d:Dr(qt[5],$),h:Dr(qt[6],$),m:Dr(qt[7],$),s:Dr(qt[8],$)}):$t==null?$t={}:typeof $t=="object"&&("from"in $t||"to"in $t)&&(wt=(function(De,_e){var An;return!De.isValid()||!_e.isValid()?{milliseconds:0,months:0}:(_e=Dl(_e,De),De.isBefore(_e)?An=Il(De,_e):((An=Il(_e,De)).milliseconds=-An.milliseconds,An.months=-An.months),An)})($n($t.from),$n($t.to)),($t={}).ms=wt.milliseconds,$t.M=wt.months),Z=new Bi($t),Cs(P)&&r(P,"_locale")&&(Z._locale=P._locale),Cs(P)&&r(P,"_isValid")&&(Z._isValid=P._isValid),Z}function Dr(P,B){var $=P&&parseFloat(P.replace(",","."));
4671return(isNaN($)?0:$)*B}function Il(P,B){var $={};return $.months=B.month()-P.month()+12*(B.year()-P.year()),P.clone().add($.months,"M").isAfter(B)&&--$.months,$.milliseconds=+B-+P.clone().add($.months,"M"),$}function Mc(P,B){return function($,Z){var wt;return Z===null||isNaN(+Z)||(U(B,"moment()."+B+"(period, number) is deprecated. Please use moment()."+B+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),wt=$,$=Z,Z=wt),Za(this,ro($,Z),P),this}}function Za(P,B,$,Z){var wt=B._milliseconds,$t=xi(B._days),qt=xi(B._months);P.isValid()&&(Z=Z==null||Z,qt&&lt(P,Ut(P,"Month")+qt*$),$t&&zt(P,"Date",Ut(P,"Date")+$t*$),wt&&P._d.setTime(P._d.valueOf()+wt*$),Z&&e.updateOffset(P,$t||qt))}ro.fn=Bi.prototype,ro.invalid=function(){return ro(NaN)};var gf=Mc(1,"add"),Wg=Mc(-1,"subtract");function mu(P){return typeof P=="string"||P instanceof String}function $g(P){return C(P)||c(P)||mu(P)||l(P)||(function(B){var $=n(B),Z=!1;return $&&(Z=B.filter((function(wt){return!l(wt)&&mu(B)})).length===0),$&&Z})(P)||(function(B){var $,Z,wt=s(B)&&!o(B),$t=!1,qt=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],De=qt.length;for($=0;$<De;$+=1)Z=qt[$],$t=$t||r(B,Z);return wt&&$t})(P)||P==null}function Gg(P){var B,$=s(P)&&!o(P),Z=!1,wt=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(B=0;B<wt.length;B+=1)Z=Z||r(P,wt[B]);return $&&Z}function Th(P,B){if(P.date()<B.date())return-Th(B,P);var $=12*(B.year()-P.year())+(B.month()-P.month()),Z=P.clone().add($,"months");return-($+(B-Z<0?(B-Z)/(Z-P.clone().add($-1,"months")):(B-Z)/(P.clone().add($+1,"months")-Z)))||0}function Tc(P){var B;return P===void 0?this._locale._abbr:((B=Kt(P))!=null&&(this._locale=B),this)}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var bu=k("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(P){return P===void 0?this.localeData():this.locale(P)}));function qg(){return this._locale}var mf=1e3,Ac=6e4,Ah=36e5,Yg=126227808e5;function na(P,B){return(P%B+B)%B}function Eh(P,B,$){return P<100&&P>=0?new Date(P+400,B,$)-Yg:new Date(P,B,$).valueOf()}function bf(P,B,$){return P<100&&P>=0?Date.UTC(P+400,B,$)-Yg:Date.UTC(P,B,$)}function Ol(P,B){return B.erasAbbrRegex(P)}function oo(){var P,B,$=[],Z=[],wt=[],$t=[],qt=this.eras();for(P=0,B=qt.length;P<B;++P)Z.push(Me(qt[P].name)),$.push(Me(qt[P].abbr)),wt.push(Me(qt[P].narrow)),$t.push(Me(qt[P].name)),$t.push(Me(qt[P].abbr)),$t.push(Me(qt[P].narrow));this._erasRegex=new RegExp("^("+$t.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+Z.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+$.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+wt.join("|")+")","i")}function ka(P,B){pt(0,[P,P.length],0,B)}function vu(P,B,$,Z,wt){var $t;return P==null?ye(this,Z,wt).year:(B>($t=be(P,Z,wt))&&(B=$t),kh.call(this,P,B,$,Z,wt))}function kh(P,B,$,Z,wt){var $t=se(P,B,$,Z,wt),qt=Dt($t.year,0,$t.dayOfYear);return this.year(qt.getUTCFullYear()),this.month(qt.getUTCMonth()),this.date(qt.getUTCDate()),this}pt("N",0,0,"eraAbbr"),pt("NN",0,0,"eraAbbr"),pt("NNN",0,0,"eraAbbr"),pt("NNNN",0,0,"eraName"),pt("NNNNN",0,0,"eraNarrow"),pt("y",["y",1],"yo","eraYear"),pt("y",["yy",2],0,"eraYear"),pt("y",["yyy",3],0,"eraYear"),pt("y",["yyyy",4],0,"eraYear"),Nt("N",Ol),Nt("NN",Ol),Nt("NNN",Ol),Nt("NNNN",(function(P,B){return B.erasNameRegex(P)})),Nt("NNNNN",(function(P,B){return B.erasNarrowRegex(P)})),_t(["N","NN","NNN","NNNN","NNNNN"],(function(P,B,$,Z){var wt=$._locale.erasParse(P,Z,$._strict);wt?p($).era=wt:p($).invalidEra=P})),Nt("y",mn),Nt("yy",mn),Nt("yyy",mn),Nt("yyyy",mn),Nt("yo",(function(P,B){return B._eraYearOrdinalRegex||mn})),_t(["y","yy","yyy","yyyy"],0),_t(["yo"],(function(P,B,$,Z){var wt;$._locale._eraYearOrdinalRegex&&(wt=P.match($._locale._eraYearOrdinalRegex)),$._locale.eraYearOrdinalParse?B[0]=$._locale.eraYearOrdinalParse(P,wt):B[0]=parseInt(P,10)})),pt(0,["gg",2],0,(function(){return this.weekYear()%100})),pt(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),ka("gggg","weekYear"),ka("ggggg","weekYear"),ka("GGGG","isoWeekYear"),ka("GGGGG","isoWeekYear"),kt("weekYear","gg"),kt("isoWeekYear","GG"),ee("weekYear",1),ee("isoWeekYear",1),Nt("G",mt),Nt("g",mt),Nt("GG",we,gt),Nt("gg",we,gt),Nt("GGGG",It,de),Nt("gggg",It,de),Nt("GGGGG",Cn,ve),Nt("ggggg",Cn,ve),Zt(["gggg","ggggg","GGGG","GGGGG"],(function(P,B,$,Z){B[Z.substr(0,2)]=Qt(P)}
vendor: 7,168 bytes, line 4671
4671)),Zt(["gg","GG"],(function(P,B,$,Z){B[Z]=e.parseTwoDigitYear(P)})),pt("Q",0,"Qo","quarter"),kt("quarter","Q"),ee("quarter",7),Nt("Q",it),_t("Q",(function(P,B){B[1]=3*(Qt(P)-1)})),pt("D",["DD",2],"Do","date"),kt("date","D"),ee("date",9),Nt("D",we),Nt("DD",we,gt),Nt("Do",(function(P,B){return P?B._dayOfMonthOrdinalParse||B._ordinalParse:B._dayOfMonthOrdinalParseLenient})),_t(["D","DD"],2),_t("Do",(function(P,B){B[2]=Qt(P.match(we)[0])}));var Ec=xe("Date",!0);pt("DDD",["DDDD",3],"DDDo","dayOfYear"),kt("dayOfYear","DDD"),ee("dayOfYear",4),Nt("DDD",en),Nt("DDDD",ft),_t(["DDD","DDDD"],(function(P,B,$){$._dayOfYear=Qt(P)})),pt("m",["mm",2],0,"minute"),kt("minute","m"),ee("minute",14),Nt("m",we),Nt("mm",we,gt),_t(["m","mm"],4);var kc=xe("Minutes",!1);pt("s",["ss",2],0,"second"),kt("second","s"),ee("second",15),Nt("s",we),Nt("ss",we,gt),_t(["s","ss"],5);var cr,Ph,Rh=xe("Seconds",!1);for(pt("S",0,0,(function(){return~~(this.millisecond()/100)})),pt(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),pt(0,["SSS",3],0,"millisecond"),pt(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),pt(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),pt(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),pt(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),pt(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),pt(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),kt("millisecond","ms"),ee("millisecond",16),Nt("S",en,it),Nt("SS",en,gt),Nt("SSS",en,ft),cr="SSSS";cr.length<=9;cr+="S")Nt(cr,mn);function Dh(P,B){B[6]=Qt(1e3*("0."+P))}for(cr="S";cr.length<=9;cr+="S")_t(cr,Dh);Ph=xe("Milliseconds",!1),pt("z",0,0,"zoneAbbr"),pt("zz",0,0,"zoneName");var Ne=A.prototype;function Xg(P){return P}Ne.add=gf,Ne.calendar=function(P,B){arguments.length===1&&(arguments[0]?$g(arguments[0])?(P=arguments[0],B=void 0):Gg(arguments[0])&&(B=arguments[0],P=void 0):(P=void 0,B=void 0));var $=P||$n(),Z=Dl($,this).startOf("day"),wt=e.calendarFormat(this,Z)||"sameElse",$t=B&&(V(B[wt])?B[wt].call(this,$):B[wt]);return this.format($t||this.localeData().calendar(wt,this,$n($)))},Ne.clone=function(){return new A(this)},Ne.diff=function(P,B,$){var Z,wt,$t;if(!this.isValid())return NaN;if(!(Z=Dl(P,this)).isValid())return NaN;switch(wt=6e4*(Z.utcOffset()-this.utcOffset()),B=Wt(B)){case"year":$t=Th(this,Z)/12;break;case"month":$t=Th(this,Z);break;case"quarter":$t=Th(this,Z)/3;break;case"second":$t=(this-Z)/1e3;break;case"minute":$t=(this-Z)/6e4;break;case"hour":$t=(this-Z)/36e5;break;case"day":$t=(this-Z-wt)/864e5;break;case"week":$t=(this-Z-wt)/6048e5;break;default:$t=this-Z}return $?$t:Gt($t)},Ne.endOf=function(P){var B,$;if((P=Wt(P))===void 0||P==="millisecond"||!this.isValid())return this;switch($=this._isUTC?bf:Eh,P){case"year":B=$(this.year()+1,0,1)-1;break;case"quarter":B=$(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":B=$(this.year(),this.month()+1,1)-1;break;case"week":B=$(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":B=$(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":B=$(this.year(),this.month(),this.date()+1)-1;break;case"hour":B=this._d.valueOf(),B+=Ah-na(B+(this._isUTC?0:this.utcOffset()*Ac),Ah)-1;break;case"minute":B=this._d.valueOf(),B+=Ac-na(B,Ac)-1;break;case"second":B=this._d.valueOf(),B+=mf-na(B,mf)-1}return this._d.setTime(B),e.updateOffset(this,!0),this},Ne.format=function(P){P||(P=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var B=Et(this,P);return this.localeData().postformat(B)},Ne.from=function(P,B){return this.isValid()&&(C(P)&&P.isValid()||$n(P).isValid())?ro({to:this,from:P}).locale(this.locale()).humanize(!B):this.localeData().invalidDate()},Ne.fromNow=function(P){return this.from($n(),P)},Ne.to=function(P,B){return this.isValid()&&(C(P)&&P.isValid()||$n(P).isValid())?ro({from:this,to:P}).locale(this.locale()).humanize(!B):this.localeData().invalidDate()},Ne.toNow=function(P){return this.to($n(),P)},Ne.get=function(P){return V(this[P=Wt(P)])?this[P]():this},Ne.invalidAt=function(){return p(this).overflow},Ne.isAfter=function(P,B){var $=C(P)?P:$n(P);return!(!this.isValid()||!$.isValid())&&((B=Wt(B)||"millisecond")==="millisecond"?this.valueOf()>$.valueOf():$.valueOf()<this.clone().startOf(B).valueOf())},Ne.isBefore=function(P,B){var $=C(P)?P:$n(P);return!(!this.isValid()||!$.isValid())&&((B=Wt(B)||"millisecond")==="millisecond"?this.valueOf()<$.valueOf():this.clone().endOf(B).valueOf()<$.valueOf())},Ne.isBetween=function(P,B,$,Z){var wt=C(P)?P:$n(P),$t=C(B)?B:$n(B);return!!(this.isValid()&&wt.isValid()&&$t.isValid())&&((Z=Z||"()")[0]==="("?this.isAfter(wt,$):!this.isBefore(wt,$))&&(Z[1]===")"?this.isBefore($t,$):!this.isAfter($t,$))},Ne.isSame=function(P,B){var $,Z=C(P)?P:$n(P);return!(!this.isValid()||!Z.isValid())&&((B=Wt(B)||"millisecond")==="millisecond"?this.valueOf()===Z.valueOf():($=Z.valueOf(),this.clone().startOf(B).valueOf()<=$&&$<=this.clone().endOf(B).valueOf()))},Ne.isSameOrAfter=function(P,B){return this.isSame(P,B)||this.isAfter(P,B)},Ne.isSameOrBefore=function(P,B){return this.isSame(P,B)||this.isBefore(P,B)},Ne.isValid=function(){return g(this)},Ne.lang=bu,Ne.locale=Tc,Ne.localeData=qg,Ne.max=so,Ne.min=$r,Ne.parsingFlags=function(){return h({},p(this))},Ne.set=function(P,B){if(typeof P=="object"){var $,Z=(function($t){var qt,De=[];for(qt in $t)r($t,qt)&&De.push({unit:qt,priority:ae[qt]});return De.sort((function(_e,An){return _e.priority-An.priority})),De})(P=jt(P)),wt=Z.length;for($=0;$<wt;$++)this[Z[$].unit](P[Z[$].unit])}else if(V(this[P=Wt(P)]))return this[P](B);return this},Ne.startOf=function(P){var B,$;if((P=Wt(P))===void 0||P==="millisecond"||!this.isValid())return this;switch($=this._isUTC?bf:Eh,P){case"year":B=$(this.year(),0,1);break;case"quarter":B=$(this.year(),this.month()-this.month()%3,1);break;case"month":B=$(this.year(),this.month(),1);break;case"week":B=$(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":B=$(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":B=$(this.year(),this.month(),this.date());break;case"hour":B=this._d.valueOf(),B-=na(B+(this._isUTC?0:this.utcOffset()*Ac),Ah);break;case"minute":B=this._d.valueOf(),B-=na(B,Ac);break;case"second":B=this._d.valueOf(),B-=na(B,mf)}return this._d.setTime(B),e.updateOffset(this,!0),this},Ne.subtract=Wg,Ne.toArray=function(){var P=this;return[P.year(),P.month(),P.date(),P.hour(),P.minute(),P.second(),P.millisecond()]},Ne.toObject=function(){var P=this;return{years:P.year(),months:P.month(),date:P.date(),hours:P.hours(),minutes:P.minutes(),seconds:P.seconds(),milliseconds:P.milliseconds()}},Ne.toDate=function(){return new Date(this.valueOf())},Ne.toISOString=function(P){if(!this.isValid())return null;var B=P!==!0,$=B?this.clone().utc():this;return $.year()<0||$.year()>9999?Et($,B?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):V(Date.prototype.toISOString)?B?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",Et($,"Z")):Et($,B?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}
4671,Ne.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var P,B,$,Z="moment",wt="";return this.isLocal()||(Z=this.utcOffset()===0?"moment.utc":"moment.parseZone",wt="Z"),P="["+Z+'("]',B=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",$=wt+'[")]',this.format(P+B+"-MM-DD[T]HH:mm:ss.SSS"+$)},typeof Symbol<"u"&&Symbol.for!=null&&(Ne[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ne.toJSON=function(){return this.isValid()?this.toISOString():null},Ne.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},Ne.unix=function(){return Math.floor(this.valueOf()/1e3)},Ne.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},Ne.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},Ne.eraName=function(){var P,B,$,Z=this.localeData().eras();for(P=0,B=Z.length;P<B;++P)if($=this.clone().startOf("day").valueOf(),Z[P].since<=$&&$<=Z[P].until||Z[P].until<=$&&$<=Z[P].since)return Z[P].name;return""},Ne.eraNarrow=function(){var P,B,$,Z=this.localeData().eras();for(P=0,B=Z.length;P<B;++P)if($=this.clone().startOf("day").valueOf(),Z[P].since<=$&&$<=Z[P].until||Z[P].until<=$&&$<=Z[P].since)return Z[P].narrow;return""},Ne.eraAbbr=function(){var P,B,$,Z=this.localeData().eras();for(P=0,B=Z.length;P<B;++P)if($=this.clone().startOf("day").valueOf(),Z[P].since<=$&&$<=Z[P].until||Z[P].until<=$&&$<=Z[P].since)return Z[P].abbr;return""},Ne.eraYear=function(){var P,B,$,Z,wt=this.localeData().eras();for(P=0,B=wt.length;P<B;++P)if($=wt[P].since<=wt[P].until?1:-1,Z=this.clone().startOf("day").valueOf(),wt[P].since<=Z&&Z<=wt[P].until||wt[P].until<=Z&&Z<=wt[P].since)return(this.year()-e(wt[P].since).year())*$+wt[P].offset;return this.year()},Ne.year=rt,Ne.isLeapYear=function(){return Bt(this.year())},Ne.weekYear=function(P){return vu.call(this,P,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},Ne.isoWeekYear=function(P){return vu.call(this,P,this.isoWeek(),this.isoWeekday(),1,4)},Ne.quarter=Ne.quarters=function(P){return P==null?Math.ceil((this.month()+1)/3):this.month(3*(P-1)+this.month()%3)},Ne.month=xt,Ne.daysInMonth=function(){return pe(this.year(),this.month())},Ne.week=Ne.weeks=function(P){var B=this.localeData().week(this);return P==null?B:this.add(7*(P-B),"d")},Ne.isoWeek=Ne.isoWeeks=function(P){var B=ye(this,1,4).week;return P==null?B:this.add(7*(P-B),"d")},Ne.weeksInYear=function(){var P=this.localeData()._week;return be(this.year(),P.dow,P.doy)},Ne.weeksInWeekYear=function(){var P=this.localeData()._week;return be(this.weekYear(),P.dow,P.doy)},Ne.isoWeeksInYear=function(){return be(this.year(),1,4)},Ne.isoWeeksInISOWeekYear=function(){return be(this.isoWeekYear(),1,4)},Ne.date=Ec,Ne.day=Ne.days=function(P){if(!this.isValid())return P!=null?this:NaN;var B=this._isUTC?this._d.getUTCDay():this._d.getDay();return P!=null?(P=(function($,Z){return typeof $!="string"?$:isNaN($)?typeof($=Z.weekdaysParse($))=="number"?$:null:parseInt($,10)})(P,this.localeData()),this.add(P-B,"d")):B},Ne.weekday=function(P){if(!this.isValid())return P!=null?this:NaN;var B=(this.day()+7-this.localeData()._week.dow)%7;return P==null?B:this.add(P-B,"d")},Ne.isoWeekday=function(P){if(!this.isValid())return P!=null?this:NaN;if(P!=null){var B=(function($,Z){return typeof $=="string"?Z.weekdaysParse($)%7||7:isNaN($)?null:$})(P,this.localeData());return this.day(this.day()%7?B:B-7)}return this.day()||7},Ne.dayOfYear=function(P){var B=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return P==null?B:this.add(P-B,"d")},Ne.hour=Ne.hours=Ie,Ne.minute=Ne.minutes=kc,Ne.second=Ne.seconds=Rh,Ne.millisecond=Ne.milliseconds=Ph,Ne.utcOffset=function(P,B,$){var Z,wt=this._offset||0;if(!this.isValid())return P!=null?this:NaN;if(P!=null){if(typeof P=="string"){if((P=xr(Vt,P))===null)return this}else Math.abs(P)<16&&!$&&(P*=60);return!this._isUTC&&B&&(Z=Ja(this)),this._offset=P,this._isUTC=!0,Z!=null&&this.add(Z,"m"),wt!==P&&(!B||this._changeInProgress?Za(this,ro(P-wt,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?wt:Ja(this)},Ne.utc=function(P){return this.utcOffset(0,P)},Ne.local=function(P){return this._isUTC&&(this.utcOffset(0,P),this._isUTC=!1,P&&this.subtract(Ja(this),"m")),this},Ne.parseZone=function(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var P=xr(K,this._i);P!=null?this.utcOffset(P):this.utcOffset(0,!0)}return this},Ne.hasAlignedHourOffset=function(P){return!!this.isValid()&&(P=P?$n(P).utcOffset():0,(this.utcOffset()-P)%60==0)},Ne.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},Ne.isLocal=function(){return!!this.isValid()&&!this._isUTC},Ne.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},Ne.isUtc=Mh,Ne.isUTC=Mh,Ne.zoneAbbr=function(){return this._isUTC?"UTC":""},Ne.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},Ne.dates=k("dates accessor is deprecated. Use date instead.",Ec),Ne.months=k("months accessor is deprecated. Use month instead",xt),Ne.years=k("years accessor is deprecated. Use year instead",rt),Ne.zone
vendor: 9,465 bytes, line 4671
4671=k("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",(function(P,B){return P!=null?(typeof P!="string"&&(P=-P),this.utcOffset(P,B),this):-this.utcOffset()})),Ne.isDSTShifted=k("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",(function(){if(!a(this._isDSTShifted))return this._isDSTShifted;var P,B={};return M(B,this),(B=ps(B))._a?(P=B._isUTC?d(B._a):$n(B._a),this._isDSTShifted=this.isValid()&&(function($,Z,wt){var $t,qt=Math.min($.length,Z.length),De=Math.abs($.length-Z.length),_e=0;for($t=0;$t<qt;$t++)(wt&&$[$t]!==Z[$t]||!wt&&Qt($[$t])!==Qt(Z[$t]))&&_e++;return _e+De})(B._a,P.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}));var wi=X.prototype;function Pc(P,B,$,Z){var wt=Kt(),$t=d().set(Z,B);return wt[$]($t,P)}function yu(P,B,$){if(l(P)&&(B=P,P=void 0),P=P||"",B!=null)return Pc(P,B,$,"month");var Z,wt=[];for(Z=0;Z<12;Z++)wt[Z]=Pc(P,Z,$,"month");return wt}function Pa(P,B,$,Z){typeof P=="boolean"?(l(B)&&($=B,B=void 0),B=B||""):($=B=P,P=!1,l(B)&&($=B,B=void 0),B=B||"");var wt,$t=Kt(),qt=P?$t._week.dow:0,De=[];if($!=null)return Pc(B,($+qt)%7,Z,"day");for(wt=0;wt<7;wt++)De[wt]=Pc(B,(wt+qt)%7,Z,"day");return De}wi.calendar=function(P,B,$){var Z=this._calendar[P]||this._calendar.sameElse;return V(Z)?Z.call(B,$):Z},wi.longDateFormat=function(P){var B=this._longDateFormat[P],$=this._longDateFormat[P.toUpperCase()];return B||!$?B:(this._longDateFormat[P]=$.match(W).map((function(Z){return Z==="MMMM"||Z==="MM"||Z==="DD"||Z==="dddd"?Z.slice(1):Z})).join(""),this._longDateFormat[P])},wi.invalidDate=function(){return this._invalidDate},wi.ordinal=function(P){return this._ordinal.replace("%d",P)},wi.preparse=Xg,wi.postformat=Xg,wi.relativeTime=function(P,B,$,Z){var wt=this._relativeTime[$];return V(wt)?wt(P,B,$,Z):wt.replace(/%d/i,P)},wi.pastFuture=function(P,B){var $=this._relativeTime[P>0?"future":"past"];return V($)?$(B):$.replace(/%s/i,B)},wi.set=function(P){var B,$;for($ in P)r(P,$)&&(V(B=P[$])?this[$]=B:this["_"+$]=B);this._config=P,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},wi.eras=function(P,B){var $,Z,wt,$t=this._eras||Kt("en")._eras;for($=0,Z=$t.length;$<Z;++$)switch(typeof $t[$].since=="string"&&(wt=e($t[$].since).startOf("day"),$t[$].since=wt.valueOf()),typeof $t[$].until){case"undefined":$t[$].until=1/0;break;case"string":wt=e($t[$].until).startOf("day").valueOf(),$t[$].until=wt.valueOf()}return $t},wi.erasParse=function(P,B,$){var Z,wt,$t,qt,De,_e=this.eras();for(P=P.toUpperCase(),Z=0,wt=_e.length;Z<wt;++Z)if($t=_e[Z].name.toUpperCase(),qt=_e[Z].abbr.toUpperCase(),De=_e[Z].narrow.toUpperCase(),$)switch(B){case"N":case"NN":case"NNN":if(qt===P)return _e[Z];break;case"NNNN":if($t===P)return _e[Z];break;case"NNNNN":if(De===P)return _e[Z]}else if([$t,qt,De].indexOf(P)>=0)return _e[Z]},wi.erasConvertYear=function(P,B){var $=P.since<=P.until?1:-1;return B===void 0?e(P.since).year():e(P.since).year()+(B-P.offset)*$},wi.erasAbbrRegex=function(P){return r(this,"_erasAbbrRegex")||oo.call(this),P?this._erasAbbrRegex:this._erasRegex},wi.erasNameRegex=function(P){return r(this,"_erasNameRegex")||oo.call(this),P?this._erasNameRegex:this._erasRegex},wi.erasNarrowRegex=function(P){return r(this,"_erasNarrowRegex")||oo.call(this),P?this._erasNarrowRegex:this._erasRegex},wi.months=function(P,B){return P?n(this._months)?this._months[P.month()]:this._months[(this._months.isFormat||Re).test(B)?"format":"standalone"][P.month()]:n(this._months)?this._months:this._months.standalone},wi.monthsShort=function(P,B){return P?n(this._monthsShort)?this._monthsShort[P.month()]:this._monthsShort[Re.test(B)?"format":"standalone"][P.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},wi.monthsParse=function(P,B,$){var Z,wt,$t;if(this._monthsParseExact)return J.call(this,P,B,$);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),Z=0;Z<12;Z++)if(wt=d([2e3,Z]),$&&!this._longMonthsParse[Z]&&(this._longMonthsParse[Z]=new RegExp("^"+this.months(wt,"").replace(".","")+"$","i"),this._shortMonthsParse[Z]=new RegExp("^"+this.monthsShort(wt,"").replace(".","")+"$","i")),$||this._monthsParse[Z]||($t="^"+this.months(wt,"")+"|^"+this.monthsShort(wt,""),this._monthsParse[Z]=new RegExp($t.replace(".",""),"i")),$&&B==="MMMM"&&this._longMonthsParse[Z].test(P)||$&&B==="MMM"&&this._shortMonthsParse[Z].test(P)||!$&&this._monthsParse[Z].test(P))return Z},wi.monthsRegex=function(P){return this._monthsParseExact?(r(this,"_monthsRegex")||At.call(this),P?this._monthsStrictRegex:this._monthsRegex):(r(this,"_monthsRegex")||(this._monthsRegex=Ee),this._monthsStrictRegex&&P?this._monthsStrictRegex:this._monthsRegex)},wi.monthsShortRegex=function(P){return this._monthsParseExact?(r(this,"_monthsRegex")||At.call(this),P?this._monthsShortStrictRegex:this._monthsShortRegex):(r(this,"_monthsShortRegex")||(this._monthsShortRegex=Ft),this._monthsShortStrictRegex&&P?this._monthsShortStrictRegex:this._monthsShortRegex)},wi.week=function(P){return ye(P,this._week.dow,this._week.doy).week},wi.firstDayOfYear=function(){return this._week.doy},wi.firstDayOfWeek=function(){return this._week.dow},wi.weekdays=function(P,B){var $=n(this._weekdays)?this._weekdays:this._weekdays[P&&P!==!0&&this._weekdays.isFormat.test(B)?"format":"standalone"];return P===!0?fn($,this._week.dow):P?$[P.day()]:$},wi.weekdaysMin=function(P){return P===!0?fn(this._weekdaysMin,this._week.dow):P?this._weekdaysMin[P.day()]:this._weekdaysMin},wi.weekdaysShort=function(P){return P===!0?fn(this._weekdaysShort,this._week.dow):P?this._weekdaysShort[P.day()]:this._weekdaysShort},wi.weekdaysParse=function(P,B,$){var Z,wt,$t;if(this._weekdaysParseExact)return Ti.call(this,P,B,$);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),Z=0;Z<7;Z++)if(wt=d([2e3,1]).day(Z),$&&!this._fullWeekdaysParse[Z]&&(this._fullWeekdaysParse[Z]=new RegExp("^"+this.weekdays(wt,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[Z]=new RegExp("^"+this.weekdaysShort(wt,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[Z]=new RegExp("^"+this.weekdaysMin(wt,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[Z]||($t="^"+this.weekdays(wt,"")+"|^"+this.weekdaysShort(wt,"")+"|^"+this.weekdaysMin(wt,""),this._weekdaysParse[Z]=new RegExp($t.replace(".",""),"i")),$&&B==="dddd"&&this._fullWeekdaysParse[Z].test(P)||$&&B==="ddd"&&this._shortWeekdaysParse[Z].test(P)||$&&B==="dd"&&this._minWeekdaysParse[Z].test(P)||!$&&this._weekdaysParse[Z].test(P))return Z},wi.weekdaysRegex=function(P){return this._weekdaysParseExact?(r(this,"_weekdaysRegex")||Yi.call(this),P?this._weekdaysStrictRegex:this._weekdaysRegex):(r(this,"_weekdaysRegex")||(this._weekdaysRegex=jn),this._weekdaysStrictRegex&&P?this._weekdaysStrictRegex:this._weekdaysRegex)},wi.weekdaysShortRegex=function(P){return this._weekdaysParseExact?(r(this,"_weekdaysRegex")||Yi.call(this),P?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(r(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Fn),this._weekdaysShortStrictRegex&&P?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},wi.weekdaysMinRegex=function(P){return this._weekdaysParseExact?(r(this,"_weekdaysRegex")||Yi.call(this),P?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(r(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=si),this._weekdaysMinStrictRegex&&P?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},wi.isPM=function(P){return(P+"").toLowerCase().charAt(0)==="p"},wi.meridiem=function(P,B,$){return P>11?$?"pm":"PM":$?"am":"AM"},Ot("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(P){var B=P%10;return P+(Qt(P%100/10)===1?"th":B===1?"st":B===2?"nd":B===3?"rd":"th")}}),e.lang=k("moment.lang is deprecated. Use moment.locale instead.",Ot),e.langData=k("moment.langData is deprecated. Use moment.localeData instead.",Kt);var zi=Math.abs;function ts(P,B,$,Z){var wt=ro(B,$);return P._milliseconds+=Z*wt._milliseconds,P._days+=Z*wt._days,P._months+=Z*wt._months,P._bubble()}function Do(P){return P<0?Math.floor(P):Math.ceil(P)}function ao(P){return 4800*P/146097}function qs(P){return 146097*P/4800}function Ys(P){return function(){return this.as(P)}}var vf=Ys("ms"),yf=Ys("s"),Kg=Ys("m"),Jg=Ys("h"),xf=Ys("d"),Lh=Ys("w"),Nl=Ys("M"),Ih=Ys("Q"),Zg=Ys("y");function Bl(P){return function(){return this.isValid()?this._data[P]:NaN}}var Qg=Bl("milliseconds"),Lo=Bl("seconds"),lo=Bl("minutes"),wf=Bl("hours"),tm=Bl("days"),_f=Bl("months"),em=Bl("years"),ia=Math.round,Fl={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Qa(P,B,$,Z,wt){return wt.relativeTime(B||1,!!$,P,Z)}var Ul=Math.abs;function sa(P){return(P>0)-(P<0)||+P}function Oh(){if(!this.isValid())return this.localeData().invalidDate();var P,B,$,Z,wt,$t,qt,De,_e=Ul(this._milliseconds)/1e3,An=Ul(this._days),Yn=Ul(this._months),On=this.asSeconds();return On?(P=Gt(_e/60),B=Gt(P/60),_e%=60,P%=60,$=Gt(Yn/12),Yn%=12,Z=_e?_e.toFixed(3).replace(/\.?0+$/,""):"",wt=On<0?"-":"",$t=sa(this._months)!==sa(On)?"-":"",qt=sa(this._days)!==sa(On)?"-":"",De=sa(this._milliseconds)!==sa(On)?"-":"",wt+"P"+($?$t+$+"Y":"")+(Yn?$t+Y
4671n+"M":"")+(An?qt+An+"D":"")+(B||P||_e?"T":"")+(B?De+B+"H":"")+(P?De+P+"M":"")+(_e?De+Z+"S":"")):"P0D"}var oi=Bi.prototype;return oi.isValid=function(){return this._isValid},oi.abs=function(){var P=this._data;return this._milliseconds=zi(this._milliseconds),this._days=zi(this._days),this._months=zi(this._months),P.milliseconds=zi(P.milliseconds),P.seconds=zi(P.seconds),P.minutes=zi(P.minutes),P.hours=zi(P.hours),P.months=zi(P.months),P.years=zi(P.years),this},oi.add=function(P,B){return ts(this,P,B,1)},oi.subtract=function(P,B){return ts(this,P,B,-1)},oi.as=function(P){if(!this.isValid())return NaN;var B,$,Z=this._milliseconds;if((P=Wt(P))==="month"||P==="quarter"||P==="year")switch(B=this._days+Z/864e5,$=this._months+ao(B),P){case"month":return $;case"quarter":return $/3;case"year":return $/12}else switch(B=this._days+Math.round(qs(this._months)),P){case"week":return B/7+Z/6048e5;case"day":return B+Z/864e5;case"hour":return 24*B+Z/36e5;case"minute":return 1440*B+Z/6e4;case"second":return 86400*B+Z/1e3;case"millisecond":return Math.floor(864e5*B)+Z;default:throw new Error("Unknown unit "+P)}},oi.asMilliseconds=vf,oi.asSeconds=yf,oi.asMinutes=Kg,oi.asHours=Jg,oi.asDays=xf,oi.asWeeks=Lh,oi.asMonths=Nl,oi.asQuarters=Ih,oi.asYears=Zg,oi.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*Qt(this._months/12):NaN},oi._bubble=function(){var P,B,$,Z,wt,$t=this._milliseconds,qt=this._days,De=this._months,_e=this._data;return $t>=0&&qt>=0&&De>=0||$t<=0&&qt<=0&&De<=0||($t+=864e5*Do(qs(De)+qt),qt=0,De=0),_e.milliseconds=$t%1e3,P=Gt($t/1e3),_e.seconds=P%60,B=Gt(P/60),_e.minutes=B%60,$=Gt(B/60),_e.hours=$%24,qt+=Gt($/24),De+=wt=Gt(ao(qt)),qt-=Do(qs(wt)),Z=Gt(De/12),De%=12,_e.days=qt,_e.months=De,_e.years=Z,this},oi.clone=function(){return ro(this)},oi.get=function(P){return P=Wt(P),this.isValid()?this[P+"s"]():NaN},oi.milliseconds=Qg,oi.seconds=Lo,oi.minutes=lo,oi.hours=wf,oi.days=tm,oi.weeks=function(){return Gt(this.days()/7)},oi.months=_f,oi.years=em,oi.humanize=function(P,B){if(!this.isValid())return this.localeData().invalidDate();var $,Z,wt=!1,$t=Fl;return typeof P=="object"&&(B=P,P=!1),typeof P=="boolean"&&(wt=P),typeof B=="object"&&($t=Object.assign({},Fl,B),B.s!=null&&B.ss==null&&($t.ss=B.s-1)),Z=(function(qt,De,_e,An){var Yn=ro(qt).abs(),On=ia(Yn.as("s")),li=ia(Yn.as("m")),Vi=ia(Yn.as("h")),Ms=ia(Yn.as("d")),Io=ia(Yn.as("M")),tl=ia(Yn.as("w")),zl=ia(Yn.as("y")),Oo=On<=_e.ss&&["s",On]||On<_e.s&&["ss",On]||li<=1&&["m"]||li<_e.m&&["mm",li]||Vi<=1&&["h"]||Vi<_e.h&&["hh",Vi]||Ms<=1&&["d"]||Ms<_e.d&&["dd",Ms];return _e.w!=null&&(Oo=Oo||tl<=1&&["w"]||tl<_e.w&&["ww",tl]),(Oo=Oo||Io<=1&&["M"]||Io<_e.M&&["MM",Io]||zl<=1&&["y"]||["yy",zl])[2]=De,Oo[3]=+qt>0,Oo[4]=An,Qa.apply(null,Oo)})(this,!wt,$t,$=this.localeData()),wt&&(Z=$.pastFuture(+this,Z)),$.postformat(Z)},oi.toISOString=Oh,oi.toString=Oh,oi.toJSON=Oh,oi.locale=Tc,oi.localeData=qg,oi.toIsoString=k("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Oh),oi.lang=bu,pt("X",0,0,"unix"),pt("x",0,0,"valueOf"),Nt("x",mt),Nt("X",/[+-]?\d+(\.\d{1,3})?/),_t("X",(function(P,B,$){$._d=new Date(1e3*parseFloat(P))})),_t("x",(function(P,B,$){$._d=new Date(Qt(P))})),e.version="2.29.4",i=$n,e.fn=Ne,e.min=function(){var P=[].slice.call(arguments,0);return ea("isBefore",P)},e.max=function(){var P=[].slice.call(arguments,0);return ea("isAfter",P)},e.now=function(){return Date.now?Date.now():+new Date},e.utc=d,e.unix=function(P){return $n(1e3*P)},e.months=function(P,B){return yu(P,B,"months")},e.isDate=c,e.locale=Ot,e.invalid=y,e.duration=ro,e.isMoment=C,e.weekdays=function(P,B,$){return Pa(P,B,$,"weekdays")},e.parseZone=function(){return $n.apply(null,arguments).parseZone()},e.localeData=Kt,e.isDuration=Cs,e.monthsShort=function(P,B){return yu(P,B,"monthsShort")},e.weekdaysMin=function(P,B,$){return Pa(P,B,$,"weekdaysMin")},e.defineLocale=re,e.updateLocale=function(P,B){if(B!=null){var $,Z,wt=Dn;Xe[P]!=null&&Xe[P].parentLocale!=null?Xe[P].set(q(Xe[P]._config,B)):((Z=nt(P))!=null&&(wt=Z._config),B=q(wt,B),Z==null&&(B.abbr=P),($=new X(B)).parentLocale=Xe[P],Xe[P]=$),Ot(P)}else Xe[P]!=null&&(Xe[P].parentLocale!=null?(Xe[P]=Xe[P].parentLocale,P===Ot()&&Ot(P)):Xe[P]!=null&&delete Xe[P]);return Xe[P]},e.locales=function(){return O(Xe)},e.weekdaysShort=function(P,B,$){return Pa(P,B,$,"weekdaysShort")},e.normalizeUnits=Wt,e.relativeTimeRounding=function(P){return P===void 0?ia:typeof P=="function"&&(ia=P,!0)},e.relativeTimeThreshold=function(P,B){return Fl[P]!==void 0&&(B===void 0?Fl[P]:(Fl[P]=B,P==="s"&&(Fl.ss=B-1),!0))},e.calendarFormat=function(P,B){var $=P.diff(B,"days",!0);return $<-6?"sameElse":$<-1?"lastWeek":$<0?"lastDay":$<1?"sameDay":$<2?"nextDay":$<7?"nextWeek":"sameElse"},e.prototype=Ne,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e}))});var Bit=uo(($V,Nit)=>{(function(i,t){typeof $V=="object"&&typeof Nit<"u"?t(WV(),VV()):typeof define=="function"&&define.amd?define(["app/assets/javascript/vendors/moment","app/javascript/vendors/chart.js"],t):t((i=typeof globalThis<"u"?globalThis:i||self).moment,i.Chart)})($V,(function(i,t){"use strict";function e(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var n=e(i);let s={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};t._adapters._date.override(typeof n.default=="function"?{_id:"moment",formats:function(){return s}
4671,parse:function(r,o){return typeof r=="string"&&typeof o=="string"?r=n.default(r,o):r instanceof n.default||(r=n.default(r)),r.isValid()?r.valueOf():null},format:function(r,o){return n.default(r).format(o)},add:function(r,o,a){return n.default(r).add(o,a).valueOf()},diff:function(r,o,a){return n.default(r).diff(n.default(o),a)},startOf:function(r,o,a){return r=n.default(r),o==="isoWeek"?(a=Math.trunc(Math.min(Math.max(0,a),6)),r.isoWeekday(a).startOf("day").valueOf()):r.startOf(o).valueOf()},endOf:function(r,o){return n.default(r).endOf(o).valueOf()}}:{})}))});var zit=uo((GV,qV)=>{(function(i,t){typeof GV=="object"&&typeof qV<"u"?qV.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis<"u"?globalThis:i||self).flatpickr=t()})(GV,(function(){"use strict";var i=function(){return(i=Object.assign||function(j){for(var W,_=1,at=arguments.length;_<at;_++)for(var ct in W=arguments[_])Object.prototype.hasOwnProperty.call(W,ct)&&(j[ct]=W[ct]);return j}).apply(this,arguments)};function t(){for(var j=0,W=0,_=arguments.length;W<_;W++)j+=arguments[W].length;var at=Array(j),ct=0;for(W=0;W<_;W++)for(var pt=arguments[W],Et=0,vt=pt.length;Et<vt;Et++,ct++)at[ct]=pt[Et];return at}var e=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],n={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(j){return typeof console<"u"&&console.warn(j)},getWeek:function(j){var W=new Date(j.getTime());W.setHours(0,0,0,0),W.setDate(W.getDate()+3-(W.getDay()+6)%7);var _=new Date(W.getFullYear(),0,4);return 1+Math.round(((W.getTime()-_.getTime())/864e5-3+(_.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},s={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(j){var W=j%100;if(W>3&&W<21)return"th";switch(W%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},r=function(j,W){return W===void 0&&(W=2),("000"+j).slice(-1*W)},o=function(j){return j===!0?1:0};function a(j,W){var _;return function(){var at=this,ct=arguments;clearTimeout(_),_=setTimeout((function(){return j.apply(at,ct)}),W)}}var l=function(j){return j instanceof Array?j:[j]};function c(j,W,_){if(_===!0)return j.classList.add(W);j.classList.remove(W)}function u(j,W,_){var at=window.document.createElement(j);return W=W||"",_=_||"",at.className=W,_!==void 0&&(at.textContent=_),at}function h(j){for(;j.firstChild;)j.removeChild(j.firstChild)}function d(j,W){return W(j)?j:j.parentNode?d(j.parentNode,W):void 0}function p(j,W){var _=u("div","numInputWrapper"),at=u("input","numInput "+j),ct=u("span","arrowUp"),pt=u("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?at.type="number":(at.type="text",at.pattern="\\d*"),W!==void 0)for(var Et in W)at.setAttribute(Et,W[Et]);
4671return _.appendChild(at),_.appendChild(ct),_.appendChild(pt),_}function g(j){try{return typeof j.composedPath=="function"?j.composedPath()[0]:j.target}catch{return j.target}}var y=function(){},x=function(j,W,_){return _.months[W?"shorthand":"longhand"][j]},w={D:y,F:function(j,W,_){j.setMonth(_.months.longhand.indexOf(W))},G:function(j,W){j.setHours((j.getHours()>=12?12:0)+parseFloat(W))},H:function(j,W){j.setHours(parseFloat(W))},J:function(j,W){j.setDate(parseFloat(W))},K:function(j,W,_){j.setHours(j.getHours()%12+12*o(new RegExp(_.amPM[1],"i").test(W)))},M:function(j,W,_){j.setMonth(_.months.shorthand.indexOf(W))},S:function(j,W){j.setSeconds(parseFloat(W))},U:function(j,W){return new Date(1e3*parseFloat(W))},W:function(j,W,_){var at=parseInt(W),ct=new Date(j.getFullYear(),0,2+7*(at-1),0,0,0,0);return ct.setDate(ct.getDate()-ct.getDay()+_.firstDayOfWeek),ct},Y:function(j,W){j.setFullYear(parseFloat(W))},Z:function(j,W){return new Date(W)},d:function(j,W){j.setDate(parseFloat(W))},h:function(j,W){j.setHours((j.getHours()>=12?12:0)+parseFloat(W))},i:function(j,W){j.setMinutes(parseFloat(W))},j:function(j,W){j.setDate(parseFloat(W))},l:y,m:function(j,W){j.setMonth(parseFloat(W)-1)},n:function(j,W){j.setMonth(parseFloat(W)-1)},s:function(j,W){j.setSeconds(parseFloat(W))},u:function(j,W){return new Date(parseFloat(W))},w:y,y:function(j,W){j.setFullYear(2e3+parseFloat(W))}},M={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},A={Z:function(j){return j.toISOString()},D:function(j,W,_){return W.weekdays.shorthand[A.w(j,W,_)]},F:function(j,W,_){return x(A.n(j,W,_)-1,!1,W)},G:function(j,W,_){return r(A.h(j,W,_))},H:function(j){return r(j.getHours())},J:function(j,W){return W.ordinal!==void 0?j.getDate()+W.ordinal(j.getDate()):j.getDate()},K:function(j,W){return W.amPM[o(j.getHours()>11)]},M:function(j,W){return x(j.getMonth(),!0,W)},S:function(j){return r(j.getSeconds())},U:function(j){return j.getTime()/1e3},W:function(j,W,_){return _.getWeek(j)},Y:function(j){return r(j.getFullYear(),4)},d:function(j){return r(j.getDate())},h:function(j){return j.getHours()%12?j.getHours()%12:12},i:function(j){return r(j.getMinutes())},j:function(j){return j.getDate()},l:function(j,W){return W.weekdays.longhand[j.getDay()]},m:function(j){return r(j.getMonth()+1)},n:function(j){return j.getMonth()+1},s:function(j){return j.getSeconds()},u:function(j){return j.getTime()},w:function(j){return j.getDay()},y:function(j){return String(j.getFullYear()).substring(2)}},C=function(j){var W=j.config,_=W===void 0?n:W,at=j.l10n,ct=at===void 0?s:at,pt=j.isMobile,Et=pt!==void 0&&pt;return function(vt,yt,kt){var Wt=kt||ct;return _.formatDate===void 0||Et?yt.split("").map((function(jt,ae,ee){return A[jt]&&ee[ae-1]!=="\\"?A[jt](vt,Wt,_):jt!=="\\"?jt:""})).join(""):_.formatDate(vt,yt,Wt)}},R=function(j){var W=j.config,_=W===void 0?n:W,at=j.l10n,ct=at===void 0?s:at;return function(pt,Et,vt,yt){if(pt===0||pt){var kt,Wt=yt||ct,jt=pt;if(pt instanceof Date)kt=new Date(pt.getTime());else if(typeof pt!="string"&&pt.toFixed!==void 0)kt=new Date(pt);else if(typeof pt=="string"){var ae=Et||(_||n).dateFormat,ee=String(pt).trim();if(ee==="today")kt=new Date,vt=!0;else if(_&&_.parseDate)kt=_.parseDate(pt,ae);else if(/Z$/.test(ee)||/GMT$/.test(ee))kt=new Date(pt);else{for(var Bt=void 0,Gt=[],Qt=0,xe=0,Ut="";Qt<ae.length;Qt++){var zt=ae[Qt],St=zt==="\\",it=ae[Qt-1]==="\\"||St;if(M[zt]&&!it){Ut+=M[zt];var gt=new RegExp(Ut).exec(pt);gt&&(Bt=!0)&&Gt[zt!=="Y"?"push":"unshift"]({fn:w[zt],val:gt[++xe]})}else St||(Ut+=".")}kt=_&&_.noCalendar?new Date(new Date().setHours(0,0,0,0)):new Date(new Date().getFullYear(),0,1,0,0,0,0),Gt.forEach((function(ft){var de=ft.fn,ve=ft.val;return kt=de(kt,ve,Wt)||kt})),kt=Bt?kt:void 0}}if(kt instanceof Date&&!isNaN(kt.getTime()))return vt===!0&&kt.setHours(0,0,0,0),kt;_.errorHandler(new Error("Invalid date provided: "+jt))}}};function k(j,W,_){return _===void 0&&(_=!0),_!==!1?new Date(j.getTime()).setHours(0,0,0,0)-new Date(W.getTime()).setHours(0,0,0,0):j.getTime()-W.getTime()}var O=function(j,W,_){return 3600*j+60*W+_},I=864e5;function U(j){var W=j.defaultHour,_=j.defaultMinute,at=j.defaultSeconds;if(j.minDate!==void 0){var ct=j.minDate.getHours(),pt=j.minDate.getMinutes(),Et=j.minDate.getSeconds();W<ct&&(W=ct),W===ct&&_<pt&&(_=pt),W===ct&&_===pt&&at<Et&&(at=j.minDate.getSeconds())}if(j.maxDate!==void 0){var vt=j.maxDate.getHours(),yt=j.maxDate.getMinutes();
4671(W=Math.min(W,vt))===vt&&(_=Math.min(yt,_)),W===vt&&_===yt&&(at=j.maxDate.getSeconds())}return{hours:W,minutes:_,seconds:at}}typeof Object.assign!="function"&&(Object.assign=function(j){for(var W=[],_=1;_<arguments.length;_++)W[_-1]=arguments[_];if(!j)throw TypeError("Cannot convert undefined or null to object");for(var at=function(vt){vt&&Object.keys(vt).forEach((function(yt){return j[yt]=vt[yt]}))},ct=0,pt=W;ct<pt.length;ct++){var Et=pt[ct];at(Et)}return j});function V(j,W){var _={config:i(i({},n),X.defaultConfig),l10n:s};function at(){var st;return((st=_.calendarContainer)===null||st===void 0?void 0:st.getRootNode()).activeElement||document.activeElement}function ct(st){return st.bind(_)}function pt(){var st=_.config;st.weekNumbers===!1&&st.showMonths===1||st.noCalendar!==!0&&window.requestAnimationFrame((function(){if(_.calendarContainer!==void 0&&(_.calendarContainer.style.visibility="hidden",_.calendarContainer.style.display="block"),_.daysContainer!==void 0){var rt=(_.days.offsetWidth+1)*st.showMonths;_.daysContainer.style.width=rt+"px",_.calendarContainer.style.width=rt+(_.weekWrapper!==void 0?_.weekWrapper.offsetWidth:0)+"px",_.calendarContainer.style.removeProperty("visibility"),_.calendarContainer.style.removeProperty("display")}}))}function Et(st){if(_.selectedDates.length===0){var rt=_.config.minDate===void 0||k(new Date,_.config.minDate)>=0?new Date:new Date(_.config.minDate.getTime()),Tt=U(_.config);rt.setHours(Tt.hours,Tt.minutes,Tt.seconds,rt.getMilliseconds()),_.selectedDates=[rt],_.latestSelectedDateObj=rt}st!==void 0&&st.type!=="blur"&&(function(he){he.preventDefault();var se=he.type==="keydown",ye=g(he),be=ye;_.amPM!==void 0&&ye===_.amPM&&(_.amPM.textContent=_.l10n.amPM[o(_.amPM.textContent===_.l10n.amPM[0])]);var fn=parseFloat(be.getAttribute("min")),qe=parseFloat(be.getAttribute("max")),xn=parseFloat(be.getAttribute("step")),vn=parseInt(be.value,10),jn=he.delta||(se?he.which===38?1:-1:0),Fn=vn+xn*jn;if(be.value!==void 0&&be.value.length===2){var si=be===_.hourElement,Ti=be===_.minuteElement;Fn<fn?(Fn=qe+Fn+o(!si)+(o(si)&&o(!_.amPM)),Ti&&Gt(void 0,-1,_.hourElement)):Fn>qe&&(Fn=be===_.hourElement?Fn-qe-o(!_.amPM):fn,Ti&&Gt(void 0,1,_.hourElement)),_.amPM&&si&&(xn===1?Fn+vn===23:Math.abs(Fn-vn)>xn)&&(_.amPM.textContent=_.l10n.amPM[o(_.amPM.textContent===_.l10n.amPM[0])]),be.value=r(Fn)}})(st);var Dt=_._input.value;vt(),xt(),_._input.value!==Dt&&_._debouncedChange()}function vt(){if(_.hourElement!==void 0&&_.minuteElement!==void 0){var st,rt,Tt=(parseInt(_.hourElement.value.slice(-2),10)||0)%24,Dt=(parseInt(_.minuteElement.value,10)||0)%60,he=_.secondElement!==void 0?(parseInt(_.secondElement.value,10)||0)%60:0;_.amPM!==void 0&&(st=Tt,rt=_.amPM.textContent,Tt=st%12+12*o(rt===_.l10n.amPM[1]));var se=_.config.minTime!==void 0||_.config.minDate&&_.minDateHasTime&&_.latestSelectedDateObj&&k(_.latestSelectedDateObj,_.config.minDate,!0)===0,ye=_.config.maxTime!==void 0||_.config.maxDate&&_.maxDateHasTime&&_.latestSelectedDateObj&&k(_.latestSelectedDateObj,_.config.maxDate,!0)===0;if(_.config.maxTime!==void 0&&_.config.minTime!==void 0&&_.config.minTime>_.config.maxTime){var be=O(_.config.minTime.getHours(),_.config.minTime.getMinutes(),_.config.minTime.getSeconds()),fn=O(_.config.maxTime.getHours(),_.config.maxTime.getMinutes(),_.config.maxTime.getSeconds()),qe=O(Tt,Dt,he);if(qe>fn&&qe<be){var xn=(function(Fn){var si=Math.floor(Fn/3600),Ti=(Fn-3600*si)/60;return[si,Ti,Fn-3600*si-60*Ti]})(be);Tt=xn[0],Dt=xn[1],he=xn[2]}}else{if(ye){var vn=_.config.maxTime!==void 0?_.config.maxTime:_.config.maxDate;(Tt=Math.min(Tt,vn.getHours()))===vn.getHours()&&(Dt=Math.min(Dt,vn.getMinutes())),Dt===vn.getMinutes()&&(he=Math.min(he,vn.getSeconds()))}if(se){var jn=_.config.minTime!==void 0?_.config.minTime:_.config.minDate;(Tt=Math.max(Tt,jn.getHours()))===jn.getHours()&&Dt<jn.getMinutes()&&(Dt=jn.getMinutes()),Dt===jn.getMinutes()&&(he=Math.max(he,jn.getSeconds()))}}kt(Tt,Dt,he)}}function yt(st){var rt=st||_.latestSelectedDateObj;rt&&rt instanceof Date&&kt(rt.getHours(),rt.getMinutes(),rt.getSeconds())}function kt(st,rt,Tt){_.latestSelectedDateObj!==void 0&&_.latestSelectedDateObj.setHours(st%24,rt,Tt||0,0),_.hourElement&&_.minuteElement&&!_.isMobile&&(_.hourElement.value=r(_.config.time_24hr?st:(12+st)%12+12*o(st%12==0)),_.minuteElement.value=r(rt),_.amPM!==void 0&&(_.amPM.textContent=_.l10n.amPM[o(st>=12)]),_.secondElement!==void 0&&(_.secondElement.value=r(Tt)))}function Wt(st){var rt=g(st),Tt=parseInt(rt.value)+(st.delta||0);(Tt/1e3>1||st.key==="Enter"&&!/[^\d]/.test(Tt.toString()))&&It(Tt)}function jt(st,rt,Tt,Dt){return rt instanceof Array?rt.forEach((function(he){return jt(st,he,Tt,Dt)})):st instanceof Array?st.forEach((function(he){return jt(he,rt,Tt,Dt)})):(st.addEventListener(rt,Tt,Dt),void _._handlers.push({remove:function(){return st.removeEventListener(rt,Tt,Dt)}}))}function ae(){Re("onChange")}function ee(st,rt){var Tt=st!==void 0?_.parseDate(st):_.latestSelectedDateObj||(_.config.minDate&&_.config.minDate>_.now?_.config.minDate:_.config.maxDate&&_.config.maxDate<_.now?_.config.maxDate:_.now),Dt=_.currentYear,he=_.currentMonth;try{Tt!==void 0&&(_.currentYear=Tt.getFullYear(),_.currentMonth=Tt.getMonth())}catch(se){se.message="Invalid date supplied: "+Tt,_.config.errorHandler(se)}rt&&_.currentYear!==Dt&&(Re("onYearChange"),gt()),!rt||_.currentYear===Dt&&_.currentMonth===he||Re("onMonthChange"),_.redraw()}function Bt(st){var rt=g(st);~rt.className.indexOf("arrow")&&Gt(st,rt.classList.contains("arrowUp")?1:-1)}function Gt(st,rt,Tt){var Dt=st&&g(st),he=Tt||Dt&&Dt.parentNode&&Dt.parentNode.firstChild,se=Ft("increment");se.delta=rt,he&&he.dispatchEvent(se)}function Qt(st,rt,Tt,Dt){var he=Cn(rt,!0),se=u("span",st,rt.getDate().toString());return se.dateObj=rt,se.$i=Dt,se.setAttribute("aria-label",_.formatDate(rt,_.config.ariaDateFormat)),st.indexOf("hidden")===-1&&k(rt,_.now)===0&&(_.todayDateElem=se,se.classList.add("today"),se.setAttribute("aria-current","date")),he?(se.tabIndex=-1,Ee(rt)&&(se.classList.add("selected"),_.selectedDateElem=se,_.config.mode==="range"&&(c(se,"startRange",_.selectedDates[0]&&k(rt,_.selectedDates[0],!0)===0),c(se,"endRange",_.selectedDates[1]&&k(rt,_.selectedDates[1],!0)===0),st==="nextMonthDay"&&se.classList.add("inRange")))):se.classList.add("flatpickr-disabled"),_.config.mode==="range"&&(function(ye){return!(_.config.mode!=="range"||_.selectedDates.length<2)&&k(ye,_.selectedDates[0])>=0&&k(ye,_.selectedDates[1])<=0})(rt)&&!Ee(rt)&&se.classList.add("inRange"),_.weekNumbers&&_.config.showMonths===1&&st!=="prevMonthDay"&&Dt%7==6&&_.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+_.config.getWeek(rt)+"</span>"),Re("onDayCreate",se),se}function xe(st){st.focus(),_.config.mode==="range"&&Vt(st)}function Ut(st){for(var rt=st>0?0:_.config.showMonths-1,Tt=st>0?_.config.showMonths:-1,Dt=rt;Dt!=Tt;Dt+=st)for(var he=_.daysContainer.children[Dt],se=st>0?0:he.children.length-1,ye=st>0?he.children.length:-1,be=se;be!=ye;be+=st){var fn=he.children[be];if(fn.className.indexOf("hidden")===-1&&Cn(fn.dateObj))return fn}}function zt(st,rt){var Tt=at(),Dt=mn(Tt||document.body),he=st!==void 0?st:Dt?Tt:_.selectedDateElem!==void 0&&mn(_.selectedDateElem)?_.selectedDateElem:_.todayDateElem!==void 0&&mn(_.todayDateElem)?_.todayDateElem:Ut(rt>0?1:-1);he===void 0?_._input.focus():Dt?(function(se,ye){for(var be=se.className.indexOf("Month")===-1?se.dateObj.getMonth():_.currentMonth,fn=ye>0?_.config.showMonths:-1,qe=ye>0?1:-1,xn=be-_.currentMonth;xn!=fn;xn+=qe)for(var vn=_.daysContainer.children[xn],jn=be-_.currentMonth===xn?se.$i+ye:ye<0?vn.children.length-1:0,Fn=vn.children.length,si=jn;si>=0&&si<Fn&&si!=(ye>0?Fn:-1);si+=qe){var Ti=vn.children[si];if(Ti.className.indexOf("hidden")===-1&&Cn(Ti.dateObj)&&Math.abs(se.$i-si)>=Math.abs(ye))return xe(Ti)}_.changeMonth(qe),zt(Ut(qe),0)})(he,rt):xe(he)}function St(st,rt){for(var Tt=(new Date(st,rt,1).getDay()-_.l10n.firstDayOfWeek+7)%7,Dt=_.utils.getDaysInMonth((rt-1+12)%12,st),he=_.utils.getDaysInMonth(rt,st),se=window.document.createDocumentFragment(),ye=_.config.showMonths>1,be=ye?"prevMonthDay hidden":"prevMonthDay",fn=ye?"nextMonthDay hidden":"nextMonthDay",qe=Dt+1-Tt,xn=0;qe<=Dt;qe++,xn++)se.appendChild(Qt("flatpickr-day "+be,new Date(st,rt-1,qe),0,xn));for(qe=1;qe<=he;qe++,xn++)se.appendChild(Qt("flatpickr-day",new Date(st,rt,qe),0,xn));for(var vn=he+1;vn<=42-Tt&&(_.config.showMonths===1||xn%7!=0);vn++,xn++)se.appendChild(Qt("flatpickr-day "+fn,new Date(st,rt+1,vn%he),0,xn));var jn=u("div","dayContainer");return jn.appendChild(se),jn}function it(){if(_.daysContainer!==void 0){h(_.daysContainer),_.weekNumbers&&h(_.weekNumbers);for(var st=document.createDocumentFragment(),rt=0;rt<_.config.showMonths;rt++){var Tt=new Date(_.currentYear,_.currentMonth,1);Tt.setMonth(_.currentMonth+rt),st.appendChild(St(Tt.getFullYear(),Tt.getMonth()))}_.daysContainer.appendChild(st),_.days=_.daysContainer.firstChild,_.config.mode==="range"&&_.selectedDates.length===1&&Vt()}}function gt(){if(!(_.config.showMonths>1||_.config.monthSelectorType!=="dropdown")){var st=function(Dt){return!(_.config.minDate!==void 0&&_.currentYear===_.config.minDate.getFullYear()&&Dt<_.config.minDate.getMonth())&&!(_.config.maxDate!==void 0&&_.currentYear===_.config.maxDate.getFullYear()&&Dt>_.config.maxDate.getMonth())};_.monthsDropdownContainer.tabIndex=-1,_.monthsDropdownContainer.innerHTML="";for(var rt=0;rt<12;rt++)if(st(rt)){var Tt=u("option","flatpickr-monthDropdown-month");Tt.value=new Date(_.currentYear,rt).getMonth().toString(),Tt.textContent=x(rt,_.config.shorthandCurrentMonth,_.l10n),Tt.tabIndex=-1,_.currentMonth===rt&&(Tt.selected=!0),_.monthsDropdownContainer.appendChild(Tt)}}}function ft(){var st,rt=u("div","flatpickr-month"),Tt=window.document.createDocumentFragment();_.config.showMonths>1||_.config.monthSelectorType==="static"?st=u("span","cur-month"):(_.monthsDropdownContainer=u("select","flatpickr-monthDropdown-months"),_.monthsDropdownContainer.setAttribute("aria-label",_.l10n.monthAriaLabel),jt(_.monthsDropdownContainer,"change",(function(ye){var be=g(ye),fn=parseInt(be.value,10);_.changeMonth(fn-_.currentMonth),Re("onMonthChange")})),gt(),st=_.monthsDropdownContainer);var Dt=p("cur-year",{tabindex:"-1"}),he=Dt.getElementsByTagName("input")[0];he.setAttribute("aria-label",_.l10n.yearAriaLabel),_.config.minDate&&he.setAttribute("min",_.config.minDate.getFullYear().toString()),_.config.maxDate&&(he.setAttribute("max",_.config.maxDate.getFullYear().toString()),he.disabled=!!_.config.minDate&&_.config.minDate.getFullYear()===_.config.maxDate.getFullYear());var se=u("div","flatpickr-current-month");return se.appendChild(st),se.appendChild(Dt),Tt.appendChild(se),rt.appendChild(Tt),{container:rt,yearElement:he,monthElement:st}}function de(){h(_.monthNav),_.monthNav.appendChild(_.prevMonthNav),_.config.showMonths&&(_.yearElements=[],_.monthElements=[]);for(var st=_.config.showMonths;st--;){var rt=ft();_.yearElements.push(rt.yearElement),_.monthElements.push(rt.monthElement),_.monthNav.appendChild(rt.container)}_.monthNav.appendChild(_.nextMonthNav)}function ve(){_.weekdayContainer?h(_.weekdayContainer):_.weekdayContainer=u("div","flatpickr-weekdays");for(var st=_.config.showMonths;st--;){var rt=u("div","flatpickr-weekdaycontainer");_.weekdayContainer.appendChild(rt)}return we(),_.weekdayContainer}function we(){if(_.weekdayContainer){var st=_.l10n.firstDayOfWeek,rt=t(_.l10n.weekdays.shorthand);st>0&&st<rt.length&&(rt=t(rt.splice(st,rt.length),rt.splice(0,st)));for(var Tt=_.config.showMonths;Tt--;)_.weekdayContainer.children[Tt].innerHTML=`
4672      <span class='flatpickr-weekday'>
4673        `+rt.join("</span><span class='flatpickr-weekday'>")+`
4674      </span>
4675      `}}function Ae(st,rt){rt===void 0&&(rt=!0);var Tt=rt?st:st-_.currentMonth;Tt<0&&_._hidePrevMonthArrow===!0||Tt>0&&_._hideNextMonthArrow===!0||(_.currentMonth+=Tt,(_.currentMonth<0||_.currentMonth>11)&&(_.currentYear+=_.currentMonth>11?1:-1,_.currentMonth=(_.currentMonth+12)%12,Re("onYearChange"),gt()),it(),Re("onMonthChange"),J())}function Ue(st){return _.calendarContainer.contains(st)}function en(st){if(_.isOpen&&!_.config.inline){var rt=g(st),Tt=Ue(rt),Dt=!(rt===_.input||rt===_.altInput||_.element.contains(rt)||st.path&&st.path.indexOf&&(~st.path.indexOf(_.input)||~st.path.indexOf(_.altInput)))&&!Tt&&!Ue(st.relatedTarget),he=!_.config.ignoredFocusElements.some((function(se){return se.contains(rt)}));Dt&&he&&(_.config.allowInput&&_.setDate(_._input.value,!1,_.config.altInput?_.config.altFormat:_.config.dateFormat),_.timeContainer!==void 0&&_.minuteElement!==void 0&&_.hourElement!==void 0&&_.input.value!==""&&_.input.value!==void 0&&Et(),_.close(),_.config&&_.config.mode==="range"&&_.selectedDates.length===1&&_.clear(!1))}}function It(st){if(!(!st||_.config.minDate&&st<_.config.minDate.getFullYear()||_.config.maxDate&&st>_.config.maxDate.getFullYear())){var rt=st,Tt=_.currentYear!==rt;_.currentYear=rt||_.currentYear,_.config.maxDate&&_.currentYear===_.config.maxDate.getFullYear()?_.currentMonth=Math.min(_.config.maxDate.getMonth(),_.currentMonth):_.config.minDate&&_.currentYear===_.config.minDate.getFullYear()&&(_.currentMonth=Math.max(_.config.minDate.getMonth(),_.currentMonth)),Tt&&(_.redraw(),Re("onYearChange"),gt())}}function Cn(st,rt){var Tt;rt===void 0&&(rt=!0);var Dt=_.parseDate(st,void 0,rt);if(_.config.minDate&&Dt&&k(Dt,_.config.minDate,rt!==void 0?rt:!_.minDateHasTime)<0||_.config.maxDate&&Dt&&k(Dt,_.config.maxDate,rt!==void 0?rt:!_.maxDateHasTime)>0)return!1;if(!_.config.enable&&_.config.disable.length===0)return!0;if(Dt===void 0)return!1;for(var he=!!_.config.enable,se=(Tt=_.config.enable)!==null&&Tt!==void 0?Tt:_.config.disable,ye=0,be=void 0;ye<se.length;ye++){if(typeof(be=se[ye])=="function"&&be(Dt)||be instanceof Date&&Dt!==void 0&&be.getTime()===Dt.getTime())return he;if(typeof be=="string"){var fn=_.parseDate(be,void 0,!0);return fn&&fn.getTime()===Dt.getTime()?he:!he}if(typeof be=="object"&&Dt!==void 0&&be.from&&be.to&&Dt.getTime()>=be.from.getTime()&&Dt.getTime()<=be.to.getTime())return he}return!he}function mn(st){return _.daysContainer!==void 0&&st.className.indexOf("hidden")===-1&&st.className.indexOf("flatpickr-disabled")===-1&&_.daysContainer.contains(st)}function mt(st){var rt=st.target===_._input,Tt=_._input.value.trimEnd()!==lt();!rt||!Tt||st.relatedTarget&&Ue(st.relatedTarget)||_.setDate(_._input.value,!0,st.target===_.altInput?_.config.altFormat:_.config.dateFormat)}function K(st){var rt=g(st),Tt=_.config.wrap?j.contains(rt):rt===_._input,Dt=_.config.allowInput,he=_.isOpen&&(!Dt||!Tt),se=_.config.inline&&Tt&&!Dt;if(st.keyCode===13&&Tt){if(Dt)return _.setDate(_._input.value,!0,rt===_.altInput?_.config.altFormat:_.config.dateFormat),_.close(),rt.blur();_.open()}else if(Ue(rt)||he||se){var ye=!!_.timeContainer&&_.timeContainer.contains(rt);switch(st.keyCode){case 13:ye?(st.preventDefault(),Et(),Zt()):fe(st);break;case 27:st.preventDefault(),Zt();break;case 8:case 46:Tt&&!_.config.allowInput&&(st.preventDefault(),_.clear());break;case 37:case 39:if(ye||Tt)_.hourElement&&_.hourElement.focus();else{st.preventDefault();var be=at();if(_.daysContainer!==void 0&&(Dt===!1||be&&mn(be))){var fn=st.keyCode===39?1:-1;st.ctrlKey?(st.stopPropagation(),Ae(fn),zt(Ut(1),0)):zt(void 0,fn)}}break;case 38:case 40:st.preventDefault();var qe=st.keyCode===40?1:-1;_.daysContainer&&rt.$i!==void 0||rt===_.input||rt===_.altInput?st.ctrlKey?(st.stopPropagation(),It(_.currentYear-qe),zt(Ut(1),0)):ye||zt(void 0,7*qe):rt===_.currentYearElement?It(_.currentYear-qe):_.config.enableTime&&(!ye&&_.hourElement&&_.hourElement.focus(),Et(st),_._debouncedChange());break;
4675case 9:if(ye){var xn=[_.hourElement,_.minuteElement,_.secondElement,_.amPM].concat(_.pluginElements).filter((function(Fn){return Fn})),vn=xn.indexOf(rt);if(vn!==-1){var jn=xn[vn+(st.shiftKey?-1:1)];st.preventDefault(),(jn||_._input).focus()}}else!_.config.noCalendar&&_.daysContainer&&_.daysContainer.contains(rt)&&st.shiftKey&&(st.preventDefault(),_._input.focus())}}if(_.amPM!==void 0&&rt===_.amPM)switch(st.key){case _.l10n.amPM[0].charAt(0):case _.l10n.amPM[0].charAt(0).toLowerCase():_.amPM.textContent=_.l10n.amPM[0],vt(),xt();break;case _.l10n.amPM[1].charAt(0):case _.l10n.amPM[1].charAt(0).toLowerCase():_.amPM.textContent=_.l10n.amPM[1],vt(),xt()}(Tt||Ue(rt))&&Re("onKeyDown",st)}function Vt(st,rt){if(rt===void 0&&(rt="flatpickr-day"),_.selectedDates.length===1&&(!st||st.classList.contains(rt)&&!st.classList.contains("flatpickr-disabled"))){for(var Tt=st?st.dateObj.getTime():_.days.firstElementChild.dateObj.getTime(),Dt=_.parseDate(_.selectedDates[0],void 0,!0).getTime(),he=Math.min(Tt,_.selectedDates[0].getTime()),se=Math.max(Tt,_.selectedDates[0].getTime()),ye=!1,be=0,fn=0,qe=he;qe<se;qe+=I)Cn(new Date(qe),!0)||(ye=ye||qe>he&&qe<se,qe<Dt&&(!be||qe>be)?be=qe:qe>Dt&&(!fn||qe<fn)&&(fn=qe));Array.from(_.rContainer.querySelectorAll("*:nth-child(-n+"+_.config.showMonths+") >
4675 ."+rt)).forEach((function(xn){var vn,jn,Fn,si=xn.dateObj.getTime(),Ti=be>0&&si<be||fn>0&&si>fn;if(Ti)return xn.classList.add("notAllowed"),void["inRange","startRange","endRange"].forEach((function(Yi){xn.classList.remove(Yi)}));ye&&!Ti||(["startRange","inRange","endRange","notAllowed"].forEach((function(Yi){xn.classList.remove(Yi)})),st!==void 0&&(st.classList.add(Tt<=_.selectedDates[0].getTime()?"startRange":"endRange"),Dt<Tt&&si===Dt?xn.classList.add("startRange"):Dt>Tt&&si===Dt&&xn.classList.add("endRange"),si>=be&&(fn===0||si<=fn)&&(jn=Dt,Fn=Tt,(vn=si)>Math.min(jn,Fn)&&vn<Math.max(jn,Fn))&&xn.classList.add("inRange")))}))}}function te(){!_.isOpen||_.config.static||_.config.inline||ie()}function Nt(st){return function(rt){var Tt=_.config["_"+st+"Date"]=_.parseDate(rt,_.config.dateFormat),Dt=_.config["_"+(st==="min"?"max":"min")+"Date"];Tt!==void 0&&(_[st==="min"?"minDateHasTime":"maxDateHasTime"]=Tt.getHours()>0||Tt.getMinutes()>0||Tt.getSeconds()>0),_.selectedDates&&(_.selectedDates=_.selectedDates.filter((function(he){return Cn(he)})),_.selectedDates.length||st!=="min"||yt(Tt),xt()),_.daysContainer&&(_t(),Tt!==void 0?_.currentYearElement[st]=Tt.getFullYear().toString():_.currentYearElement.removeAttribute(st),_.currentYearElement.disabled=!!Dt&&Tt!==void 0&&Dt.getFullYear()===Tt.getFullYear())}}function Se(){return _.config.wrap?j.querySelector("[data-input]"):j}function Me(){typeof _.config.locale!="object"&&X.l10ns[_.config.locale]===void 0&&_.config.errorHandler(new Error("flatpickr: invalid locale "+_.config.locale)),_.l10n=i(i({},X.l10ns.default),typeof _.config.locale=="object"?_.config.locale:_.config.locale!=="default"?X.l10ns[_.config.locale]:void 0),M.D="("+_.l10n.weekdays.shorthand.join("|")+")",M.l="("+_.l10n.weekdays.longhand.join("|")+")",M.M="("+_.l10n.months.shorthand.join("|")+")",M.F="("+_.l10n.months.longhand.join("|")+")",M.K="("+_.l10n.amPM[0]+"|"+_.l10n.amPM[1]+"|"+_.l10n.amPM[0].toLowerCase()+"|"+_.l10n.amPM[1].toLowerCase()+")",i(i({},W),JSON.parse(JSON.stringify(j.dataset||{}))).time_24hr===void 0&&X.defaultConfig.time_24hr===void 0&&(_.config.time_24hr=_.l10n.time_24hr),_.formatDate=C(_),_.parseDate=R({config:_.config,l10n:_.l10n})}function ie(st){if(typeof _.config.position!="function"){if(_.calendarContainer!==void 0){Re("onPreCalendarPosition");var rt=st||_._positionElement,Tt=Array.prototype.reduce.call(_.calendarContainer.children,(function(Dn,Xe){return Dn+Xe.offsetHeight}),0),Dt=_.calendarContainer.offsetWidth,he=_.config.position.split(" "),se=he[0],ye=he.length>1?he[1]:null,be=rt.getBoundingClientRect(),fn=window.innerHeight-be.bottom,qe=se==="above"||se!=="below"&&fn<Tt&&be.top>Tt,xn=window.pageYOffset+be.top+(qe?-Tt-2:rt.offsetHeight+2);if(c(_.calendarContainer,"arrowTop",!qe),c(_.calendarContainer,"arrowBottom",qe),!_.config.inline){var vn=window.pageXOffset+be.left,jn=!1,Fn=!1;ye==="center"?(vn-=(Dt-be.width)/2,jn=!0):ye==="right"&&(vn-=Dt-be.width,Fn=!0),c(_.calendarContainer,"arrowLeft",!jn&&!Fn),c(_.calendarContainer,"arrowCenter",jn),c(_.calendarContainer,"arrowRight",Fn);var si=window.document.body.offsetWidth-(window.pageXOffset+be.right),Ti=vn+Dt>window.document.body.offsetWidth,Yi=si+Dt>window.document.body.offsetWidth;if(c(_.calendarContainer,"rightMost",Ti),!_.config.static)if(_.calendarContainer.style.top=xn+"px",Ti)if(Yi){var _s=(function(){for(var Dn=null,Xe=0;Xe<document.styleSheets.length;Xe++){var mi=document.styleSheets[Xe];if(mi.cssRules){try{mi.cssRules}catch{continue}Dn=mi;break}}return Dn??(Qi=document.createElement("style"),document.head.appendChild(Qi),Qi.sheet);var Qi})();if(_s===void 0)return;var Pt=window.document.body.offsetWidth,ze=Math.max(0,Pt/2-Dt/2),Ie=_s.cssRules.length,En="{left:"+be.left+"px;right:auto;}";c(_.calendarContainer,"rightMost",!1),c(_.calendarContainer,"centerMost",!0),_s.insertRule(".flatpickr-calendar.centerMost:before,.flatpickr-calendar.centerMost:after"+En,Ie),_.calendarContainer.style.left=ze+"px",_.calendarContainer.style.right="auto"}else _.calendarContainer.style.left="auto",_.calendarContainer.style.right=si+"px";else _.calendarContainer.style.left=vn+"px",_.calendarContainer.style.right="auto"}}}else _.config.position(_,st)}function _t(){_.config.noCalendar||_.isMobile||(gt(),J(),it())}function Zt(){_._input.focus(),window.navigator.userAgent.indexOf("MSIE")!==-1||navigator.msMaxTouchPoints!==void 0?setTimeout(_.close,0):_.close()}function fe(st){st.preventDefault(),st.stopPropagation();var rt=d(g(st),(function(qe){return qe.classList&&qe.classList.contains("flatpickr-day")&&!qe.classList.contains("flatpickr-disabled")&&!qe.classList.contains("notAllowed")}));if(rt!==void 0){var Tt=rt,Dt=_.latestSelectedDateObj=new Date(Tt.dateObj.getTime()),he=(Dt.getMonth()<_.currentMonth||Dt.getMonth()>_.currentMonth+_.config.showMonths-1)&&_.config.mode!=="range";if(_.selectedDateElem=Tt,_.config.mode==="single")_.selectedDates=[Dt];else if(_.config.mode==="multiple"){var se=Ee(Dt);se?_.selectedDates.splice(parseInt(se),1):_.selectedDates.push(Dt)}else _.config.mode==="range"&&(_.selectedDates.length===2&&_.clear(!1,!1),_.latestSelectedDateObj=Dt,_.
4675selectedDates.push(Dt),k(Dt,_.selectedDates[0],!0)!==0&&_.selectedDates.sort((function(qe,xn){return qe.getTime()-xn.getTime()})));if(vt(),he){var ye=_.currentYear!==Dt.getFullYear();_.currentYear=Dt.getFullYear(),_.currentMonth=Dt.getMonth(),ye&&(Re("onYearChange"),gt()),Re("onMonthChange")}if(J(),it(),xt(),he||_.config.mode==="range"||_.config.showMonths!==1?_.selectedDateElem!==void 0&&_.hourElement===void 0&&_.selectedDateElem&&_.selectedDateElem.focus():xe(Tt),_.hourElement!==void 0&&_.hourElement!==void 0&&_.hourElement.focus(),_.config.closeOnSelect){var be=_.config.mode==="single"&&!_.config.enableTime,fn=_.config.mode==="range"&&_.selectedDates.length===2&&!_.config.enableTime;(be||fn)&&Zt()}ae()}}_.parseDate=R({config:_.config,l10n:_.l10n}),_._handlers=[],_.pluginElements=[],_.loadedPlugins=[],_._bind=jt,_._setHoursFromDate=yt,_._positionCalendar=ie,_.changeMonth=Ae,_.changeYear=It,_.clear=function(st,rt){if(st===void 0&&(st=!0),rt===void 0&&(rt=!0),_.input.value="",_.altInput!==void 0&&(_.altInput.value=""),_.mobileInput!==void 0&&(_.mobileInput.value=""),_.selectedDates=[],_.latestSelectedDateObj=void 0,rt===!0&&(_.currentYear=_._initialDate.getFullYear(),_.currentMonth=_._initialDate.getMonth()),_.config.enableTime===!0){var Tt=U(_.config),Dt=Tt.hours,he=Tt.minutes,se=Tt.seconds;kt(Dt,he,se)}_.redraw(),st&&Re("onChange")},_.close=function(){_.isOpen=!1,_.isMobile||(_.calendarContainer!==void 0&&_.calendarContainer.classList.remove("open"),_._input!==void 0&&_._input.classList.remove("active")),Re("onClose")},_.onMouseOver=Vt,_._createElement=u,_.createDay=Qt,_.destroy=function(){_.config!==void 0&&Re("onDestroy");for(var st=_._handlers.length;st--;)_._handlers[st].remove();if(_._handlers=[],_.mobileInput)_.mobileInput.parentNode&&_.mobileInput.parentNode.removeChild(_.mobileInput),_.mobileInput=void 0;else if(_.calendarContainer&&_.calendarContainer.parentNode)if(_.config.static&&_.calendarContainer.parentNode){var rt=_.calendarContainer.parentNode;if(rt.lastChild&&rt.removeChild(rt.lastChild),rt.parentNode){for(;rt.firstChild;)rt.parentNode.insertBefore(rt.firstChild,rt);rt.parentNode.removeChild(rt)}}else _.calendarContainer.parentNode.removeChild(_.calendarContainer);_.altInput&&(_.input.type="text",_.altInput.parentNode&&_.altInput.parentNode.removeChild(_.altInput),delete _.altInput),_.input&&(_.input.type=_.input._type,_.input.classList.remove("flatpickr-input"),_.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(Tt){try{delete _[Tt]}catch{}}))},_.isEnabled=Cn,_.jumpToDate=ee,_.updateValue=xt,_.open=function(st,rt){if(rt===void 0&&(rt=_._positionElement),_.isMobile===!0){if(st){st.preventDefault();var Tt=g(st);Tt&&Tt.blur()}return _.mobileInput!==void 0&&(_.mobileInput.focus(),_.mobileInput.click()),void Re("onOpen")}if(!(_._input.disabled||_.config.inline)){var Dt=_.isOpen;_.isOpen=!0,Dt||(_.calendarContainer.classList.add("open"),_._input.classList.add("active"),Re("onOpen"),ie(rt)),_.config.enableTime===!0&&_.config.noCalendar===!0&&(_.config.allowInput!==!1||st!==void 0&&_.timeContainer.contains(st.relatedTarget)||setTimeout((function(){return _.hourElement.select()}),50))}},_.redraw=_t,_.set=function(st,rt){if(st!==null&&typeof st=="object")for(var Tt in Object.assign(_.config,st),st)ce[Tt]!==void 0&&ce[Tt].forEach((function(Dt){return Dt()}));else _.config[st]=rt,ce[st]!==void 0?ce[st].forEach((function(Dt){return Dt()})):e.indexOf(st)>-1&&(_.config[st]=l(rt));_.redraw(),xt(!0)},_.setDate=function(st,rt,Tt){if(rt===void 0&&(rt=!1),Tt===void 0&&(Tt=_.config.dateFormat),st!==0&&!st||st instanceof Array&&st.length===0)return _.clear(rt);pe(st,Tt),_.latestSelectedDateObj=_.selectedDates[_.selectedDates.length-1],_.redraw(),ee(void 0,rt),yt(),_.selectedDates.length===0&&_.clear(!1),xt(rt),rt&&Re("onChange")},_.toggle=function(st){if(_.isOpen===!0)return _.close();_.open(st)};var ce={locale:[Me,we],showMonths:[de,pt,ve],minDate:[ee],maxDate:[ee],positionElement:[je],clickOpens:[function(){_.config.clickOpens===!0?(jt(_._input,"focus",_.open),jt(_._input,"click",_.open)):(_._input.removeEventListener("focus",_.open),_._input.removeEventListener("click",_.open))}]};function pe(st,rt){var Tt=[];if(st instanceof Array)Tt=st.map((function(Dt){return _.parseDate(Dt,rt)}));else if(st instanceof Date||typeof st=="number")Tt=[_.parseDate(st,rt)];else if(typeof st=="string")switch(_.config.mode){case"single":case"time":Tt
4675=[_.parseDate(st,rt)];break;case"multiple":Tt=st.split(_.config.conjunction).map((function(Dt){return _.parseDate(Dt,rt)}));break;case"range":Tt=st.split(_.l10n.rangeSeparator).map((function(Dt){return _.parseDate(Dt,rt)}))}else _.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(st)));_.selectedDates=_.config.allowInvalidPreload?Tt:Tt.filter((function(Dt){return Dt instanceof Date&&Cn(Dt,!1)})),_.config.mode==="range"&&_.selectedDates.sort((function(Dt,he){return Dt.getTime()-he.getTime()}))}function Fe(st){return st.slice().map((function(rt){return typeof rt=="string"||typeof rt=="number"||rt instanceof Date?_.parseDate(rt,void 0,!0):rt&&typeof rt=="object"&&rt.from&&rt.to?{from:_.parseDate(rt.from,void 0),to:_.parseDate(rt.to,void 0)}:rt})).filter((function(rt){return rt}))}function je(){_._positionElement=_.config.positionElement||_._input}function Re(st,rt){if(_.config!==void 0){var Tt=_.config[st];if(Tt!==void 0&&Tt.length>0)for(var Dt=0;Tt[Dt]&&Dt<Tt.length;Dt++)Tt[Dt](_.selectedDates,_.input.value,_,rt);st==="onChange"&&(_.input.dispatchEvent(Ft("change")),_.input.dispatchEvent(Ft("input")))}}function Ft(st){var rt=document.createEvent("Event");return rt.initEvent(st,!0,!0),rt}function Ee(st){for(var rt=0;rt<_.selectedDates.length;rt++){var Tt=_.selectedDates[rt];if(Tt instanceof Date&&k(Tt,st)===0)return""+rt}return!1}function J(){_.config.noCalendar||_.isMobile||!_.monthNav||(_.yearElements.forEach((function(st,rt){var Tt=new Date(_.currentYear,_.currentMonth,1);Tt.setMonth(_.currentMonth+rt),_.config.showMonths>1||_.config.monthSelectorType==="static"?_.monthElements[rt].textContent=x(Tt.getMonth(),_.config.shorthandCurrentMonth,_.l10n)+" ":_.monthsDropdownContainer.value=Tt.getMonth().toString(),st.value=Tt.getFullYear().toString()})),_._hidePrevMonthArrow=_.config.minDate!==void 0&&(_.currentYear===_.config.minDate.getFullYear()?_.currentMonth<=_.config.minDate.getMonth():_.currentYear<_.config.minDate.getFullYear()),_._hideNextMonthArrow=_.config.maxDate!==void 0&&(_.currentYear===_.config.maxDate.getFullYear()?_.currentMonth+1>_.config.maxDate.getMonth():_.currentYear>_.config.maxDate.getFullYear()))}function lt(st){var rt=st||(_.config.altInput?_.config.altFormat:_.config.dateFormat);return _.selectedDates.map((function(Tt){return _.formatDate(Tt,rt)})).filter((function(Tt,Dt,he){return _.config.mode!=="range"||_.config.enableTime||he.indexOf(Tt)===Dt})).join(_.config.mode!=="range"?_.config.conjunction:_.l10n.rangeSeparator)}function xt(st){st===void 0&&(st=!0),_.mobileInput!==void 0&&_.mobileFormatStr&&(_.mobileInput.value=_.latestSelectedDateObj!==void 0?_.formatDate(_.latestSelectedDateObj,_.mobileFormatStr):""),_.input.value=lt(_.config.dateFormat),_.altInput!==void 0&&(_.altInput.value=lt(_.config.altFormat)),st!==!1&&Re("onValueUpdate")}function At(st){var rt=g(st),Tt=_.prevMonthNav.contains(rt),Dt=_.nextMonthNav.contains(rt);Tt||Dt?Ae(Tt?-1:1):_.yearElements.indexOf(rt)>=0?rt.select():rt.classList.contains("arrowUp")?_.changeYear(_.currentYear+1):rt.classList.contains("arrowDown")&&_.changeYear(_.currentYear-1)}return(function(){_.element=_.input=j,_.isOpen=!1,(function(){var rt=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],Tt=i(i({},JSON.parse(JSON.stringify(j.dataset||{}))),W),Dt={};_.config.parseDate=Tt.parseDate,_.config.formatDate=Tt.formatDate,Object.defineProperty(_.config,"enable",{get:function(){return _.config._enable},set:function(vn){_.config._enable=Fe(vn)}}),Object.defineProperty(_.config,"disable",{get:function(){return _.config._disable},set:function(vn){_.config._disable=Fe(vn)}});var he=Tt.mode==="time";if(!Tt.dateFormat&&(Tt.enableTime||he)){var se=X.defaultConfig.dateFormat||n.dateFormat;Dt.dateFormat=Tt.noCalendar||he?"H:i"+(Tt.enableSeconds?":S":""):se+" H:i"+(Tt.enableSeconds?":S":"")}if(Tt.altInput&&(Tt.enableTime||he)&&!Tt.altFormat){var ye=X.defaultConfig.altFormat||n.altFormat;Dt.altFormat=Tt.noCalendar||he?"h:i"+(Tt.enableSeconds?":S K":" K"):ye+" h:i"+(Tt.enableSeconds?":S":"")+" K"}Object.defineProperty(_.config,"minDate",{get:function(){return _.config._minDate},set:Nt("min")}),Object.defineProperty(_.config,"maxDate",{get:function(){return _.config._maxDate},set:Nt("max")});var be=function(vn){return function(jn){_.config[vn==="min"?"_minTime":"_maxTime"]=_.parseDate(jn,"H:i:S")}};Object.defineProperty(_.config,"minTime",{get:function(){return _.config._minTime},set:be("min")}),Object.defineProperty(_.config,"maxTime",{get:function(){return _.config._maxTime},set:be("max")}),Tt.mode==="time"&&(_.config.noCalendar=!0,_.config.enableTime=!0),Object.assign(_.config,Dt,Tt);for(var fn=0;fn<rt.length;fn++)_.config[rt[fn]]=_.config[rt[fn]]===!0||_.config[rt[fn]]==="true";for(e.filter((function(vn){return _.config[vn]!==void 0}
4675)).forEach((function(vn){_.config[vn]=l(_.config[vn]||[]).map(ct)})),_.isMobile=!_.config.disableMobile&&!_.config.inline&&_.config.mode==="single"&&!_.config.disable.length&&!_.config.enable&&!_.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),fn=0;fn<_.config.plugins.length;fn++){var qe=_.config.plugins[fn](_)||{};for(var xn in qe)e.indexOf(xn)>-1?_.config[xn]=l(qe[xn]).map(ct).concat(_.config[xn]):Tt[xn]===void 0&&(_.config[xn]=qe[xn])}Tt.altInputClass||(_.config.altInputClass=Se().className+" "+_.config.altInputClass),Re("onParseConfig")})(),Me(),(function(){if(_.input=Se(),!_.input)return void _.config.errorHandler(new Error("Invalid input element specified"));_.input._type=_.input.type,_.input.type="text",_.input.classList.add("flatpickr-input"),_._input=_.input,_.config.altInput&&(_.altInput=u(_.input.nodeName,_.config.altInputClass),_._input=_.altInput,_.altInput.placeholder=_.input.placeholder,_.altInput.disabled=_.input.disabled,_.altInput.required=_.input.required,_.altInput.tabIndex=_.input.tabIndex,_.altInput.type="text",_.input.setAttribute("type","hidden"),!_.config.static&&_.input.parentNode&&_.input.parentNode.insertBefore(_.altInput,_.input.nextSibling)),_.config.allowInput||_._input.setAttribute("readonly","readonly"),je()})(),(function(){_.selectedDates=[],_.now=_.parseDate(_.config.now)||new Date;var rt=_.config.defaultDate||(_.input.nodeName!=="INPUT"&&_.input.nodeName!=="TEXTAREA"||!_.input.placeholder||_.input.value!==_.input.placeholder?_.input.value:null);rt&&pe(rt,_.config.dateFormat),_._initialDate=_.selectedDates.length>0?_.selectedDates[0]:_.config.minDate&&_.config.minDate.getTime()>_.now.getTime()?_.config.minDate:_.config.maxDate&&_.config.maxDate.getTime()<_.now.getTime()?_.config.maxDate:_.now,_.currentYear=_._initialDate.getFullYear(),_.currentMonth=_._initialDate.getMonth(),_.selectedDates.length>0&&(_.latestSelectedDateObj=_.selectedDates[0]),_.config.minTime!==void 0&&(_.config.minTime=_.parseDate(_.config.minTime,"H:i")),_.config.maxTime!==void 0&&(_.config.maxTime=_.parseDate(_.config.maxTime,"H:i")),_.minDateHasTime=!!_.config.minDate&&(_.config.minDate.getHours()>0||_.config.minDate.getMinutes()>0||_.config.minDate.getSeconds()>0),_.maxDateHasTime=!!_.config.maxDate&&(_.config.maxDate.getHours()>0||_.config.maxDate.getMinutes()>0||_.config.maxDate.getSeconds()>0)})(),_.utils={getDaysInMonth:function(rt,Tt){return rt===void 0&&(rt=_.currentMonth),Tt===void 0&&(Tt=_.currentYear),rt===1&&(Tt%4==0&&Tt%100!=0||Tt%400==0)?29:_.l10n.daysInMonth[rt]}},_.isMobile||(function(){var rt=window.document.createDocumentFragment();if(_.calendarContainer=u("div","flatpickr-calendar"),_.calendarContainer.tabIndex=-1,!_.config.noCalendar){if(rt.appendChild((_.monthNav=u("div","flatpickr-months"),_.yearElements=[],_.monthElements=[],_.prevMonthNav=u("span","flatpickr-prev-month"),_.prevMonthNav.innerHTML=_.config.prevArrow,_.nextMonthNav=u("span","flatpickr-next-month"),_.nextMonthNav.innerHTML=_.config.nextArrow,de(),Object.defineProperty(_,"_hidePrevMonthArrow",{get:function(){return _.__hidePrevMonthArrow},set:function(be){_.__hidePrevMonthArrow!==be&&(c(_.prevMonthNav,"flatpickr-disabled",be),_.__hidePrevMonthArrow=be)}}),Object.defineProperty(_,"_hideNextMonthArrow",{get:function(){return _.__hideNextMonthArrow},set:function(be){_.__hideNextMonthArrow!==be&&(c(_.nextMonthNav,"flatpickr-disabled",be),_.__hideNextMonthArrow=be)}}),_.currentYearElement=_.yearElements[0],J(),_.monthNav)),_.innerContainer=u("div","flatpickr-innerContainer"),_.config.weekNumbers){var Tt=(function(){_.calendarContainer.classList.add("hasWeeks");var be=u("div","flatpickr-weekwrapper");be.appendChild(u("span","flatpickr-weekday",_.l10n.weekAbbreviation));var fn=u("div","flatpickr-weeks");return be.appendChild(fn),{weekWrapper:be,weekNumbers:fn}})(),Dt=Tt.weekWrapper,he=Tt.weekNumbers;_.innerContainer.appendChild(Dt),_.weekNumbers=he,_.weekWrapper=Dt}_.rContainer=u("div","flatpickr-rContainer"),_.rContainer.appendChild(ve()),_.daysContainer||(_.daysContainer=u("div","flatpickr-days"),_.daysContainer.tabIndex=-1),it(),_.rContainer.appendChild(_.daysContainer),_.innerContainer.appendChild(_.rContainer),rt.appendChild(_.innerContainer)}_.config.enableTime&&rt.appendChild((function(){_.calendarContainer.classList.add("hasTime"),_.config.noCalendar&&_.calendarContainer.classList.add("noCalendar");var be=U(_.config);_.timeContainer=u("div","flatpickr-time"),_.timeContainer.tabIndex=-1;var fn=u("span","flatpickr-time-separator",":"),qe=p("flatpickr-hour",{"aria-label":_.l10n.hourAriaLabel});_.hourElement=qe.getElementsByTagName("input")[0];var xn=p("flatpickr-minute",{"aria-label":_.l10n.minuteAriaLabel});if(_.minuteElement=xn.getElementsByTagName("input")[0],_.hourElement.tabIndex=_.minuteElement.tabIndex=-1,_.hourElement.value=r(_.latestSelectedDateObj?_.latestSelectedDateObj.getHours():_.config.time_24hr?be.hours:(function(jn){switch(jn%24){case 0:case 12:return 12;default:return jn%12}})(be.hours)),_.minuteElement.value=r(_.latestSelectedDateObj?_.latestSelectedDateObj.getMinutes():be.minutes),_.hourElement.setAttribute("step",_.config.hourIncrement.toString()),_.minuteElement.setAttribute("step",_.config.minuteIncrement.toString()),_.hourElement.setAttribute("min",_.config.time_24hr?"0":"1"),_.hourElement.setAttribute("max",_.config.time_24hr?"23":"12"),_.hourElement.setAttribute("maxlength","2"),_.minuteElement.setAttribute("min","0"),_.minuteElement.setAttribute("max","59"),_.minuteElement.setAttribute("maxlength","2"),_.timeContainer.appendChild(qe),_.timeContainer.appendChild(fn),_.timeContainer.appendChild(xn),_.config.time_24hr&&_.timeContainer.classList.add("time24hr"),_.config.enableSeconds){_.timeContainer.classList.add("hasSeconds");var vn=p("flatpickr-second");_.secondElement=vn.getElementsByTagName("input")[0],_.secondElement.value=r(_.latestSelectedDateObj?_.latestSelectedDateObj.getSeconds():be.seconds),_.secondElement.setAttribute("step",_.minuteElement.getAttribute("step")),_.secondElement.setAttribute("min","0"),_.secondElement.setAttribute("max","59"),_.secondElement.setAttribute("maxlength","2"),_.timeContainer.appendChild(u("span","flatpickr-time-separator",":")),_.timeContainer.appendChild(vn)}return _.config.time_24hr||(_.amPM=u("span","flatpickr-am-pm",_.l10n.amPM[o((_.latestSelectedDateObj?_.hourElement.value:_.config.defaultHour)>11)]),_.amPM.title=_.l10n.toggleTitle,_.amPM.tabIndex=-1,_.timeContainer.appendChild(_.amPM)),_.timeContainer})()),c(_.calendarContainer,"rangeMode",_.config.mode==="range"),c(_.calendarContainer,"animate",_.config.animate===!0),c(_.calendarContainer,"multiMonth",_.config.showMonths>1),_.calendarContainer.appendChild(rt);var se=_.config.appendTo!==void 0&&_.config.appendTo.nodeType!==void 0;if((_.config.inline||_.config.static)&&(_.calendarContainer.classList.add(_.config.inline?"inline":"static"),_.config.inline&&(!se&&_.element.parentNode?_.element.parentNode.insertBefore(_.calendarContainer,_._input.nextSibling):_.config.appendTo!==void 0&&_.config.appendTo.appendChild(_.calendarContainer)),_.config.static)){var ye=u("div","flatpickr-wrapper");_.element.parentNode&&_.element.parentNode.insertBefore(ye,_.element),ye.appendChild(_.element),_.altInput&&ye.appendChild(_.altInput),ye.appendChild(_.calendarContainer)}_.config.static||_.config.inline||(_.config.appendTo!==void 0?_.config.appendTo:window.document.body).appendChild(_.calendarContainer)})(),(function(){if(_.config.wrap&&["open","close","toggle","clear"].forEach((function(Dt){Array.prototype.forEach.call(_.element.querySelectorAll("[data-"+Dt+"]"),(function(he){return jt(he,"click",_[Dt])}))})),_.isMobile)return void(function(){var Dt=_.config.enableTime?_.config.noCalendar?"time":"datetime-local":"date";_.mobileInput=u("input",_.input.className+" flatpickr-mobile"),_.mobileInput.tabIndex=1,_.mobileInput.type=Dt,_.mobileInput.disabled=_.input.disabled,_.mobileInput.required=_.input.required,_.mobileInput.placeholder=_.input.placeholder,_.mobileFormatStr=Dt==="datetime-local"?"Y-m-d\\TH:i:S":Dt==="date"?"Y-m-d":"H:i:S",_.selectedDates.length>0&&(_.mobileInput.defaultValue=_.mobileInput.value=_.formatDate(_.selectedDates[0],_.mobileFormatStr)),_.config.minDate&&(_.mobileInput.min=_.formatDate(_.config.minDate,"Y-m-d")),_.config.maxDate&&(_.mobileInput.max=_.formatDate(_.config.maxDate,"Y-m-d")),_.input.getAttribute("step")&&(_.mobileInput.step=String(_.input.getAttribute("step"))),_.
4675input.type="hidden",_.altInput!==void 0&&(_.altInput.type="hidden");try{_.input.parentNode&&_.input.parentNode.insertBefore(_.mobileInput,_.input.nextSibling)}catch{}jt(_.mobileInput,"change",(function(he){_.setDate(g(he).value,!1,_.mobileFormatStr),Re("onChange"),Re("onClose")}))})();var rt=a(te,50);if(_._debouncedChange=a(ae,300),_.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&jt(_.daysContainer,"mouseover",(function(Dt){_.config.mode==="range"&&Vt(g(Dt))})),jt(_._input,"keydown",K),_.calendarContainer!==void 0&&jt(_.calendarContainer,"keydown",K),_.config.inline||_.config.static||jt(window,"resize",rt),window.ontouchstart!==void 0?jt(window.document,"touchstart",en):jt(window.document,"mousedown",en),jt(window.document,"focus",en,{capture:!0}),_.config.clickOpens===!0&&(jt(_._input,"focus",_.open),jt(_._input,"click",_.open)),_.daysContainer!==void 0&&(jt(_.monthNav,"click",At),jt(_.monthNav,["keyup","increment"],Wt),jt(_.daysContainer,"click",fe)),_.timeContainer!==void 0&&_.minuteElement!==void 0&&_.hourElement!==void 0){var Tt=function(Dt){return g(Dt).select()};jt(_.timeContainer,["increment"],Et),jt(_.timeContainer,"blur",Et,{capture:!0}),jt(_.timeContainer,"click",Bt),jt([_.hourElement,_.minuteElement],["focus","click"],Tt),_.secondElement!==void 0&&jt(_.secondElement,"focus",(function(){return _.secondElement&&_.secondElement.select()})),_.amPM!==void 0&&jt(_.amPM,"click",(function(Dt){Et(Dt)}))}_.config.allowInput&&jt(_._input,"blur",mt)})(),(_.selectedDates.length||_.config.noCalendar)&&(_.config.enableTime&&yt(_.config.noCalendar?_.latestSelectedDateObj:void 0),xt(!1)),pt();var st=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!_.isMobile&&st&&ie(),Re("onReady")})(),_}function q(j,W){for(var _=Array.prototype.slice.call(j).filter((function(Et){return Et instanceof HTMLElement})),at=[],ct=0;ct<_.length;ct++){var pt=_[ct];try{if(pt.getAttribute("data-fp-omit")!==null)continue;pt._flatpickr!==void 0&&(pt._flatpickr.destroy(),pt._flatpickr=void 0),pt._flatpickr=V(pt,W||{}),at.push(pt._flatpickr)}catch(Et){console.error(Et)}}return at.length===1?at[0]:at}typeof HTMLElement<"u"&&typeof HTMLCollection<"u"&&typeof NodeList<"u"&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(j){return q(this,j)},HTMLElement.prototype.flatpickr=function(j){return q([this],j)});var X=function(j,W){return typeof j=="string"?q(window.document.querySelectorAll(j),W):j instanceof Node?q([j],W):q(j,W)};return X.defaultConfig={},X.l10ns={en:i({},s),default:i({},s)},X.localize=function(j){X.l10ns.default=i(i({},X.l10ns.default),j)},X.setDefaults=function(j){X.defaultConfig=i(i({},X.defaultConfig),j)},X.parseDate=R({}),X.formatDate=C({}),X.compareDates=k,typeof jQuery<"u"&&jQuery.fn!==void 0&&(jQuery.fn.flatpickr=function(j){return q(this,j)}),Date.prototype.fp_incr=function(j){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof j=="string"?parseInt(j,10):j))},typeof window<"u"&&(window.flatpickr=X),X}))});var Hit=uo((kP,Vit)=>{(function(i,t){typeof kP=="object"&&typeof Vit<"u"?t(kP):typeof define=="function"&&define.amd?define(["exports"],t):(i=typeof globalThis<"u"?globalThis:i||self,t(i.ActiveStorage={}))})(kP,(function(i){"use strict";var t={exports:{}};(function(W,_){(function(at){W.exports=at()})((function(at){var ct=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function pt(Ut,zt){var St=Ut[0],it=Ut[1],gt=Ut[2],ft=Ut[3];St+=(it&gt|~it&ft)+zt[0]-680876936|0,St=(St<<7|St>>>25)+it|0,ft+=(St&it|~St&gt)+zt[1]-389564586|0,ft=(ft<<12|ft>>>20)+St|0,gt+=(ft&St|~ft&it)+zt[2]+606105819|0,gt=(gt<<17|gt>>>15)+ft|0,it+=(gt&ft|~gt&St)+zt[3]-1044525330|0,it=(it<<22|it>>>10)+gt|0,St+=(it&gt|~it&ft)+zt[4]-176418897|0,St=(St<<7|St>>>25)+it|0,ft+=(St&it|~St&gt)+zt[5]+1200080426|0,ft=(ft<<12|ft>>>20)+St|0,gt+=(ft&St|~ft&it)+zt[6]-1473231341|0,gt=(gt<<17|gt>>>15)+ft|0,it+=(gt&ft|~gt&St)+zt[7]-45705983|0,it=(it<<22|it>>>10)+gt|0,St+=(it&gt|~it&ft)+zt[8]+1770035416|0,St=(St<<7|St>>>25)+it|0,ft+=(St&it|~St&gt)+zt[9]-1958414417|0,ft=(ft<<12|ft>>>20)+St|0,gt+=(ft&St|~ft&it)+zt[10]-42063|0,gt=(gt<<17|gt>>>15)+ft|0,it+=(gt&ft|~gt&St)+zt[11]-1990404162|0,it=(it<<22|it>>>10)+gt|0,St+=(it&gt|~it&ft)+zt[12]+1804603682|0,St=(St<<7|St>>>
467525)+it|0,ft+=(St&it|~St&gt)+zt[13]-40341101|0,ft=(ft<<12|ft>>>20)+St|0,gt+=(ft&St|~ft&it)+zt[14]-1502002290|0,gt=(gt<<17|gt>>>15)+ft|0,it+=(gt&ft|~gt&St)+zt[15]+1236535329|0,it=(it<<22|it>>>10)+gt|0,St+=(it&ft|gt&~ft)+zt[1]-165796510|0,St=(St<<5|St>>>27)+it|0,ft+=(St&gt|it&~gt)+zt[6]-1069501632|0,ft=(ft<<9|ft>>>23)+St|0,gt+=(ft&it|St&~it)+zt[11]+643717713|0,gt=(gt<<14|gt>>>18)+ft|0,it+=(gt&St|ft&~St)+zt[0]-373897302|0,it=(it<<20|it>>>12)+gt|0,St+=(it&ft|gt&~ft)+zt[5]-701558691|0,St=(St<<5|St>>>27)+it|0,ft+=(St&gt|it&~gt)+zt[10]+38016083|0,ft=(ft<<9|ft>>>23)+St|0,gt+=(ft&it|St&~it)+zt[15]-660478335|0,gt=(gt<<14|gt>>>18)+ft|0,it+=(gt&St|ft&~St)+zt[4]-405537848|0,it=(it<<20|it>>>12)+gt|0,St+=(it&ft|gt&~ft)+zt[9]+568446438|0,St=(St<<5|St>>>27)+it|0,ft+=(St&gt|it&~gt)+zt[14]-1019803690|0,ft=(ft<<9|ft>>>23)+St|0,gt+=(ft&it|St&~it)+zt[3]-187363961|0,gt=(gt<<14|gt>>>18)+ft|0,it+=(gt&St|ft&~St)+zt[8]+1163531501|0,it=(it<<20|it>>>12)+gt|0,St+=(it&ft|gt&~ft)+zt[13]-1444681467|0,St=(St<<5|St>>>27)+it|0,ft+=(St&gt|it&~gt)+zt[2]-51403784|0,ft=(ft<<9|ft>>>23)+St|0,gt+=(ft&it|St&~it)+zt[7]+1735328473|0,gt=(gt<<14|gt>>>18)+ft|0,it+=(gt&St|ft&~St)+zt[12]-1926607734|0,it=(it<<20|it>>>12)+gt|0,St+=(it^gt^ft)+zt[5]-378558|0,St=(St<<4|St>>>28)+it|0,ft+=(St^it^gt)+zt[8]-2022574463|0,ft=(ft<<11|ft>>>21)+St|0,gt+=(ft^St^it)+zt[11]+1839030562|0,gt=(gt<<16|gt>>>16)+ft|0,it+=(gt^ft^St)+zt[14]-35309556|0,it=(it<<23|it>>>9)+gt|0,St+=(it^gt^ft)+zt[1]-1530992060|0,St=(St<<4|St>>>28)+it|0,ft+=(St^it^gt)+zt[4]+1272893353|0,ft=(ft<<11|ft>>>21)+St|0,gt+=(ft^St^it)+zt[7]-155497632|0,gt=(gt<<16|gt>>>16)+ft|0,it+=(gt^ft^St)+zt[10]-1094730640|0,it=(it<<23|it>>>9)+gt|0,St+=(it^gt^ft)+zt[13]+681279174|0,St=(St<<4|St>>>28)+it|0,ft+=(St^it^gt)+zt[0]-358537222|0,ft=(ft<<11|ft>>>21)+St|0,gt+=(ft^St^it)+zt[3]-722521979|0,gt=(gt<<16|gt>>>16)+ft|0,it+=(gt^ft^St)+zt[6]+76029189|0,it=(it<<23|it>>>9)+gt|0,St+=(it^gt^ft)+zt[9]-640364487|0,St=(St<<4|St>>>28)+it|0,ft+=(St^it^gt)+zt[12]-421815835|0,ft=(ft<<11|ft>>>21)+St|0,gt+=(ft^St^it)+zt[15]+530742520|0,gt=(gt<<16|gt>>>16)+ft|0,it+=(gt^ft^St)+zt[2]-995338651|0,it=(it<<23|it>>>9)+gt|0,St+=(gt^(it|~ft))+zt[0]-198630844|0,St=(St<<6|St>>>26)+it|0,ft+=(it^(St|~gt))+zt[7]+1126891415|0,ft=(ft<<10|ft>>>22)+St|0,gt+=(St^(ft|~it))+zt[14]-1416354905|0,gt=(gt<<15|gt>>>17)+ft|0,it+=(ft^(gt|~St))+zt[5]-57434055|0,it=(it<<21|it>>>11)+gt|0,St+=(gt^(it|~ft))+zt[12]+1700485571|0,St=(St<<6|St>>>26)+it|0,ft+=(it^(St|~gt))+zt[3]-1894986606|0,ft=(ft<<10|ft>>>22)+St|0,gt+=(St^(ft|~it))+zt[10]-1051523|0,gt=(gt<<15|gt>>>17)+ft|0,it+=(ft^(gt|~St))+zt[1]-2054922799|0,it=(it<<21|it>>>11)+gt|0,St+=(gt^(it|~ft))+zt[8]+1873313359|0,St=(St<<6|St>>>26)+it|0,ft+=(it^(St|~gt))+zt[15]-30611744|0,ft=(ft<<10|ft>>>22)+St|0,gt+=(St^(ft|~it))+zt[6]-1560198380|0,gt=(gt<<15|gt>>>17)+ft|0,it+=(ft^(gt|~St))+zt[13]+1309151649|0,it=(it<<21|it>>>11)+gt|0,St+=(gt^(it|~ft))+zt[4]-145523070|0,St=(St<<6|St>>>26)+it|0,ft+=(it^(St|~gt))+zt[11]-1120210379|0,ft=(ft<<10|ft>>>22)+St|0,gt+=(St^(ft|~it))+zt[2]+718787259|0,gt=(gt<<15|gt>>>17)+ft|0,it+=(ft^(gt|~St))+zt[9]-343485551|0,it=(it<<21|it>>>11)+gt|0,Ut[0]=St+Ut[0]|0,Ut[1]=it+Ut[1]|0,Ut[2]=gt+Ut[2]|0,Ut[3]=ft+Ut[3]|0}function Et(Ut){var zt=[],St;for(St=0;St<64;St+=4)zt[St>>2]=Ut.charCodeAt(St)+(Ut.charCodeAt(St+1)<<8)+(Ut.charCodeAt(St+2)<<16)+(Ut.charCodeAt(St+3)<<24);return zt}function vt(Ut){var zt=[],St;for(St=0;St<64;St+=4)zt[St>>2]=Ut[St]+(Ut[St+1]<<8)+(Ut[St+2]<<16)+(Ut[St+3]<<24);return zt}function yt(Ut){var zt=Ut.length,St=[1732584193,-271733879,-1732584194,271733878],it,gt,ft,de,ve,we;for(it=64;it<=zt;it+=64)pt(St,Et(Ut.substring(it-64,it)));for(Ut=Ut.substring(it-64),gt=Ut.length,ft=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],it=0;it<gt;it+=1)ft[it>>2]|=Ut.charCodeAt(it)<<(it%4<<3);if(ft[it>>2]|=128<<(it%4<<3),it>55)for(pt(St,ft),it=0;it<16;it+=1)ft[it]=0;return de=zt*8,de=de.toString(16).match(/(.*?)(.{0,8})$/),ve=parseInt(de[2],16),we=parseInt(de[1],16)||0,ft[14]=ve,ft[15]=we,pt(St,ft),St}function kt(Ut){var zt=Ut.length,St=[1732584193,-271733879,-1732584194,271733878],it,gt,ft,de,ve,we;for(it=64;it<=zt;it+=64)pt(St,vt(Ut.subarray(it-64,it)));
4675for(Ut=it-64<zt?Ut.subarray(it-64):new Uint8Array(0),gt=Ut.length,ft=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],it=0;it<gt;it+=1)ft[it>>2]|=Ut[it]<<(it%4<<3);if(ft[it>>2]|=128<<(it%4<<3),it>55)for(pt(St,ft),it=0;it<16;it+=1)ft[it]=0;return de=zt*8,de=de.toString(16).match(/(.*?)(.{0,8})$/),ve=parseInt(de[2],16),we=parseInt(de[1],16)||0,ft[14]=ve,ft[15]=we,pt(St,ft),St}function Wt(Ut){var zt="",St;for(St=0;St<4;St+=1)zt+=ct[Ut>>St*8+4&15]+ct[Ut>>St*8&15];return zt}function jt(Ut){var zt;for(zt=0;zt<Ut.length;zt+=1)Ut[zt]=Wt(Ut[zt]);return Ut.join("")}jt(yt("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function Ut(zt,St){return zt=zt|0||0,zt<0?Math.max(zt+St,0):Math.min(zt,St)}ArrayBuffer.prototype.slice=function(zt,St){var it=this.byteLength,gt=Ut(zt,it),ft=it,de,ve,we,Ae;return St!==at&&(ft=Ut(St,it)),gt>ft?new ArrayBuffer(0):(de=ft-gt,ve=new ArrayBuffer(de),we=new Uint8Array(ve),Ae=new Uint8Array(this,gt,de),we.set(Ae),ve)}})();function ae(Ut){return/[\u0080-\uFFFF]/.test(Ut)&&(Ut=unescape(encodeURIComponent(Ut))),Ut}function ee(Ut,zt){var St=Ut.length,it=new ArrayBuffer(St),gt=new Uint8Array(it),ft;for(ft=0;ft<St;ft+=1)gt[ft]=Ut.charCodeAt(ft);return zt?gt:it}function Bt(Ut){return String.fromCharCode.apply(null,new Uint8Array(Ut))}function Gt(Ut,zt,St){var it=new Uint8Array(Ut.byteLength+zt.byteLength);return it.set(new Uint8Array(Ut)),it.set(new Uint8Array(zt),Ut.byteLength),St?it:it.buffer}function Qt(Ut){var zt=[],St=Ut.length,it;for(it=0;it<St-1;it+=2)zt.push(parseInt(Ut.substr(it,2),16));return String.fromCharCode.apply(String,zt)}function xe(){this.reset()}return xe.prototype.append=function(Ut){return this.appendBinary(ae(Ut)),this},xe.prototype.appendBinary=function(Ut){this._buff+=Ut,this._length+=Ut.length;var zt=this._buff.length,St;for(St=64;St<=zt;St+=64)pt(this._hash,Et(this._buff.substring(St-64,St)));return this._buff=this._buff.substring(St-64),this},xe.prototype.end=function(Ut){var zt=this._buff,St=zt.length,it,gt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ft;for(it=0;it<St;it+=1)gt[it>>2]|=zt.charCodeAt(it)<<(it%4<<3);return this._finish(gt,St),ft=jt(this._hash),Ut&&(ft=Qt(ft)),this.reset(),ft},xe.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},xe.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},xe.prototype.setState=function(Ut){return this._buff=Ut.buff,this._length=Ut.length,this._hash=Ut.hash,this},xe.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},xe.prototype._finish=function(Ut,zt){var St=zt,it,gt,ft;if(Ut[St>>2]|=128<<(St%4<<3),St>55)for(pt(this._hash,Ut),St=0;St<16;St+=1)Ut[St]=0;it=this._length*8,it=it.toString(16).match(/(.*?)(.{0,8})$/),gt=parseInt(it[2],16),ft=parseInt(it[1],16)||0,Ut[14]=gt,Ut[15]=ft,pt(this._hash,Ut)},xe.hash=function(Ut,zt){return xe.hashBinary(ae(Ut),zt)},xe.hashBinary=function(Ut,zt){var St=yt(Ut),it=jt(St);return zt?Qt(it):it},xe.ArrayBuffer=function(){this.reset()},xe.ArrayBuffer.prototype.append=function(Ut){var zt=Gt(this._buff.buffer,Ut,!0),St=zt.length,it;for(this._length+=Ut.byteLength,it=64;it<=St;it+=64)pt(this._hash,vt(zt.subarray(it-64,it)));return this._buff=it-64<St?new Uint8Array(zt.buffer.slice(it-64)):new Uint8Array(0),this},xe.ArrayBuffer.prototype.end=function(Ut){var zt=this._buff,St=zt.length,it=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],gt,ft;for(gt=0;gt<St;gt+=1)it[gt>>2]|=zt[gt]<<(gt%4<<3);return this._finish(it,St),ft=jt(this._hash),Ut&&(ft=Qt(ft)),this.reset(),ft},xe.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},xe.ArrayBuffer.prototype.getState=function(){var Ut=xe.prototype.getState.call(this);return Ut.buff=Bt(Ut.buff),Ut},xe.ArrayBuffer.prototype.setState=function(Ut){return Ut.buff=ee(Ut.buff,!0),xe.prototype.setState.call(this,Ut)},xe.ArrayBuffer.prototype.destroy=xe.prototype.destroy,xe.ArrayBuffer.prototype._finish=xe.prototype._finish,xe.ArrayBuffer.hash=function(Ut,zt){var St=kt(new Uint8Array(Ut)),it=jt(St);return zt?Qt(it):it},xe}))})(t);var e=t.exports;let n=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice;class s{static create(_,at){new s(_).create(at)}constructor(_){this.file=_,this.chunkSize=2097152,this.chunkCount=Math.ceil(this.file.size/this.chunkSize),this.chunkIndex=0}create(_){this.callback=_,this.md5Buffer=new e.ArrayBuffer,this.fileReader=new FileReader,this.fileReader.addEventListener("load",(at=>this.fileReaderDidLoad(at))),this.fileReader.addEventListener("error",(at=>this.fileReaderDidError(at))),this.readNextChunk()}
4675fileReaderDidLoad(_){if(this.md5Buffer.append(_.target.result),!this.readNextChunk()){let at=this.md5Buffer.end(!0),ct=btoa(at);this.callback(null,ct)}}fileReaderDidError(_){this.callback(`Error reading ${this.file.name}`)}readNextChunk(){if(this.chunkIndex<this.chunkCount||this.chunkIndex==0&&this.chunkCount==0){let _=this.chunkIndex*this.chunkSize,at=Math.min(_+this.chunkSize,this.file.size),ct=n.call(this.file,_,at);return this.fileReader.readAsArrayBuffer(ct),this.chunkIndex++,!0}else return!1}}function r(W){let _=a(document.head,`meta[name="${W}"]`);if(_)return _.getAttribute("content")}function o(W,_){typeof W=="string"&&(_=W,W=document);let at=W.querySelectorAll(_);return c(at)}function a(W,_){return typeof W=="string"&&(_=W,W=document),W.querySelector(_)}function l(W,_,at={}){let{disabled:ct}=W,{bubbles:pt,cancelable:Et,detail:vt}=at,yt=document.createEvent("Event");yt.initEvent(_,pt||!0,Et||!0),yt.detail=vt||{};try{W.disabled=!1,W.dispatchEvent(yt)}finally{W.disabled=ct}return yt}function c(W){return Array.isArray(W)?W:Array.from?Array.from(W):[].slice.call(W)}class u{constructor(_,at,ct,pt={}){this.file=_,this.attributes={filename:_.name,content_type:_.type||"application/octet-stream",byte_size:_.size,checksum:at},this.xhr=new XMLHttpRequest,this.xhr.open("POST",ct,!0),this.xhr.responseType="json",this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.setRequestHeader("Accept","application/json"),this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(pt).forEach((vt=>{this.xhr.setRequestHeader(vt,pt[vt])}));let Et=r("csrf-token");Et!=null&&this.xhr.setRequestHeader("X-CSRF-Token",Et),this.xhr.addEventListener("load",(vt=>this.requestDidLoad(vt))),this.xhr.addEventListener("error",(vt=>this.requestDidError(vt)))}get status(){return this.xhr.status}get response(){let{responseType:_,response:at}=this.xhr;return _=="json"?at:JSON.parse(at)}
4675create(_){this.callback=_,this.xhr.send(JSON.stringify({blob:this.attributes}))}requestDidLoad(_){if(this.status>=200&&this.status<300){let{response:at}=this,{direct_upload:ct}=at;delete at.direct_upload,this.attributes=at,this.directUploadData=ct,this.callback(null,this.toJSON())}else this.requestDidError(_)}requestDidError(_){this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`)}toJSON(){let _={};for(let at in this.attributes)_[at]=this.attributes[at];return _}}class h{constructor(_){this.blob=_,this.file=_.file;let{url:at,headers:ct}=_.directUploadData;this.xhr=new XMLHttpRequest,this.xhr.open("PUT",at,!0),this.xhr.responseType="text";for(let pt in ct)this.xhr.setRequestHeader(pt,ct[pt]);this.xhr.addEventListener("load",(pt=>this.requestDidLoad(pt))),this.xhr.addEventListener("error",(pt=>this.requestDidError(pt)))}create(_){this.callback=_,this.xhr.send(this.file.slice())}requestDidLoad(_){let{status:at,response:ct}=this.xhr;at>=200&&at<300?this.callback(null,ct):this.requestDidError(_)}requestDidError(_){this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`)}}let d=0;class p{constructor(_,at,ct,pt={}){this.id=++d,this.file=_,this.url=at,this.delegate=ct,this.customHeaders=pt}create(_){s.create(this.file,((at,ct)=>{if(at){_(at);return}let pt=new u(this.file,ct,this.url,this.customHeaders);g(this.delegate,"directUploadWillCreateBlobWithXHR",pt.xhr),pt.create((Et=>{if(Et)_(Et);else{let vt=new h(pt);g(this.delegate,"directUploadWillStoreFileWithXHR",vt.xhr),vt.create((yt=>{yt?_(yt):_(null,pt.toJSON())}))}}))}))}}function g(W,_,...at){if(W&&typeof W[_]=="function")return W[_](...at)}class y{constructor(_,at){this.input=_,this.file=at,this.directUpload=new p(this.file,this.url,this),this.dispatch("initialize")}start(_){let at=document.createElement("input");at.type="hidden",at.name=this.input.name,this.input.insertAdjacentElement("beforebegin",at),this.dispatch("start"),this.directUpload.create(((ct,pt)=>{ct?(at.parentNode.removeChild(at),this.dispatchError(ct)):at.value=pt.signed_id,this.dispatch("end"),_(ct)}))}uploadRequestDidProgress(_){let at=_.loaded/_.total*90;at&&this.dispatch("progress",{progress:at})}get url(){return this.input.getAttribute("data-direct-upload-url")}dispatch(_,at={}){return at.file=this.file,at.id=this.directUpload.id,l(this.input,`direct-upload:${_}`,{detail:at})}dispatchError(_){this.dispatch("error",{error:_}).defaultPrevented||alert(_)}directUploadWillCreateBlobWithXHR(_){this.dispatch("before-blob-request",{xhr:_})}directUploadWillStoreFileWithXHR(_){this.dispatch("before-storage-request",{xhr:_}),_.upload.addEventListener("progress",(at=>this.uploadRequestDidProgress(at))),_.upload.addEventListener("loadend",(()=>{this.simulateResponseProgress(_)}))}simulateResponseProgress(_){let at=90,ct=Date.now(),pt=()=>{let Et=Date.now()-ct,vt=this.estimateResponseTime();at=90+Math.min(Et/vt,1)*9,this.dispatch("progress",{progress:at}),_.readyState!==XMLHttpRequest.DONE&&at<99&&requestAnimationFrame(pt)};_.addEventListener("loadend",(()=>{this.dispatch("progress",{progress:100})})),requestAnimationFrame(pt)}estimateResponseTime(){let _=this.file.size,at=1024*1024;return _<at?1e3:_<10*at?2e3:3e3+_/at*50}}let x="input[type=file][data-direct-upload-url]:not([disabled])";class w{constructor(_){this.form=_,this.inputs=o(_,x).filter((at=>at.files.length))}start(_){let at=this.createDirectUploadControllers(),ct=()=>{let pt=at.shift();pt?pt.start((Et=>{Et?(_(Et),this.dispatch("end")):ct()})):(_(),this.dispatch("end"))};this.dispatch("start"),ct()}createDirectUploadControllers(){let _=[];return this.inputs.forEach((at=>{c(at.files).forEach((ct=>{let pt=new y(at,ct);_.push(pt)}))})),_}dispatch(_,at={}){return l(this.form,`direct-uploads:${_}`,{detail:at})}}let M="data-direct-uploads-processing",A=new WeakMap,C=!1;function R(){C||(C=!0,document.addEventListener("click",k,!0),document.addEventListener("submit",O,!0),document.addEventListener("ajax:before",I))}function k(W){let _=W.target.closest("button, input");_&&_.type==="submit"&&_.form&&A.set(_.form,_)}function O(W){U(W)}function I(W){W.target.tagName=="FORM"&&U(W)}function U(W){let _=W.target;if(_.hasAttribute(M)){W.preventDefault();return}let at=new w(_),{inputs:ct}=at;ct.length&&(W.preventDefault(),_.setAttribute(M,""),ct.forEach(q),at.start((pt=>{_.removeAttribute(M),pt?ct.forEach(X):V(_)})))}function V(W){let _=A.get(W)||a(W,"input[type=submit], button[type=submit]");if(_){let{disabled:at}=_;_.disabled=!1,_.focus(),_.click(),_.disabled=at}
4675else _=document.createElement("input"),_.type="submit",_.style.display="none",W.appendChild(_),_.click(),W.removeChild(_);A.delete(W)}function q(W){W.disabled=!0}function X(W){W.disabled=!1}function j(){window.ActiveStorage&&R()}setTimeout(j,1),i.DirectUpload=p,i.DirectUploadController=y,i.DirectUploadsController=w,i.dispatchEvent=l,i.start=R,Object.defineProperty(i,"__esModule",{value:!0})}))});var jit=uo((YV,XV)=>{(function(i,t){typeof YV=="object"&&typeof XV<"u"?XV.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis<"u"?globalThis:i||self).LocalTime=t()})(YV,(function(){"use strict";let i={config:{},run(){this.getController().processElements()},process(...O){for(let I of O)this.getController().processElement(I);return O.length},getController(){return this.controller?this.controller:this.controller=new i.Controller}};i.config.useFormat24=!1,i.config.i18n={en:{date:{dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbrDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbrMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yesterday:"yesterday",today:"today",tomorrow:"tomorrow",on:"on {date}",formats:{default:"%b %e, %Y",thisYear:"%b %e"}},time:{am:"am",pm:"pm",singular:"a {time}",singularAn:"an {time}",elapsed:"{time} ago",second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",formats:{default:"%l:%M%P",default_24h:"%H:%M"}},datetime:{at:"{date} at {time}",formats:{default:"%B %e, %Y at %l:%M%P %Z",default_24h:"%B %e, %Y at %H:%M %Z"}}}},i.config.locale="en",i.config.defaultLocale="en",i.config.timerInterval=6e4;let t=!isNaN(Date.parse("2011-01-01T12:00:00-05:00"));i.parseDate=O=>(O=O.toString(),t||(O=(function(I){let U=I.match(e);if(U){let V,[q,X,j,W,_,at,ct,pt]=U;return pt!=="Z"&&(V=pt.replace(":","")),`${X}/${j}/${W} ${_}:${at}:${ct} GMT${[V]}`}})(O)),new Date(Date.parse(O)));let e=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|[-+]?[\d:]+)$/;i.elementMatchesSelector=(()=>{let O=document.documentElement,I=O.matches||O.matchesSelector||O.webkitMatchesSelector||O.mozMatchesSelector||O.msMatchesSelector;return(U,V)=>{if(U?.nodeType===Node.ELEMENT_NODE)return I.call(U,V)}})();let{config:n}=i,{i18n:s}=n;i.getI18nValue=(O="",I={locale:n.locale})=>{let{locale:U}=I;return(function(q,X){let j=q;for(var W of Array.from(X.split("."))){if(!j[W])return null;j=j[W]}return j})(s[U],O)||(U!==n.defaultLocale?i.getI18nValue(O,{locale:n.defaultLocale}):void 0)},i.translate=(O,I={},U)=>{let V=i.getI18nValue(O,U);for(let q in I){let X=I[q];V=V.replace(`{${q}}`,X)}return V};let{getI18nValue:r,translate:o}=i,a=typeof Intl?.DateTimeFormat=="function",l={"Central European Standard Time":"CET","Central European Summer Time":"CEST","China Standard Time":"CST","Israel Daylight Time":"IDT","Israel Standard Time":"IST","Moscow Standard Time":"MSK","Peru Standard Time":"PET","Philippine Standard Time":"PHT","Singapore Standard Time":"SGT","Western Indonesia Time":"WIB"};i.knownEdgeCaseTimeZones=l,i.strftime=(()=>{let O=(V,q)=>{let X=V.getDay(),j=V.getDate(),W=V.getMonth(),_=V.getFullYear(),at=V.getHours(),ct=V.getMinutes(),pt=V.getSeconds();return q.replace(/%(-?)([%aAbBcdeHIlmMpPSwyYZ])/g,((Et,vt,yt)=>{switch(yt){case"%":return"%";case"a":return r("date.abbrDayNames")[X];case"A":return r("date.dayNames")[X];case"b":return r("date.abbrMonthNames")[W];case"B":return r("date.monthNames")[W];case"c":return V.toString();case"d":return I(j,vt);case"e":return j;case"H":return I(at,vt);case"I":return I(O(V,"%l"),vt);case"l":return at===0||at===12?12:(at+12)%12;case"m":return I(W+1,vt);case"M":return I(ct,vt);case"p":return o("time."+(at>11?"pm":"am")).toUpperCase();case"P":return o("time."+(at>11?"pm":"am"));case"S":return I(pt,vt);case"w":return X;case"y":return I(_%100,vt);case"Y":return _;case"Z":return(function(kt){let Wt,jt,ae;return(jt=(function(ee){return Object.keys(l).find((Bt=>
4675a?new Date(ee).toLocaleString("en-US",{timeZoneName:"long"}).includes(Bt):ee.toString().includes(Bt)))})(kt))?l[jt]:(ae=U(kt,{allowGMT:!1}))||(ae=(function(ee){let Bt=ee.toString(),Gt;if((Gt=Bt.match(/\(([\w\s]+)\)$/))!=null){let Qt=Gt[1];return/\s/.test(Qt)?Qt.match(/\b(\w)/g).join(""):Qt}if((Gt=Bt.match(/(\w{3,4})\s\d{4}$/))!=null||(Gt=Bt.match(/(UTC[\+\-]\d+)/))!=null)return Gt[1]})(kt))?ae:(Wt=U(kt,{allowGMT:!0}))?Wt:""})(V)}}))};function I(V,q){return q==="-"?V:`0${V}`.slice(-2)}function U(V,{allowGMT:q}){if(a){let X=new Date(V).toLocaleString("en-US",{timeZoneName:"short"}).split(" ").pop();if(q||!X.includes("GMT"))return X}}return O})(),i.CalendarDate=class{static fromDate(O){return new this(O.getFullYear(),O.getMonth()+1,O.getDate())}static today(){return this.fromDate(new Date)}constructor(O,I,U){this.date=new Date(Date.UTC(O,I-1)),this.date.setUTCDate(U),this.year=this.date.getUTCFullYear(),this.month=this.date.getUTCMonth()+1,this.day=this.date.getUTCDate(),this.value=this.date.getTime()}equals(O){return O?.value===this.value}is(O){return this.equals(O)}isToday(){return this.is(this.constructor.today())}occursOnSameYearAs(O){return this.year===O?.year}occursThisYear(){return this.occursOnSameYearAs(this.constructor.today())}daysSince(O){if(O)return(this.date-O.date)/864e5}daysPassed(){return this.constructor.today().daysSince(this)}};let{strftime:c,translate:u,getI18nValue:h,config:d}=i;i.RelativeTime=class{constructor(O){this.date=O,this.calendarDate=i.CalendarDate.fromDate(this.date)}toString(){let O,I;return(I=this.toTimeElapsedString())?u("time.elapsed",{time:I}):(O=this.toWeekdayString())?(I=this.toTimeString(),u("datetime.at",{date:O,time:I})):u("date.on",{date:this.toDateString()})}toTimeOrDateString(){return this.calendarDate.isToday()?this.toTimeString():this.toDateString()}toTimeElapsedString(){let O,I=new Date().getTime()-this.date.getTime(),U=Math.round(I/1e3),V=Math.round(U/60),q=Math.round(V/60);return I<0?null:U<10?(O=u("time.second"),u("time.singular",{time:O})):U<45?`${U} ${u("time.seconds")}`:U<90?(O=u("time.minute"),u("time.singular",{time:O})):V<45?`${V} ${u("time.minutes")}`:V<90?(O=u("time.hour"),u("time.singularAn",{time:O})):q<24?`${q} ${u("time.hours")}`:""}toWeekdayString(){switch(this.calendarDate.daysPassed()){case 0:return u("date.today");case 1:return u("date.yesterday");case-1:return u("date.tomorrow");case 2:case 3:case 4:case 5:case 6:return c(this.date,"%A");default:return""}}toDateString(){let O=this.calendarDate.occursThisYear()?h("date.formats.thisYear"):h("date.formats.default");return c(this.date,O)}toTimeString(){let O=d.useFormat24?"default_24h":"default";return c(this.date,h(`time.formats.${O}`))}};let{elementMatchesSelector:p}=i;i.PageObserver=class{constructor(O,I){this.selector=O,this.callback=I,this.processMutations=this.processMutations.bind(this),this.processInsertion=this.processInsertion.bind(this)}start(){this.started||(this.observeWithMutationObserver()||this.observeWithMutationEvent(),this.started=!0)}observeWithMutationObserver(){return typeof MutationObserver<"u"&&MutationObserver!==null?(new MutationObserver(this.processMutations).observe(document.documentElement,{childList:!0,subtree:!0}),!0):!1}observeWithMutationEvent(){return addEventListener("DOMNodeInserted",this.processInsertion,!1),!0}findSignificantElements(O){let I=[];return O?.nodeType===Node.ELEMENT_NODE&&(p(O,this.selector)&&I.push(O),I.push(...Array.from(O.querySelectorAll(this.selector)||[]))),I}processMutations(O){let I=[];for(let U of O)if(U.type==="childList")for(let V of U.addedNodes)I.push(...this.findSignificantElements(V)||[]);this.notify(I)}processInsertion(O){let I=this.findSignificantElements(O.target);this.notify(I)}notify(O){O?.length>0&&typeof this.callback=="function"&&this.callback(O)}};let{parseDate:g,strftime:y,getI18nValue:x,config:w}=i,M="time[data-local]:not([data-localized])",A=O=>O.setAttribute("data-localized",""),C=O=>new i.RelativeTime(O);i.Controller=class{constructor(){this.processElements=this.processElements.bind(this),this.pageObserver=new i.PageObserver(M,this.processElements)}start(){this.started||(this.processElements(),this.startTimer(),this.pageObserver.start(),this.started=!0)}startTimer(){let O;(O=w.timerInterval)&&(this.timer||(this.timer=setInterval(this.processElements,O)))}processElements(O){O||(O=document.querySelectorAll(M));for(let I of Array.from(O))this.processElement(I);return O.length}processElement(O){let I=O.getAttribute("datetime"),U=O.getAttribute("data-local"),V=w.useFormat24&&O.getAttribute("data-format24")||O.getAttribute("data-format"),q=g(I);if(!isNaN(q)){if(!O.hasAttribute("title")){let X=w.useFormat24?"default_24h":"default",j=y(q,x(`datetime.formats.${X}`));O.setAttribute("title",j)}(X=>{X.setAttribute("data-processed-at",new Date().toISOString())})(O),O.textContent=(()=>{switch(U){case"time":return A(O),y(q,V);case"date":return A(O),C(q).toDateString();case"time-ago":return C(q).toString();
4675case"time-or-date":return C(q).toTimeOrDateString();case"weekday":return C(q).toWeekdayString();case"weekday-or-date":return C(q).toWeekdayString()||C(q).toDateString()}})()}}};let R=!1;function k(){i.getController().start()}return i.start=()=>{var O;R?i.run():(R=!0,typeof MutationObserver<"u"&&MutationObserver!==null||(document.attachEvent?document.readyState==="complete":document.readyState!=="loading")?k():(O=k,typeof requestAnimationFrame=="function"?requestAnimationFrame(O):setTimeout(O,17)))},i.processing=()=>i.getController().started,window.LocalTime===i&&i.start(),i}))});var PR={};Le(PR,{FetchEnctype:()=>Vh,FetchMethod:()=>La,FetchRequest:()=>jh,FetchResponse:()=>hm,FrameElement:()=>Ia,FrameLoadingStyle:()=>Lf,FrameRenderer:()=>fm,PageRenderer:()=>pm,PageSnapshot:()=>sl,StreamActions:()=>$h,StreamElement:()=>eC,StreamSourceElement:()=>nC,cache:()=>l6,config:()=>wr,connectStreamSource:()=>Yv,disconnectStreamSource:()=>Xv,fetch:()=>ER,fetchEnctypeFromString:()=>e6,fetchMethodFromString:()=>iC,isSafe:()=>sC,morphBodyElements:()=>m6,morphChildren:()=>rC,morphElements:()=>qv,morphTurboFrameElements:()=>b6,navigator:()=>c6,registerAdapter:()=>u6,renderStreamMessage:()=>d6,session:()=>Js,setConfirmMethod:()=>p6,setFormMode:()=>g6,setProgressBarDelay:()=>f6,start:()=>kR,visit:()=>h6});var Lf={eager:"eager",lazy:"lazy"},Ia=class i extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new i.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(t){t=="loading"?this.delegate.loadingStyleChanged():t=="src"?this.delegate.sourceURLChanged():t=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(t){t?this.setAttribute("refresh",t):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return Dst(this.getAttribute("loading")||"")}set loading(t){t?this.setAttribute("loading",t):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(t){t?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function Dst(i){return i.toLowerCase()==="lazy"?Lf.lazy:Lf.eager}var Lst={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 Wv(i){if(i.getAttribute("data-turbo-eval")=="false")return i;{let t=document.createElement("script"),e=YH();return e&&(t.nonce=e),t.textContent=i.textContent,t.async=!1,Ist(t,i),t}}function Ist(i,t){for(let{name:e,value:n}of t.attributes)i.setAttribute(e,n)}function Ost(i){let t=document.createElement("template");return t.innerHTML=i,t.content}function Ls(i,{target:t,cancelable:e,detail:n}={}){let s=new CustomEvent(i,{cancelable:e,bubbles:!0,composed:!0,detail:n});return t&&t.isConnected?t.dispatchEvent(s):document.documentElement.dispatchEvent(s),s}function BH(i){i.preventDefault(),i.stopImmediatePropagation()}function Hv(){return document.visibilityState==="hidden"?WH():jH()}function jH(){return new Promise(i=>requestAnimationFrame(()=>i()))}function WH(){return new Promise(i=>setTimeout(()=>i(),0))}function $H(i=""){return new DOMParser().parseFromString(i,"text/html")}function GH(i,...t){let e=Nst(i,t).replace(/^\n/,"").split(`
4676`),n=e[0].match(/^\s+/),s=n?n[0].length:0;return e.map(r=>r.slice(s)).join(`
4677`)}function Nst(i,t){return i.reduce((e,n,s)=>{let r=t[s]==null?"":t[s];return e+n+r},"")}function Hh(){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()*16).toString(16)).join("")}function HS(i,...t){for(let e of t.map(n=>n?.getAttribute(i)))if(typeof e=="string")return e;return null}function Bst(i,...t){return t.some(e=>e&&e.hasAttribute(i))}function jS(...i){for(let t of i)t.localName=="turbo-frame"&&t.setAttribute("busy",""),t.setAttribute("aria-busy","true")}function WS(...i){for(let t of i)t.localName=="turbo-frame"&&t.removeAttribute("busy"),t.removeAttribute("aria-busy")}function Fst(i,t=2e3){return new Promise(e=>{let n=()=>{i.removeEventListener("error",n),i.removeEventListener("load",n),e()};i.addEventListener("load",n,{once:!0}),i.addEventListener("error",n,{once:!0}),setTimeout(e,t)})}function qH(i){switch(i){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Ust(i){return i=="advance"||i=="replace"||i=="restore"}function If(...i){let t=HS("data-turbo-action",...i);return Ust(t)?t:null}function MR(i){return document.querySelector(`meta[name="${i}"]`)}function $S(i){let t=MR(i);return t&&t.content}function YH(){let i=MR("csp-nonce");if(i){let{nonce:t,content:e}=i;return t==""?e:t}}function zst(i,t){let e=MR(i);return e||(e=document.createElement("meta"),e.setAttribute("name",i),document.head.appendChild(e)),e.setAttribute("content",t),e}function cm(i,t){if(i instanceof Element)return i.closest(t)||cm(i.assignedSlot||i.getRootNode()?.host,t)}function TR(i){return!!i&&i.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof i.focus=="function"}function XH(i){return Array.from(i.querySelectorAll("[autofocus]")).find(TR)}async function Vst(i,t){let e=t();i(),await jH();let n=t();return[e,n]}function KH(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 JH(i){let t=cm(i,"a[href], a[xlink\\:href]");if(!t||t.href.startsWith("#")||t.hasAttribute("download"))return null;let e=t.getAttribute("target");return e&&e!=="_self"?null:t}function Hst(i,t){let e=null;return(...n)=>{let s=()=>i.apply(this,n);clearTimeout(e),e=setTimeout(s,t)}}var jst={"aria-disabled":{beforeSubmit:i=>{i.setAttribute("aria-disabled","true"),i.addEventListener("click",BH)},afterSubmit:i=>{i.removeAttribute("aria-disabled"),i.removeEventListener("click",BH)}},disabled:{beforeSubmit:i=>i.disabled=!0,afterSubmit:i=>i.disabled=!1}},JP=class{#t=null;constructor(t){Object.assign(this,t)}get submitter(){return this.#t}set submitter(t){this.#t=jst[t]||t}},Wst=new JP({mode:"on",submitter:"disabled"}),wr={drive:Lst,forms:Wst};function qr(i){return new URL(i.toString(),document.baseURI)}function jv(i){let t;if(i.hash)return i.hash.slice(1);if(t=i.href.match(/#(.*)$/))return t[1]}function AR(i,t){let e=t?.getAttribute("formaction")||i.getAttribute("action")||i.action;return qr(e)}function $st(i){return(Xst(i).match(/\.[^.]*$/)||[])[0]||""}function Gst(i,t){let e=FH(t.origin+t.pathname);return FH(i.href)===e||i.href.startsWith(e)}function zh(i,t){return Gst(i,t)&&!wr.drive.unvisitableExtensions.has($st(i))}function ZH(i){return qr(i.getAttribute("href")||"")}function qst(i){let t=jv(i);return t!=null?i.href.slice(0,-(t.length+1)):i.href}function VS(i){return qst(i)}function QH(i,t){return qr(i).href==qr(t).href}function Yst(i){return i.pathname.split("/").slice(1)}function Xst(i){return Yst(i).slice(-1)[0]}function FH(i){return i.endsWith("/")?i:i+"/"}var hm=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 qr(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)}},ZP=class extends Set{constructor(t){super(),this.maxSize=t}add(t){if(this.size>=this.maxSize){let n=this.values().next().value;this.delete(n)}super.add(t)}},t6=new ZP(20);function ER(i,t={}){let e=new Headers(t.headers||{}),n=Hh();return t6.add(n),e.append("X-Turbo-Request-Id",n),window.fetch(i,{...t,headers:e})}function iC(i){switch(i.toLowerCase()){case"get":return La.get;case"post":return La.post;case"put":return La.put;case"patch":return La.patch;case"delete":return La.delete}}var La={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function e6(i){switch(i.toLowerCase()){case Vh.multipart:return Vh.multipart;case Vh.plain:return Vh.plain;default:return Vh.urlEncoded}}var Vh={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},jh=class{abortController=new AbortController;#t=t=>{};constructor(t,e,n,s=new URLSearchParams,r=null,o=Vh.urlEncoded){let[a,l]=UH(qr(n),e,s,o);this.delegate=t,this.url=a,this.target=r,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:e.toUpperCase(),headers:{...this.defaultHeaders}
4677,body:l,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(t){let e=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,n=iC(t)||La.get;this.url.search="";let[s,r]=UH(this.url,n,e,this.enctype);this.url=s,this.fetchOptions.body=r,this.fetchOptions.method=n.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 e=await this.#e(t);try{this.delegate.requestStarted(this),e.detail.fetchRequest?this.response=e.detail.fetchRequest.response:this.response=ER(this.url.href,t);let n=await this.response;return await this.receive(n)}catch(n){if(n.name!=="AbortError")throw this.#n(n)&&this.delegate.requestErrored(this,n),n}finally{this.delegate.requestFinished(this)}}async receive(t){let e=new hm(t);return Ls("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:e},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,e):e.succeeded?this.delegate.requestSucceededWithResponse(this,e):this.delegate.requestFailedWithResponse(this,e),e}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return sC(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(t){this.headers.Accept=[t,this.headers.Accept].join(", ")}async#e(t){let e=new Promise(s=>this.#t=s),n=Ls("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:t,url:this.url,resume:this.#t},target:this.target});return this.url=n.detail.url,n.defaultPrevented&&await e,n}#n(t){return!Ls("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:t}}).defaultPrevented}};function sC(i){return iC(i)==La.get}function UH(i,t,e,n){let s=Array.from(e).length>0?new URLSearchParams(n6(e)):i.searchParams;return sC(t)?[Kst(i,s),null]:n==Vh.urlEncoded?[i,s]:[i,e]}function n6(i){let t=[];for(let[e,n]of i)n instanceof File||t.push([e,n]);return t}function Kst(i,t){let e=new URLSearchParams(n6(t));return i.search=e.toString(),i}var QP=class{started=!1;constructor(t,e){this.delegate=t,this.element=e,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))}intersect=t=>{t.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},Wh=class{static contentType="text/vnd.turbo-stream.html";static wrap(t){return typeof t=="string"?new this(Ost(t)):t}constructor(t){this.fragment=Jst(t)}};function Jst(i){for(let t of i.querySelectorAll("turbo-stream")){let e=document.importNode(t,!0);for(let n of e.templateElement.content.querySelectorAll("script"))n.replaceWith(Wv(n));t.replaceWith(e)}return i}var Zst=i=>i,GS=class{keys=[];entries={};#t;constructor(t,e=Zst){this.size=t,this.#t=e}has(t){return this.#t(t)in this.entries}get(t){if(this.has(t)){let e=this.read(t);return this.touch(t),e}}put(t,e){return this.write(t,e),this.touch(t),e}clear(){for(let t of Object.keys(this.entries))this.evict(t)}read(t){return this.entries[this.#t(t)]}write(t,e){this.entries[this.#t(t)]=e}touch(t){t=this.#t(t);let e=this.keys.indexOf(t);e>-1&&this.keys.splice(e,1),this.keys.unshift(t),this.trim()}trim(){for(let t of this.keys.splice(this.size))this.evict(t)}evict(t){delete this.entries[t]}},Qst=100,tR=class extends GS{#t=null;#e={};constructor(t=1,e=Qst){super(t,VS),this.prefetchDelay=e}putLater(t,e,n){this.#t=setTimeout(()=>{e.perform(),this.put(t,e,n),this.#t=null},this.prefetchDelay)}put(t,e,n=i6){super.put(t,e),this.#e[VS(t)]=new Date(new Date().getTime()+n)}clear(){super.clear(),this.#t&&clearTimeout(this.#t)}evict(t){super.evict(t),delete this.#e[t]}has(t){if(super.has(t)){let e=this.#e[VS(t)];return e&&e>Date.now()}else return!1}},i6=10*1e3,lm=new tR,am={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},qS=class i{state=am.initialized;static confirmMethod(t){return Promise.resolve(confirm(t))}constructor(t,e,n,s=!1){let r=rrt(e,n),o=srt(irt(e,n),r),a=trt(e,n),l=ort(e,n);this.delegate=t,this.formElement=e,this.submitter=n,this.fetchRequest=new jh(this,r,o,a,e,l),this.mustRedirect=s}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=qr(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:e}=am,n=HS("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof n=="string"&&!await(typeof wr.forms.confirm=="function"?wr.forms.confirm:i.confirmMethod)(n,this.formElement,this.submitter))&&this.state==t)return this.state=e,this.fetchRequest.perform()}stop(){let{stopping:t,stopped:e}=am;if(this.state!=t&&this.state!=e)return this.state=t,this.fetchRequest.cancel(),!0}prepareRequest(t){if(!t.isSafe){let e=ert($S("csrf-param"))||$S("csrf-token");e&&(t.headers["X-CSRF-Token"]=e)}this.requestAcceptsTurboStreamResponse(t)&&t.acceptResponseType(Wh.contentType)}requestStarted(t){this.state=am.waiting,this.submitter&&wr.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),jS(this.formElement),Ls("turbo:submit-start",{target:this.formElement,detail
4677:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(t,e){lm.clear(),this.result={success:e.succeeded,fetchResponse:e}}requestSucceededWithResponse(t,e){if(e.clientError||e.serverError){this.delegate.formSubmissionFailedWithResponse(this,e);return}if(lm.clear(),this.requestMustRedirect(t)&&nrt(e)){let n=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,n)}else this.state=am.receiving,this.result={success:!0,fetchResponse:e},this.delegate.formSubmissionSucceededWithResponse(this,e)}requestFailedWithResponse(t,e){this.result={success:!1,fetchResponse:e},this.delegate.formSubmissionFailedWithResponse(this,e)}requestErrored(t,e){this.result={success:!1,error:e},this.delegate.formSubmissionErrored(this,e)}requestFinished(t){this.state=am.stopped,this.submitter&&wr.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),WS(this.formElement),Ls("turbo:submit-end",{target:this.formElement,detail:{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||Bst("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function trt(i,t){let e=new FormData(i),n=t?.getAttribute("name"),s=t?.getAttribute("value");return n&&e.append(n,s||""),e}function ert(i){if(i!=null){let e=(document.cookie?document.cookie.split("; "):[]).find(n=>n.startsWith(i));if(e){let n=e.split("=").slice(1).join("=");return n?decodeURIComponent(n):void 0}}}function nrt(i){return i.statusCode==200&&!i.redirected}function irt(i,t){let e=typeof i.action=="string"?i.action:null;return t?.hasAttribute("formaction")?t.getAttribute("formaction")||"":i.getAttribute("action")||e||""}function srt(i,t){let e=qr(i);return sC(t)&&(e.search=""),e}function rrt(i,t){let e=t?.getAttribute("formmethod")||i.getAttribute("method")||"";return iC(e.toLowerCase())||La.get}function ort(i,t){return e6(t?.getAttribute("formenctype")||i.enctype)}var dm=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 XH(this.element)}get permanentElements(){return r6(this.element)}getPermanentElementById(t){return s6(this.element,t)}getPermanentElementMapForSnapshot(t){let e={};for(let n of this.permanentElements){let{id:s}=n,r=t.getPermanentElementById(s);r&&(e[s]=[n,r])}return e}};function s6(i,t){return i.querySelector(`#${t}[data-turbo-permanent]`)}function r6(i){return i.querySelectorAll("[id][data-turbo-permanent]")}var $v=class{started=!1;constructor(t,e){this.delegate=t,this.eventTarget=e}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)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=t=>{if(!t.defaultPrevented){let e=t.target instanceof HTMLFormElement?t.target:void 0,n=t.submitter||void 0;e&&art(e,n)&&lrt(e,n)&&this.delegate.willSubmitForm(e,n)&&(t.preventDefault(),t.stopImmediatePropagation(),this.delegate.formSubmitted(e,n))}}};function art(i,t){return(t?.getAttribute("formmethod")||i.getAttribute("method"))!="dialog"}function lrt(i,t){let e=t?.getAttribute("formtarget")||i.getAttribute("target");return KH(e)}var YS=class{#t=t=>{};#e=t=>{};constructor(t,e){this.delegate=t,this.element=e}scrollToAnchor(t){let e=this.snapshot.getElementForAnchor(t);e?(this.focusElement(e),this.scrollToElement(e)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(t){this.scrollToAnchor(jv(t))}scrollToElement(t){t.scrollIntoView()}focusElement(t){t instanceof HTMLElement&&(t.hasAttribute("tabindex")?t.focus():(t.setAttribute("tabindex","-1"),t.focu
4677s(),t.removeAttribute("tabindex")))}scrollToPosition({x:t,y:e}){this.scrollRoot.scrollTo(t,e)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(t){let{isPreview:e,shouldRender:n,willRender:s,newSnapshot:r}=t,o=s;if(n)try{this.renderPromise=new Promise(u=>this.#t=u),this.renderer=t,await this.prepareToRenderSnapshot(t);let a=new Promise(u=>this.#e=u),l={resume:this.#e,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(r,l)||await a,await this.renderSnapshot(t),this.delegate.viewRenderedSnapshot(r,e,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(t)}finally{delete this.renderer,this.#t(void 0),delete this.renderPromise}else o&&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()}},eR=class extends YS{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new dm(this.element)}},XS=class{constructor(t,e){this.delegate=t,this.element=e}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)}clickBubbled=t=>{this.clickEventIsSignificant(t)?this.clickEvent=t:delete this.clickEvent};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};willVisit=t=>{delete this.clickEvent};clickEventIsSignificant(t){let e=t.composed?t.target?.parentElement:t.target,n=JH(e)||e;return n instanceof Element&&n.closest("turbo-frame, html")==this.element}},KS=class{started=!1;constructor(t,e){this.delegate=t,this.eventTarget=e}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)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=t=>{if(t instanceof MouseEvent&&this.clickEventIsSignificant(t)){let e=t.composedPath&&t.composedPath()[0]||t.target,n=JH(e);if(n&&KH(n.target)){let s=ZH(n);this.delegate.willFollowLinkToLocation(n,s,t)&&(t.preventDefault(),this.delegate.followedLinkToLocation(n,s))}}};clickEventIsSignificant(t){return!(t.target&&t.target.isContentEditable||t.defaultPrevented||t.which>1||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)}},JS=class{constructor(t,e){this.delegate=t,this.linkInterceptor=new KS(this,e)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(t,e){return!1}prefetchAndCacheRequestToLocation(t,e){}willFollowLinkToLocation(t,e,n){return this.delegate.willSubmitFormLinkToLocation(t,e,n)&&(t.hasAttribute("data-turbo-method")||t.hasAttribute("data-turbo-stream"))}followedLinkToLocation(t,e){let n=document.createElement("form"),s="hidden";for(let[h,d]of e.searchParams)n.append(Object.assign(document.createElement("input"),{type:s,name:h,value:d}));let r=Object.assign(e,{search:""});n.setAttribute("data-turbo","true"),n.setAttribute("action",r.href),n.setAttribute("hidden","");let o=t.getAttribute("data-turbo-method");o&&n.setAttribute("method",o);let a=t.getAttribute("data-turbo-frame");a&&n.setAttribute("data-turbo-frame",a);let l=If(t);l&&n.setAttribute("data-turbo-action",l);let c=t.getAttribute("data-turbo-confirm");c&&n.setAttribute("data-turbo-confirm",c),t.hasAttribute("data-turbo-stream")&&n.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(t,e,n),document.body.appendChild(n),n.addEventListener("turbo:submit-end",()=>n.remove(),{once:!0}),requestAnimationFrame(()=>n.requestSubmit())}},ZS=class{static async preservingPermanentElements(t,e,n){let s=new this(t,e);s.enter(),await n(),s.leave()}constructor(t,e){this.delegate=t,this.permanentElementMap=e}enter(){for(let t in this.permanentElementMap){let[e,n]=this.permanentElementMap[t];this.delegate.enteringBardo(e,n),this.replaceNewPermanentElementWithPlaceholder(n)}}leave(){for(let t in this.permanentElementMap){let[e]=this.permanentElementMap[t];this.replaceCurrentPermanentElementWithClone(e),this.replacePlaceholderWithPermanentElement(e),this.delegate.leavingBardo(e)}}replaceNewPermanentElementWithPlaceholder(t){let e=crt(t);t.replaceWith(e)}replaceCurrentPermanentElementWithClone(t){let e=t.cloneNode(!0);t.replaceWith(e)}replacePlaceholderWithPermanentElement(t){this.getPlaceholderById(t.id)?.replaceWith(t)}getPlaceholderById(t){return this.placeholders.find(e=>e.content==t)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function crt(i){let t=document.createElement("meta");return t.setAttribute("name","turbo-permanent-placeholder"),t.setAttribute("content",i.id),t}var Gv=class{#t=null;static renderElement(t,e){}
4677constructor(t,e,n,s=!0){this.currentSnapshot=t,this.newSnapshot=e,this.isPreview=n,this.willRender=s,this.renderElement=this.constructor.renderElement,this.promise=new Promise((r,o)=>this.resolvingFunctions={resolve:r,reject:o})}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 ZS.preservingPermanentElements(this,this.permanentElementMap,t)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){let t=this.connectedSnapshot.firstAutofocusableElement;t&&t.focus()}}enteringBardo(t){this.#t||t.contains(this.currentSnapshot.activeElement)&&(this.#t=this.currentSnapshot.activeElement)}leavingBardo(t){t.contains(this.#t)&&this.#t instanceof HTMLElement&&(this.#t.focus(),this.#t=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"}},fm=class extends Gv{static renderElement(t,e){let n=document.createRange();n.selectNodeContents(t),n.deleteContents();let s=e,r=s.ownerDocument?.createRange();r&&(r.selectNodeContents(s),t.appendChild(r.extractContents()))}constructor(t,e,n,s,r,o=!0){super(e,n,s,r,o),this.delegate=t}get shouldRender(){return!0}async render(){await Hv(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await Hv(),this.focusFirstAutofocusableElement(),await Hv(),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,e=urt(this.currentElement.getAttribute("data-autoscroll-block"),"end"),n=hrt(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(t)return t.scrollIntoView({block:e,behavior:n}),!0}return!1}activateScriptElements(){for(let t of this.newScriptElements){let e=Wv(t);t.replaceWith(e)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function urt(i,t){return i=="end"||i=="start"||i=="center"||i=="nearest"?i:t}function hrt(i,t){return i=="auto"||i=="smooth"?i:t}var drt=(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:d=>d.getAttribute("im-preserve")==="true",shouldReAppend:d=>d.getAttribute("im-re-append")==="true",shouldRemove:i,afterHeadMorphed:i},restoreFocus:!0};function e(d,p,g={}){d=u(d);let y=h(p),x=c(d,y,g),w=s(x,()=>a(x,d,y,M=>M.morphStyle==="innerHTML"?(r(M,d,y),Array.from(d.childNodes)):n(M,d,y)));return x.pantry.remove(),w}function n(d,p,g){let y=h(p);return r(d,y,g,p,p.nextSibling),Array.from(y.childNodes)}function s(d,p){if(!d.config.restoreFocus)return p();let g=document.activeElement;if(!(g instanceof HTMLInputElement||g instanceof HTMLTextAreaElement))return p();let{id:y,selectionStart:x,selectionEnd:w}=g,M=p();return y&&y!==document.activeElement?.getAttribute("id")&&(g=d.target.querySelector(`[id="${y}"]`),g?.focus()),g&&!g.selectionEnd&&w&&g.setSelectionRange(x,w),M}let r=(function(){function d(C,R,k,O=null,I=null){R instanceof HTMLTemplateElement&&k instanceof HTMLTemplateElement&&(R=R.content,k=k.content),O||=R.firstChild;for(let U of k.childNodes){if(O&&O!=I){let q=g(C,U,O,I);if(q){q!==O&&x(C,O,q),o(q,U,C),O=q.nextSibling;continue}}if(U instanceof Element){let q=U.getAttribute("id");if(C.persistentIds.has(q)){let X=w(R,q,O,C);o(X,U,C),O=X.nextSibling;continue}}let V=p(R,U,O,C);V&&(O=V.nextSibling)}for(;O&&O!=I;){let U=O;O=O.nextSibling,y(C,U)}}function p(C,R,k,O){if(O.callbacks.beforeNodeAdded(R)===!1)return null;if(O.idMap.has(R)){let I=document.createElement(R.tagName);return C.insertBefore(I,k),o(I,R,O),O.callbacks.afterNodeAdded(I),I}else{let I=document.importNode(R,!0);return C.insertBefore(I,k),O.callbacks.afterNodeAdded(I),I}}let g=(function(){function C(O,I,U,V){let q=null,X=I.nextSibling,j=0,W=U;for(;W&&W!=V;){if(k(W,I)){if(R(O,W,I))return W;q===null&&(O.idMap.has(W)||(q=W))}if(q===null&&X&&k(W,X)&&(j++,X=X.nextSibling,j>=2&&(q=void 0)),O.activeElementAndParents.includes(W))break;W=W.nextSibling}return q||null}
4677function R(O,I,U){let V=O.idMap.get(I),q=O.idMap.get(U);if(!q||!V)return!1;for(let X of V)if(q.has(X))return!0;return!1}function k(O,I){let U=O,V=I;return U.nodeType===V.nodeType&&U.tagName===V.tagName&&(!U.getAttribute?.("id")||U.getAttribute?.("id")===V.getAttribute?.("id"))}return C})();function y(C,R){if(C.idMap.has(R))A(C.pantry,R,null);else{if(C.callbacks.beforeNodeRemoved(R)===!1)return;R.parentNode?.removeChild(R),C.callbacks.afterNodeRemoved(R)}}function x(C,R,k){let O=R;for(;O&&O!==k;){let I=O;O=O.nextSibling,y(C,I)}return O}function w(C,R,k,O){let I=O.target.getAttribute?.("id")===R&&O.target||O.target.querySelector(`[id="${R}"]`)||O.pantry.querySelector(`[id="${R}"]`);return M(I,O),A(C,I,k),I}function M(C,R){let k=C.getAttribute("id");for(;C=C.parentNode;){let O=R.idMap.get(C);O&&(O.delete(k),O.size||R.idMap.delete(C))}}function A(C,R,k){if(C.moveBefore)try{C.moveBefore(R,k)}catch{C.insertBefore(R,k)}else C.insertBefore(R,k)}return d})(),o=(function(){function d(M,A,C){return C.ignoreActive&&M===document.activeElement?null:(C.callbacks.beforeNodeMorphed(M,A)===!1||(M instanceof HTMLHeadElement&&C.head.ignore||(M instanceof HTMLHeadElement&&C.head.style!=="morph"?l(M,A,C):(p(M,A,C),w(M,C)||r(C,M,A))),C.callbacks.afterNodeMorphed(M,A)),M)}function p(M,A,C){let R=A.nodeType;if(R===1){let k=M,O=A,I=k.attributes,U=O.attributes;for(let V of U)x(V.name,k,"update",C)||k.getAttribute(V.name)!==V.value&&k.setAttribute(V.name,V.value);for(let V=I.length-1;0<=V;V--){let q=I[V];if(q&&!O.hasAttribute(q.name)){if(x(q.name,k,"remove",C))continue;k.removeAttribute(q.name)}}
4677w(k,C)||g(k,O,C)}(R===8||R===3)&&M.nodeValue!==A.nodeValue&&(M.nodeValue=A.nodeValue)}function g(M,A,C){if(M instanceof HTMLInputElement&&A instanceof HTMLInputElement&&A.type!=="file"){let R=A.value,k=M.value;y(M,A,"checked",C),y(M,A,"disabled",C),A.hasAttribute("value")?k!==R&&(x("value",M,"update",C)||(M.setAttribute("value",R),M.value=R)):x("value",M,"remove",C)||(M.value="",M.removeAttribute("value"))}else if(M instanceof HTMLOptionElement&&A instanceof HTMLOptionElement)y(M,A,"selected",C);else if(M instanceof HTMLTextAreaElement&&A instanceof HTMLTextAreaElement){let R=A.value,k=M.value;if(x("value",M,"update",C))return;R!==k&&(M.value=R),M.firstChild&&M.firstChild.nodeValue!==R&&(M.firstChild.nodeValue=R)}}function y(M,A,C,R){let k=A[C],O=M[C];if(k!==O){let I=x(C,M,"update",R);I||(M[C]=A[C]),k?I||M.setAttribute(C,""):x(C,M,"remove",R)||M.removeAttribute(C)}}function x(M,A,C,R){return M==="value"&&R.ignoreActiveValue&&A===document.activeElement?!0:R.callbacks.beforeAttributeUpdated(M,A,C)===!1}function w(M,A){return!!A.ignoreActiveValue&&M===document.activeElement&&M!==document.body}return d})();function a(d,p,g,y){if(d.head.block){let x=p.querySelector("head"),w=g.querySelector("head");if(x&&w){let M=l(x,w,d);return Promise.all(M).then(()=>{let A=Object.assign(d,{head:{block:!1,ignore:!0}});return y(A)})}}return y(d)}function l(d,p,g){let y=[],x=[],w=[],M=[],A=new Map;for(let R of p.children)A.set(R.outerHTML,R);for(let R of d.children){let k=A.has(R.outerHTML),O=g.head.shouldReAppend(R),I=g.head.shouldPreserve(R);k||I?O?x.push(R):(A.delete(R.outerHTML),w.push(R)):g.head.style==="append"?O&&(x.push(R),M.push(R)):g.head.shouldRemove(R)!==!1&&x.push(R)}M.push(...A.values());let C=[];for(let R of M){let k=document.createRange().createContextualFragment(R.outerHTML).firstChild;if(g.callbacks.beforeNodeAdded(k)!==!1){if("href"in k&&k.href||"src"in k&&k.src){let O,I=new Promise(function(U){O=U});k.addEventListener("load",function(){O()}),C.push(I)}d.appendChild(k),g.callbacks.afterNodeAdded(k),y.push(k)}}for(let R of x)g.callbacks.beforeNodeRemoved(R)!==!1&&(d.removeChild(R),g.callbacks.afterNodeRemoved(R));return g.head.afterHeadMorphed(d,{added:y,kept:w,removed:x}),C}let c=(function(){function d(C,R,k){let{persistentIds:O,idMap:I}=M(C,R),U=p(k),V=U.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(V))throw`Do not understand how to morph style ${V}`;return{target:C,newContent:R,config:U,morphStyle:V,ignoreActive:U.ignoreActive,ignoreActiveValue:U.ignoreActiveValue,restoreFocus:U.restoreFocus,idMap:I,persistentIds:O,pantry:g(),activeElementAndParents:y(C),callbacks:U.callbacks,head:U.head}}function p(C){let R=Object.assign({},t);return Object.assign(R,C),R.callbacks=Object.assign({},t.callbacks,C.callbacks),R.head=Object.assign({},t.head,C.head),R}function g(){let C=document.createElement("div");return C.hidden=!0,document.body.insertAdjacentElement("afterend",C),C}function y(C){let R=[],k=document.activeElement;if(k?.tagName!=="BODY"&&C.contains(k))for(;k&&(R.push(k),k!==C);)k=k.parentElement;return R}function x(C){let R=Array.from(C.querySelectorAll("[id]"));return C.getAttribute?.("id")&&R.push(C),R}function w(C,R,k,O){for(let I of O){let U=I.getAttribute("id");if(R.has(U)){let V=I;for(;V;){let q=C.get(V);if(q==null&&(q=new Set,C.set(V,q)),q.add(U),V===k)break;V=V.parentElement}}}}function M(C,R){let k=x(C),O=x(R),I=A(k,O),U=new Map;w(U,I,C,k);let V=R.__idiomorphRoot||R;return w(U,I,V,O),{persistentIds:I,idMap:U}}function A(C,R){let k=new Set,O=new Map;for(let{id:U,tagName:V}of C)O.has(U)?k.add(U):O.set(U,V);let I=new Set;for(let{id:U,tagName:V}of R)I.has(U)?k.add(U):O.get(U)===V&&I.add(U);for(let U of k)I.delete(U);return I}return d})(),{normalizeElement:u,normalizeParent:h}=(function(){let d=new WeakSet;function p(w){return w instanceof Document?w.documentElement:w}function g(w){if(w==null)return document.createElement("div");if(typeof w=="string")return g(x(w));if(d.has(w))return w;if(w instanceof Node){if(w.parentNode)return new y(w);{let M=document.createElement("div");return M.append(w),M}}else{let M=document.createElement("div");for(let A of[...w])M.append(A);return M}}class y{constructor(M){this.originalNode=M,this.realParentNode=M.parentNode,this.previousSibling=M.previousSibling,this.nextSibling=M.nextSibling}get childNodes(){let M=[],A=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;A&&A!=this.nextSibling;)M.push(A),A=A.nextSibling;return M}querySelectorAll(M){return this.childNodes.reduce((A,C)=>{if(C instanceof Element){C.matches(M)&&A.push(C);let R=C.querySelectorAll(M);for(let k=0;k<R.length;k++)A.push(R[k])}return A},[])}insertBefore(M,A){return this.realParentNode.insertBefore(M,A)}moveBefore(M,A){return this.realParentNode.moveBefore(M,A)}get __idiomorphRoot(){return this.originalNode}}function x(w){let M=new DOMParser,A=w.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(A.match(/<\/html>/)||A.match(/<\/head>/)||A.match(/<\/body>/)){let C=M.parseFromString(w,"text/html");if(A.match(/<\/html>/))return d.add(C),C;{let R=C.firstChild;return R&&d.add(R),R}}else{let R=M.parseFromString("<body><template>"+w+"</template></body>","text/html").body.querySelector("template").content;return d.add(R),R}}return{normalizeElement:p,normalizeParent:g}})();return{morph:e,defaults:t}}
4677)();function qv(i,t,{callbacks:e,...n}={}){drt.morph(i,t,{...n,callbacks:new nR(e)})}function rC(i,t,e={}){qv(i,t.childNodes,{...e,morphStyle:"innerHTML"})}function o6(i,t){return i instanceof Ia&&i.shouldReloadWithMorph&&(!t||frt(i,t))&&!i.closest("[data-turbo-permanent]")}function frt(i,t){return t instanceof Element&&t.nodeName==="TURBO-FRAME"&&i.id===t.id&&(!t.getAttribute("src")||QH(i.src,t.getAttribute("src")))}function a6(i){return i.parentElement.closest("turbo-frame[src][refresh=morph]")}var nR=class{#t;constructor({beforeNodeMorphed:t}={}){this.#t=t||(()=>!0)}beforeNodeAdded=t=>!(t.id&&t.hasAttribute("data-turbo-permanent")&&document.getElementById(t.id));beforeNodeMorphed=(t,e)=>{if(t instanceof Element)return!t.hasAttribute("data-turbo-permanent")&&this.#t(t,e)?!Ls("turbo:before-morph-element",{cancelable:!0,target:t,detail:{currentElement:t,newElement:e}}).defaultPrevented:!1};beforeAttributeUpdated=(t,e,n)=>!Ls("turbo:before-morph-attribute",{cancelable:!0,target:e,detail:{attributeName:t,mutationType:n}}).defaultPrevented;beforeNodeRemoved=t=>this.beforeNodeMorphed(t);afterNodeMorphed=(t,e)=>{t instanceof Element&&Ls("turbo:morph-element",{target:t,detail:{currentElement:t,newElement:e}})}},QS=class extends fm{static renderElement(t,e){Ls("turbo:before-frame-morph",{target:t,detail:{currentElement:t,newElement:e}}),rC(t,e,{callbacks:{beforeNodeMorphed:(n,s)=>o6(n,s)&&a6(n)===t?(n.reload(),!1):!0}})}async preservingPermanentElements(t){return await t()}},iR=class i{static animationDuration=300;static get defaultCSS(){return GH`
4678      .turbo-progress-bar {
4679        position: fixed;
4680        display: block;
4681        top: 0;
4682        left: 0;
4683        height: 3px;
4684        background: #0076ff;
4685        z-index: 2147483647;
4686        transition:
4687          width ${i.animationDuration}ms ease-out,
4688          opacity ${i.animationDuration/2}ms ${i.animationDuration/2}ms ease-in;
4689        transform: translate3d(0, 0, 0);
4690      }
4691    `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(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,i.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,i.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let t=document.createElement("style");t.type="text/css",t.textContent=i.defaultCSS;let e=YH();return e&&(t.nonce=e),t}createProgressElement(){let t=document.createElement("div");return t.className="turbo-progress-bar",t}},sR=class extends dm{detailsByOuterHTML=this.children.filter(t=>!brt(t)).map(t=>xrt(t)).reduce((t,e)=>{let{outerHTML:n}=e,s=n in t?t[n]:{type:prt(e),tracked:grt(e),elements:[]};return{...t,[n]:{...s,elements:[...s.elements,e]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(t=>this.detailsByOuterHTML[t].tracked).join("")}getScriptElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("script",t)}getStylesheetElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",t)}getElementsMatchingTypeNotInSnapshot(t,e){return Object.keys(this.detailsByOuterHTML).filter(n=>!(n in e.detailsByOuterHTML)).map(n=>this.detailsByOuterHTML[n]).filter(({type:n})=>n==t).map(({elements:[n]})=>n)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((t,e)=>{let{type:n,tracked:s,elements:r}=this.detailsByOuterHTML[e];return n==null&&!s?[...t,...r]:r.length>1?[...t,...r.slice(1)]:t},[])}getMetaValue(t){let e=this.findMetaElementByName(t);return e?e.getAttribute("content"):null}findMetaElementByName(t){return Object.keys(this.detailsByOuterHTML).reduce((e,n)=>{let{elements:[s]}=this.detailsByOuterHTML[n];return yrt(s,t)?s:e},void 0|void 0)}};function prt(i){if(mrt(i))return"script";if(vrt(i))return"stylesheet"}function grt(i){return i.getAttribute("data-turbo-track")=="reload"}function mrt(i){return i.localName=="script"}function brt(i){return i.localName=="noscript"}function vrt(i){let t=i.localName;return t=="style"||t=="link"&&i.getAttribute("rel")=="stylesheet"}function yrt(i,t){return i.localName=="meta"&&i.getAttribute("name")==t}function xrt(i){return i.hasAttribute("nonce")&&i.setAttribute("nonce",""),i}var sl=class i extends dm{static fromHTMLString(t=""){return this.fromDocument($H(t))}static fromElement(t){return this.fromDocument(t.ownerDocument)}static fromDocument({documentElement:t,body:e,head:n}){return new this(t,e,new sR(n))}constructor(t,e,n){super(e),this.documentElement=t,this.headSnapshot=n}clone(){let t=this.element.cloneNode(!0),e=this.element.querySelectorAll("select"),n=t.querySelectorAll("select");for(let[s,r]of e.entries()){let o=n[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of r.selectedOptions)o.options[a.index].selected=!0}for(let s of t.querySelectorAll('input[type="password"]'))s.value="";for(let s of t.querySelectorAll("noscript"))s.remove();return new i(this.documentElement,t,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get dir(){return this.documentElement.getAttribute("dir")}get headElement(){return this.headSnapshot.element}get rootLocation(){let t=this.getSetting("root")??"/";return qr(t)}
4691get 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.getSetting("view-transition")==="true"||this.headSnapshot.getMetaValue("view-transition")==="same-origin")&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}get refreshMethod(){return this.getSetting("refresh-method")}get refreshScroll(){return this.getSetting("refresh-scroll")}getSetting(t){return this.headSnapshot.getMetaValue(`turbo-${t}`)}},rR=class{#t=!1;#e=Promise.resolve();renderChange(t,e){return t&&this.viewTransitionsAvailable&&!this.#t?(this.#t=!0,this.#e=this.#e.then(async()=>{await document.startViewTransition(e).finished})):this.#e=this.#e.then(e),this.#e}get viewTransitionsAvailable(){return document.startViewTransition}},wrt={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1,refresh:{}},zS={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},Cu={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},um={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},_rt={advance:"forward",restore:"back",replace:"none"},oR=class{identifier=Hh();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=Cu.initialized;viewTransitioner=new rR;constructor(t,e,n,s={}){this.delegate=t,this.location=e,this.restorationIdentifier=n||Hh();let{action:r,historyChanged:o,referrer:a,snapshot:l,snapshotHTML:c,response:u,visitCachedSnapshot:h,willRender:d,updateHistory:p,shouldCacheSnapshot:g,acceptsStreamResponse:y,direction:x,refresh:w}={...wrt,...s};this.action=r,this.historyChanged=o,this.referrer=a,this.snapshot=l,this.snapshotHTML=c,this.response=u,this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=h,this.willRender=d,this.updateHistory=p,this.scrolled=!d,this.shouldCacheSnapshot=g,this.acceptsStreamResponse=y,this.direction=x||_rt[r],this.refresh=w}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)}start(){this.state==Cu.initialized&&(this.recordTimingMetric(zS.visitStart),this.state=Cu.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==Cu.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=Cu.canceled)}complete(){this.state==Cu.started&&(this.recordTimingMetric(zS.visitEnd),this.adapter.visitCompleted(this),this.state=Cu.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==Cu.started&&(this.state=Cu.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let t=this.location.href===this.referrer?.href?"replace":this.action,e=qH(t);this.history.update(e,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new jh(this,La.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(zS.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(t=this.response){if(this.response=t,t){let{statusCode:e}=t;zH(e)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,e)}}finishRequest(){this.recordTimingMetric(zS.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:t,responseHTML:e}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,zH(t)&&e!=null){let n=sl.fromHTMLString(e);await this.renderPageSnapshot(n,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(sl.fromHTMLString(e),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let t=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(t&&(!jv(this.location)||t.hasAnchor(jv(this.location)))&&(this.action=="restore"||t.isPreviewable))return t}getPreloadedSnapshot(){if(this.snapshotHTML)return sl.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let t=this.getCachedSnapshot();if(t){let e=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(t,e),this.adapter.visitRendered(this),e||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}prepareRequest(t){this.acceptsStreamResponse&&t.acceptResponseType(Wh.contentType)}
4691requestStarted(){this.startRequest()}requestPreventedHandlingResponse(t,e){}async requestSucceededWithResponse(t,e){let n=await e.responseHTML,{redirected:s,statusCode:r}=e;n==null?this.recordResponse({statusCode:um.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=e.redirected?e.location:void 0,this.recordResponse({statusCode:r,responseHTML:n,redirected:s}))}async requestFailedWithResponse(t,e){let n=await e.responseHTML,{redirected:s,statusCode:r}=e;n==null?this.recordResponse({statusCode:um.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:r,responseHTML:n,redirected:s})}requestErrored(t,e){this.recordResponse({statusCode:um.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.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:t}=this.restorationData;if(t)return this.view.scrollToPosition(t),!0}scrollToAnchor(){let t=jv(this.location);if(t!=null)return this.view.scrollToAnchor(t),!0}recordTimingMetric(t){this.timingMetrics[t]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return 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(e=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>e(),0):requestAnimationFrame(()=>e())}),await t(),delete this.frame}async renderPageSnapshot(t,e){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(t),async()=>{await this.view.renderPage(t,e,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function zH(i){return i>=200&&i<300}var aR=class{progressBar=new iR;constructor(t){this.session=t}visitProposedToLocation(t,e){zh(t,this.navigator.rootLocation)?this.navigator.startVisit(t,e?.restorationIdentifier||Hh(),e):window.location.href=t.toString()}visitStarted(t){this.location=t.location,this.redirectedToLocation=null,t.loadCachedSnapshot(),t.issueRequest()}visitRequestStarted(t){this.progressBar.setValue(0),t.hasCachedSnapshot()||t.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(t){t.loadResponse(),t.response.redirected&&(this.redirectedToLocation=t.redirectedToLocation)}visitRequestFailedWithStatusCode(t,e){switch(e){case um.networkFailure:case um.timeoutFailure:case um.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:e}});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)}showProgressBar=()=>{this.progressBar.show()};reload(t){Ls("turbo:reload",{detail:t}),window.location.href=(this.redirectedToLocation||this.location)?.toString()||window.location.href}get navigator(){return this.session.navigator}},lR=class{selector="[data-turbo-temporary]";started=!1;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))}removeTemporaryElements=t=>{for(let e of this.temporaryElements)e.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector)]}},cR=class{constructor(t,e){this.session=t,this.element=e,this.linkInterceptor=new XS(this,e),this.formSubmitObserver=new $v
4691(this,e)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(t,e,n){return this.#e(t)}linkClickIntercepted(t,e,n){let s=this.#n(t);s&&s.delegate.linkClickIntercepted(t,e,n)}willSubmitForm(t,e){return t.closest("turbo-frame")==null&&this.#t(t,e)&&this.#e(t,e)}formSubmitted(t,e){let n=this.#n(t,e);n&&n.delegate.formSubmitted(t,e)}#t(t,e){let n=AR(t,e),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),r=qr(s?.content??"/");return this.#e(t,e)&&zh(n,r)}#e(t,e){if(t instanceof HTMLFormElement?this.session.submissionIsNavigatable(t,e):this.session.elementIsNavigatable(t)){let s=this.#n(t,e);return s?s!=t.closest("turbo-frame"):!1}else return!1}#n(t,e){let n=e?.getAttribute("data-turbo-frame")||t.getAttribute("data-turbo-frame");if(n&&n!="_top"){let s=this.element.querySelector(`#${n}:not([disabled])`);if(s instanceof Ia)return s}}},uR=class{location;restorationIdentifier=Hh();restorationData={};started=!1;currentIndex=0;constructor(t){this.delegate=t}start(){this.started||(addEventListener("popstate",this.onPopState,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),this.started=!1)}push(t,e){this.update(history.pushState,t,e)}replace(t,e){this.update(history.replaceState,t,e)}update(t,e,n=Hh()){t===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:n,restorationIndex:this.currentIndex}};t.call(history,s,"",e.href),this.location=e,this.restorationIdentifier=n}getRestorationDataForIdentifier(t){return this.restorationData[t]||{}}updateRestorationData(t){let{restorationIdentifier:e}=this,n=this.restorationData[e];this.restorationData[e]={...n,...t}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=t=>{let{turbo:e}=t.state||{};if(this.location=new URL(window.location.href),e){let{restorationIdentifier:n,restorationIndex:s}=e;this.restorationIdentifier=n;let r=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,n,r),this.currentIndex=s}else this.currentIndex++,this.delegate.historyPoppedWithEmptyState(this.location)}},hR=class{started=!1;#t=null;constructor(t,e){this.delegate=t,this.eventTarget=e}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#e,{once:!0}):this.#e())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#n,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#i,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#s,!0),this.started=!1)}#e=()=>{this.eventTarget.addEventListener("mouseenter",this.#n,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#i,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#s,!0),this.started=!0};#n=t=>{if($S("turbo-prefetch")==="false")return;let e=t.target;if(e.matches&&e.matches("a[href]:not([target^=_]):not([download])")&&this.#l(e)){let s=e,r=ZH(s);if(this.delegate.canPrefetchRequestToLocation(s,r)){this.#t=s;let o=new jh(this,La.get,r,new URLSearchParams,e);o.fetchOptions.priority="low",lm.putLater(r,o,this.#o)}}};#i=t=>{t.target===this.#t&&this.#r()};#r=()=>{lm.clear(),this.#t=null};#s=t=>{if(t.target.tagName!=="FORM"&&t.detail.fetchOptions.method==="GET"){let e=lm.get(t.detail.url);e&&(t.detail.fetchRequest=e),lm.clear()}};prepareRequest(t){let e=t.target;t.headers["X-Sec-Purpose"]="prefetch";let n=e.closest("turbo-frame"),s=e.getAttribute("data-turbo-frame")||n?.getAttribute("target")||n?.id;s&&s!=="_top"&&(t.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(t){}requestErrored(t){}requestFinished(t){}requestPreventedHandlingResponse(t,e){}requestFailedWithResponse(t,e){}get#o(){return Number($S("turbo-prefetch-cache-time"))||i6}#l(t){return!(!t.getAttribute("href")||Srt(t)||Crt(t)||Mrt(t)||Trt(t)||Ert(t))}},Srt=i=>i.origin!==document.location.origin||!["http:","https:"].includes(i.protocol)||i.hasAttribute("target"),Crt=i=>i.pathname+i.search===document.location.pathname+document.location.search||i.href.startsWith("#"),Mrt=i=>{if(i.getAttribute("data-turbo-prefetch")==="false"||i.getAttribute("data-turbo")==="false")return!0;let t=cm(i,"[data-turbo-prefetch]");return!!(t&&t.getAttribute("data-turbo-prefetch")==="false")},Trt=i=>{let t=i.getAttribute("data-turbo-method");return!!(t&&t.toLowerCase()!=="get"||Art(i)||i.hasAttribute("data-turbo-confirm")||i.hasAttribute("data-turbo-stream"))},Art=i=>i.hasAttribute("data-remote")||i.hasAttribute("data-behavior")||i.hasAttribute("data-confirm")||i.hasAttribute("data-method"),Ert=i=>Ls("turbo:before-prefetch",{target:i,cancelable:!0}).defaultPrevented,dR=class{constructor(t){this.delegate=t}proposeVisit(t,e={}){this.delegate.allowsVisitingLocationWithAction(t,e.action)&&this.delegate.visitProposedToLocation(t,e)}startVisit(t,e,n={}){this.stop(),this.currentVisit=new oR(this,qr(t),e,{referrer:this.location,...n}),this.currentVisit.start()}submitForm(t,e){this.stop(),this.formSubmission=new qS(this,t,e,!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,e){if(t==this.formSubmission){let n=await e.responseHTML;if(n){let s=t.isSafe;s||this.view.clearSnapshotCache();let{statusCode:r,redirected:o}=e,l={action:this.#t(t,e),shouldCacheSnapshot:s,response:{statusCode:r,responseHTML:n,redirected:o}};this.proposeVisit(e.location,l)}}}async formSubmissionFailedWithResponse(t,e){let n=await e.responseHTML;if(n){let s=sl.fromHTMLString(n);e.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),s.refreshScroll!=="preserve"&&this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(t,e){console.error(e)}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,e){return!1}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#t(t,e){let{submitter:n,formElement:s}=t;return If(n,s)||this.#e(e)}#e(t){return t.redirected&&t.location.href===this.location?.href?"replace":"advance"}},Df={initial:0,loading:1,interactive:2,complete:3},fR=class{stage=Df.initial;started=!1;constructor(t){this.delegate=t}start(){this.started||(this.stage==Df.initial&&(this.stage=Df.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)}interpretReadyState=()=>{let{readyState:t}=this;t=="interactive"?this.pageIsInteractive():t=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==Df.loading&&(this.stage=Df.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Df.interactive&&(this.stage=Df.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},pR=class{started=!1;constructor(t){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)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(t){this.delegate.scrollPositionChanged(t)}},gR=class{render({fragment:t}){ZS.preservingPermanentElements(this,krt(t),()=>{Prt(t,()=>{Rrt(()=>{document.documentElement.appendChild(t)})})})}enteringBardo(t,e){e.replaceWith(t.cloneNode(!0))}leavingBardo(){}};function krt(i){let t=r6(document.documentElement),e={};for(let n of t){let{id:s}=n;for(let r of i.querySelectorAll("turbo-stream")){let o=s6(r.templateElement.content,s);o&&(e[s]=[n,o])}}return e}async function Prt(i,t){let e=`turbo-stream-autofocus-${Hh()}`,n=i.querySelectorAll("turbo-stream"),s=Drt(n),r=null;if(s&&(s.id?r=s.id:r=e,s.id=r),t(),await Hv(),(document.activeElement==null||document.activeElement==document.body)&&r){let a=document.getElementById(r);TR(a)&&a.focus(),a&&a.id==e&&a.removeAttribute("id")}}async function Rrt(i){let[t,e]=await Vst(i,()=>document.activeElement),n=t&&t.id;if(n){let s=document.getElementById(n);TR(s)&&s!=e&&s.focus()}}function Drt(i){for(let t of i){let e=XH(t.templateElement.content);if(e)return e}return null}var mR=class{sources=new Set;#t=!1;constructor(t){this.delegate=t}start(){this.#t||(this.#t=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#t&&(this.#t=!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)}inspectFetchResponse=t=>{let e=Lrt(t);e&&Irt(e)&&(t.preventDefault(),this.receiveMessageResponse(e))};receiveMessageEvent=t=>
4691{this.#t&&typeof t.data=="string"&&this.receiveMessageHTML(t.data)};async receiveMessageResponse(t){let e=await t.responseHTML;e&&this.receiveMessageHTML(e)}receiveMessageHTML(t){this.delegate.receivedMessageFromStream(Wh.wrap(t))}};function Lrt(i){let t=i.detail?.fetchResponse;if(t instanceof hm)return t}function Irt(i){return(i.contentType??"").startsWith(Wh.contentType)}var bR=class extends Gv{static renderElement(t,e){let{documentElement:n,body:s}=document;n.replaceChild(e,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:t,head:e}=document;t.replaceChild(this.newHead,e),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let t of this.scriptElements){let e=t.parentNode;if(e){let n=Wv(t);e.replaceChild(n,t)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},pm=class extends Gv{static renderElement(t,e){document.body&&e instanceof HTMLBodyElement?document.body.replaceWith(e):document.documentElement.appendChild(e)}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(){this.#t(),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}#t(){let{documentElement:t}=this.currentSnapshot,{dir:e,lang:n}=this.newSnapshot;n?t.setAttribute("lang",n):t.removeAttribute("lang"),e?t.setAttribute("dir",e):t.removeAttribute("dir")}async mergeHead(){let t=this.mergeProvisionalElements(),e=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await t,await e,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 t=[];for(let e of this.newHeadStylesheetElements)t.push(Fst(e)),document.head.appendChild(e);await Promise.all(t)}copyNewHeadScriptElements(){for(let t of this.newHeadScriptElements)document.head.appendChild(Wv(t))}removeUnusedDynamicStylesheetElements(){for(let t of this.unusedDynamicStylesheetElements)document.head.removeChild(t)}async mergeProvisionalElements(){let t=[...this.newHeadProvisionalElements];for(let e of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(e,t)||document.head.removeChild(e);for(let e of t)document.head.appendChild(e)}isCurrentElementInElementList(t,e){for(let[n,s]of e.entries()){if(t.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(t.innerHTML==s.innerHTML)return e.splice(n,1),!0}if(s.isEqualNode(t))return e.splice(n,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let t of this.currentHeadProvisionalElements)document.head.removeChild(t)}copyNewHeadProvisionalElements(){for(let t of this.newHeadProvisionalElements)document.head.appendChild(t)}activateNewBody(){document.adoptNode(this.newElement),this.removeNoscriptElements(),this.activateNewBodyScriptElements()}removeNoscriptElements(){for(let t of this.newElement.querySelectorAll("noscript"))t.remove()}activateNewBodyScriptElements(){for(let t of this.newBodyScriptElements){let e=Wv(t);t.replaceWith(e)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(t=>t.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")}},tC=class extends pm{static renderElement(t,e){qv(t,e,{callbacks:{beforeNodeMorphed:(n,s)=>o6(n,s)&&!a6(n)?(n.reload(),!1):!0}}),Ls("turbo:morph",{detail:{currentElement:t,newElement:e}})}async preservingPermanentElements(t){return await t()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}},vR=class extends GS{constructor(t){super(t,VS)}get snapshots(){return this.entries}},yR=class extends YS{snapshotCache=new vR(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(t){return this.snapshot.prefersViewTransitions&&t.prefersViewTransitions}renderPage(t,e=!1,n=!0,s){let o=this.isPageRefresh(s)&&(s?.refresh?.method||this.snapshot.refreshMethod)==="morph"?tC:pm,a=new o(this.snapshot,t,e,n);return a.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(t,e){e?.changeHistory();let n=new bR(this.snapshot,t,!1);return this.render(n)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(t=this.snapshot){if(t.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:e}=this;await WH();let n=t.clone();return this.snapshotCache.put(e,n),n}}getCachedSnapshotForLocation(t){return this.snapshotCache.get(t)}isPageRefresh(t){return!t||this.lastRenderedLocation.pathname===t.location.pathname&&t.action==="replace"}shouldPreserveScrollPosition(t){return this.isPageRefresh(t)&&(t?.refresh?.scroll||this.snapshot.refreshScroll)==="preserve"}get snapshot(){return sl.fromElement(this.element)}},xR=class{selector="a[data-turbo-preload]";constructor(t,e){this.delegate=t,this.snapshotCache=e}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#t):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#t)}preloadOnLoadLinksForView(t){for(let e of t.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(e)&&this.preloadURL(e)}async preloadURL(t){let e=new URL(t.href);if(this.snapshotCache.has(e))return;await new jh(this,La.get,e,new URLSearchParams,t).perform()}prepareRequest(t){t.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(t,e){try{let n=await e.responseHTML,s=sl.fromHTMLString(n);this.snapshotCache.put(t.url,s)}catch{}}requestStarted(t){}requestErrored(t){}requestFinished(t){}requestPreventedHandlingResponse(t,e){}requestFailedWithResponse(t,e){}#t=()=>{this.preloadOnLoadLinksForView(document.body)}},wR=class{constructor(t){this.session=t}clear(){this.session.clearCache()}resetCacheControl(){this.#t("")}exemptPageFromCache(){this.#t("no-cache")}exemptPageFromPreview(){this.#t("no-preview")}#t(t){zst("turbo-cache-control",t)}},_R=class{navigator=new dR(this);history=new uR(this);view=new yR(this,document.documentElement);adapter=new aR(this);
4691pageObserver=new fR(this);cacheObserver=new lR;linkPrefetchObserver=new hR(this,document);linkClickObserver=new KS(this,window);formSubmitObserver=new $v(this,document);scrollObserver=new pR(this);streamObserver=new mR(this);formLinkClickObserver=new JS(this,document.documentElement);frameRedirector=new cR(this,document.documentElement);streamMessageRenderer=new gR;cache=new wR(this);enabled=!0;started=!1;#t=150;constructor(t){this.recentRequests=t,this.preloader=new xR(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,e={}){let n=e.frame?document.getElementById(e.frame):null;if(n instanceof Ia){let s=e.action||If(n);n.delegate.proposeVisitIfNavigatedWithAction(n,s),n.src=t.toString()}else this.navigator.proposeVisit(qr(t),e)}refresh(t,e={}){e=typeof e=="string"?{requestId:e}:e;let{method:n,requestId:s,scroll:r}=e,o=s&&this.recentRequests.has(s),a=t===document.baseURI;!o&&!this.navigator.currentVisit&&a&&this.visit(t,{action:"replace",shouldCacheSnapshot:!1,refresh:{method:n,scroll:r}})}connectStreamSource(t){this.streamObserver.connectStreamSource(t)}disconnectStreamSource(t){this.streamObserver.disconnectStreamSource(t)}renderStreamMessage(t){this.streamMessageRenderer.render(Wh.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){wr.drive.progressBarDelay=t}get progressBarDelay(){return wr.drive.progressBarDelay}set drive(t){wr.drive.enabled=t}get drive(){return wr.drive.enabled}set formMode(t){wr.forms.mode=t}get formMode(){return wr.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#t}set pageRefreshDebouncePeriod(t){this.refresh=Hst(this.debouncedRefresh.bind(this),t),this.#t=t}shouldPreloadLink(t){let e=t.hasAttribute("data-turbo-method"),n=t.hasAttribute("data-turbo-stream"),s=t.getAttribute("data-turbo-frame"),r=s=="_top"?null:document.getElementById(s)||cm(t,"turbo-frame:not([disabled])");if(e||n||r instanceof Ia)return!1;{let o=new URL(t.href);return this.elementIsNavigatable(t)&&zh(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(t,e,n){this.enabled?this.navigator.startVisit(t,e,{action:"restore",historyChanged:!0,direction:n}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}historyPoppedWithEmptyState(t){this.history.replace(t),this.view.lastRenderedLocation=t,this.view.cacheSnapshot()}scrollPositionChanged(t){this.history.updateRestorationData({scrollPosition:t})}willSubmitFormLinkToLocation(t,e){return this.elementIsNavigatable(t)&&zh(e,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(t,e){return this.elementIsNavigatable(t)&&zh(e,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(e)}willFollowLinkToLocation(t,e,n){return this.elementIsNavigatable(t)&&zh(e,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(t,e,n)}followedLinkToLocation(t,e){let n=this.getActionForLink(t),s=t.hasAttribute("data-turbo-stream");this.visit(e.href,{action:n,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(t,e){return this.applicationAllowsVisitingLocation(t)}visitProposedToLocation(t,e){VH(t),this.adapter.visitProposedToLocation(t,e)}visitStarted(t){t.acceptsStreamResponse||(jS(document.documentElement),this.view.markVisitDirection(t.direction)),VH(t.location),this.notifyApplicationAfterVisitingLocation(t.location,t.action)}visitCompleted(t){this.view.unmarkVisitDirection(),WS(document.documentElement),this.notifyApplicationAfterPageLoad(t.getTimingMetrics())}willSubmitForm(t,e){let n=AR(t,e);return this.submissionIsNavigatable(t,e)&&zh(qr(n),this.snapshot.rootLocation)}formSubmitted(t,e){this.navigator.submitForm(t,e)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}
4691pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(t){this.renderStreamMessage(t)}viewWillCacheSnapshot(){this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:t},e){let n=this.notifyApplicationBeforeRender(t,e),{defaultPrevented:s,detail:{render:r}}=n;return this.view.renderer&&r&&(this.view.renderer.renderElement=r),!s}viewRenderedSnapshot(t,e,n){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(n)}preloadOnLoadLinksForView(t){this.preloader.preloadOnLoadLinksForView(t)}viewInvalidated(t){this.adapter.pageInvalidated(t)}frameLoaded(t){this.notifyApplicationAfterFrameLoad(t)}frameRendered(t,e){this.notifyApplicationAfterFrameRender(t,e)}applicationAllowsFollowingLinkToLocation(t,e,n){return!this.notifyApplicationAfterClickingLinkToLocation(t,e,n).defaultPrevented}applicationAllowsVisitingLocation(t){return!this.notifyApplicationBeforeVisitingLocation(t).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(t,e,n){return Ls("turbo:click",{target:t,detail:{url:e.href,originalEvent:n},cancelable:!0})}notifyApplicationBeforeVisitingLocation(t){return Ls("turbo:before-visit",{detail:{url:t.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(t,e){return Ls("turbo:visit",{detail:{url:t.href,action:e}})}notifyApplicationBeforeCachingSnapshot(){return Ls("turbo:before-cache")}notifyApplicationBeforeRender(t,e){return Ls("turbo:before-render",{detail:{newBody:t,...e},cancelable:!0})}notifyApplicationAfterRender(t){return Ls("turbo:render",{detail:{renderMethod:t}})}notifyApplicationAfterPageLoad(t={}){return Ls("turbo:load",{detail:{url:this.location.href,timing:t}})}notifyApplicationAfterFrameLoad(t){return Ls("turbo:frame-load",{target:t})}notifyApplicationAfterFrameRender(t,e){return Ls("turbo:frame-render",{detail:{fetchResponse:t},target:e,cancelable:!0})}submissionIsNavigatable(t,e){if(wr.forms.mode=="off")return!1;{let n=e?this.elementIsNavigatable(e):!0;return wr.forms.mode=="optin"?n&&t.closest('[data-turbo="true"]')!=null:n&&this.elementIsNavigatable(t)}}elementIsNavigatable(t){let e=cm(t,"[data-turbo]"),n=cm(t,"turbo-frame");return wr.drive.enabled||n?e?e.getAttribute("data-turbo")!="false":!0:e?e.getAttribute("data-turbo")=="true":!1}getActionForLink(t){return If(t)||"advance"}get snapshot(){return this.view.snapshot}};function VH(i){Object.defineProperties(i,Ort)}var Ort={absoluteURL:{get(){return this.toString()}}},Js=new _R(t6),{cache:l6,navigator:c6}=Js;function kR(){Js.start()}function u6(i){Js.registerAdapter(i)}function h6(i,t){Js.visit(i,t)}
4691function Yv(i){Js.connectStreamSource(i)}function Xv(i){Js.disconnectStreamSource(i)}function d6(i){Js.renderStreamMessage(i)}function f6(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.`"),wr.drive.progressBarDelay=i}function p6(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.`"),wr.forms.confirm=i}function g6(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.`"),wr.forms.mode=i}function m6(i,t){tC.renderElement(i,t)}function b6(i,t){QS.renderElement(i,t)}var Nrt=Object.freeze({__proto__:null,PageRenderer:pm,PageSnapshot:sl,FrameRenderer:fm,fetch:ER,config:wr,session:Js,cache:l6,navigator:c6,start:kR,registerAdapter:u6,visit:h6,connectStreamSource:Yv,disconnectStreamSource:Xv,renderStreamMessage:d6,setProgressBarDelay:f6,setConfirmMethod:p6,setFormMode:g6,morphBodyElements:m6,morphTurboFrameElements:b6,morphChildren:rC,morphElements:qv}),SR=class extends Error{},CR=class{fetchResponseLoaded=t=>Promise.resolve();#t=null;#e=()=>{};#n=!1;#i=!1;#r=new Set;#s=!1;action=null;constructor(t){this.element=t,this.view=new eR(this,this.element),this.appearanceObserver=new QP(this,this.element),this.formLinkClickObserver=new JS(this,this.element),this.linkInterceptor=new XS(this,this.element),this.restorationIdentifier=Hh(),this.formSubmitObserver=new $v(this,this.element)}connect(){this.#n||(this.#n=!0,this.loadingStyle==Lf.lazy?this.appearanceObserver.start():this.#o(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#n&&(this.#n=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop(),this.element.hasAttribute("recurse")||this.#t?.cancel())}disabledChanged(){this.disabled?this.#t?.cancel():this.loadingStyle==Lf.eager&&this.#o()}sourceURLChanged(){this.#y("src")||(this.sourceURL||this.#t?.cancel(),this.element.isConnected&&(this.complete=!1),(this.loadingStyle==Lf.eager||this.#i)&&this.#o())}sourceURLReloaded(){let{refresh:t,src:e}=this.element;return this.#s=e&&t==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=e,this.element.loaded}loadingStyleChanged(){this.loadingStyle==Lf.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#o())}async#o(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#d(qr(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#i=!0)}async loadResponse(t){(t.redirected||t.succeeded&&t.isHTML)&&(this.sourceURL=t.response.url);try{let e=await t.responseHTML;if(e){let n=$H(e);sl.fromDocument(n).isVisitable?await this.#l(t,n):await this.#p(t)}}finally{this.#s=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(t){this.proposeVisitIfNavigatedWithAction(t,If(t)),this.#o()}willSubmitFormLinkToLocation(t){return this.#c(t)}submittedFormLinkToLocation(t,e,n){let s=this.#a(t);s&&n.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(t,e,n){return this.#c(t)}linkClickIntercepted(t,e){this.#f(t,e)}willSubmitForm(t,e){return t.closest("turbo-frame")==this.element&&this.#c(t,e)}formSubmitted(t,e){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new qS(this,t,e);let{fetchRequest:n}=this.formSubmission,s=this.#a(t,e);this.prepareRequest(n,s),this.formSubmission.start()}prepareRequest(t,e=this){t.headers["Turbo-Frame"]=e.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&t.acceptResponseType(Wh.contentType)}requestStarted(t){jS(this.element)}requestPreventedHandlingResponse(t,e){this.#e()}async requestSucceededWithResponse(t,e){await this.loadResponse(e),this.#e()}async requestFailedWithResponse(t,e){await this.loadResponse(e),this.#e()}requestErrored(t,e){console.error(e),this.#e()}requestFinished(t){WS(this.element)}formSubmissionStarted({formElement:t}){jS(t,this.#a(t))}formSubmissionSucceededWithResponse(t,e){let n=this.#a(t.formElement,t.submitter);n.delegate.proposeVisitIfNavigatedWithAction(n,If(t.submitter,t.formElement,n)),n.delegate.loadResponse(e),t.isSafe||Js.clearCache()}formSubmissionFailedWithResponse(t,e){this.element.delegate.loadResponse(e),Js.clearCache()}formSubmissionErrored(t,e){console.error(e)}formSubmissionFinished({formElement:t}){WS(t,this.#a(t))}allowsImmediateRender({element:t},e){let n=Ls("turbo:before-frame-render",{target:this.element,detail
4691:{newFrame:t,...e},cancelable:!0}),{defaultPrevented:s,detail:{render:r}}=n;return this.view.renderer&&r&&(this.view.renderer.renderElement=r),!s}viewRenderedSnapshot(t,e,n){}preloadOnLoadLinksForView(t){Js.preloadOnLoadLinksForView(t)}viewInvalidated(){}willRenderFrame(t,e){this.previousFrameElement=t.cloneNode(!0)}visitCachedSnapshot=({element:t})=>{let e=t.querySelector("#"+this.element.id);e&&this.previousFrameElement&&e.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#l(t,e){let n=await this.extractForeignFrameElement(e.body),s=this.#s?QS:fm;if(n){let r=new dm(n),o=new s(this,this.view.snapshot,r,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(o),this.complete=!0,Js.frameRendered(t,this.element),Js.frameLoaded(this.element),await this.fetchResponseLoaded(t)}else this.#g(t)&&this.#m(t)}async#d(t){let e=new jh(this,La.get,t,new URLSearchParams,this.element);return this.#t?.cancel(),this.#t=e,new Promise(n=>{this.#e=()=>{this.#e=()=>{},this.#t=null,n()},e.perform()})}#f(t,e,n){let s=this.#a(t,n);s.delegate.proposeVisitIfNavigatedWithAction(s,If(n,t,s)),this.#w(t,()=>{s.src=e})}proposeVisitIfNavigatedWithAction(t,e=null){if(this.action=e,this.action){let n=sl.fromElement(t).clone(),{visitCachedSnapshot:s}=t.delegate;t.delegate.fetchResponseLoaded=async r=>{if(t.src){let{statusCode:o,redirected:a}=r,l=await r.responseHTML,u={response:{statusCode:o,redirected:a,responseHTML:l},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:n};this.action&&(u.action=this.action),Js.visit(t.src,u)}}}}changeHistory(){if(this.action){let t=qH(this.action);Js.history.update(t,qr(this.element.src||""),this.restorationIdentifier)}}async#p(t){console.warn(`The response (${t.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#u(t.response)}#g(t){this.element.setAttribute("complete","");let e=t.response,n=async(r,o)=>{r instanceof Response?this.#u(r):Js.visit(r,o)};return!Ls("turbo:frame-missing",{target:this.element,detail:{response:e,visit:n},cancelable:!0}).defaultPrevented}#m(t){this.view.missing(),this.#b(t)}#b(t){let e=`The response (${t.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new SR(e)}async#u(t){let e=new hm(t),n=await e.responseHTML,{location:s,redirected:r,statusCode:o}=e;return Js.visit(s,{response:{redirected:r,statusCode:o,responseHTML:n}})}#a(t,e){let n=HS("data-turbo-frame",e,t)||this.element.getAttribute("target"),s=this.#h(n);return s instanceof Ia?s:this.element}async extractForeignFrameElement(t){let e,n=CSS.escape(this.id);try{if(e=HH(t.querySelector(`turbo-frame#${n}`),this.sourceURL),e)return e;if(e=HH(t.querySelector(`turbo-frame[src][recurse~=${n}]`),this.sourceURL),e)return await e.loaded,await this.extractForeignFrameElement(e)}catch(s){return console.error(s),new Ia}return null}#v(t,e){let n=AR(t,e);return zh(qr(n),this.rootLocation)}#c(t,e){let n=HS("data-turbo-frame",e,t)||this.element.getAttribute("target");if(t instanceof HTMLFormElement&&!this.#v(t,e)||!this.enabled||n=="_top")return!1;if(n){let s=this.#h(n);if(s)return!s.disabled;if(n=="_parent")return!1}return!(!Js.elementIsNavigatable(t)||e&&!Js.elementIsNavigatable(e))}get id(){return this.element.id}get disabled(){return this.element.disabled}get enabled(){return!this.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(t){this.#x("src",()=>{this.element.src=t??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#e()!==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&&this.#n}get rootLocation(){let e=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return qr(e)}#y(t){return this.#r.has(t)}#x(t,e){this.#r.add(t),e(),this.#r.delete(t)}#w(t,e){this.currentNavigationElement=t,e(),delete this.currentNavigationElement}#h(t){if(t!=null){let e=t==="_parent"?this.element.parentElement.closest("turbo-frame"):document.getElementById(t);if(e instanceof Ia)return e}}};function HH(i,t){if(i){let e=i.getAttribute("src");if(e!=null&&t!=null&&QH(e,t))throw new Error(`Matching <turbo-frame id="${i.id}"> element has a source URL which references itself`);if(i.ownerDocument!==document&&(i=document.importNode(i,!0)),i instanceof Ia)return i.connectedCallback(),i.disconnectedCallback(),i}}var $h={after(){this.removeDuplicateTargetSiblings(),this.targetElements.forEac
4691h(i=>i.parentElement?.insertBefore(this.templateContent,i.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.append(this.templateContent))},before(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.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"?qv(t,this.templateContent):t.replaceWith(this.templateContent)})},update(){let i=this.getAttribute("method");this.targetElements.forEach(t=>{i==="morph"?rC(t,this.templateContent):(t.innerHTML="",t.append(this.templateContent))})},refresh(){let i=this.getAttribute("method"),t=this.requestId,e=this.getAttribute("scroll");Js.refresh(this.baseURI,{method:i,requestId:t,scroll:e})}},eC=class i extends HTMLElement{static async renderElement(t){await t.performAction()}async connectedCallback(){try{await this.render()}catch(t){console.error(t)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let t=this.beforeRenderEvent;this.dispatchEvent(t)&&(await Hv(),await t.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(t=>t.remove())}get duplicateChildren(){let t=this.targetElements.flatMap(n=>[...n.children]).filter(n=>!!n.getAttribute("id")),e=[...this.templateContent?.children||[]].filter(n=>!!n.getAttribute("id")).map(n=>n.getAttribute("id"));return t.filter(n=>e.includes(n.getAttribute("id")))}removeDuplicateTargetSiblings(){this.duplicateSiblings.forEach(t=>t.remove())}get duplicateSiblings(){let t=this.targetElements.flatMap(n=>[...n.parentElement.children]).filter(n=>!!n.id),e=[...this.templateContent?.children||[]].filter(n=>!!n.id).map(n=>n.id);return t.filter(n=>e.includes(n.id))}get performAction(){if(this.action){let t=$h[this.action];if(t)return t;this.#t("unknown action")}this.#t("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#t("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let t=this.ownerDocument.createElement("template");return this.appendChild(t),t}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#t("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#t(t){throw new Error(`${this.description}: ${t}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:i.renderElement}})}get targetElementsById(){let t=this.ownerDocument?.getElementById(this.target);return t!==null?[t]:[]}get targetElementsByQuery(){let t=this.ownerDocument?.querySelectorAll(this.targets);return t.length!==0?Array.prototype.slice.call(t):[]}},nC=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Yv(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),Xv(this.streamSource))}get src(){return this.getAttribute("src")||""}};Ia.delegateConstructor=CR;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",Ia);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",eC);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",nC);(()=>{let i=document.currentScript;if(!i||i.hasAttribute("data-turbo-suppress-warning"))return;let t=i.parentElement;for(;t;){if(t==document.body)return console.warn(GH`
4692        You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
4693
4694        Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
4695
4696        For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements
4697
4698        ——
4699        Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
4700      `,i.outerHTML);t=t.parentElement}})();window.Turbo={...Nrt,StreamActions:$h};kR();
4700var C6;async function zrt(){return C6||S6(Vrt().then(S6))}function S6(i){return C6=i}async function Vrt(){let{createConsumer:i}=await Promise.resolve().then(()=>(_6(),w6));return i()}async function M6(i,t){let{subscriptions:e}=await zrt();return e.create(i,t)}function ey(i){return!i||typeof i!="object"||i instanceof Date||i instanceof RegExp?i:Array.isArray(i)?i.map(ey):Object.keys(i).reduce(function(t,e){var n=e[0].toLowerCase()+e.slice(1).replace(/([A-Z]+)/g,function(s,r){return"_"+r.toLowerCase()});return t[n]=ey(i[e]),t},{})}var zR=class extends HTMLElement{static observedAttributes=["channel","signed-stream-name"];async connectedCallback(){Yv(this),this.subscription=await M6(this.channel,{received:this.dispatchMessageEvent.bind(this),connected:this.subscriptionConnected.bind(this),disconnected:this.subscriptionDisconnected.bind(this)})}disconnectedCallback(){Xv(this),this.subscription&&this.subscription.unsubscribe(),this.subscriptionDisconnected()}attributeChangedCallback(){this.subscription&&(this.disconnectedCallback(),this.connectedCallback())}dispatchMessageEvent(t){let e=new MessageEvent("message",{data:t});return this.dispatchEvent(e)}subscriptionConnected(){this.setAttribute("connected","")}subscriptionDisconnected(){this.removeAttribute("connected")}get channel(){let t=this.getAttribute("channel"),e=this.getAttribute("signed-stream-name");return{channel:t,signed_stream_name:e,...ey({...this.dataset})}}};customElements.get("turbo-cable-stream-source")===void 0&&customElements.define("turbo-cable-stream-source",zR);function T6(i){if(i.target instanceof HTMLFormElement){let{target:t,detail:{fetchOptions:e}}=i;t.addEventListener("turbo:submit-start",({detail:{formSubmission:{submitter:n}}})=>{let s=$rt(e.body)?e.body:new URLSearchParams,r=jrt(n,s,t);/get/i.test(r)||(/post/i.test(r)?s.delete("_method"):s.set("_method",r),e.method="post")},{once:!0})}}function jrt(i,t,e){let n=Wrt(i),s=t.get("_method"),r=e.getAttribute("method")||"get";return typeof n=="string"?n:typeof s=="string"?s:r}function Wrt(i){return i instanceof HTMLButtonElement||i instanceof HTMLInputElement?i.name==="_method"?i.value:i.hasAttribute("formmethod")?i.formMethod:null:null}function $rt(i){return i instanceof FormData||i instanceof URLSearchParams}window.Turbo=PR;addEventListener("turbo:before-fetch-request",T6);function sy(i){return i+.5|0}var qh=(i,t,e)=>Math.max(Math.min(i,e),t);function ny(i){return qh(sy(i*2.55),0,255)}function Yh(i){return qh(sy(i*255),0,255)}function Mu(i){return qh(sy(i/2.55)/100,0,1)}function A6(i){return qh(sy(i*100),0,100)}var rl={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},HR=[..."0123456789ABCDEF"],Grt=i=>HR[i&15],qrt=i=>HR[(i&240)>>4]+HR[i&15],hC=i=>(i&240)>>4===(i&15),Yrt=i=>hC(i.r)&&hC(i.g)&&hC(i.b)&&hC(i.a);function Xrt(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&rl[i[1]]*17,g:255&rl[i[2]]*17,b:255&rl[i[3]]*17,a:t===5?rl[i[4]]*17:255}:(t===7||t===9)&&(e={r:rl[i[1]]<<4|rl[i[2]],g:rl[i[3]]<<4|rl[i[4]],b:rl[i[5]]<<4|rl[i[6]],a:t===9?rl[i[7]]<<4|rl[i[8]]:255})),e}var Krt=(i,t)=>i<255?t(i):"";function Jrt(i){var t=Yrt(i)?Grt:qrt;return i?"#"+t(i.r)+t(i.g)+t(i.b)+Krt(i.a,t):void 0}var Zrt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function R6(i,t,e){let n=t*Math.min(e,1-e),s=(r,o=(r+i/30)%12)=>e-n*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function Qrt(i,t,e){let n=(s,r=(s+i/60)%6)=>e-e*t*Math.max(Math.min(r,4-r,1),0);return[n(5),n(3),n(1)]}function tot(i,t,e){let n=R6(i,1,.5),s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)n[s]*=1-t-e,n[s]+=t;return n}function eot(i,t,e,n,s){return i===s?(t-e)/n+(t<e?6:0):t===s?(e-i)/n+2:(i-t)/n+4}function jR(i){let e=i.r/255,n=i.g/255,s=i.b/255,r=Math.max(e,n,s),o=Math.min(e,n,s),a=(r+o)/2,l,c,u;return r!==o&&(u=r-o,c=a>.5?u/(2-r-o):u/(r+o),l=eot(e,n,s,u,r),l=l*60+.5),[l|0,c||0,a]}function WR(i,t,e,n){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,n)).map(Yh)}function $R(i,t,e){return WR(R6,i,t,e)}function not(i,t,e){return WR(tot,i,t,e)}function iot(i,t,e){return WR(Qrt,i,t,e)}
vendor: 18,135 bytes, line 4700
4700function D6(i){return(i%360+360)%360}function sot(i){let t=Zrt.exec(i),e=255,n;if(!t)return;t[5]!==n&&(e=t[6]?ny(+t[5]):Yh(+t[5]));let s=D6(+t[2]),r=+t[3]/100,o=+t[4]/100;return t[1]==="hwb"?n=not(s,r,o):t[1]==="hsv"?n=iot(s,r,o):n=$R(s,r,o),{r:n[0],g:n[1],b:n[2],a:e}}function rot(i,t){var e=jR(i);e[0]=D6(e[0]+t),e=$R(e),i.r=e[0],i.g=e[1],i.b=e[2]}function oot(i){if(!i)return;let t=jR(i),e=t[0],n=A6(t[1]),s=A6(t[2]);return i.a<255?`hsla(${e}, ${n}%, ${s}%, ${Mu(i.a)})`:`hsl(${e}, ${n}%, ${s}%)`}var E6={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},k6={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function aot(){let i={},t=Object.keys(k6),e=Object.keys(E6),n,s,r,o,a;for(n=0;n<t.length;n++){for(o=a=t[n],s=0;s<e.length;s++)r=e[s],a=a.replace(r,E6[r]);r=parseInt(k6[o],16),i[a]=[r>>16&255,r>>8&255,r&255]}return i}var dC;function lot(i){dC||(dC=aot(),dC.transparent=[0,0,0,0]);let t=dC[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var cot=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function uot(i){let t=cot.exec(i),e=255,n,s,r;if(t){if(t[7]!==n){let o=+t[7];e=t[8]?ny(o):qh(o*255,0,255)}return n=+t[1],s=+t[3],r=+t[5],n=255&(t[2]?ny(n):qh(n,0,255)),s=255&(t[4]?ny(s):qh(s,0,255)),r=255&(t[6]?ny(r):qh(r,0,255)),{r:n,g:s,b:r,a:e}}}function hot(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${Mu(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}var VR=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,bm=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function dot(i,t,e){let n=bm(Mu(i.r)),s=bm(Mu(i.g)),r=bm(Mu(i.b));return{r:Yh(VR(n+e*(bm(Mu(t.r))-n))),g:Yh(VR(s+e*(bm(Mu(t.g))-s))),b:Yh(VR(r+e*(bm(Mu(t.b))-r))),a:i.a+e*(t.a-i.a)}}function fC(i,t,e){if(i){let n=jR(i);n[t]=Math.max(0,Math.min(n[t]+n[t]*e,t===0?360:1)),n=$R(n),i.r=n[0],i.g=n[1],i.b=n[2]}}function L6(i,t){return i&&Object.assign(t||{},i)}function P6(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=Yh(i[3]))):(t=L6(i,{r:0,g:0,b:0,a:1}),t.a=Yh(t.a)),t}function fot(i){return i.charAt(0)==="r"?uot(i):sot(i)}var iy=class i{constructor(t){if(t instanceof i)return t;let e=typeof t,n;e==="object"?n=P6(t):e==="string"&&(n=Xrt(t)||lot(t)||fot(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=L6(this._rgb);return t&&(t.a=Mu(t.a)),t}set rgb(t){this._rgb=P6(t)}rgbString(){return this._valid?hot(this._rgb):void 0}hexString(){return this._valid?Jrt(this._rgb):void 0}hslString(){return this._valid?oot(this._rgb):void 0}mix(t,e){if(t){let n=this.rgb,s=t.rgb,r,o=e===r?.5:e,a=2*o-1,l=n.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;r=1-c,n.r=255&c*n.r+r*s.r+.5,n.g=255&c*n.g+r*s.g+.5,n.b=255&c*n.b+r*s.b+.5,n.a=o*n.a+(1-o)*s.a,this.rgb=n}return this}interpolate(t,e){return t&&(this._rgb=dot(this._rgb,t._rgb,e)),this}clone(){return new i(this.rgb)}alpha(t){return this._rgb.a=Yh(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=sy(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){let e=this._rgb;return e.a*=1+t,this}negate(){let t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return fC(this._rgb,2,t),this}darken(t){return fC(this._rgb,2,-t),this}saturate(t){return fC(this._rgb,1,t),this}desaturate(t){return fC(this._rgb,1,-t),this}rotate(t){return rot(this._rgb,t),this}};function Nc(){}var W6=(()=>{let i=0;return()=>i++})();function di(i){return i==null}function os(i){if(Array.isArray&&Array.isArray(i))return!0;let t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function bi(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function Is(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function ca(i,t){return Is(i)?i:t}function Gn(i,t){return typeof i>"u"?t:i}var $6=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,XR=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function es(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function ji(i,t,e,n){let s,r,o;if(os(i))if(r=i.length,n)for(s=r-1;s>=0;s--)t.call(e,i[s],s);else for(s=0;s<r;s++)t.call(e,i[s],s);else if(bi(i))for(o=Object.keys(i),r=o.length,s=0;s<r;s++)t.call(e,i[o[s]],o[s])}function ay(i,t){let e,n,s,r;if(!i||!t||i.length!==t.length)return!1;for(e=0,n=i.length;e<n;++e)if(s=i[e],r=t[e],s.datasetIndex!==r.datasetIndex||s.index!==r.index)return!1;return!0}function bC(i){if(os(i))return i.map(bC);if(bi(i)){let t=Object.create(null),e=Object.keys(i),n=e.length,s=0;for(;s<n;++s)t[e[s]]=bC(i[e[s]]);return t}return i}function G6(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function pot(i,t,e,n){if(!G6(i))return;let s=t[i],r=e[i];bi(s)&&bi(r)?ym(s,r,n):t[i]=bC(r)}function ym(i,t,e){let n=os(t)?t:[t],s=n.length;if(!bi(i))return i;e=e||{};let r=e.merger||pot,o;for(let a=0;a<s;++a){if(o=n[a],!bi(o))continue;let l=Object.keys(o);for(let c=0,u=l.length;c<u;++c)r(l[c],i,o,e)}return i}function wm(i,t){return ym(i,t,{merger:got})}function got(i,t,e){if(!G6(i))return;let n=t[i],s=e[i];bi(n)&&bi(s)?wm(n,s):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=bC(s))}var I6={"":i=>i,x:i=>i.x,y:i=>i.y};function mot(i){let t=i.split("."),e=[],n="";for(let s of t)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(e.push(n),n="");return e}function bot(i){let t=mot(i);return e=>{for(let n of t){if(n==="")break;e=e&&e[n]}return e}}function Eu(i,t){return(I6[t]||(I6[t]=bot(t)))(i)}function wC(i){return i.charAt(0).toUpperCase()+i.slice(1)}var _m=i=>typeof i<"u",Tu=i=>typeof i=="function",KR=(i,t)=>{if(i.size!==t.size)return!1;for(let e of i)if(!t.has(e))return!1;return!0};function q6(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}var Ri=Math.PI,as=2*Ri,vot=as+Ri,vC=Number.POSITIVE_INFINITY,yot=Ri/180,Us=Ri/2,Bf=Ri/4,O6=Ri*2/3,Au=Math.log10,jl=Math.sign;function Sm(i,t,e){return Math.abs(i-t)<e}function JR(i){let t=Math.round(i);i=Sm(i,t,i/1e3)?t:i;let e=Math.pow(10,Math.floor(Au(i))),n=i/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function Y6(i){let t=[],e=Math.sqrt(i),n;for(n=1;n<e;n++)i%n===0&&(t.push(n),t.push(i/n));return e===(e|0)&&t.push(e),t.sort((s,r)=>s-r).pop(),t}function xot(i){return typeof i=="symbol"||typeof i=="object"&&i!==null&&!(Symbol.toPrimitive in i||"toString"in i||"valueOf"in i)}function zf(i){return!xot(i)&&!isNaN(parseFloat(i))&&isFinite(i)}function X6(i,t){let e=Math.round(i);return e-t<=i&&e+t>=i}function ZR(i,t,e){let n,s,r;for(n=0,s=i.length;n<s;n++)r=i[n][e],isNaN(r)||(t.min=Math.min(t.min,r),t.max=Math.max(t.max,r))}function ol(i){return i*(Ri/180)}function _C(i){return i*(180/Ri)}function QR(i){if(!Is(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function tD(i,t){let e=t.x-i.x,n=t.y-i.y,s=Math.sqrt(e*e+n*n),r=Math.atan2(n,e);return r<-.5*Ri&&(r+=as),{angle:r,distance:s}}function yC(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function wot(i,t){return(i-t+vot)%as-Ri}function Yr(i){return(i%as+as)%as}function Cm(i,t,e,n){let s=Yr(i),r=Yr(t),o=Yr(e),a=Yr(r-s),l=Yr(o-s),c=Yr(s-r),u=Yr(s-o);return s===r||s===o||n&&r===o||a>l&&c<u}function _r(i,t,e){return Math.max(t,Math.min(e,i))}function K6(i){return _r(i,-32768,32767)}function Bc(i,t,e,n=1e-6){return i>=Math.min(t,e)-n&&i<=Math.max(t,e)+n}function SC(i,t,e){e=e||(o=>i[o]<t);let n=i.length-1,s=0,r;for(;n-s>1;)r=s+n>>1,e(r)?s=r:n=r;return{lo:s,hi:n}}var Ic=(i,t,e,n)=>SC(i,e,n?s=>{let r=i[s][t];return r<e||r===e&&i[s+1][t]===e}:s=>i[s][t]<e),J6=(i,t,e)=>SC(i,e,n=>i[n][t]>=e);function Z6(i,t,e){let n=0,s=i.length;for(;n<s&&i[n]<t;)n++;for(;s>n&&i[s-1]>e;)s--;return n>0||s<i.length?i.slice(n,s):i}var Q6=["push","pop","shift","splice","unshift"];function tj(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Q6.forEach(e=>{let n="_onData"+wC(e),s=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...r){let o=s.apply(this,r);return i._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...r)}),o}})})}function eD(i,t){let e=i._chartjs;if(!e)return;let n=e.listeners,s=n.indexOf(t);s!==-1&&n.splice(s,1),!(n.length>0)&&(Q6.forEach(r=>{delete i[r]}),delete i._chartjs)}function nD(i){let t=new Set(i);return t.size===i.length?i:Array.from(t)}var iD=(function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame})();function sD(i,t){let e=[],n=!1;return function(...s){e=s,n||(n=!0,iD.call(window,()=>{n=!1,i.apply(t,e)}))}}function ej(i,t){let e;return function(...n){return t?(clearTimeout(e),e=setTimeout(i,t,n)):i.apply(this,n),t}}var CC=i=>i==="start"?"left":i==="end"?"right":"center",Xr=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,nj=(i,t,e,n)=>i===(n?"left":"right")?e:i==="center"?(t+e)/2:t;function rD(i,t,e){let n=t.length,s=0,r=n;if(i._sorted){let{iScale:o,vScale:a,_parsed:l}=i,c=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null,u=o.axis,{min:h,max:d,minDefined:p,maxDefined:g}=o.getUserBounds();if(p){if(s=Math.min(Ic(l,u,h).lo,e?n:Ic(t,u,o.getPixelForValue(h)).lo),c){let y=l.slice(0,s+1).reverse().findIndex(x=>!di(x[a.axis]));s-=Math.max(0,y)}s=_r(s,0,n-1)}if(g){let y=Math.max(Ic(l,o.axis,d,!0).hi+1,e?0:Ic(t,u,o.getPixelForValue(d),!0).hi+1);if(c){let x=l.slice(y-1).findIndex(w=>!di(w[a.axis]));y+=Math.max(0,x)}r=_r(y,s,n)-s}else r=n-s}return{start:s,count:r}}function oD(i){let{xScale:t,yScale:e,_scaleRanges:n}=i,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!n)return i._scaleRanges=s,!0;let r=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==e.min||n.ymax!==e.max;return Object.assign(n,s),r}var pC=i=>i===0||i===1,N6=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*as/e)),B6=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*as/e)+1,vm={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*Us)+1,easeOutSine:i=>Math.sin(i*Us),easeInOutSine:i=>-.5*(Math.cos(Ri*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>pC(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>pC(i)?i:N6(i,.075,.3),easeOutElastic:i=>pC(i)?i:B6(i,.075,.3),easeInOutElastic(i){return pC(i)?i:i<.5?.5*N6(i*2,.1125,.45):.5+.5*B6(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-vm.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?vm.easeInBounce(i*2)*.5:vm.easeOutBounce(i*2-1)*.5+.5};function aD(i){if(i&&typeof i=="object"){let t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function lD(i){return aD(i)?i:new iy(i)}function GR(i){return aD(i)?i:new iy(i).saturate(.5).darken(.1).hexString()}var _ot=["x","y","borderWidth","radius","tension"],Sot=["color","borderColor","backgroundColor"];function Cot(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:Sot},numbers:{type:"number",properties:_ot}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Mot(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var F6=new Map;function Tot(i,t){t=t||{};let e=i+JSON.stringify(t),n=F6.get(e);return n||(n=new Intl.NumberFormat(i,t),F6.set(e,n)),n}function Mm(i,t,e){return Tot(t,e).format(i)}var ij={values(i){return os(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";let n=this.chart.options.locale,s,r=i;if(e.length>1){let c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),r=Aot(i,e)}let o=Au(Math.abs(r)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Mm(i,n,l)},logarithmic(i,t,e){if(i===0)return"0";let n=e[t].significand||i/Math.pow(10,Math.floor(Au(i)));return[1,2,3,5,10,15].includes(n)||t>.8*e.length?ij.numeric.call(this,i,t,e):""}};function Aot(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var ly={formatters:ij};function Eot(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ly.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}var Jh=Object.create(null),MC=Object.create(null);function ry(i,t){if(!t)return i;let e=t.split(".");for(let n=0,s=e.length;n<s;++n){let r=e[n];i=i[r]||(i[r]=Object.create(null))}return i}function qR(i,t,e){return typeof t=="string"?ym(ry(i,t),e):ym(ry(i,""),t)}var YR=class{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=n=>n.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(n,s)=>GR(s.backgroundColor),this.hoverBorderColor=(n,s)=>GR(s.borderColor),this.hoverColor=(n,s)=>GR(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={}
vendor: 5,075 bytes, line 4700
4700,this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return qR(this,t,e)}get(t){return ry(this,t)}describe(t,e){return qR(MC,t,e)}override(t,e){return qR(Jh,t,e)}route(t,e,n,s){let r=ry(this,t),o=ry(this,n),a="_"+e;Object.defineProperties(r,{[a]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){let l=this[a],c=o[s];return bi(l)?Object.assign({},c,l):Gn(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}},gs=new YR({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Cot,Mot,Eot]);function kot(i){return!i||di(i.size)||di(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function oy(i,t,e,n,s){let r=t[s];return r||(r=t[s]=i.measureText(s).width,e.push(s)),r>n&&(n=r),n}function sj(i,t,e,n){n=n||{};let s=n.data=n.data||{},r=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(s=n.data={},r=n.garbageCollect=[],n.font=t),i.save(),i.font=t;let o=0,a=e.length,l,c,u,h,d;for(l=0;l<a;l++)if(h=e[l],h!=null&&!os(h))o=oy(i,s,r,o,h);else if(os(h))for(c=0,u=h.length;c<u;c++)d=h[c],d!=null&&!os(d)&&(o=oy(i,s,r,o,d));i.restore();let p=r.length/2;if(p>e.length){for(l=0;l<p;l++)delete s[r[l]];r.splice(0,p)}return o}function Zh(i,t,e){let n=i.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*n)/n+s}function cD(i,t){!t&&!i||(t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore())}function TC(i,t,e,n){uD(i,t,e,n,null)}function uD(i,t,e,n,s){let r,o,a,l,c,u,h,d,p=t.pointStyle,g=t.rotation,y=t.radius,x=(g||0)*yot;if(p&&typeof p=="object"&&(r=p.toString(),r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]")){i.save(),i.translate(e,n),i.rotate(x),i.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),i.restore();return}if(!(isNaN(y)||y<=0)){switch(i.beginPath(),p){default:s?i.ellipse(e,n,s/2,y,0,0,as):i.arc(e,n,y,0,as),i.closePath();break;case"triangle":u=s?s/2:y,i.moveTo(e+Math.sin(x)*u,n-Math.cos(x)*y),x+=O6,i.lineTo(e+Math.sin(x)*u,n-Math.cos(x)*y),x+=O6,i.lineTo(e+Math.sin(x)*u,n-Math.cos(x)*y),i.closePath();break;case"rectRounded":c=y*.516,l=y-c,o=Math.cos(x+Bf)*l,h=Math.cos(x+Bf)*(s?s/2-c:l),a=Math.sin(x+Bf)*l,d=Math.sin(x+Bf)*(s?s/2-c:l),i.arc(e-h,n-a,c,x-Ri,x-Us),i.arc(e+d,n-o,c,x-Us,x),i.arc(e+h,n+a,c,x,x+Us),i.arc(e-d,n+o,c,x+Us,x+Ri),i.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*y,u=s?s/2:l,i.rect(e-u,n-l,2*u,2*l);break}x+=Bf;case"rectRot":h=Math.cos(x)*(s?s/2:y),o=Math.cos(x)*y,a=Math.sin(x)*y,d=Math.sin(x)*(s?s/2:y),i.moveTo(e-h,n-a),i.lineTo(e+d,n-o),i.lineTo(e+h,n+a),i.lineTo(e-d,n+o),i.closePath();break;case"crossRot":x+=Bf;case"cross":h=Math.cos(x)*(s?s/2:y),o=Math.cos(x)*y,a=Math.sin(x)*y,d=Math.sin(x)*(s?s/2:y),i.moveTo(e-h,n-a),i.lineTo(e+h,n+a),i.moveTo(e+d,n-o),i.lineTo(e-d,n+o);break;case"star":h=Math.cos(x)*(s?s/2:y),o=Math.cos(x)*y,a=Math.sin(x)*y,d=Math.sin(x)*(s?s/2:y),i.moveTo(e-h,n-a),i.lineTo(e+h,n+a),i.moveTo(e+d,n-o),i.lineTo(e-d,n+o),x+=Bf,h=Math.cos(x)*(s?s/2:y),o=Math.cos(x)*y,a=Math.sin(x)*y,d=Math.sin(x)*(s?s/2:y),i.moveTo(e-h,n-a),i.lineTo(e+h,n+a),i.moveTo(e+d,n-o),i.lineTo(e-d,n+o);break;case"line":o=s?s/2:Math.cos(x)*y,a=Math.sin(x)*y,i.moveTo(e-o,n-a),i.lineTo(e+o,n+a);break;case"dash":i.moveTo(e,n),i.lineTo(e+Math.cos(x)*(s?s/2:y),n+Math.sin(x)*y);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function Oc(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.x<t.right+e&&i.y>t.top-e&&i.y<t.bottom+e}function cy(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function uy(i){i.restore()}function rj(i,t,e,n,s){if(!t)return i.lineTo(e.x,e.y);if(s==="middle"){let r=(t.x+e.x)/2;i.lineTo(r,t.y),i.lineTo(r,e.y)}else s==="after"!=!!n?i.lineTo(t.x,e.y):i.lineTo(e.x,t.y);i.lineTo(e.x,e.y)}function oj(i,t,e,n){if(!t)return i.lineTo(e.x,e.y);i.bezierCurveTo(n?t.cp1x:t.cp2x,n?t.cp1y:t.cp2y,n?e.cp2x:e.cp1x,n?e.cp2y:e.cp1y,e.x,e.y)}function Pot(i,t){t.translation&&i.translate(t.translation[0],t.translation[1]),di(t.rotation)||i.rotate(t.rotation),t.color&&(i.fillStyle=t.color),t.textAlign&&(i.textAlign=t.textAlign),t.textBaseline&&(i.textBaseline=t.textBaseline)}function Rot(i,t,e,n,s){if(s.strikethrough||s.underline){let r=i.measureText(n),o=t-r.actualBoundingBoxLeft,a=t+r.actualBoundingBoxRight,l=e-r.actualBoundingBoxAscent,c=e+r.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;i.strokeStyle=i.fillStyle,i.beginPath(),i.lineWidth=s.decorationWidth||2,i.moveTo(o,u),i.lineTo(a,u),i.stroke()}}function Dot(i,t){let e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function Qh(i,t,e,n,s,r={}){let o=os(t)?t:[t],a=r.strokeWidth>0&&r.strokeColor!=="",l,c;for(i.save(),i.font=s.string,Pot(i,r),l=0;l<o.length;++l)c=o[l],r.backdrop&&Dot(i,r.backdrop),a&&(r.strokeColor&&(i.strokeStyle=r.strokeColor),di(r.strokeWidth)||(i.lineWidth=r.strokeWidth),i.strokeText(c,e,n,r.maxWidth)),i.fillText(c,e,n,r.maxWidth),Rot(i,e,n,c,r),n+=Number(s.lineHeight);
vendor: 9,812 bytes, line 4700
4700i.restore()}function Tm(i,t){let{x:e,y:n,w:s,h:r,radius:o}=t;i.arc(e+o.topLeft,n+o.topLeft,o.topLeft,1.5*Ri,Ri,!0),i.lineTo(e,n+r-o.bottomLeft),i.arc(e+o.bottomLeft,n+r-o.bottomLeft,o.bottomLeft,Ri,Us,!0),i.lineTo(e+s-o.bottomRight,n+r),i.arc(e+s-o.bottomRight,n+r-o.bottomRight,o.bottomRight,Us,0,!0),i.lineTo(e+s,n+o.topRight),i.arc(e+s-o.topRight,n+o.topRight,o.topRight,0,-Us,!0),i.lineTo(e+o.topLeft,n)}var Lot=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Iot=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Oot(i,t){let e=(""+i).match(Lot);if(!e||e[1]==="normal")return t*1.2;switch(i=+e[2],e[3]){case"px":return i;case"%":i/=100;break}return t*i}var Not=i=>+i||0;function AC(i,t){let e={},n=bi(t),s=n?Object.keys(t):t,r=bi(i)?n?o=>Gn(i[o],i[t[o]]):o=>i[o]:()=>i;for(let o of s)e[o]=Not(r(o));return e}function hD(i){return AC(i,{top:"y",right:"x",bottom:"y",left:"x"})}function td(i){return AC(i,["topLeft","topRight","bottomLeft","bottomRight"])}function Kr(i){let t=hD(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ur(i,t){i=i||{},t=t||gs.font;let e=Gn(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let n=Gn(i.style,t.style);n&&!(""+n).match(Iot)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);let s={family:Gn(i.family,t.family),lineHeight:Oot(Gn(i.lineHeight,t.lineHeight),e),size:e,style:n,weight:Gn(i.weight,t.weight),string:""};return s.string=kot(s),s}function Am(i,t,e,n){let s=!0,r,o,a;for(r=0,o=i.length;r<o;++r)if(a=i[r],a!==void 0&&(t!==void 0&&typeof a=="function"&&(a=a(t),s=!1),e!==void 0&&os(a)&&(a=a[e%a.length],s=!1),a!==void 0))return n&&!s&&(n.cacheable=!1),a}function aj(i,t,e){let{min:n,max:s}=i,r=XR(t,(s-n)/2),o=(a,l)=>e&&a===0?0:a+l;return{min:o(n,-Math.abs(r)),max:o(s,r)}}function ku(i,t){return Object.assign(Object.create(i),t)}function EC(i,t=[""],e,n,s=()=>i[0]){let r=e||i;typeof n>"u"&&(n=uj("_fallback",i));let o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:r,_fallback:n,_getTarget:s,override:a=>EC([a,...i],t,r,n)};return new Proxy(o,{deleteProperty(a,l){return delete a[l],delete a._keys,delete i[0][l],!0},get(a,l){return lj(a,l,()=>Wot(l,t,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return z6(a).includes(l)},ownKeys(a){return z6(a)},set(a,l,c){let u=a._storage||(a._storage=s());return a[l]=u[l]=c,delete a._keys,!0}})}function Uf(i,t,e,n){let s={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:dD(i,n),setContext:r=>Uf(i,r,e,n),override:r=>Uf(i.override(r),t,e,n)};return new Proxy(s,{deleteProperty(r,o){return delete r[o],delete i[o],!0},get(r,o,a){return lj(r,o,()=>Fot(r,o,a))},getOwnPropertyDescriptor(r,o){return r._descriptors.allKeys?Reflect.has(i,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,o)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(r,o){return Reflect.has(i,o)},ownKeys(){return Reflect.ownKeys(i)},set(r,o,a){return i[o]=a,delete r[o],!0}})}function dD(i,t={scriptable:!0,indexable:!0}){let{_scriptable:e=t.scriptable,_indexable:n=t.indexable,_allKeys:s=t.allKeys}=i;return{allKeys:s,scriptable:e,indexable:n,isScriptable:Tu(e)?e:()=>e,isIndexable:Tu(n)?n:()=>n}}var Bot=(i,t)=>i?i+wC(t):t,fD=(i,t)=>bi(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function lj(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];let n=e();return i[t]=n,n}function Fot(i,t,e){let{_proxy:n,_context:s,_subProxy:r,_descriptors:o}=i,a=n[t];return Tu(a)&&o.isScriptable(t)&&(a=Uot(t,a,i,e)),os(a)&&a.length&&(a=zot(t,a,i,o.isIndexable)),fD(t,a)&&(a=Uf(a,s,r&&r[t],o)),a}function Uot(i,t,e,n){let{_proxy:s,_context:r,_subProxy:o,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let l=t(r,o||n);return a.delete(i),fD(i,l)&&(l=pD(s._scopes,s,i,l)),l}function zot(i,t,e,n){let{_proxy:s,_context:r,_subProxy:o,_descriptors:a}=e;if(typeof r.index<"u"&&n(i))return t[r.index%t.length];if(bi(t[0])){let l=t,c=s._scopes.filter(u=>u!==l);t=[];for(let u of l){let h=pD(c,s,i,u);t.push(Uf(h,r,o&&o[i],a))}}return t}function cj(i,t,e){return Tu(i)?i(t,e):i}var Vot=(i,t)=>i===!0?t:typeof i=="string"?Eu(t,i):void 0;function Hot(i,t,e,n,s){for(let r of t){let o=Vot(e,r);if(o){i.add(o);let a=cj(o._fallback,e,s);if(typeof a<"u"&&a!==e&&a!==n)return a}else if(o===!1&&typeof n<"u"&&e!==n)return null}return!1}function pD(i,t,e,n){let s=t._rootScopes,r=cj(t._fallback,e,n),o=[...i,...s],a=new Set;a.add(n);let l=U6(a,o,e,r||e,n);return l===null||typeof r<"u"&&r!==e&&(l=U6(a,o,r,l,n),l===null)?!1:EC(Array.from(a),[""],s,r,()=>jot(t,e,n))}function U6(i,t,e,n,s){for(;e;)e=Hot(i,t,e,n,s);return e}function jot(i,t,e){let n=i._getTarget();t in n||(n[t]={});let s=n[t];return os(s)&&bi(e)?e:s||{}}function Wot(i,t,e,n){let s;for(let r of t)if(s=uj(Bot(r,i),e),typeof s<"u")return fD(i,s)?pD(e,n,i,s):s}function uj(i,t){for(let e of t){if(!e)continue;let n=e[i];if(typeof n<"u")return n}}function z6(i){let t=i._keys;return t||(t=i._keys=$ot(i._scopes)),t}function $ot(i){let t=new Set;for(let e of i)for(let n of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(n);return Array.from(t)}function gD(i,t,e,n){let{iScale:s}=i,{key:r="r"}=this._parsing,o=new Array(n),a,l,c,u;for(a=0,l=n;a<l;++a)c=a+e,u=t[c],o[a]={r:s.parse(Eu(u,r),c)};return o}var Got=Number.EPSILON||1e-14,xm=(i,t)=>t<i.length&&!i[t].skip&&i[t],hj=i=>i==="x"?"y":"x";function qot(i,t,e,n){let s=i.skip?t:i,r=t,o=e.skip?t:e,a=yC(r,s),l=yC(o,r),c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;let h=n*c,d=n*u;return{previous:{x:r.x-h*(o.x-s.x),y:r.y-h*(o.y-s.y)},next:{x:r.x+d*(o.x-s.x),y:r.y+d*(o.y-s.y)}}}function Yot(i,t,e){let n=i.length,s,r,o,a,l,c=xm(i,0);for(let u=0;u<n-1;++u)if(l=c,c=xm(i,u+1),!(!l||!c)){if(Sm(t[u],0,Got)){e[u]=e[u+1]=0;continue}s=e[u]/t[u],r=e[u+1]/t[u],a=Math.pow(s,2)+Math.pow(r,2),!(a<=9)&&(o=3/Math.sqrt(a),e[u]=s*o*t[u],e[u+1]=r*o*t[u])}}function Xot(i,t,e="x"){let n=hj(e),s=i.length,r,o,a,l=xm(i,0);for(let c=0;c<s;++c){if(o=a,a=l,l=xm(i,c+1),!a)continue;let u=a[e],h=a[n];o&&(r=(u-o[e])/3,a[`cp1${e}`]=u-r,a[`cp1${n}`]=h-r*t[c]),l&&(r=(l[e]-u)/3,a[`cp2${e}`]=u+r,a[`cp2${n}`]=h+r*t[c])}}function Kot(i,t="x"){let e=hj(t),n=i.length,s=Array(n).fill(0),r=Array(n),o,a,l,c=xm(i,0);for(o=0;o<n;++o)if(a=l,l=c,c=xm(i,o+1),!!l){if(c){let u=c[t]-l[t];s[o]=u!==0?(c[e]-l[e])/u:0}r[o]=a?c?jl(s[o-1])!==jl(s[o])?0:(s[o-1]+s[o])/2:s[o-1]:s[o]}Yot(i,s,r),Xot(i,r,t)}function gC(i,t,e){return Math.max(Math.min(i,e),t)}function Jot(i,t){let e,n,s,r,o,a=Oc(i[0],t);for(e=0,n=i.length;e<n;++e)o=r,r=a,a=e<n-1&&Oc(i[e+1],t),r&&(s=i[e],o&&(s.cp1x=gC(s.cp1x,t.left,t.right),s.cp1y=gC(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=gC(s.cp2x,t.left,t.right),s.cp2y=gC(s.cp2y,t.top,t.bottom)))}function dj(i,t,e,n,s){let r,o,a,l;if(t.spanGaps&&(i=i.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")Kot(i,s);else{let c=n?i[i.length-1]:i[0];for(r=0,o=i.length;r<o;++r)a=i[r],l=qot(c,a,i[Math.min(r+1,o-(n?0:1))%o],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&Jot(i,e)}function kC(){return typeof window<"u"&&typeof document<"u"}function PC(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function xC(i,t,e){let n;return typeof i=="string"?(n=parseInt(i,10),i.indexOf("%")!==-1&&(n=n/100*t.parentNode[e])):n=i,n}var RC=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function Zot(i,t){return RC(i).getPropertyValue(t)}var Qot=["top","right","bottom","left"];function Ff(i,t,e){let n={};e=e?"-"+e:"";for(let s=0;s<4;s++){let r=Qot[s];n[r]=parseFloat(i[t+"-"+r+e])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}var tat=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function eat(i,t){let e=i.touches,n=e&&e.length?e[0]:i,{offsetX:s,offsetY:r}=n,o=!1,a,l;if(tat(s,r,i.target))a=s,l=r;else{let c=t.getBoundingClientRect();a=n.clientX-c.left,l=n.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function ed(i,t){if("native"in i)return i;let{canvas:e,currentDevicePixelRatio:n}=t,s=RC(e),r=s.boxSizing==="border-box",o=Ff(s,"padding"),a=Ff(s,"border","width"),{x:l,y:c,box:u}=eat(i,e),h=o.left+(u&&a.left),d=o.top+(u&&a.top),{width:p,height:g}=t;return r&&(p-=o.width+a.width,g-=o.height+a.height),{x:Math.round((l-h)/p*e.width/n),y:Math.round((c-d)/g*e.height/n)}}function nat(i,t,e){let n,s;if(t===void 0||e===void 0){let r=i&&PC(i);if(!r)t=i.clientWidth,e=i.clientHeight;else{let o=r.getBoundingClientRect(),a=RC(r),l=Ff(a,"border","width"),c=Ff(a,"padding");t=o.width-c.width-l.width,e=o.height-c.height-l.height,n=xC(a.maxWidth,r,"clientWidth"),s=xC(a.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:n||vC,maxHeight:s||vC}}var Kh=i=>Math.round(i*10)/10;function fj(i,t,e,n){let s=RC(i),r=Ff(s,"margin"),o=xC(s.maxWidth,i,"clientWidth")||vC,a=xC(s.maxHeight,i,"clientHeight")||vC,l=nat(i,t,e),{width:c,height:u}=l;if(s.boxSizing==="content-box"){let d=Ff(s,"border","width"),p=Ff(s,"padding");c-=p.width+d.width,u-=p.height+d.height}return c=Math.max(0,c-r.width),u=Math.max(0,n?c/n:u-r.height),c=Kh(Math.min(c,o,l.maxWidth)),u=Kh(Math.min(u,a,l.maxHeight)),c&&!u&&(u=Kh(c/2)),(t!==void 0||e!==void 0)&&n&&l.height&&u>l.height&&(u=l.height,c=Kh(Math.floor(u*n))),{width:c,height:u}}function mD(i,t,e){let n=t||1,s=Kh(i.height*n),r=Kh(i.width*n);i.height=Kh(i.height),i.width=Kh(i.width);let o=i.canvas;return o.style&&(e||!o.style.height&&!o.style.width)&&(o.style.height=`${i.height}px`,o.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||o.height!==s||o.width!==r?(i.currentDevicePixelRatio=n,o.height=s,o.width=r,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}var pj=(function(){let i=!1;
vendor: 4,141 bytes, line 4700
4700try{let t={get passive(){return i=!0,!1}};kC()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i})();function bD(i,t){let e=Zot(i,t),n=e&&e.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Xh(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function gj(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:n==="middle"?e<.5?i.y:t.y:n==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function mj(i,t,e,n){let s={x:i.cp2x,y:i.cp2y},r={x:t.cp1x,y:t.cp1y},o=Xh(i,s,e),a=Xh(s,r,e),l=Xh(r,t,e),c=Xh(o,a,e),u=Xh(a,l,e);return Xh(c,u,e)}var iat=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,n){return e-n},leftForLtr(e,n){return e-n}}},sat=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function Vf(i,t,e){return i?iat(t,e):sat()}function vD(i,t){let e,n;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,n=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=n)}function yD(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function bj(i){return i==="angle"?{between:Cm,compare:wot,normalize:Yr}:{between:Bc,compare:(t,e)=>t-e,normalize:t=>t}}function V6({start:i,end:t,count:e,loop:n,style:s}){return{start:i%e,end:t%e,loop:n&&(t-i+1)%e===0,style:s}}function rat(i,t,e){let{property:n,start:s,end:r}=e,{between:o,normalize:a}=bj(n),l=t.length,{start:c,end:u,loop:h}=i,d,p;if(h){for(c+=l,u+=l,d=0,p=l;d<p&&o(a(t[c%l][n]),s,r);++d)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:h,style:i.style}}function xD(i,t,e){if(!e)return[i];let{property:n,start:s,end:r}=e,o=t.length,{compare:a,between:l,normalize:c}=bj(n),{start:u,end:h,loop:d,style:p}=rat(i,t,e),g=[],y=!1,x=null,w,M,A,C=()=>l(s,A,w)&&a(s,A)!==0,R=()=>a(r,w)===0||l(r,A,w),k=()=>y||C(),O=()=>!y||R();for(let I=u,U=u;I<=h;++I)M=t[I%o],!M.skip&&(w=c(M[n]),w!==A&&(y=l(w,s,r),x===null&&k()&&(x=a(w,s)===0?I:U),x!==null&&O()&&(g.push(V6({start:x,end:I,loop:d,count:o,style:p})),x=null),U=I,A=w));return x!==null&&g.push(V6({start:x,end:h,loop:d,count:o,style:p})),g}function wD(i,t){let e=[],n=i.segments;for(let s=0;s<n.length;s++){let r=xD(n[s],i.points,t);r.length&&e.push(...r)}return e}function oat(i,t,e,n){let s=0,r=t-1;if(e&&!n)for(;s<t&&!i[s].skip;)s++;for(;s<t&&i[s].skip;)s++;for(s%=t,e&&(r+=s);r>s&&i[r%t].skip;)r--;return r%=t,{start:s,end:r}}function aat(i,t,e,n){let s=i.length,r=[],o=t,a=i[t],l;for(l=t+1;l<=e;++l){let c=i[l%s];c.skip||c.stop?a.skip||(n=!1,r.push({start:t%s,end:(l-1)%s,loop:n}),t=o=c.stop?l:null):(o=l,a.skip&&(t=l)),a=c}return o!==null&&r.push({start:t%s,end:o%s,loop:n}),r}function vj(i,t){let e=i.points,n=i.options.spanGaps,s=e.length;if(!s)return[];let r=!!i._loop,{start:o,end:a}=oat(e,s,r,n);if(n===!0)return H6(i,[{start:o,end:a,loop:r}],e,t);let l=a<o?a+s:a,c=!!i._fullLoop&&o===0&&a===s-1;return H6(i,aat(e,o,l,c),e,t)}function H6(i,t,e,n){return!n||!n.setContext||!e?t:lat(i,t,e,n)}function lat(i,t,e,n){let s=i._chart.getContext(),r=j6(i.options),{_datasetIndex:o,options:{spanGaps:a}}=i,l=e.length,c=[],u=r,h=t[0].start,d=h;function p(g,y,x,w){let M=a?-1:1;if(g!==y){for(g+=l;e[g%l].skip;)g-=M;for(;e[y%l].skip;)y+=M;g%l!==y%l&&(c.push({start:g%l,end:y%l,loop:x,style:w}),u=w,h=y%l)}}for(let g of t){h=a?h:g.start;let y=e[h%l],x;for(d=h+1;d<=g.end;d++){let w=e[d%l];x=j6(n.setContext(ku(s,{type:"segment",p0:y,p1:w,p0DataIndex:(d-1)%l,p1DataIndex:d%l,datasetIndex:o}))),cat(x,u)&&p(h,d-1,g.loop,u),y=w,u=x}h<d-1&&p(h,d-1,g.loop,u)}return c}function j6(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function cat(i,t){if(!t)return!1;let e=[],n=function(s,r){return aD(r)?(e.includes(r)||e.push(r),e.indexOf(r)):r};return JSON.stringify(i,n)!==JSON.stringify(t,n)}function mC(i,t,e){return i.options.clip?i[e]:t[e]}function uat(i,t){let{xScale:e,yScale:n}=i;
vendor: 12,079 bytes, line 4700
4700return e&&n?{left:mC(e,t,"left"),right:mC(e,t,"right"),top:mC(n,t,"top"),bottom:mC(n,t,"bottom")}:t}function _D(i,t){let e=t._clip;if(e.disabled)return!1;let n=uat(t,i.chartArea);return{left:e.left===!1?0:n.left-(e.left===!0?0:e.left),right:e.right===!1?i.width:n.right+(e.right===!0?0:e.right),top:e.top===!1?0:n.top-(e.top===!0?0:e.top),bottom:e.bottom===!1?i.height:n.bottom+(e.bottom===!0?0:e.bottom)}}var ID=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,n,s){let r=e.listeners[s],o=e.duration;r.forEach(a=>a({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(n-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=iD.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;let r=n.items,o=r.length-1,a=!1,l;for(;o>=0;--o)l=r[o],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),a=!0):(r[o]=r[r.length-1],r.pop());a&&(s.draw(),this._notify(s,n,t,"progress")),r.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let n=e.items,s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},Pu=new ID,yj="transparent",hat={boolean(i,t,e){return e>.5?t:i},color(i,t,e){let n=lD(i||yj),s=n.valid&&lD(t||yj);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}},OD=class{constructor(t,e,n,s){let r=e[n];s=Am([t.to,s,r,t.from]);let o=Am([t.from,r,s]);this._active=!0,this._fn=t.fn||hat[t.type||typeof o],this._easing=vm[t.easing]||vm.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);let s=this._target[this._prop],r=n-this._start,o=this._duration-r;this._start=n,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=Am([t.to,e,s,t.from]),this._from=Am([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,n=this._duration,s=this._prop,r=this._from,o=this._loop,a=this._to,l;if(this._active=r!==a&&(o||e<n),!this._active){this._target[s]=a,this._notify(!0);return}if(e<0){this._target[s]=r;return}l=e/n%2,l=o&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,a,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){let e=t?"res":"rej",n=this._promises||[];for(let s=0;s<n.length;s++)n[s][e]()}},zC=class{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!bi(t))return;let e=Object.keys(gs.animation),n=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{let r=t[s];if(!bi(r))return;let o={};for(let a of e)o[a]=r[a];(os(r.properties)&&r.properties||[s]).forEach(a=>{(a===s||!n.has(a))&&n.set(a,o)})})}_animateOptions(t,e){let n=e.options,s=fat(t,n);if(!s)return[];let r=this._createAnimations(s,n);return n.$shared&&dat(t.options.$animations,n).then(()=>{t.options=n},()=>{}),r}_createAnimations(t,e){let n=this._properties,s=[],r=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now(),l;for(l=o.length-1;l>=0;--l){let c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}let u=e[c],h=r[c],d=n.get(c);if(h)if(d&&h.active()){h.update(d,u,a);continue}else h.cancel();if(!d||!d.duration){t[c]=u;continue}r[c]=h=new OD(d,t,c,u),s.push(h)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let n=this._createAnimations(t,e);if(n.length)return Pu.add(this._chart,n),!0}};function dat(i,t){let e=[],n=Object.keys(t);for(let s=0;s<n.length;s++){let r=i[n[s]];r&&r.active()&&e.push(r.wait())}return Promise.all(e)}function fat(i,t){if(!t)return;let e=i.options;if(!e){i.options=t;return}return e.$shared&&(i.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function xj(i,t){let e=i&&i.options||{},n=e.reverse,s=e.min===void 0?t:0,r=e.max===void 0?t:0;return{start:n?r:s,end:n?s:r}}function pat(i,t,e){if(e===!1)return!1;let n=xj(i,e),s=xj(t,e);return{top:s.end,right:n.end,bottom:s.start,left:n.start}}function gat(i){let t,e,n,s;return bi(i)?(t=i.top,e=i.right,n=i.bottom,s=i.left):t=e=n=s=i,{top:t,right:e,bottom:n,left:s,disabled:i===!1}}function v8(i,t){let e=[],n=i._getSortedDatasetMetas(t),s,r;for(s=0,r=n.length;s<r;++s)e.push(n[s].index);return e}function wj(i,t,e,n={}){let s=i.keys,r=n.mode==="single",o,a,l,c;if(t===null)return;let u=!1;for(o=0,a=s.length;o<a;++o){if(l=+s[o],l===e){if(u=!0,n.all)continue;break}c=i.values[l],Is(c)&&(r||t===0||jl(t)===jl(c))&&(t+=c)}return!u&&!n.all?0:t}function mat(i,t){let{iScale:e,vScale:n}=t,s=e.axis==="x"?"x":"y",r=n.axis==="x"?"x":"y",o=Object.keys(i),a=new Array(o.length),l,c,u;for(l=0,c=o.length;l<c;++l)u=o[l],a[l]={[s]:u,[r]:i[u]};return a}function SD(i,t){let e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function bat(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function vat(i){let{min:t,max:e,minDefined:n,maxDefined:s}=i.getUserBounds();return{min:n?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function yat(i,t,e){let n=i[t]||(i[t]={});return n[e]||(n[e]={})}function _j(i,t,e,n){for(let s of t.getMatchingVisibleMetas(n).reverse()){let r=i[s.index];if(e&&r>0||!e&&r<0)return s.index}return null}function Sj(i,t){let{chart:e,_cachedMeta:n}=i,s=e._stacks||(e._stacks={}),{iScale:r,vScale:o,index:a}=n,l=r.axis,c=o.axis,u=bat(r,o,n),h=t.length,d;for(let p=0;p<h;++p){let g=t[p],{[l]:y,[c]:x}=g,w=g._stacks||(g._stacks={});d=w[c]=yat(s,u,y),d[a]=x,d._top=_j(d,o,!0,n.type),d._bottom=_j(d,o,!1,n.type);let M=d._visualValues||(d._visualValues={});M[a]=x}}function CD(i,t){let e=i.scales;return Object.keys(e).filter(n=>e[n].axis===t).shift()}function xat(i,t){return ku(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function wat(i,t,e){return ku(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function hy(i,t){let e=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){t=t||i._parsed;for(let s of t){let r=s._stacks;if(!r||r[n]===void 0||r[n][e]===void 0)return;delete r[n][e],r[n]._visualValues!==void 0&&r[n]._visualValues[e]!==void 0&&delete r[n]._visualValues[e]}}}var MD=i=>i==="reset"||i==="none",Cj=(i,t)=>t?i:Object.assign({},i),_at=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:v8(e,!0),values:null},zc=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=SD(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&hy(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(h,d,p,g)=>h==="x"?d:h==="r"?g:p,r=e.xAxisID=Gn(n.xAxisID,CD(t,"x")),o=e.yAxisID=Gn(n.yAxisID,CD(t,"y")),a=e.rAxisID=Gn(n.rAxisID,CD(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,r,o,a),u=e.vAxisID=s(l,o,r,a);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&eD(this._data,this),t._stacked&&hy(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(bi(e)){let s=this._cachedMeta;this._data=mat(e,s)}else if(n!==e){if(n){eD(n,this);let s=this._cachedMeta;hy(s),s._parsed=[]}e&&Object.isExtensible(e)&&tj(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,n=this.getDataset(),s=!1;this._dataCheck();let r=e._stacked;e._stacked=SD(e.vScale,e),e.stack!==n.stack&&(s=!0,hy(e),e.stack=n.stack),this._resyncElements(t),(s||r!==e._stacked)&&(Sj(this,e._parsed),e._stacked=SD(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:n,_data:s}=this,{iScale:r,_stacked:o}=n,a=r.axis,l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],u,h,d;if(this._parsing===!1)n._parsed=s,n._sorted=!0,d=s;else{os(s[t])?d=this.parseArrayData(n,s,t,e):bi(s[t])?d=this.parseObjectData(n,s,t,e):d=this.parsePrimitiveData(n,s,t,e);let p=()=>h[a]===null||c&&h[a]<c[a];for(u=0;u<e;++u)n._parsed[u+t]=h=d[u],l&&(p()&&(l=!1),c=h);n._sorted=l}o&&Sj(this,d)}parsePrimitiveData(t,e,n,s){let{iScale:r,vScale:o}=t,a=r.axis,l=o.axis,c=r.getLabels(),u=r===o,h=new Array(s),d,p,g;for(d=0,p=s;d<p;++d)g=d+n,h[d]={[a]:u||r.parse(c[g],g),[l]:o.parse(e[g],g)};return h}parseArrayData(t,e,n,s){let{xScale:r,yScale:o}=t,a=new Array(s),l,c,u,h;for(l=0,c=s;l<c;++l)u=l+n,h=e[u],a[l]={x:r.parse(h[0],u),y:o.parse(h[1],u)};return a}parseObjectData(t,e,n,s){let{xScale:r,yScale:o}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s),u,h,d,p;for(u=0,h=s;u<h;++u)d=u+n,p=e[d],c[u]={x:r.parse(Eu(p,a),d),y:o.parse(Eu(p,l),d)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,n){let s=this.chart,r=this._cachedMeta,o=e[t.axis],a={keys:v8(s,!0),values:e._stacks[t.axis]._visualValues};return wj(a,o,r.index,{mode:n})}updateRangeFromParsed(t,e,n,s){let r=n[e.axis],o=r===null?NaN:r,a=s&&n._stacks[e.axis];s&&a&&(s.values=a,o=wj(s,r,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){let n=this._cachedMeta,s=n._parsed,r=n._sorted&&t===n.iScale,o=s.length,a=this._getOtherScale(t),l=_at(e,n,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:h}=vat(a),d,p;function g(){p=s[d];let y=p[a.axis];return!Is(p[t.axis])||u>y||h<y}for(d=0;d<o&&!(!g()&&(this.updateRangeFromParsed(c,t,p,l),r));++d);if(r){for(d=o-1;d>=0;--d)if(!g()){this.updateRangeFromParsed(c,t,p,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,n=[],s,r,o;for(s=0,r=e.length;s<r;++s)o=e[s][t.axis],Is(o)&&n.push(o);return n}getMaxOverflow(){return!1}
vendor: 4,947 bytes, line 4700
4700getLabelAndValue(t){let e=this._cachedMeta,n=e.iScale,s=e.vScale,r=this.getParsed(t);return{label:n?""+n.getLabelForValue(r[n.axis]):"",value:s?""+s.getLabelForValue(r[s.axis]):""}}_update(t){let e=this._cachedMeta;this.update(t||"default"),e._clip=gat(Gn(this.options.clip,pat(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,e=this.chart,n=this._cachedMeta,s=n.data||[],r=e.chartArea,o=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop,u;for(n.dataset&&n.dataset.draw(t,r,a,l),u=a;u<a+l;++u){let h=s[u];h.hidden||(h.active&&c?o.push(h):h.draw(t,r))}for(u=0;u<o.length;++u)o[u].draw(t,r)}getStyle(t,e){let n=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,e,n){let s=this.getDataset(),r;if(t>=0&&t<this._cachedMeta.data.length){let o=this._cachedMeta.data[t];r=o.$context||(o.$context=wat(this.getContext(),t,o)),r.parsed=this.getParsed(t),r.raw=s.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=xat(this.chart.getContext(),this.index)),r.dataset=s,r.index=r.datasetIndex=this.index;return r.active=!!e,r.mode=n,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",n){let s=e==="active",r=this._cachedDataOpts,o=t+"-"+e,a=r[o],l=this.enableOptionSharing&&_m(n);if(a)return Cj(a,l);let c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),h=s?[`${t}Hover`,"hover",t,""]:[t,""],d=c.getOptionScopes(this.getDataset(),u),p=Object.keys(gs.elements[t]),g=()=>this.getContext(n,s,e),y=c.resolveNamedOptions(d,p,g,h);return y.$shared&&(y.$shared=l,r[o]=Object.freeze(Cj(y,l))),y}_resolveAnimations(t,e,n){let s=this.chart,r=this._cachedDataOpts,o=`animation-${e}`,a=r[o];if(a)return a;let l;if(s.options.animation!==!1){let u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,e),d=u.getOptionScopes(this.getDataset(),h);l=u.createResolver(d,this.getContext(t,n,e))}let c=new zC(s,l&&l.animations);return l&&l._cacheable&&(r[o]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||MD(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,r=this.getSharedOptions(n),o=this.includeOptions(e,r)||r!==s;return this.updateSharedOptions(r,e,n),{sharedOptions:r,includeOptions:o}}updateElement(t,e,n,s){MD(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!MD(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;let r=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,n=this._cachedMeta.data;for(let[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];let s=n.length,r=e.length,o=Math.min(r,s);o&&this.parse(0,o),r>s?this._insertElements(s,r-s,t):r<s&&this._removeElements(r,s-r)}_insertElements(t,e,n=!0){let s=this._cachedMeta,r=s.data,o=t+e,a,l=c=>{for(c.length+=e,a=c.length-1;a>=o;a--)c[a]=c[a-e]};for(l(r),a=t;a<o;++a)r[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),n&&this.updateElements(r,t,e,"reset")}updateElements(t,e,n,s){}_removeElements(t,e){let n=this._cachedMeta;if(this._parsing){let s=n._parsed.splice(t,e);n._stacked&&hy(n,s)}n.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,n,s]=t;this[e](n,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);let n=arguments.length-2;n&&this._sync(["_insertElements",t,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};function Sat(i,t){if(!i._cache.$bar){let e=i.getMatchingVisibleMetas(t),n=[];for(let s=0,r=e.length;s<r;s++)n=n.concat(e[s].controller.getAllParsedValues(i));i._cache.$bar=nD(n.sort((s,r)=>s-r))}return i._cache.$bar}function Cat(i){let t=i.iScale,e=Sat(t,i.type),n=t._length,s,r,o,a,l=()=>{o===32767||o===-32768||(_m(a)&&(n=Math.min(n,Math.abs(o-a)||n)),a=o)};for(s=0,r=e.length;s<r;++s)o=t.getPixelForValue(e[s]),l();for(a=void 0,s=0,r=t.ticks.length;s<r;++s)o=t.getPixelForTick(s),l();return n}
vendor: 4,114 bytes, line 4700
4700function Mat(i,t,e,n){let s=e.barThickness,r,o;return di(s)?(r=t.min*e.categoryPercentage,o=e.barPercentage):(r=s*n,o=1),{chunk:r/n,ratio:o,start:t.pixels[i]-r/2}}function Tat(i,t,e,n){let s=t.pixels,r=s[i],o=i>0?s[i-1]:null,a=i<s.length-1?s[i+1]:null,l=e.categoryPercentage;o===null&&(o=r-(a===null?t.end-t.start:a-r)),a===null&&(a=r+r-o);let c=r-(r-Math.min(o,a))/2*l;return{chunk:Math.abs(a-o)/2*l/n,ratio:e.barPercentage,start:c}}function Aat(i,t,e,n){let s=e.parse(i[0],n),r=e.parse(i[1],n),o=Math.min(s,r),a=Math.max(s,r),l=o,c=a;Math.abs(o)>Math.abs(a)&&(l=a,c=o),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:o,max:a}}function y8(i,t,e,n){return os(i)?Aat(i,t,e,n):t[e.axis]=e.parse(i,n),t}function Mj(i,t,e,n){let s=i.iScale,r=i.vScale,o=s.getLabels(),a=s===r,l=[],c,u,h,d;for(c=e,u=e+n;c<u;++c)d=t[c],h={},h[s.axis]=a||s.parse(o[c],c),l.push(y8(d,h,r,c));return l}function TD(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function Eat(i,t,e){return i!==0?jl(i):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function kat(i){let t,e,n,s,r;return i.horizontal?(t=i.base>i.x,e="left",n="right"):(t=i.base<i.y,e="bottom",n="top"),t?(s="end",r="start"):(s="start",r="end"),{start:e,end:n,reverse:t,top:s,bottom:r}}function Pat(i,t,e,n){let s=t.borderSkipped,r={};if(!s){i.borderSkipped=r;return}if(s===!0){i.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:o,end:a,reverse:l,top:c,bottom:u}=kat(i);s==="middle"&&e&&(i.enableBorderRadius=!0,(e._top||0)===n?s=c:(e._bottom||0)===n?s=u:(r[Tj(u,o,a,l)]=!0,s=c)),r[Tj(s,o,a,l)]=!0,i.borderSkipped=r}function Tj(i,t,e,n){return n?(i=Rat(i,t,e),i=Aj(i,e,t)):i=Aj(i,t,e),i}function Rat(i,t,e){return i===t?e:i===e?t:i}function Aj(i,t,e){return i==="start"?t:i==="end"?e:i}function Dat(i,{inflateAmount:t},e){i.inflateAmount=t==="auto"?e===1?.33:0:t}var ND=class extends zc{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,n,s){return Mj(t,e,n,s)}parseArrayData(t,e,n,s){return Mj(t,e,n,s)}parseObjectData(t,e,n,s){let{iScale:r,vScale:o}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=r.axis==="x"?a:l,u=o.axis==="x"?a:l,h=[],d,p,g,y;for(d=n,p=n+s;d<p;++d)y=e[d],g={},g[r.axis]=r.parse(Eu(y,c),d),h.push(y8(Eu(y,u),g,o,d));return h}updateRangeFromParsed(t,e,n,s){super.updateRangeFromParsed(t,e,n,s);let r=n._custom;r&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let e=this._cachedMeta,{iScale:n,vScale:s}=e,r=this.getParsed(t),o=r._custom,a=TD(o)?"["+o.start+", "+o.end+"]":""+s.getLabelForValue(r[s.axis]);return{label:""+n.getLabelForValue(r[n.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,n,s){let r=s==="reset",{index:o,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),u=this._getRuler(),{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,s);for(let p=e;p<e+n;p++){let g=this.getParsed(p),y=r||di(g[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(p),x=this._calculateBarIndexPixels(p,u),w=(g._stacks||{})[a.axis],M={horizontal:c,base:y.base,enableBorderRadius:!w||TD(g._custom)||o===w._top||o===w._bottom,x:c?y.head:x.center,y:c?x.center:y.head,height:c?x.size:Math.abs(y.size),width:c?Math.abs(y.size):x.size};d&&(M.options=h||this.resolveDataElementOptions(p,t[p].active?"active":s));let A=M.options||t[p].options;Pat(M,A,w,o),Dat(M,A,u.ratio),this.updateElement(t[p],p,M,s)}}_getStacks(t,e){let{iScale:n}=this._cachedMeta,s=n.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),r=n.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(e),l=a&&a[n.axis],c=u=>{let h=u._parsed.find(p=>
4700p[n.axis]===l),d=h&&h[u.vScale.axis];if(di(d)||isNaN(d))return!0};for(let u of s)if(!(e!==void 0&&c(u))&&((r===!1||o.indexOf(u.stack)===-1||r===void 0&&u.stack===void 0)&&o.push(u.stack),u.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(n=>t[n].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)t[Gn(this.chart.options.indexAxis==="x"?n.xAxisID:n.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,n){let s=this._getStacks(t,n),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){let t=this.options,e=this._cachedMeta,n=e.iScale,s=[],r,o;for(r=0,o=e.data.length;r<o;++r)s.push(n.getPixelForValue(this.getParsed(r)[n.axis],r));let a=t.barThickness;return{min:a||Cat(e),pixels:s,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:e,_stacked:n,index:s},options:{base:r,minBarLength:o}}=this,a=r||0,l=this.getParsed(t),c=l._custom,u=TD(c),h=l[e.axis],d=0,p=n?this.applyStack(e,l,n):h,g,y;p!==h&&(d=p-h,p=h),u&&(h=c.barStart,p=c.barEnd-c.barStart,h!==0&&jl(h)!==jl(c.barEnd)&&(d=0),d+=h);let x=!di(r)&&!u?r:d,w=e.getPixelForValue(x);if(this.chart.getDataVisibility(t)?g=e.getPixelForValue(d+p):g=w,y=g-w,Math.abs(y)<o){y=Eat(y,e,a)*o,h===a&&(w-=y/2);let M=e.getPixelForDecimal(0),A=e.getPixelForDecimal(1),C=Math.min(M,A),R=Math.max(M,A);w=Math.max(Math.min(w,R),C),g=w+y,n&&!u&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(g)-e.getValueForPixel(w))}if(w===e.getPixelForValue(a)){let M=jl(y)*e.getLineWidthForValue(a)/2;w+=M,y-=M}return{size:y,base:w,head:g,center:g+y/2}}_calculateBarIndexPixels(t,e){let n=e.scale,s=this.options,r=s.skipNull,o=Gn(s.maxBarThickness,1/0),a,l,c=this._getAxisCount();if(e.grouped){let u=r?this._getStackCount(t):e.stackCount,h=s.barThickness==="flex"?Tat(t,e,s,u*c):Mat(t,e,s,u*c),d=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,p=this._getAxis().indexOf(Gn(d,this.getFirstScaleIdForIndexAxis())),g=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0)+p;a=h.start+h.chunk*g+h.chunk/2,l=Math.min(o,h.chunk*h.ratio)}else a=n.getPixelForValue(this.getParsed(t)[n.axis],t),l=Math.min(o,e.min*e.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){let t=this._cachedMeta,e=t.vScale,n=t.data,s=n.length,r=0;for(;r<s;++r)this.getParsed(r)[e.axis]!==null&&!n[r].hidden&&n[r].draw(this._ctx)}},BD=class extends zc{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,n,s){let r=super.parsePrimitiveData(t,e,n,s);for(let o=0;o<r.length;o++)r[o]._custom=this.resolveDataElementOptions(o+n).radius;return r}parseArrayData(t,e,n,s){let r=super.parseArrayData(t,e,n,s);for(let o=0;o<r.length;o++){let a=e[n+o];r[o]._custom=Gn(a[2],this.resolveDataElementOptions(o+n).radius)}return r}parseObjectData(t,e,n,s){let r=super.parseObjectData(t,e,n,s);for(let o=0;o<r.length;o++){let a=e[n+o];r[o]._custom=Gn(a&&a.r&&+a.r,this.resolveDataElementOptions(o+n).radius)}return r}getMaxOverflow(){let t=this._cachedMeta.data,e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:s,yScale:r}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),l=r.getLabelForValue(o.y),c=o._custom;return{label:n[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,s){let r=s==="reset",{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),u=o.axis,h=a.axis;for(let d=e;d<e+n;d++){let p=t[d],g=!r&&this.getParsed(d),y={},x=y[u]=r?o.getPixelForDecimal(.5):o.getPixelForValue(g[u]),w=y[h]=r?a.getBasePixel():a.getPixelForValue(g[h]);y.skip=isNaN(x)||isNaN(w),c&&(y.options=l||this.resolveDataElementOptions(d,p.active?"active":s),r&&(y.options.radius=0)),this.updateElement(p,d,y,s)}}resolveDataElementOptions(t,e){let n=this.getParsed(t),s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));let r=s.radius;return e!=="active"&&(s.radius=0),s.radius+=Gn(n&&n._custom,r),s}};function Lat(i,t,e){let n=1,s=1,r=0,o=0;if(t<as){let a=i,l=a+t,c=Math.cos(a),u=Math.sin(a),h=Math.cos(l),d=Math.sin(l),p=(A,C,R)=>Cm(A,a,l,!0)?1:Math.max(C,C*e,R,R*e),g=(A,C,R)=>Cm(A,a,l,!0)?-1:Math.min(C,C*e,R,R*e),y=p(0,c,h),x=p(Us,u,d),w=g(Ri,c,h),M=g(Ri+Us,u,d);n=(y-w)/2,s=(x-M)/2,r=-(y+w)/2,o=-(x+M)/2}return{ratioX:n,ratioY:s,offsetX:r,offsetY:o}}var vy=class extends zc{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}}
vendor: 7,184 bytes, line 4700
4700,cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:n,textAlign:s,color:r,useBorderRadius:o,borderRadius:a}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,c)=>{let h=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:h.backgroundColor,fontColor:r,hidden:!t.getDataVisibility(c),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:s,pointStyle:n,borderRadius:o&&(a||h.borderRadius),index:c}}):[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let r=l=>+n[l];if(bi(n[t])){let{key:l="value"}=this._parsing;r=c=>+Eu(n[c],l)}let o,a;for(o=t,a=t+e;o<a;++o)s._parsed[o]=r(o)}}_getRotation(){return ol(this.options.rotation-90)}_getCircumference(){return ol(this.options.circumference)}_getRotationExtents(){let t=as,e=-as;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){let s=this.chart.getDatasetMeta(n).controller,r=s._getRotation(),o=s._getCircumference();t=Math.min(t,r),e=Math.max(e,r+o)}return{rotation:t,circumference:e-t}}update(t){let e=this.chart,{chartArea:n}=e,s=this._cachedMeta,r=s.data,o=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,a=Math.max((Math.min(n.width,n.height)-o)/2,0),l=Math.min($6(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:u,rotation:h}=this._getRotationExtents(),{ratioX:d,ratioY:p,offsetX:g,offsetY:y}=Lat(h,u,l),x=(n.width-o)/d,w=(n.height-o)/p,M=Math.max(Math.min(x,w)/2,0),A=XR(this.options.radius,M),C=Math.max(A*l,0),R=(A-C)/this._getVisibleDatasetWeightTotal();this.offsetX=g*A,this.offsetY=y*A,s.total=this.calculateTotal(),this.outerRadius=A-R*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-R*c,0),this.updateElements(r,0,r.length,t)}_circumference(t,e){let n=this.options,s=this._cachedMeta,r=this._getCircumference();return e&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*r/as)}updateElements(t,e,n,s){let r=s==="reset",o=this.chart,a=o.chartArea,c=o.options.animation,u=(a.left+a.right)/2,h=(a.top+a.bottom)/2,d=r&&c.animateScale,p=d?0:this.innerRadius,g=d?0:this.outerRadius,{sharedOptions:y,includeOptions:x}=this._getSharedOptions(e,s),w=this._getRotation(),M;for(M=0;M<e;++M)w+=this._circumference(M,r);for(M=e;M<e+n;++M){let A=this._circumference(M,r),C=t[M],R={x:u+this.offsetX,y:h+this.offsetY,startAngle:w,endAngle:w+A,circumference:A,outerRadius:g,innerRadius:p};x&&(R.options=y||this.resolveDataElementOptions(M,C.active?"active":s)),w+=A,this.updateElement(C,M,R,s)}}calculateTotal(){let t=this._cachedMeta,e=t.data,n=0,s;for(s=0;s<e.length;s++){let r=t._parsed[s];r!==null&&!isNaN(r)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(n+=Math.abs(r))}return n}calculateCircumference(t){let e=this._cachedMeta.total;return e>0&&!isNaN(t)?as*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart,s=n.data.labels||[],r=Mm(e._parsed[t],n.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0,n=this.chart,s,r,o,a,l;if(!t){for(s=0,r=n.data.datasets.length;s<r;++s)if(n.isDatasetVisible(s)){o=n.getDatasetMeta(s),t=o.data,a=o.controller;break}}if(!t)return 0;for(s=0,r=t.length;s<r;++s)l=a.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let n=0,s=t.length;n<s;++n){let r=this.resolveDataElementOptions(n);e=Math.max(e,r.offset||0,r.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(e+=this._getRingWeight(n));return e}_getRingWeight(t){return Math.max(Gn(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}},FD=class extends zc{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:n,data:s=[],_dataset:r}=e,o=this.chart._animationsDisabled,{start:a,count:l}=rD(e,s,o);this._drawStart=a,this._drawCount=l,oD(e)&&(a=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!r._decimated,n.points=s;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!o,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,n,s){let r=s==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(e,s),d=o.axis,p=a.axis,{spanGaps:g,segment:y}=this.options,x=zf(g)?g:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||r||s==="none",M=e+n,A=t.length,C=e>0&&this.getParsed(e-1);for(let R=0;R<A;++R){let k=t[R],O=w?k:{};if(R<e||R>=M){O.skip=!0;continue}let I=this.getParsed(R),U=di(I[p]),V=O[d]=o.getPixelForValue(I[d],R),q=O[p]=r||U?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,I,l):I[p],R);O.skip=isNaN(V)||isNaN(q)||U,O.stop=R>0&&Math.abs(I[d]-C[d])>x,y&&(O.parsed=I,O.raw=c.data[R]),h&&(O.options=u||this.resolveDataElementOptions(R,k.active?"active":s)),w||this.updateElement(k,R,O,s),C=I}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;let r=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,r,o)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},VC=class extends zc{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((r,o)=>{let l=t.getDatasetMeta(0).controller.getStyle(o);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(o),index:o}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update(
4700)}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart,s=n.data.labels||[],r=Mm(e._parsed[t].r,n.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,n,s){return gD.bind(this)(t,e,n,s)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,s)=>{let r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(r<e.min&&(e.min=r),r>e.max&&(e.max=r))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,n=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),o=Math.max(n.cutoutPercentage?r/100*n.cutoutPercentage:1,0),a=(r-o)/t.getVisibleDatasetCount();this.outerRadius=r-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,n,s){let r=s==="reset",o=this.chart,l=o.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,h=c.yCenter,d=c.getIndexAngle(0)-.5*Ri,p=d,g,y=360/this.countVisibleElements();for(g=0;g<e;++g)p+=this._computeAngle(g,s,y);for(g=e;g<e+n;g++){let x=t[g],w=p,M=p+this._computeAngle(g,s,y),A=o.getDataVisibility(g)?c.getDistanceFromCenterForValue(this.getParsed(g).r):0;p=M,r&&(l.animateScale&&(A=0),l.animateRotate&&(w=M=d));let C={x:u,y:h,innerRadius:0,outerRadius:A,startAngle:w,endAngle:M,options:this.resolveDataElementOptions(g,x.active?"active":s)};this.updateElement(x,g,C,s)}}countVisibleElements(){let t=this._cachedMeta,e=0;return t.data.forEach((n,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?ol(this.resolveDataElementOptions(t,e).angle||n):0}},UD=class extends vy{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},zD=class extends zc{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){let e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return gD.bind(this)(t,e,n,s)}update(t){let e=this._cachedMeta,n=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(n.points=s,t!=="resize"){let o=this.resolveDatasetElementOptions(t);this.options.showLine||(o.borderWidth=0);let a={_loop:!0,_fullLoop:r.length===s.length,options:o};this.updateElement(n,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){let r=this._cachedMeta.rScale,o=s==="reset";for(let a=e;a<e+n;a++){let l=t[a],c=this.resolveDataElementOptions(a,l.active?"active":s),u=r.getPointPositionForValue(a,this.getParsed(a).r),h=o?r.xCenter:u.x,d=o?r.yCenter:u.y,p={x:h,y:d,angle:u.angle,skip:isNaN(h)||isNaN(d),options:c};this.updateElement(l,a,p,s)}}},VD=class extends zc{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){let e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:s,yScale:r}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),l=r.getLabelForValue(o.y);return{label:n[t]||"",value:"("+a+", "+l+")"}}update(t){let e=this._cachedMeta,{data:n=[]}=e,s=this.chart._animationsDisabled,{start:r,count:o}=rD(e,n,s);if(this._drawStart=r,this._drawCount=o,oD(e)&&(r=0,o=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:a,_dataset:l}=e;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!l._decimated,a.points=n;let c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(a,void 0,{animated:!s,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(n,r,o,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,n,s){let r=s==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,u=this.resolveDataElementOptions(e,s),h=this.getSharedOptions(u),d=this.includeOptions(s,h),p=o.axis,g=a.axis,{spanGaps:y,segment:x}=this.options,w=zf(y)?y:Number.POSITIVE_INFINITY,M=this.chart._animationsDisabled||r||s==="none",A=e>0&&this.getParsed(e-1);for(let C=e;C<e+n;++C){let R=t[C],k=this.getParsed(C),O=M?R:{},I=di(k[g]),U=O[p]=o.getPixelForValue(k[p],C),V=O[g]=r||I?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,k,l):k[g],C
vendor: 4,396 bytes, line 4700
4700);O.skip=isNaN(U)||isNaN(V)||I,O.stop=C>0&&Math.abs(k[p]-A[p])>w,x&&(O.parsed=k,O.raw=c.data[C]),d&&(O.options=h||this.resolveDataElementOptions(C,R.active?"active":s)),M||this.updateElement(R,C,O,s),A=k}this.updateSharedOptions(h,s,u)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}let n=t.dataset,s=n.options&&n.options.borderWidth||0;if(!e.length)return s;let r=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,r,o)/2}},Iat=Object.freeze({__proto__:null,BarController:ND,BubbleController:BD,DoughnutController:vy,LineController:FD,PieController:UD,PolarAreaController:VC,RadarController:zD,ScatterController:VD});function Hf(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var HD=class i{static override(t){Object.assign(i.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Hf()}parse(){return Hf()}format(){return Hf()}add(){return Hf()}diff(){return Hf()}startOf(){return Hf()}endOf(){return Hf()}},Oat={_date:HD};function Nat(i,t,e,n){let{controller:s,data:r,_sorted:o}=i,a=s._cachedMeta.iScale,l=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&o&&r.length){let c=a._reversePixels?J6:Ic;if(n){if(s._sharedOptions){let u=r[0],h=typeof u.getRange=="function"&&u.getRange(t);if(h){let d=c(r,t,e-h),p=c(r,t,e+h);return{lo:d.lo,hi:p.hi}}}}else{let u=c(r,t,e);if(l){let{vScale:h}=s._cachedMeta,{_parsed:d}=i,p=d.slice(0,u.lo+1).reverse().findIndex(y=>!di(y[h.axis]));u.lo-=Math.max(0,p);let g=d.slice(u.hi).findIndex(y=>!di(y[h.axis]));u.hi+=Math.max(0,g)}return u}}return{lo:0,hi:r.length-1}}function Sy(i,t,e,n,s){let r=i.getSortedVisibleDatasetMetas(),o=e[t];for(let a=0,l=r.length;a<l;++a){let{index:c,data:u}=r[a],{lo:h,hi:d}=Nat(r[a],t,o,s);for(let p=h;p<=d;++p){let g=u[p];g.skip||n(g,c,p)}}}function Bat(i){let t=i.indexOf("x")!==-1,e=i.indexOf("y")!==-1;return function(n,s){let r=t?Math.abs(n.x-s.x):0,o=e?Math.abs(n.y-s.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(o,2))}}function AD(i,t,e,n,s){let r=[];return!s&&!i.isPointInArea(t)||Sy(i,e,t,function(a,l,c){!s&&!Oc(a,i.chartArea,0)||a.inRange(t.x,t.y,n)&&r.push({element:a,datasetIndex:l,index:c})},!0),r}function Fat(i,t,e,n){let s=[];function r(o,a,l){let{startAngle:c,endAngle:u}=o.getProps(["startAngle","endAngle"],n),{angle:h}=tD(o,{x:t.x,y:t.y});Cm(h,c,u)&&s.push({element:o,datasetIndex:a,index:l})}return Sy(i,e,t,r),s}function Uat(i,t,e,n,s,r){let o=[],a=Bat(e),l=Number.POSITIVE_INFINITY;function c(u,h,d){let p=u.inRange(t.x,t.y,s);if(n&&!p)return;let g=u.getCenterPoint(s);if(!(!!r||i.isPointInArea(g))&&!p)return;let x=a(t,g);x<l?(o=[{element:u,datasetIndex:h,index:d}],l=x):x===l&&o.push({element:u,datasetIndex:h,index:d})}return Sy(i,e,t,c),o}function ED(i,t,e,n,s,r){return!r&&!i.isPointInArea(t)?[]:e==="r"&&!n?Fat(i,t,e,s):Uat(i,t,e,n,s,r)}function Ej(i,t,e,n,s){let r=[],o=e==="x"?"inXRange":"inYRange",a=!1;return Sy(i,e,t,(l,c,u)=>{l[o]&&l[o](t[e],s)&&(r.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,s))}),n&&!a?[]:r}var zat={evaluateInteractionItems:Sy,modes:{index(i,t,e,n){let s=ed(t,i),r=e.axis||"x",o=e.includeInvisible||!1,a=e.intersect?AD(i,s,r,n,o):ED(i,s,r,!1,n,o),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{let u=a[0].index,h=c.data[u];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:u})}),l):[]},dataset(i,t,e,n){let s=ed(t,i),r=e.axis||"xy",o=e.includeInvisible||!1,a=e.intersect?AD(i,s,r,n,o):ED(i,s,r,!1,n,o);if(a.length>0){let l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(i,t,e,n){let s=ed(t,i),r=e.axis||"xy",o=e.includeInvisible||!1;return AD(i,s,r,n,o)},nearest(i,t,e,n){let s=ed(t,i),r=e.axis||"xy",o=e.includeInvisible||!1;return ED(i,s,r,e.intersect,n,o)},x(i,t,e,n){let s=ed(t,i);return Ej(i,s,"x",e.intersect,n)},y(i,t,e,n){let s=ed(t,i);return Ej(i,s,"y",e.intersect,n)}}},x8=["left","top","right","bottom"];function dy(i,t){return i.filter(e=>e.pos===t)}function kj(i,t){return i.filter(e=>x8.indexOf(e.pos)===-1&&e.box.axis===t)}function fy(i,t){return i.sort((e,n)=>{let s=t?n:e,r=t?e:n;
vendor: 51,934 bytes, line 4700
4700return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function Vat(i){let t=[],e,n,s,r,o,a;for(e=0,n=(i||[]).length;e<n;++e)s=i[e],{position:r,options:{stack:o,stackWeight:a=1}}=s,t.push({index:e,box:s,pos:r,horizontal:s.isHorizontal(),weight:s.weight,stack:o&&r+o,stackWeight:a});return t}function Hat(i){let t={};for(let e of i){let{stack:n,pos:s,stackWeight:r}=e;if(!n||!x8.includes(s))continue;let o=t[n]||(t[n]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=r}return t}function jat(i,t){let e=Hat(i),{vBoxMaxWidth:n,hBoxMaxHeight:s}=t,r,o,a;for(r=0,o=i.length;r<o;++r){a=i[r];let{fullSize:l}=a.box,c=e[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*n:l&&t.availableWidth,a.height=s):(a.width=n,a.height=u?u*s:l&&t.availableHeight)}return e}function Wat(i){let t=Vat(i),e=fy(t.filter(c=>c.box.fullSize),!0),n=fy(dy(t,"left"),!0),s=fy(dy(t,"right")),r=fy(dy(t,"top"),!0),o=fy(dy(t,"bottom")),a=kj(t,"x"),l=kj(t,"y");return{fullSize:e,leftAndTop:n.concat(r),rightAndBottom:s.concat(l).concat(o).concat(a),chartArea:dy(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:r.concat(o).concat(a)}}function Pj(i,t,e,n){return Math.max(i[e],t[e])+Math.max(i[n],t[n])}function w8(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function $at(i,t,e,n){let{pos:s,box:r}=e,o=i.maxPadding;if(!bi(s)){e.size&&(i[s]-=e.size);let h=n[e.stack]||{size:0,count:1};h.size=Math.max(h.size,e.horizontal?r.height:r.width),e.size=h.size/h.count,i[s]+=e.size}r.getPadding&&w8(o,r.getPadding());let a=Math.max(0,t.outerWidth-Pj(o,i,"left","right")),l=Math.max(0,t.outerHeight-Pj(o,i,"top","bottom")),c=a!==i.w,u=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:u}:{same:u,other:c}}function Gat(i){let t=i.maxPadding;function e(n){let s=Math.max(t[n]-i[n],0);return i[n]+=s,s}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function qat(i,t){let e=t.maxPadding;function n(s){let r={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{r[o]=Math.max(t[o],e[o])}),r}return n(i?["left","right"]:["top","bottom"])}function my(i,t,e,n){let s=[],r,o,a,l,c,u;for(r=0,o=i.length,c=0;r<o;++r){a=i[r],l=a.box,l.update(a.width||t.w,a.height||t.h,qat(a.horizontal,t));let{same:h,other:d}=$at(t,e,a,n);c|=h&&s.length,u=u||d,l.fullSize||s.push(a)}return c&&my(s,t,e,n)||u}function DC(i,t,e,n,s){i.top=e,i.left=t,i.right=t+n,i.bottom=e+s,i.width=n,i.height=s}function Rj(i,t,e,n){let s=e.padding,{x:r,y:o}=t;for(let a of i){let l=a.box,c=n[a.stack]||{count:1,placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){let h=t.w*u,d=c.size||l.height;_m(c.start)&&(o=c.start),l.fullSize?DC(l,s.left,o,e.outerWidth-s.right-s.left,d):DC(l,t.left+c.placed,o,h,d),c.start=o,c.placed+=h,o=l.bottom}else{let h=t.h*u,d=c.size||l.width;_m(c.start)&&(r=c.start),l.fullSize?DC(l,r,s.top,d,e.outerHeight-s.bottom-s.top):DC(l,r,t.top+c.placed,d,h),c.start=r,c.placed+=h,r=l.right}}t.x=r,t.y=o}var ho={addBox(i,t){i.boxes||(i.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},i.boxes.push(t)},removeBox(i,t){let e=i.boxes?i.boxes.indexOf(t):-1;e!==-1&&i.boxes.splice(e,1)},configure(i,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(i,t,e,n){if(!i)return;let s=Kr(i.options.layout.padding),r=Math.max(t-s.width,0),o=Math.max(e-s.height,0),a=Wat(i.boxes),l=a.vertical,c=a.horizontal;ji(i.boxes,y=>{typeof y.beforeLayout=="function"&&y.beforeLayout()});let u=l.reduce((y,x)=>x.box.options&&x.box.options.display===!1?y:y+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/u,hBoxMaxHeight:o/2}),d=Object.assign({},s);w8(d,Kr(n));let p=Object.assign({maxPadding:d,w:r,h:o,x:s.left,y:s.top},s),g=jat(l.concat(c),h);my(a.fullSize,p,h,g),my(l,p,h,g),my(c,p,h,g)&&my(l,p,h,g),Gat(p),Rj(a.leftAndTop,p,h,g),p.x+=p.w,p.y+=p.h,Rj(a.rightAndBottom,p,h,g),i.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},ji(a.chartArea,y=>{let x=y.box;Object.assign(x,i.chartArea),x.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}},HC=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}},jD=class extends HC{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},FC="$chartjs",Yat={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Dj=i=>i===null||i==="";function Xat(i,t){let e=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[FC]={initial:{height:n,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Dj(s)){let r=bD(i,"width");r!==void 0&&(i.width=r)}if(Dj(n))if(i.style.height==="")i.height=i.width/(t||2);else{let r=bD(i,"height");r!==void 0&&(i.height=r)}return i}var _8=pj?{passive:!0}:!1;function Kat(i,t,e){i&&i.addEventListener(t,e,_8)}function Jat(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,_8)}function Zat(i,t){let e=Yat[i.type]||i.type,{x:n,y:s}=ed(i,t);return{type:e,chart:t,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function jC(i,t){for(let e of i)if(e===t||e.contains(t))return!0}function Qat(i,t,e){let n=i.canvas,s=new MutationObserver(r=>{let o=!1;for(let a of r)o=o||jC(a.addedNodes,n),o=o&&!jC(a.removedNodes,n);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function tlt(i,t,e){let n=i.canvas,s=new MutationObserver(r=>{let o=!1;for(let a of r)o=o||jC(a.removedNodes,n),o=o&&!jC(a.addedNodes,n);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}var yy=new Map,Lj=0;function S8(){let i=window.devicePixelRatio;i!==Lj&&(Lj=i,yy.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function elt(i,t){yy.size||window.addEventListener("resize",S8),yy.set(i,t)}function nlt(i){yy.delete(i),yy.size||window.removeEventListener("resize",S8)}function ilt(i,t,e){let n=i.canvas,s=n&&PC(n);if(!s)return;let r=sD((a,l)=>{let c=s.clientWidth;e(a,l),c<s.clientWidth&&e()},window),o=new ResizeObserver(a=>{let l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||r(c,u)});return o.observe(s),elt(i,r),o}function kD(i,t,e){e&&e.disconnect(),t==="resize"&&nlt(i)}function slt(i,t,e){let n=i.canvas,s=sD(r=>{i.ctx!==null&&e(Zat(r,i))},i);return Kat(n,t,s),s}var WD=class extends HC{acquireContext(t,e){let n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(Xat(t,e),n):null}releaseContext(t){let e=t.canvas;if(!e[FC])return!1;let n=e[FC].initial;["height","width"].forEach(r=>{let o=n[r];di(o)?e.removeAttribute(r):e.setAttribute(r,o)});let s=n.style||{};return Object.keys(s).forEach(r=>{e.style[r]=s[r]}),e.width=e.width,delete e[FC],!0}addEventListener(t,e,n){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),o={attach:Qat,detach:tlt,resize:ilt}[e]||slt;s[e]=o(t,e,n)}removeEventListener(t,e){let n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:kD,detach:kD,resize:kD}[e]||Jat)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return fj(t,e,n,s)}isAttached(t){let e=t&&PC(t);return!!(e&&e.isConnected)}};function rlt(i){return!kC()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?jD:WD}var Wl=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}hasValue(){return zf(this.x)&&zf(this.y)}getProps(t,e){let n=this.$animations;if(!e||!n)return this;let s={};return t.forEach(r=>{s[r]=n[r]&&n[r].active()?n[r]._to:this[r]}),s}};function olt(i,t){let e=i.options.ticks,n=alt(i),s=Math.min(e.maxTicksLimit||n,n),r=e.major.enabled?clt(t):[],o=r.length,a=r[0],l=r[o-1],c=[];if(o>s)return ult(t,c,r,o/s),c;let u=llt(r,t,s);if(o>0){let h,d,p=o>1?Math.round((l-a)/(o-1)):null;for(LC(t,c,u,di(p)?0:a-p,a),h=0,d=o-1;h<d;h++)LC(t,c,u,r[h],r[h+1]);return LC(t,c,u,l,di(p)?t.length:l+p),c}return LC(t,c,u),c}function alt(i){let t=i.options.offset,e=i._tickSize(),n=i._length/e+(t?0:1),s=i._maxLength/e;return Math.floor(Math.min(n,s))}function llt(i,t,e){let n=hlt(i),s=t.length/e;if(!n)return Math.max(s,1);let r=Y6(n);for(let o=0,a=r.length-1;o<a;o++){let l=r[o];if(l>s)return l}return Math.max(s,1)}function clt(i){let t=[],e,n;for(e=0,n=i.length;e<n;e++)i[e].major&&t.push(e);return t}function ult(i,t,e,n){let s=0,r=e[0],o;for(n=Math.ceil(n),o=0;o<i.length;o++)o===r&&(t.push(i[o]),s++,r=e[s*n])}function LC(i,t,e,n,s){let r=Gn(n,0),o=Math.min(Gn(s,i.length),i.length),a=0,l,c,u;for(e=Math.ceil(e),s&&(l=s-n,e=l/Math.floor(l/e)),u=r;u<0;)a++,u=Math.round(r+a*e);for(c=Math.max(r,0);c<o;c++)c===u&&(t.push(i[c]),a++,u=Math.round(r+a*e))}function hlt(i){let t=i.length,e,n;if(t<2)return!1;for(n=i[0],e=1;e<t;++e)if(i[e]-i[e-1]!==n)return!1;return n}var dlt=i=>i==="left"?"right":i==="right"?"left":i,Ij=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Oj=(i,t)=>Math.min(t||i,i);function Nj(i,t){let e=[],n=i.length/t,s=i.length,r=0;for(;r<s;r+=n)e.push(i[Math.floor(r)]);return e}function flt(i,t,e){let n=i.ticks.length,s=Math.min(t,n-1),r=i._startPixel,o=i._endPixel,a=1e-6,l=i.getPixelForTick(s),c;if(!(e&&(n===1?c=Math.max(l-r,o-l):t===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<r-a||l>o+a)))return l}function plt(i,t){ji(i,e=>{let n=e.gc,s=n.length/2,r;if(s>t){for(r=0;r<s;++r)delete e.data[n[r]];n.splice(0,s)}})}function py(i){return i.drawTicks?i.tickLength:0}function Bj(i,t){if(!i.display)return 0;let e=ur(i.font,t),n=Kr(i.padding);return(os(i.text)?i.text.length:1)*e.lineHeight+n.height}function glt(i,t){return ku(i,{scale:t,type:"scale"})}function mlt(i,t,e){return ku(i,{tick:e,index:t,type:"tick"})}function blt(i,t,e){let n=CC(i);return(e&&t!=="right"||!e&&t==="right")&&(n=dlt(n)),n}function vlt(i,t,e,n){let{top:s,left:r,bottom:o,right:a,chart:l}=i,{chartArea:c,scales:u}=l,h=0,d,p,g,y=o-s,x=a-r;if(i.isHorizontal()){if(p=Xr(n,r,a),bi(e)){let w=Object.keys(e)[0],M=e[w];g=u[w].getPixelForValue(M)+y-t}else e==="center"?g=(c.bottom+c.top)/2+y-t:g=Ij(i,e,t);d=a-r}else{if(bi(e)){let w=Object.keys(e)[0],M=e[w];p=u[w].getPixelForValue(M)-x+t}else e==="center"?p=(c.left+c.right)/2-x+t:p=Ij(i,e,t);g=Xr(n,o,s),h=e==="left"?-Us:Us}return{titleX:p,titleY:g,maxWidth:d,rotation:h}}var Wf=class i extends Wl{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:n,_suggestedMax:s}=this;return t=ca(t,Number.POSITIVE_INFINITY),e=ca(e,Number.NEGATIVE_INFINITY),n=ca(n,Number.POSITIVE_INFINITY),s=ca(s,Number.NEGATIVE_INFINITY),{min:ca(t,n),max:ca(e,s),minDefined:Is(t),maxDefined:Is(e)}}getMinMax(t){let{min:e,max:n,minDefined:s,maxDefined:r}=this.getUserBounds(),o;if(s&&r)return{min:e,max:n};let a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)o=a[l].controller.getMinMax(this,t),s||(e=Math.min(e,o.min)),r||(n=Math.max(n,o.max));return e=r&&e>n?n:e,n=s&&e>n?e:n,{min:ca(e,ca(n,e)),max:ca(n,ca(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){es(this.options.beforeUpdate,[this])}update(t,e,n){let{beginAtZero:s,grace:r,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=aj(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=a<this.ticks.length;this._convertTicksToLabels(l?Nj(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=olt(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,n;this.isHorizontal()?(e=this.left,n=this.right):(e=this.top,n=this.bottom,t=!t),this._startPixel=e,this._endPixel=n,this._reversePixels=t,this._length=n-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){es(this.options.afterUpdate,[this])}beforeSetDimensions(){es(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){es(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),es(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){es(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let e=this.options.ticks,n,s,r;for(n=0,s=t.length;n<s;n++)r=t[n],r.label=es(e.callback,[r.value,n,t],this)}afterTickToLabelConversion(){es(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){es(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,e=t.ticks,n=Oj(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,r=e.maxRotation,o=s,a,l,c;if(!this._isVisible()||!e.display||s>=r||n<=1||!this.isHorizontal()){this.labelRotation=s;return}let u=this._getLabelSizes(),h=u.widest.width,d=u.highest.height,p=_r(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/n:p/(n-1),h+6>a&&(a=p/(n-(t.offset?.5:1)),l=this.maxHeight-py(t.grid)-e.padding-Bj(t.title,this.chart.options.font),c=Math.sqrt(h*h+d*d),o=_C(Math.min(Math.asin(_r((u.highest.height+6)/a,-1,1)),Math.asin(_r(l/c,-1,1))-Math.asin(_r(d/c,-1,1)))),o=Math.max(s,Math.min(r,o))),this.labelRotation=o}afterCalculateLabelRotation(){es(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){es(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){let l=Bj(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=py(r)+l):(t.height=this.maxHeight,t.width=py(r)+l),n.display&&this.ticks.length){let{first:c,last:u,widest:h,highest:d}=this._getLabelSizes(),p=n.padding*2,g=ol(this.labelRotation),y=Math.cos(g),x=Math.sin(g);if(a){let w=n.mirror?0:x*h.width+y*d.height;t.height=Math.min(this.maxHeight,t.height+w+p)}else{let w=n.mirror?0:y*h.width+x*d.height;t.width=Math.min(this.maxWidth,t.width+w+p)}this._calculatePadding(c,u,x,y)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,s){let{ticks:{align:r,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){let u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),d=0,p=0;l?c?(d=s*t.width,p=n*e.height):(d=n*t.height,p=s*e.width):r==="start"?p=e.width:r==="end"?d=t.width:r!=="inner"&&(d=t.width/2,p=e.width/2),this.paddingLeft=Math.max((d-u+o)*this.width/(this.width-u),0),this.paddingRight=Math.max((p-h+o)*this.width/(this.width-h),0)}else{let u=e.height/2,h=t.height/2;r==="start"?(u=0,h=t.height):r==="end"&&(u=e.height,h=0),this.paddingTop=u+o,this.paddingBottom=h+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){es(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e<n;e++)di(t[e].label)&&(t.splice(e,1),n--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,n=this.ticks;e<n.length&&(n=Nj(n,e)),this._labelSizes=t=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,n){let{ctx:s,_longestTextCache:r}=this,o=[],a=[],l=Math.floor(e/Oj(e,n)),c=0,u=0,h,d,p,g,y,x,w,M,A,C,R;for(h=0;h<e;h+=l){if(g=t[h].label,y=this._resolveTickFontOptions(h),s.font=x=y.string,w=r[x]=r[x]||{data:{},gc:[]},M=y.lineHeight,A=C=0,!di(g)&&!os(g))A=oy(s,w.data,w.gc,A,g),C=M;else if(os(g))for(d=0,p=g.length;d<p;++d)R=g[d],!di(R)&&!os(R)&&(A=oy(s,w.data,w.gc,A,R),C+=M);o.push(A),a.push(C),c=Math.max(A,c),u=Math.max(C,u)}plt(r,e);let k=o.indexOf(c),O=a.indexOf(u),I=U=>({width:o[U]||0,height:a[U]||0});return{first:I(0),last:I(e-1),widest:I(k),highest:I(O),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return K6(this._alignToPixels?Zh(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&t<e.length){let n=e[t];return n.$context||(n.$context=mlt(this.getContext(),t,n))}return this.$context||(this.$context=glt(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,e=ol(this.labelRotation),n=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),r=this._getLabelSizes(),o=t.autoSkipPadding||0,a=r?r.widest.width+o:0,l=r?r.highest.height+o:0;return this.isHorizontal()?l*n>a*s?a/n:l/s:l*s<a*n?l/n:a/s}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e=this.axis,n=this.chart,s=this.options,{grid:r,position:o,border:a}=s,l=r.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),d=py(r),p=[],g=a.setContext(this.getContext()),y=g.display?g.width:0,x=y/2,w=function(at){return Zh(n,at,y)},M,A,C,R,k,O,I,U,V,q,X,j;if(o==="top")M=w(this.bottom),O=this.bottom-d,U=M-x,q=w(t.top)+x,j=t.bottom;else if(o==="bottom")M=w(this.top),q=t.top,j=w(t.bottom)-x,O=M+x,U=this.top+d;else if(o==="left")M=w(this.right),k=this.right-d,I=M-x,V=w(t.left)+x,X=t.right;else if(o==="right")M=w(this.left),V=t.left,X=w(t.right)-x,k=M+x,I=this.left+d;else if(e==="x"){if(o==="center")M=w((t.top+t.bottom)/2+.5);else if(bi(o)){let at=Object.keys(o)[0],ct=o[at];M=w(this.chart.scales[at].getPixelForValue(ct))}q=t.top,j=t.bottom,O=M+x,U=O+d}else if(e==="y"){if(o==="center")M=w((t.left+t.right)/2);else if(bi(o)){let at=Object.keys(o)[0],ct=o[at];M=w(this.chart.scales[at].getPixelForValue(ct))}k=M-x,I=k-d,V=t.left,X=t.right}let W=Gn(s.ticks.maxTicksLimit,h),_=Math.max(1,Math.ceil(h/W));for(A=0;A<h;A+=_){let at=this.getContext(A),ct=r.setContext(at),pt=a.setContext(at),Et=ct.lineWidth,vt=ct.color,yt=pt.dash||[],kt=pt.dashOffset,Wt=ct.tickWidth,jt=ct.tickColor,ae=ct.tickBorderDash||[],ee=ct.tickBorderDashOffset;C=flt(this,A,l),C!==void 0&&(R=Zh(n,C,Et),c?k=I=V=X=R:O=U=q=j=R,p.push({tx1:k,ty1:O,tx2:I,ty2:U,x1:V,y1:q,x2:X,y2:j,width:Et,color:vt,borderDash:yt,borderDashOffset:kt,tickWidth:Wt,tickColor:jt,tickBorderDash:ae,tickBorderDashOffset:ee}))}return this._ticksLength=h,this._borderValue=M,p}_computeLabelItems(t){let e=this.axis,n=this.options,{position:s,ticks:r}=n,o=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:h}=r,d=py(n.grid),p=d+u,g=h?-u:p,y=-ol(this.labelRotation),x=[],w,M,A,C,R,k,O,I,U,V,q,X,j="middle";if(s==="top")k=this.bottom-g,O=this._getXAxisLabelAlignment();else if(s==="bottom")k=this.top+g,O=this._getXAxisLabelAlignment();else if(s==="left"){let _=this._getYAxisLabelAlignment(d);O=_.textAlign,R=_.x}else if(s==="right"){let _=this._getYAxisLabelAlignment(d);O=_.textAlign,R=_.x}else if(e==="x"){if(s==="center")k=(t.top+t.bottom)/2+p;else if(bi(s)){let _=Object.keys(s)[0],at=s[_];k=this.chart.scales[_].getPixelForValue(at)+p}O=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")R=(t.left+t.right)/2-p;else if(bi(s)){let _=Object.keys(s)[0],at=s[_];R=this.chart.scales[_].getPixelForValue(at)}O=this._getYAxisLabelAlignment(d).textAlign}e==="y"&&(l==="start"?j="top":l==="end"&&(j="bottom"));let W=this._getLabelSizes();for(w=0,M=a.length;w<M;++w){A=a[w],C=A.label;let _=r.setContext(this.getContext(w));I=this.getPixelForTick(w)+r.labelOffset,U=this._resolveTickFontOptions(w),V=U.lineHeight,q=os(C)?C.length:1;let at=q/2,ct=_.color,pt=_.textStrokeColor,Et=_.textStrokeWidth,vt=O;o?(R=I,O==="inner"&&(w===M-1?vt=this.options.reverse?"left":"right":w===0?vt=this.options.reverse?"right":"left":vt="center"),s==="top"?c==="near"||y!==0?X=-q*V+V/2:c==="center"?X=-W.highest.height/2-at*V+V:X=-W.highest.height+V/2:c==="near"||y!==0?X=V/2:c==="center"?X=W.highest.height/2-at*V:X=W.highest.height-q*V,h&&(X*=-1),y!==0&&!_.showLabelBackdrop&&(R+=V/2*Math.sin(y))):(k=I,X=(1-q)*V/2);let yt;if(_.showLabelBackdrop){let kt=Kr(_.backdropPadding),Wt=W.heights[w],jt=W.widths[w],ae=X-kt.top,ee=0-kt.left;switch(j){case"middle":ae-=Wt/2;break;case"bottom":ae-=Wt;break}switch(O){case"center":ee-=jt/2;break;case"right":ee-=jt;break;case"inner":w===M-1?ee-=jt:w>0&&(ee-=jt/2);break}yt={left:ee,top:ae,width:jt+kt.width,height:Wt+kt.height,color:_.backdropColor}}x.push({label:C,font:U,textOffset:X,options:{rotation:y,color:ct,strokeColor:pt,strokeWidth:Et,textAlign:vt,textBaseline:j,translation:[R,k],backdrop:yt}})}return x}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-ol(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:n,mirror:s,padding:r}}=this.options,o=this._getLabelSizes(),a=t+r,l=o.widest.width,c,u;return e==="left"?s?(u=this.right+r,n==="near"?c="left":n==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,n==="near"?c="right":n==="center"?(c="center",u-=l/2):(c="left",u=this.left)):e==="right"?s?(u=this.left+r,n==="near"?c="right":n==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,n==="near"?c="left":n==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:n,top:s,width:r,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(n,s,r,o),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let s=this.ticks.findIndex(r=>r.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){let e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),r,o,a=(l,c,u)=>{!u.width||!u.color||(n.save(),n.lineWidth=u.width,n.strokeStyle=u.color,n.setLineDash(u.borderDash||[]),n.lineDashOffset=u.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(r=0,o=s.length;r<o;++r){let l=s[r];e.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){let{chart:t,ctx:e,options:{border:n,grid:s}}=this,r=n.setContext(this.getContext()),o=n.display?r.width:0;if(!o)return;let a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,u,h,d;this.isHorizontal()?(c=Zh(t,this.left,o)-o/2,u=Zh(t,this.right,a)+a/2,h=d=l):(h=Zh(t,this.top,o)-o/2,d=Zh(t,this.bottom,a)+a/2,c=u=l),e.save(),e.lineWidth=r.width,e.strokeStyle=r.color,e.beginPath(),e.moveTo(c,h),e.lineTo(u,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;let n=this.ctx,s=this._computeLabelArea();s&&cy(n,s);let r=this.getLabelItems(t);for(let o of r){let a=o.options,l=o.font,c=o.label,u=o.textOffset;Qh(n,c,0,u,l,a)}s&&uy(n)}drawTitle(){let{ctx:t,options:{position:e,title:n,reverse:s}}=this;if(!n.display)return;let r=ur(n.font),o=Kr(n.padding),a=n.align,l=r.lineHeight/2;e==="bottom"||e==="center"||bi(e)?(l+=o.bottom,os(n.text)&&(l+=r.lineHeight*(n.text.length-1))):l+=o.top;let{titleX:c,titleY:u,maxWidth:h,rotation:d}=vlt(this,l,e,a);Qh(t,n.text,0,0,r,{color:n.color,maxWidth:h,rotation:d,textAlign:blt(a,e,s),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,e=t.ticks&&t.ticks.z||0,n=Gn(t.grid&&t.grid.z,-1),s=Gn(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==i.prototype.draw?[{z:e,draw:r=>{this.draw(r)}}]:[{z:n,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[],r,o;for(r=0,o=e.length;r<o;++r){let a=e[r];a[n]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){let e=this.options.ticks.setContext(this.getContext(t));return ur(e.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}},km=class{constructor(t,e,n){this.type=t,this.scope=e,this.override=n,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let e=Object.getPrototypeOf(t),n;wlt(e)&&(n=this.register(e));let s=this.items,r=t.id,o=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+t);return r in s||(s[r]=t,ylt(t,o,n),this.override&&gs.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){let e=this.items,n=t.id,s=this.scope;n in e&&delete e[n],s&&n in gs[s]&&(delete gs[s][n],this.override&&delete Jh[n])}};function ylt(i,t,e){let n=ym(Object.create(null),[e?gs.get(e):{},gs.get(t),i.defaults]);gs.set(t,n),i.defaultRoutes&&xlt(t,i.defaultRoutes),i.descriptors&&gs.describe(t,i.descriptors)}function xlt(i,t){Object.keys(t).forEach(e=>{let n=e.split("."),s=n.pop(),r=[i].concat(n).join("."),o=t[e].split("."),a=o.pop(),l=o.join(".");gs.route(r,s,l,a)})}function wlt(i){return"id"in i&&"defaults"in i}var $D=class{constructor(){this.controllers=new km(zc,"datasets",!0),this.elements=new km(Wl,"elements"),this.plugins=new km(Object,"plugins"),this.scales=new km(Wf,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,n){[...e].forEach(s=>{let r=n||this._getRegistryForType(s);n||r.isForType(s)||r===this.plugins&&s.id?this._exec(t,r,s):ji(s,o=>{let a=n||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,e,n){let s=wC(t);es(n["before"+s],[],n),e[t](n),es(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let n=this._typedRegistries[e];if(n.isForType(t))return n}return this.plugins}_get(t,e,n){let s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+n+".");return s}},Uc=new $D,GD=class{constructor(){this._init=void 0}notify(t,e,n,s){if(e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;let r=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(r,t,e,n);return e==="afterDestroy"&&(this._notify(r,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),o}_notify(t,e,n,s){s=s||{};for(let r of t){let o=r.plugin,a=o[n],l=[e,s,r.options];if(es(a,l,o)===!1&&s.cancelable)return!1}return!0}invalidate(){di(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){let n=t&&t.config,s=Gn(n.options&&n.options.plugins,{}),r=_lt(n);return s===!1&&!e?[]:Clt(t,r,s,e)}_notifyStateChanges(t){let e=this._oldCache||[],n=this._cache,s=(r,o)=>r.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}};function _lt(i){let t={},e=[],n=Object.keys(Uc.plugins.items);for(let r=0;r<n.length;r++)e.push(Uc.getPlugin(n[r]));let s=i.plugins||[];for(let r=0;r<s.length;r++){let o=s[r];e.indexOf(o)===-1&&(e.push(o),t[o.id]=!0)}return{plugins:e,localIds:t}}function Slt(i,t){return!t&&i===!1?null:i===!0?{}:i}function Clt(i,{plugins:t,localIds:e},n,s){let r=[],o=i.getContext();for(let a of t){let l=a.id,c=Slt(n[l],s);c!==null&&r.push({plugin:a,options:Mlt(i.config,{plugin:a,local:e[l]},c,o)})}return r}function Mlt(i,{plugin:t,local:e},n,s){let r=i.pluginScopeKeys(t),o=i.getOptionScopes(n,r);return e&&t.defaults&&o.push(t.defaults),i.createResolver(o,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function qD(i,t){let e=gs.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function Tlt(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function Alt(i,t){return i===t?"_index_":"_value_"}function Fj(i){if(i==="x"||i==="y"||i==="r")return i}function Elt(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function YD(i,...t){if(Fj(i))return i;for(let e of t){let n=e.axis||Elt(e.position)||i.length>1&&Fj(i[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Uj(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function klt(i,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(n=>n.xAxisID===i||n.yAxisID===i);if(e.length)return Uj(i,"x",e[0])||Uj(i,"y",e[0])}return{}}function Plt(i,t){let e=Jh[i.type]||{scales:{}},n=t.scales||{},s=qD(i.type,t),r=Object.create(null);return Object.keys(n).forEach(o=>{let a=n[o];if(!bi(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);let l=YD(o,a,klt(o,i),gs.scales[a.type]),c=Alt(l,s),u=e.scales||{};r[o]=wm(Object.create(null),[{axis:l},a,u[l],u[c]])}),i.data.datasets.forEach(o=>{let a=o.type||i.type,l=o.indexAxis||qD(a,t),u=(Jh[a]||{}).scales||{};Object.keys(u).forEach(h=>{let d=Tlt(h,l),p=o[d+"AxisID"]||d;r[p]=r[p]||Object.create(null),wm(r[p],[{axis:d},n[p],u[h]])})}),Object.keys(r).forEach(o=>{let a=r[o];wm(a,[gs.scales[a.type],gs.scale])}),r}function C8(i){let t=i.options||(i.options={});t.plugins=Gn(t.plugins,{}),t.scales=Plt(i,t)}function M8(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function Rlt(i){return i=i||{},i.data=M8(i.data),C8(i),i}var zj=new Map,T8=new Set;function IC(i,t){let e=zj.get(i);return e||(e=t(),zj.set(i,e),T8.add(e)),e}var gy=(i,t,e)=>{let n=Eu(t,e);n!==void 0&&i.add(n)},XD=class{constructor(t){this._config=Rlt(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=M8(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),C8(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return IC(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return IC(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return IC(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,n=this.type;return IC(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let n=this._scopeCache,s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){let{options:s,type:r}=this,o=this._cachedScopes(t,n),a=o.get(e);if(a)return a;let l=new Set;e.forEach(u=>{t&&(l.add(t),u.forEach(h=>gy(l,t,h))),u.forEach(h=>gy(l,s,h)),u.forEach(h=>gy(l,Jh[r]||{},h)),u.forEach(h=>gy(l,gs,h)),u.forEach(h=>gy(l,MC,h))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),T8.has(e)&&o.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,Jh[e]||{},gs.datasets[e]||{},{type:e},gs,MC]}resolveNamedOptions(t,e,n,s=[""]){let r={$shared:!0},{resolver:o,subPrefixes:a}=Vj(this._resolverCache,t,s),l=o;if(Llt(o,e)){r.$shared=!1,n=Tu(n)?n():n;let c=this.createResolver(t,n,a);l=Uf(o,n,c)}for(let c of e)r[c]=l[c];return r}createResolver(t,e,n=[""],s){let{resolver:r}=Vj(this._resolverCache,t,n);return bi(e)?Uf(r,e,void 0,s):r}};function Vj(i,t,e){let n=i.get(t);n||(n=new Map,i.set(t,n));let s=e.join(),r=n.get(s);return r||(r={resolver:EC(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},n.set(s,r)),r}var Dlt=i=>bi(i)&&Object.getOwnPropertyNames(i).some(t=>Tu(i[t]));function Llt(i,t){let{isScriptable:e,isIndexable:n}=dD(i);for(let s of t){let r=e(s),o=n(s),a=(o||r)&&i[s];if(r&&(Tu(a)||Dlt(a))||o&&os(a))return!0}return!1}var Ilt="4.5.1",Olt=["top","bottom","left","right","chartArea"];function Hj(i,t){return i==="top"||i==="bottom"||Olt.indexOf(i)===-1&&t==="x"}function jj(i,t){return function(e,n){return e[i]===n[i]?e[t]-n[t]:e[i]-n[i]}}function Wj(i){let t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),es(e&&e.onComplete,[i],t)}function Nlt(i){let t=i.chart,e=t.options.animation;es(e&&e.onProgress,[i],t)}function A8(i){return kC()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}var UC={},$j=i=>{let t=A8(i);return Object.values(UC).filter(e=>e.canvas===t).pop()};function Blt(i,t,e){let n=Object.keys(i);for(let s of n){let r=+s;if(r>=t){let o=i[s];delete i[s],(e>0||r>t)&&(i[r+e]=o)}}}function Flt(i,t,e,n){return!e||i.type==="mouseout"?null:n?t:i}var Pm=class{static defaults=gs;static instances=UC;static overrides=Jh;static registry=Uc;static version=Ilt;static getChart=$j;static register(...t){Uc.add(...t),Gj()}static unregister(...t){Uc.remove(...t),Gj()}constructor(t,e){let n=this.config=new XD(e),s=A8(t),r=$j(s);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");let o=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||rlt(s)),this.platform.updateConfig(n);let a=this.platform.acquireContext(s,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=W6(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new GD,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ej(h=>this.update(h),o.resizeDelay||0),this._dataChanges=[],UC[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Pu.listen(this,"complete",Wj),Pu.listen(this,"progress",Nlt),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:r}=this;return di(t)?e&&r?r:s?n/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Uc}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():mD(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return cD(this.canvas,this.ctx),this}stop(){return Pu.stop(this),this}resize(t,e){Pu.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let n=this.options,s=this.canvas,r=n.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,r),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,mD(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),es(n.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};ji(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){let t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((o,a)=>(o[a]=!1,o),{}),r=[];e&&(r=r.concat(Object.keys(e).map(o=>{let a=e[o],l=YD(o,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),ji(r,o=>{let a=o.options,l=a.id,c=YD(l,a),u=Gn(a.type,o.dtype);(a.position===void 0||Hj(a.position,c)!==Hj(o.dposition))&&(a.position=o.dposition),s[l]=!0;let h=null;if(l in n&&n[l].type===u)h=n[l];else{let d=Uc.getScale(u);h=new d({id:l,type:u,ctx:this.ctx,chart:this}),n[h.id]=h}h.init(a,t)}),ji(s,(o,a)=>{o||delete n[a]}),ji(n,o=>{ho.configure(this,o,o.options),ho.addBox(this,o)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,r)=>s.index-r.index),n>e){for(let s=e;s<n;++s)this._destroyDatasetMeta(s);t.splice(e,n-e)}this._sortedMetasets=t.slice(0).sort(jj("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(r=>r===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n<s;n++){let r=e[n],o=this.getDatasetMeta(n),a=r.type||this.config.type;if(o.type&&o.type!==a&&(this._destroyDatasetMeta(n),o=this.getDatasetMeta(n)),o.type=a,o.indexAxis=r.indexAxis||qD(a,this.options),o.order=r.order||0,o.index=n,o.label=""+r.label,o.visible=this.isDatasetVisible(n),o.controller)o.controller.updateIndex(n),o.controller.linkScales();else{let l=Uc.getController(a),{datasetElementType:c,dataElementType:u}=gs.datasets[a];Object.assign(l,{dataElementType:Uc.getElement(u),datasetElementType:c&&Uc.getElement(c)}),o.controller=new l(this,n),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){ji(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,u=this.data.datasets.length;c<u;c++){let{controller:h}=this.getDatasetMeta(c),d=!s&&r.indexOf(h)===-1;h.buildOrUpdateElements(d),o=Math.max(+h.getMaxOverflow(),o)}o=this._minPadding=n.layout.autoPadding?o:0,this._updateLayout(o),s||ji(r,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(jj("z","_idx"));let{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){ji(this.scales,t=>{ho.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!KR(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:n,start:s,count:r}of e){let o=n==="_removeElements"?-r:r;Blt(t,s,o)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,n=r=>new Set(t.filter(o=>o[0]===r).map((o,a)=>a+","+o.splice(1).join(","))),s=n(0);for(let r=1;r<e;r++)if(!KR(s,n(r)))return;return Array.from(s).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ho.update(this,this.width,this.height,t);let e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],ji(this.boxes,s=>{n&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,n=this.data.datasets.length;e<n;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,n=this.data.datasets.length;e<n;++e)this._updateDataset(e,Tu(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let n=this.getDatasetMeta(t),s={meta:n,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(n.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Pu.has(this)?this.attached&&!Pu.running(this)&&Pu.start(this):(this.draw(),Wj({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:n,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let e=this._sortedMetasets,n=[],s,r;for(s=0,r=e.length;s<r;++s){let o=e[s];(!t||o.visible)&&n.push(o)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,n={meta:t,index:t.index,cancelable:!0},s=_D(this,t);this.notifyPlugins("beforeDatasetDraw",n)!==!1&&(s&&cy(e,s),t.controller.draw(),s&&uy(e),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}isPointInArea(t){return Oc(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){let r=zat.modes[e];return typeof r=="function"?r(this,t,n,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],n=this._metasets,s=n.filter(r=>r&&r._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=ku(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){let n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){let s=n?"show":"hide",r=this.getDatasetMeta(t),o=r.controller._resolveAnimations(void 0,s);_m(e)?(r.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),o.update(r,{visible:n}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Pu.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),cD(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete UC[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,e=this.platform,n=(r,o)=>{e.addEventListener(this,r,o),t[r]=o},s=(r,o,a)=>{r.offsetX=o,r.offsetY=a,this._eventHandler(r)};ji(this.options.events,r=>n(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)},o,a=()=>{s("attach",a),this.attached=!0,this.resize(),n("resize",r),n("detach",o)};o=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),n("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){ji(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},ji(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){let s=n?"set":"remove",r,o,a,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){o=t[a];let c=o&&this.getDatasetMeta(o.datasetIndex).controller;c&&c[s+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let e=this._active||[],n=t.map(({datasetIndex:r,index:o})=>{let a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[o],index:o}});!ay(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,n){let s=this.options.hover,r=(l,c)=>l.filter(u=>!c.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),o=r(e,t),a=n?t:r(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){let n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;let r=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(r||n.changed)&&this.render(),this}_handleEvent(t,e,n){let{_active:s=[],options:r}=this,o=e,a=this._getActiveElements(t,s,n,o),l=q6(t),c=Flt(t,this._lastEvent,n,l);n&&(this._lastEvent=null,es(r.onHover,[t,a,this],this),l&&es(r.onClick,[t,a,this],this));let u=!ay(a,s);return(u||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,u}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;let r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,s)}};function Gj(){return ji(Pm.instances,i=>i._plugins.invalidate())}function Ult(i,t,e){let{startAngle:n,x:s,y:r,outerRadius:o,innerRadius:a,options:l}=t,{borderWidth:c,borderJoinStyle:u}=l,h=Math.min(c/o,Yr(n-e));if(i.beginPath(),i.arc(s,r,o-c/2,n+h/2,e-h/2),a>0){let d=Math.min(c/a,Yr(n-e));i.arc(s,r,a+c/2,e-d/2,n+d/2,!0)}else{let d=Math.min(c/2,o*Yr(n-e));if(u==="round")i.arc(s,r,d,e-Ri/2,n+Ri/2,!0);else if(u==="bevel"){let p=2*d*d,g=-p*Math.cos(e+Ri/2)+s,y=-p*Math.sin(e+Ri/2)+r,x=p*Math.cos(n+Ri/2)+s,w=p*Math.sin(n+Ri/2)+r;i.lineTo(g,y),i.lineTo(x,w)}}i.closePath(),i.moveTo(0,0),i.rect(0,0,i.canvas.width,i.canvas.height),i.clip("evenodd")}function zlt(i,t,e){let{startAngle:n,pixelMargin:s,x:r,y:o,outerRadius:a,innerRadius:l}=t,c=s/a;i.beginPath(),i.arc(r,o,a,n-c,e+c),l>s?(c=s/l,i.arc(r,o,l,e+c,n-c,!0)):i.arc(r,o,s,e+Us,n-Us),i.closePath(),i.clip()}function Vlt(i){return AC(i,["outerStart","outerEnd","innerStart","innerEnd"])}function Hlt(i,t,e,n){let s=Vlt(i.options.borderRadius),r=(e-t)/2,o=Math.min(r,n*t/2),a=l=>{let c=(e-Math.min(r,l))*n/2;return _r(l,0,Math.min(r,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:_r(s.innerStart,0,o),innerEnd:_r(s.innerEnd,0,o)}}
4700function Em(i,t,e,n){return{x:e+i*Math.cos(t),y:n+i*Math.sin(t)}}function WC(i,t,e,n,s,r){let{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:u}=t,h=Math.max(t.outerRadius+n+e-c,0),d=u>0?u+n+e+c:0,p=0,g=s-l;if(n){let _=u>0?u-n:0,at=h>0?h-n:0,ct=(_+at)/2,pt=ct!==0?g*ct/(ct+n):g;p=(g-pt)/2}let y=Math.max(.001,g*h-e/Ri)/h,x=(g-y)/2,w=l+x+p,M=s-x-p,{outerStart:A,outerEnd:C,innerStart:R,innerEnd:k}=Hlt(t,d,h,M-w),O=h-A,I=h-C,U=w+A/O,V=M-C/I,q=d+R,X=d+k,j=w+R/q,W=M-k/X;if(i.beginPath(),r){let _=(U+V)/2;if(i.arc(o,a,h,U,_),i.arc(o,a,h,_,V),C>0){let Et=Em(I,V,o,a);i.arc(Et.x,Et.y,C,V,M+Us)}let at=Em(X,M,o,a);if(i.lineTo(at.x,at.y),k>0){let Et=Em(X,W,o,a);i.arc(Et.x,Et.y,k,M+Us,W+Math.PI)}let ct=(M-k/d+(w+R/d))/2;if(i.arc(o,a,d,M-k/d,ct,!0),i.arc(o,a,d,ct,w+R/d,!0),R>0){let Et=Em(q,j,o,a);i.arc(Et.x,Et.y,R,j+Math.PI,w-Us)}let pt=Em(O,w,o,a);if(i.lineTo(pt.x,pt.y),A>0){let Et=Em(O,U,o,a);i.arc(Et.x,Et.y,A,w-Us,U)}}else{i.moveTo(o,a);let _=Math.cos(U)*h+o,at=Math.sin(U)*h+a;i.lineTo(_,at);let ct=Math.cos(V)*h+o,pt=Math.sin(V)*h+a;i.lineTo(ct,pt)}i.closePath()}function jlt(i,t,e,n,s){let{fullCircles:r,startAngle:o,circumference:a}=t,l=t.endAngle;if(r){WC(i,t,e,n,l,s);for(let c=0;c<r;++c)i.fill();isNaN(a)||(l=o+(a%as||as))}return WC(i,t,e,n,l,s),i.fill(),l}function Wlt(i,t,e,n,s){let{fullCircles:r,startAngle:o,circumference:a,options:l}=t,{borderWidth:c,borderJoinStyle:u,borderDash:h,borderDashOffset:d,borderRadius:p}=l,g=l.borderAlign==="inner";if(!c)return;i.setLineDash(h||[]),i.lineDashOffset=d,g?(i.lineWidth=c*2,i.lineJoin=u||"round"):(i.lineWidth=c,i.lineJoin=u||"bevel");let y=t.endAngle;if(r){WC(i,t,e,n,y,s);for(let x=0;x<r;++x)i.stroke();isNaN(a)||(y=o+(a%as||as))}g&&zlt(i,t,y),l.selfJoin&&y-o>=Ri&&p===0&&u!=="miter"&&Ult(i,t,y),r||(WC(i,t,e,n,y,s),i.stroke())}var KD=class extends Wl{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,n){let s=this.getProps(["x","y"],n),{angle:r,distance:o}=tD(s,{x:t,y:e}),{startAngle:a,endAngle:l,innerRadius:c,outerRadius:u,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),d=(this.options.spacing+this.options.borderWidth)/2,p=Gn(h,l-a),g=Cm(r,a,l)&&a!==l,y=p>=as||g,x=Bc(o,c+d,u+d);return y&&x}getCenterPoint(t){let{x:e,y:n,startAngle:s,endAngle:r,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,u=(s+r)/2,h=(o+a+c+l)/2;return{x:e+Math.cos(u)*h,y:n+Math.sin(u)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){let{options:e,circumference:n}=this,s=(e.offset||0)/4,r=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=n>as?Math.floor(n/as):0,n===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*s,Math.sin(a)*s);let l=1-Math.sin(Math.min(Ri,n||0)),c=s*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,jlt(t,this,c,r,o),Wlt(t,this,c,r,o),t.restore()}};function E8(i,t,e=t){i.lineCap=Gn(e.borderCapStyle,t.borderCapStyle),i.setLineDash(Gn(e.borderDash,t.borderDash)),i.lineDashOffset=Gn(e.borderDashOffset,t.borderDashOffset),i.lineJoin=Gn(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=Gn(e.borderWidth,t.borderWidth),i.strokeStyle=Gn(e.borderColor,t.borderColor)}function $lt(i,t,e){i.lineTo(e.x,e.y)}function Glt(i){return i.stepped?rj:i.tension||i.cubicInterpolationMode==="monotone"?oj:$lt}function k8(i,t,e={}){let n=i.length,{start:s=0,end:r=n-1}=e,{start:o,end:a}=t,l=Math.max(s,o),c=Math.min(r,a),u=s<o&&r<o||s>a&&r>a;return{count:n,start:l,loop:t.loop,ilen:c<l&&!u?n+c-l:c-l}}function qlt(i,t,e,n){let{points:s,options:r}=t,{count:o,start:a,loop:l,ilen:c}=k8(s,e,n),u=Glt(r),{move:h=!0,reverse:d}=n||{},p,g,y;for(p=0;p<=c;
vendor: 4,569 bytes, line 4700
4700++p)g=s[(a+(d?c-p:p))%o],!g.skip&&(h?(i.moveTo(g.x,g.y),h=!1):u(i,y,g,d,r.stepped),y=g);return l&&(g=s[(a+(d?c:0))%o],u(i,y,g,d,r.stepped)),!!l}function Ylt(i,t,e,n){let s=t.points,{count:r,start:o,ilen:a}=k8(s,e,n),{move:l=!0,reverse:c}=n||{},u=0,h=0,d,p,g,y,x,w,M=C=>(o+(c?a-C:C))%r,A=()=>{y!==x&&(i.lineTo(u,x),i.lineTo(u,y),i.lineTo(u,w))};for(l&&(p=s[M(0)],i.moveTo(p.x,p.y)),d=0;d<=a;++d){if(p=s[M(d)],p.skip)continue;let C=p.x,R=p.y,k=C|0;k===g?(R<y?y=R:R>x&&(x=R),u=(h*u+C)/++h):(A(),i.lineTo(C,R),g=k,h=0,y=x=R),w=R}A()}function JD(i){let t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Ylt:qlt}function Xlt(i){return i.stepped?gj:i.tension||i.cubicInterpolationMode==="monotone"?mj:Xh}function Klt(i,t,e,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,n)&&s.closePath()),E8(i,t.options),i.stroke(s)}function Jlt(i,t,e,n){let{segments:s,options:r}=t,o=JD(t);for(let a of s)E8(i,r,a.style),i.beginPath(),o(i,t,a,{start:e,end:e+n-1})&&i.closePath(),i.stroke()}var Zlt=typeof Path2D=="function";function Qlt(i,t,e,n){Zlt&&!t.options.segment?Klt(i,t,e,n):Jlt(i,t,e,n)}var Rm=class extends Wl{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){let s=n.spanGaps?this._loop:this._fullLoop;dj(this._points,n,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=vj(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){let n=this.options,s=t[e],r=this.points,o=wD(this,{property:e,start:s,end:s});if(!o.length)return;let a=[],l=Xlt(n),c,u;for(c=0,u=o.length;c<u;++c){let{start:h,end:d}=o[c],p=r[h],g=r[d];if(p===g){a.push(p);continue}let y=Math.abs((s-p[e])/(g[e]-p[e])),x=l(p,g,y,n.stepped);x[e]=t[e],a.push(x)}return a.length===1?a[0]:a}pathSegment(t,e,n){return JD(this)(t,this,e,n)}path(t,e,n){let s=this.segments,r=JD(this),o=this._loop;e=e||0,n=n||this.points.length-e;for(let a of s)o&=r(t,this,a,{start:e,end:e+n-1});return!!o}draw(t,e,n,s){let r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),Qlt(t,this,n,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};function qj(i,t,e,n){let s=i.options,{[e]:r}=i.getProps([e],n);return Math.abs(t-r)<s.radius+s.hitRadius}var ZD=class extends Wl{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,n){let s=this.options,{x:r,y:o}=this.getProps(["x","y"],n);return Math.pow(t-r,2)+Math.pow(e-o,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return qj(this,t,"x",e)}inYRange(t,e){return qj(this,t,"y",e)}getCenterPoint(t){let{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);let n=e&&t.borderWidth||0;return(e+n)*2}draw(t,e){let n=this.options;this.skip||n.radius<.1||!Oc(this,e,this.size(n)/2)||(t.strokeStyle=n.borderColor,t.lineWidth=n.borderWidth,t.fillStyle=n.backgroundColor,TC(t,n,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}};function P8(i,t){let{x:e,y:n,base:s,width:r,height:o}=i.getProps(["x","y","base","width","height"],t),a,l,c,u,h;return i.horizontal?(h=o/2,a=Math.min(e,s),l=Math.max(e,s),c=n-h,u=n+h):(h=r/2,a=e-h,l=e+h,c=Math.min(n,s),u=Math.max(n,s)),{left:a,top:c,right:l,bottom:u}}
4700function nd(i,t,e,n){return i?0:_r(t,e,n)}function tct(i,t,e){let n=i.options.borderWidth,s=i.borderSkipped,r=hD(n);return{t:nd(s.top,r.top,0,e),r:nd(s.right,r.right,0,t),b:nd(s.bottom,r.bottom,0,e),l:nd(s.left,r.left,0,t)}}function ect(i,t,e){let{enableBorderRadius:n}=i.getProps(["enableBorderRadius"]),s=i.options.borderRadius,r=td(s),o=Math.min(t,e),a=i.borderSkipped,l=n||bi(s);return{topLeft:nd(!l||a.top||a.left,r.topLeft,0,o),topRight:nd(!l||a.top||a.right,r.topRight,0,o),bottomLeft:nd(!l||a.bottom||a.left,r.bottomLeft,0,o),bottomRight:nd(!l||a.bottom||a.right,r.bottomRight,0,o)}}function nct(i){let t=P8(i),e=t.right-t.left,n=t.bottom-t.top,s=tct(i,e/2,n/2),r=ect(i,e/2,n/2);return{outer:{x:t.left,y:t.top,w:e,h:n,radius:r},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:n-s.t-s.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,r.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(s.b,s.r))}}}}function PD(i,t,e,n){let s=t===null,r=e===null,a=i&&!(s&&r)&&P8(i,n);return a&&(s||Bc(t,a.left,a.right))&&(r||Bc(e,a.top,a.bottom))}function ict(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function sct(i,t){i.rect(t.x,t.y,t.w,t.h)}function RD(i,t,e={}){let n=i.x!==e.x?-t:0,s=i.y!==e.y?-t:0,r=(i.x+i.w!==e.x+e.w?t:0)-n,o=(i.y+i.h!==e.y+e.h?t:0)-s;return{x:i.x+n,y:i.y+s,w:i.w+r,h:i.h+o,radius:i.radius}}var QD=class extends Wl{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){let{inflateAmount:e,options:{borderColor:n,backgroundColor:s}}=this,{inner:r,outer:o}=nct(this),a=ict(o.radius)?Tm:sct;t.save(),(o.w!==r.w||o.h!==r.h)&&(t.beginPath(),a(t,RD(o,e,r)),t.clip(),a(t,RD(r,-e,o)),t.fillStyle=n,t.fill("evenodd")),t.beginPath(),a(t,RD(r,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,n){return PD(this,t,e,n)}inXRange(t,e){return PD(this,t,null,e)}inYRange(t,e){return PD(this,null,t,e)}getCenterPoint(t){let{x:e,y:n,base:s,horizontal:r}=this.getProps(["x","y","base","horizontal"],t);return{x:r?(e+s)/2:e,y:r?n:(n+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}},rct=Object.freeze({__proto__:null,ArcElement:KD,BarElement:QD,LineElement:Rm,PointElement:ZD}),tL=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Yj=tL.map(i=>i.replace("rgb(","rgba(").replace(")",", 0.5)"));function R8(i){return tL[i%tL.length]}function D8(i){return Yj[i%Yj.length]}function oct(i,t){return i.borderColor=R8(t),i.backgroundColor=D8(t),++t}function act(i,t){return i.backgroundColor=i.data.map(()=>R8(t++)),t}function lct(i,t){return i.backgroundColor=i.data.map(()=>D8(t++)),t}function cct(i){let t=0;return(e,n)=>{let s=i.getDatasetMeta(n).controller;s instanceof vy?t=act(e,t):s instanceof VC?t=lct(e,t):s&&(t=oct(e,t))}}function Xj(i){let t;for(t in i)if(i[t].borderColor||i[t].backgroundColor)return!0;return!1}function uct(i){return i&&(i.borderColor||i.backgroundColor)}function hct(){return gs.borderColor!=="rgba(0,0,0,0.1)"||gs.backgroundColor!=="rgba(0,0,0,0.1)"}var dct={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(i,t,e){if(!e.enabled)return;let{data:{datasets:n},options:s}=i.config,{elements:r}=s,o=Xj(n)||uct(s)||r&&Xj(r)||hct();if(!e.forceOverride&&o)return;let a=cct(i);n.forEach(a)}};function fct(i,t,e,n,s){let r=s.samples||n;if(r>=e)return i.slice(t,t+e);let o=[],a=(e-2)/(r-2),l=0,c=t+e-1,u=t,h,d,p,g,y;for(o[l++]=i[u],h=0;h<r-2;h++){let x=0,w=0,M,A=Math.floor((h+1)*a)+1+t,C=Math.min(Math.floor((h+2)*a)+1,e)+t,R=C-A;for(M=A;M<C;M++)x+=i[M].x,w+=i[M].y;x/=R,w/=R;let k=Math.floor(h*a)+1+t,O=Math.min(Math.floor((h+1)*a)+1,e)+t,{x:I,y:U}=i[u];for(p=g=-1,M=k;M<O;M++)g=.5*Math.abs((I-x)*(i[M].y-U)-(I-i[M].x)*(w-U)),g>p&&(p=g,d=i[M],y=M);o[l++]=d,u=y}return o[l++]=i[c],o}function pct(i,t,e,n){let s=0,r=0,o,a,l,c,u,h,d,p,g,y,x=[],w=t+e-1,M=i[t].x,C=i[w].x-M;for(o=t;o<t+e;++o){a=i[o],l=(a.x-M)/C*n,c=a.y;let R=l|0;if(R===u)c<g?(g=c,h=o):c>y&&(y=c,d=o),s=(r*s+a.x)/++r;else{let k=o-1;if(!di(h)&&!di(d)){let O=Math.min(h,d),I=Math.max(h,d);O!==p&&O!==k&&x.push({...i[O],x:s}),I!==p&&I!==k&&x.push({...i[I],x:s})}o>0&&k!==p&&x.push(i[k]),x.push(a),u=R,r=0,g=y=c,h=d=p=o}}return x}function L8(i){if(i._decimated){let t=i._data;delete i._decimated,delete i._data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}
4700function Kj(i){i.data.datasets.forEach(t=>{L8(t)})}function gct(i,t){let e=t.length,n=0,s,{iScale:r}=i,{min:o,max:a,minDefined:l,maxDefined:c}=r.getUserBounds();return l&&(n=_r(Ic(t,r.axis,o).lo,0,e-1)),c?s=_r(Ic(t,r.axis,a).hi+1,n,e)-n:s=e-n,{start:n,count:s}}var mct={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(i,t,e)=>{if(!e.enabled){Kj(i);return}let n=i.width;i.data.datasets.forEach((s,r)=>{let{_data:o,indexAxis:a}=s,l=i.getDatasetMeta(r),c=o||s.data;if(Am([a,i.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let u=i.scales[l.xAxisID];if(u.type!=="linear"&&u.type!=="time"||i.options.parsing)return;let{start:h,count:d}=gct(l,c),p=e.threshold||4*n;if(d<=p){L8(s);return}di(o)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(y){this._data=y}}));let g;switch(e.algorithm){case"lttb":g=fct(c,h,d,n,e);break;case"min-max":g=pct(c,h,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=g})},destroy(i){Kj(i)}};function bct(i,t,e){let n=i.segments,s=i.points,r=t.points,o=[];for(let a of n){let{start:l,end:c}=a;c=YC(l,c,s);let u=eL(e,s[l],s[c],a.loop);if(!t.segments){o.push({source:a,target:u,start:s[l],end:s[c]});continue}let h=wD(t,u);for(let d of h){let p=eL(e,r[d.start],r[d.end],d.loop),g=xD(a,s,p);for(let y of g)o.push({source:y,target:d,start:{[e]:Jj(u,p,"start",Math.max)},end:{[e]:Jj(u,p,"end",Math.min)}})}}return o}function eL(i,t,e,n){if(n)return;let s=t[i],r=e[i];return i==="angle"&&(s=Yr(s),r=Yr(r)),{property:i,start:s,end:r}}function vct(i,t){let{x:e=null,y:n=null}=i||{},s=t.points,r=[];return t.segments.forEach(({start:o,end:a})=>{a=YC(o,a,s);let l=s[o],c=s[a];n!==null?(r.push({x:l.x,y:n}),r.push({x:c.x,y:n})):e!==null&&(r.push({x:e,y:l.y}),r.push({x:e,y:c.y}))}),r}function YC(i,t,e){for(;t>i;t--){let n=e[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function Jj(i,t,e,n){return i&&t?n(i[e],t[e]):i?i[e]:t?t[e]:0}function I8(i,t){let e=[],n=!1;return os(i)?(n=!0,e=i):e=vct(i,t),e.length?new Rm({points:e,options:{tension:0},_loop:n,_fullLoop:n}):null}function Zj(i){return i&&i.fill!==!1}function yct(i,t,e){let s=i[t].fill,r=[t],o;if(!e)return s;for(;s!==!1&&r.indexOf(s)===-1;){if(!Is(s))return s;if(o=i[s],!o)return!1;if(o.visible)return s;r.push(s),s=o.fill}return!1}function xct(i,t,e){let n=Cct(i);if(bi(n))return isNaN(n.value)?!1:n;let s=parseFloat(n);return Is(s)&&Math.floor(s)===s?wct(n[0],t,s,e):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function wct(i,t,e,n){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=n?!1:e}function _ct(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:bi(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Sct(i,t,e){let n;return i==="start"?n=e:i==="end"?n=t.options.reverse?t.min:t.max:bi(i)?n=i.value:n=t.getBaseValue(),n}function Cct(i){let t=i.options,e=t.fill,n=Gn(e&&e.target,e);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function Mct(i){let{scale:t,index:e,line:n}=i,s=[],r=n.segments,o=n.points,a=Tct(t,e);a.push(I8({x:null,y:t.bottom},n));for(let l=0;l<r.length;l++){let c=r[l];for(let u=c.start;u<=c.end;u++)Act(s,o[u],a)}return new Rm({points:s,options:{}})}function Tct(i,t){let e=[],n=i.getMatchingVisibleMetas("line");for(let s=0;s<n.length;s++){let r=n[s];if(r.index===t)break;r.hidden||e.unshift(r.dataset)}return e}function Act(i,t,e){let n=[];for(let s=0;s<e.length;s++){let r=e[s],{first:o,last:a,point:l}=Ect(r,t,"x");if(!(!l||o&&a)){if(o)n.unshift(l);else if(i.push(l),!a)break}}i.push(...n)}function Ect(i,t,e){let n=i.interpolate(t,e);if(!n)return{};let s=n[e],r=i.segments,o=i.points,a=!1,l=!1;for(let c=0;c<r.length;c++){let u=r[c],h=o[u.start][e],d=o[u.end][e];if(Bc(s,h,d)){a=s===h,l=s===d;break}}return{first:a,last:l,point:n}}var $C=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,n){let{x:s,y:r,radius:o}=this;return e=e||{start:0,end:as},t.arc(s,r,o,e.end,e.start,!0),!n.bounds}interpolate(t){let{x:e,y:n,radius:s}=this,r=t.angle;return{x:e+Math.cos(r)*s,y:n+Math.sin(r)*s,angle:r}}};function kct(i){let{chart:t,fill:e,line:n}=i;if(Is(e))return Pct(t,e);if(e==="stack")return Mct(i);if(e==="shape")return!0;let s=Rct(i);return s instanceof $C?s:I8(s,n)}function Pct(i,t){let e=i.getDatasetMeta(t);return e&&i.isDatasetVisible(t)?e.dataset:null}function Rct(i){return(i.scale||{}).getPointPositionForValue?Lct(i):Dct(i)}function Dct(i){let{scale:t={},fill:e}=i,n=_ct(e,t);if(Is(n)){let s=t.isHorizontal();return{x:s?n:null,y:s?null:n}}return null}function Lct(i){let{scale:t,fill:e}=i,n=t.options,s=t.getLabels().length,r=n.reverse?t.max:t.min,o=Sct(e,t,r),a=[];if(n.grid.circular){let l=t.getPointPositionForValue(0,r);return new $C({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(o)})}for(let l=0;l<s;++l)a.push(t.getPointPositionForValue(l,o));return a}function DD(i,t,e){let n=kct(t),{chart:s,index:r,line:o,scale:a,axis:l}=t,c=o.options,u=c.fill,h=c.backgroundColor,{above:d=h,below:p=h}=u||{},g=s.getDatasetMeta(r),y=_D(s,g);n&&o.points.length&&(cy(i,e),Ict(i,{line:o,target:n,above:d,below:p,area:e,scale:a,axis:l,clip:y}),uy(i))}function Ict(i,t){let{line:e,target:n,above:s,below:r,area:o,scale:a,clip:l}=t,c=e._loop?"angle":t.axis;i.save();let u=r;r!==s&&(c==="x"?(Qj(i,n,o.top),LD(i,{line:e,target:n,color:s,scale:a,property:c,clip:l}
vendor: 4,537 bytes, line 4700
4700),i.restore(),i.save(),Qj(i,n,o.bottom)):c==="y"&&(t8(i,n,o.left),LD(i,{line:e,target:n,color:r,scale:a,property:c,clip:l}),i.restore(),i.save(),t8(i,n,o.right),u=s)),LD(i,{line:e,target:n,color:u,scale:a,property:c,clip:l}),i.restore()}function Qj(i,t,e){let{segments:n,points:s}=t,r=!0,o=!1;i.beginPath();for(let a of n){let{start:l,end:c}=a,u=s[l],h=s[YC(l,c,s)];r?(i.moveTo(u.x,u.y),r=!1):(i.lineTo(u.x,e),i.lineTo(u.x,u.y)),o=!!t.pathSegment(i,a,{move:o}),o?i.closePath():i.lineTo(h.x,e)}i.lineTo(t.first().x,e),i.closePath(),i.clip()}function t8(i,t,e){let{segments:n,points:s}=t,r=!0,o=!1;i.beginPath();for(let a of n){let{start:l,end:c}=a,u=s[l],h=s[YC(l,c,s)];r?(i.moveTo(u.x,u.y),r=!1):(i.lineTo(e,u.y),i.lineTo(u.x,u.y)),o=!!t.pathSegment(i,a,{move:o}),o?i.closePath():i.lineTo(e,h.y)}i.lineTo(e,t.first().y),i.closePath(),i.clip()}function LD(i,t){let{line:e,target:n,property:s,color:r,scale:o,clip:a}=t,l=bct(e,n,s);for(let{source:c,target:u,start:h,end:d}of l){let{style:{backgroundColor:p=r}={}}=c,g=n!==!0;i.save(),i.fillStyle=p,Oct(i,o,a,g&&eL(s,h,d)),i.beginPath();let y=!!e.pathSegment(i,c),x;if(g){y?i.closePath():e8(i,n,d,s);let w=!!n.pathSegment(i,u,{move:y,reverse:!0});x=y&&w,x||e8(i,n,h,s)}i.closePath(),i.fill(x?"evenodd":"nonzero"),i.restore()}}function Oct(i,t,e,n){let s=t.chart.chartArea,{property:r,start:o,end:a}=n||{};if(r==="x"||r==="y"){let l,c,u,h;r==="x"?(l=o,c=s.top,u=a,h=s.bottom):(l=s.left,c=o,u=s.right,h=a),i.beginPath(),e&&(l=Math.max(l,e.left),u=Math.min(u,e.right),c=Math.max(c,e.top),h=Math.min(h,e.bottom)),i.rect(l,c,u-l,h-c),i.clip()}}function e8(i,t,e,n){let s=t.interpolate(e,n);s&&i.lineTo(s.x,s.y)}var Nct={id:"filler",afterDatasetsUpdate(i,t,e){let n=(i.data.datasets||[]).length,s=[],r,o,a,l;for(o=0;o<n;++o)r=i.getDatasetMeta(o),a=r.dataset,l=null,a&&a.options&&a instanceof Rm&&(l={visible:i.isDatasetVisible(o),index:o,fill:xct(a,o,n),chart:i,axis:r.controller.options.indexAxis,scale:r.vScale,line:a}),r.$filler=l,s.push(l);for(o=0;o<n;++o)l=s[o],!(!l||l.fill===!1)&&(l.fill=yct(s,o,e.propagate))},beforeDraw(i,t,e){let n=e.drawTime==="beforeDraw",s=i.getSortedVisibleDatasetMetas(),r=i.chartArea;for(let o=s.length-1;o>=0;--o){let a=s[o].$filler;a&&(a.line.updateControlPoints(r,a.axis),n&&a.fill&&DD(i.ctx,a,r))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let n=i.getSortedVisibleDatasetMetas();for(let s=n.length-1;s>=0;--s){let r=n[s].$filler;Zj(r)&&DD(i.ctx,r,i.chartArea)}},beforeDatasetDraw(i,t,e){let n=t.meta.$filler;!Zj(n)||e.drawTime!=="beforeDatasetDraw"||DD(i.ctx,n,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},n8=(i,t)=>{let{boxHeight:e=t,boxWidth:n=t}=i;return i.usePointStyle&&(e=Math.min(e,t),n=i.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:e,itemHeight:Math.max(t,e)}},Bct=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index,GC=class extends Wl{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,n){this.maxWidth=t,this.maxHeight=e,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=es(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(n=>t.filter(n,this.chart.data))),t.sort&&(e=e.sort((n,s)=>t.sort(n,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let n=t.labels,s=ur(n.font),r=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=n8(n,r),c,u;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(o,r,a,l)+10):(u=this.maxHeight,c=this._fitCols(o,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,e,n,s){let{ctx:r,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+a,h=t;r.textAlign="left",r.textBaseline="middle";let d=-1,p=-u;
vendor: 5,977 bytes, line 4700
4700return this.legendItems.forEach((g,y)=>{let x=n+e/2+r.measureText(g.text).width;(y===0||c[c.length-1]+x+2*a>o)&&(h+=u,c[c.length-(y>0?0:1)]=0,p+=u,d++),l[y]={left:0,top:p,row:d,width:x,height:s},c[c.length-1]+=x+a}),h}_fitCols(t,e,n,s){let{ctx:r,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=o-t,h=a,d=0,p=0,g=0,y=0;return this.legendItems.forEach((x,w)=>{let{itemWidth:M,itemHeight:A}=Fct(n,e,r,x,s);w>0&&p+A+2*a>u&&(h+=d+a,c.push({width:d,height:p}),g+=d+a,y++,d=p=0),l[w]={left:g,top:p,col:y,width:M,height:A},d=Math.max(d,M),p+=A+a}),h+=d,c.push({width:d,height:p}),h}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:n,labels:{padding:s},rtl:r}}=this,o=Vf(r,this.left,this.width);if(this.isHorizontal()){let a=0,l=Xr(n,this.left+s,this.right-this.lineWidths[a]);for(let c of e)a!==c.row&&(a=c.row,l=Xr(n,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+s}else{let a=0,l=Xr(n,this.top+t+s,this.bottom-this.columnSizes[a].height);for(let c of e)c.col!==a&&(a=c.col,l=Xr(n,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;cy(t,this),this._draw(),uy(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:n,ctx:s}=this,{align:r,labels:o}=t,a=gs.color,l=Vf(t.rtl,this.left,this.width),c=ur(o.font),{padding:u}=o,h=c.size,d=h/2,p;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;let{boxWidth:g,boxHeight:y,itemHeight:x}=n8(o,h),w=function(k,O,I){if(isNaN(g)||g<=0||isNaN(y)||y<0)return;s.save();let U=Gn(I.lineWidth,1);if(s.fillStyle=Gn(I.fillStyle,a),s.lineCap=Gn(I.lineCap,"butt"),s.lineDashOffset=Gn(I.lineDashOffset,0),s.lineJoin=Gn(I.lineJoin,"miter"),s.lineWidth=U,s.strokeStyle=Gn(I.strokeStyle,a),s.setLineDash(Gn(I.lineDash,[])),o.usePointStyle){let V={radius:y*Math.SQRT2/2,pointStyle:I.pointStyle,rotation:I.rotation,borderWidth:U},q=l.xPlus(k,g/2),X=O+d;uD(s,V,q,X,o.pointStyleWidth&&g)}else{let V=O+Math.max((h-y)/2,0),q=l.leftForLtr(k,g),X=td(I.borderRadius);s.beginPath(),Object.values(X).some(j=>j!==0)?Tm(s,{x:q,y:V,w:g,h:y,radius:X}):s.rect(q,V,g,y),s.fill(),U!==0&&s.stroke()}s.restore()},M=function(k,O,I){Qh(s,I.text,k,O+x/2,c,{strikethrough:I.hidden,textAlign:l.textAlign(I.textAlign)})},A=this.isHorizontal(),C=this._computeTitleHeight();A?p={x:Xr(r,this.left+u,this.right-n[0]),y:this.top+u+C,line:0}:p={x:this.left+u,y:Xr(r,this.top+C+u,this.bottom-e[0].height),line:0},vD(this.ctx,t.textDirection);let R=x+u;this.legendItems.forEach((k,O)=>{s.strokeStyle=k.fontColor,s.fillStyle=k.fontColor;let I=s.measureText(k.text).width,U=l.textAlign(k.textAlign||(k.textAlign=o.textAlign)),V=g+d+I,q=p.x,X=p.y;l.setWidth(this.width),A?O>0&&q+V+u>this.right&&(X=p.y+=R,p.line++,q=p.x=Xr(r,this.left+u,this.right-n[p.line])):O>0&&X+R>this.bottom&&(q=p.x=q+e[p.line].width+u,p.line++,X=p.y=Xr(r,this.top+C+u,this.bottom-e[p.line].height));let j=l.x(q);if(w(j,X,k),q=nj(U,q+g+d,A?q+V:this.right,t.rtl),M(l.x(q),X,k),A)p.x+=V+u;else if(typeof k.text!="string"){let W=c.lineHeight;p.y+=O8(k,W)+u}else p.y+=R}),yD(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,n=ur(e.font),s=Kr(e.padding);if(!e.display)return;let r=Vf(t.rtl,this.left,this.width),o=this.ctx,a=e.position,l=n.size/2,c=s.top+l,u,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),u=this.top+c,h=Xr(t.align,h,this.right-d);else{let g=this.columnSizes.reduce((y,x)=>Math.max(y,x.height),0);u=c+Xr(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}let p=Xr(a,h,h+d);o.textAlign=r.textAlign(CC(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=n.string,Qh(o,e.text,p,u,n)}_computeTitleHeight(){let t=this.options.title,e=ur(t.font),n=Kr(t.padding);return t.display?e.lineHeight+n.height:0}_getLegendItemAt(t,e){let n,s,r;if(Bc(t,this.left,this.right)&&Bc(e,this.top,this.bottom)){for(r=this.legendHitBoxes,n=0;n<r.length;++n)if(s=r[n],Bc(t,s.left,s.left+s.width)&&Bc(e,s.top,s.top+s.height))return this.legendItems[n]}return null}handleEvent(t){let e=this.options;if(!Vct(t.type,e))return;let n=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let s=this._hoveredItem,r=Bct(s,n);s&&!r&&es(e.onLeave,[t,s,this],this),this._hoveredItem=n,n&&!r&&es(e.onHover,[t,n,this],this)}else n&&es(e.onClick,[t,n,this],this)}};function Fct(i,t,e,n,s){let r=Uct(n,i,t,e),o=zct(s,n,t.lineHeight);return{itemWidth:r,itemHeight:o}}function Uct(i,t,e,n){let s=i.text;return s&&typeof s!="string"&&(s=s.reduce((r,o)=>r.length>o.length?r:o)),t+e.size/2+n.measureText(s).width}function zct(i,t,e){let n=i;return typeof t.text!="string"&&(n=O8(t,e)),n}function O8(i,t){let e=i.text?i.text.length:0;return t*e}function Vct(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var Hct={id:"legend",_element:GC,start(i,t,e){let n=i.legend=new GC({ctx:i.ctx,options:e,chart:i});ho.configure(i,n,e),ho.addBox(i,n)},stop(i){ho.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){let n=i.legend;ho.configure(i,n,e),n.options=e},afterUpdate(i){let t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){let n=t.datasetIndex,s=e.chart;s.isDatasetVisible(n)?(s.hide(n),t.hidden=!0):(s.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){let t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:n,textAlign:s,color:r,useBorderRadius:o,borderRadius:a}}=i.legend.options;
vendor: 4,669 bytes, lines 4700-4702
4700return i._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(e?0:void 0),u=Kr(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:r,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}},xy=class extends Wl{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){let n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let s=os(n.text)?n.text.length:1;this._padding=Kr(n.padding);let r=s*ur(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:n,bottom:s,right:r,options:o}=this,a=o.align,l=0,c,u,h;return this.isHorizontal()?(u=Xr(a,n,r),h=e+t,c=r-n):(o.position==="left"?(u=n+t,h=Xr(a,s,e),l=Ri*-.5):(u=r-t,h=Xr(a,e,s),l=Ri*.5),c=s-e),{titleX:u,titleY:h,maxWidth:c,rotation:l}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let n=ur(e.font),r=n.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(r);Qh(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:c,textAlign:CC(e.align),textBaseline:"middle",translation:[o,a]})}};function jct(i,t){let e=new xy({ctx:i.ctx,options:t,chart:i});ho.configure(i,e,t),ho.addBox(i,e),i.titleBlock=e}var Wct={id:"title",_element:xy,start(i,t,e){jct(i,e)},stop(i){let t=i.titleBlock;ho.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){let n=i.titleBlock;ho.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},OC=new WeakMap,$ct={id:"subtitle",start(i,t,e){let n=new xy({ctx:i.ctx,options:e,chart:i});ho.configure(i,n,e),ho.addBox(i,n),OC.set(i,n)},stop(i){ho.removeBox(i,OC.get(i)),OC.delete(i)},beforeUpdate(i,t,e){let n=OC.get(i);ho.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},by={average(i){if(!i.length)return!1;let t,e,n=new Set,s=0,r=0;for(t=0,e=i.length;t<e;++t){let a=i[t].element;if(a&&a.hasValue()){let l=a.tooltipPosition();n.add(l.x),s+=l.y,++r}}return r===0||n.size===0?!1:{x:[...n].reduce((a,l)=>a+l)/n.size,y:s/r}},nearest(i,t){if(!i.length)return!1;let e=t.x,n=t.y,s=Number.POSITIVE_INFINITY,r,o,a;for(r=0,o=i.length;r<o;++r){let l=i[r].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),u=yC(t,c);u<s&&(s=u,a=l)}}if(a){let l=a.tooltipPosition();e=l.x,n=l.y}return{x:e,y:n}}};function Fc(i,t){return t&&(os(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function Ru(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
4701`)>-1?i.split(`
4702`):i}function Gct(i,t){let{element:e,datasetIndex:n,index:s}=t,r=i.getDatasetMeta(n).controller,{label:o,value:a}=r.getLabelAndValue(s);return{chart:i,label:o,parsed:r.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:a,dataset:r.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function i8(i,t){let e=i.chart.ctx,{body:n,footer:s,title:r}=i,{boxWidth:o,boxHeight:a}=t,l=ur(t.bodyFont),c=ur(t.titleFont),u=ur(t.footerFont),h=r.length,d=s.length,p=n.length,g=Kr(t.padding),y=g.height,x=0,w=n.reduce((C,R)=>C+R.before.length+R.lines.length+R.after.length,0);if(w+=i.beforeBody.length+i.afterBody.length,h&&(y+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),w){let C=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=p*C+(w-p)*l.lineHeight+(w-1)*t.bodySpacing}d&&(y+=t.footerMarginTop+d*u.lineHeight+(d-1)*t.footerSpacing);let M=0,A=function(C){x=Math.max(x,e.measureText(C).width+M)};return e.save(),e.font=c.string,ji(i.title,A),e.font=l.string,ji(i.beforeBody.concat(i.afterBody),A),M=t.displayColors?o+2+t.boxPadding:0,ji(n,C=>{ji(C.before,A),ji(C.lines,A),ji(C.after,A)}
vendor: 9,392 bytes, line 4702
4702),M=0,e.font=u.string,ji(i.footer,A),e.restore(),x+=g.width,{width:x,height:y}}function qct(i,t){let{y:e,height:n}=t;return e<n/2?"top":e>i.height-n/2?"bottom":"center"}function Yct(i,t,e,n){let{x:s,width:r}=n,o=e.caretSize+e.caretPadding;if(i==="left"&&s+r+o>t.width||i==="right"&&s-r-o<0)return!0}function Xct(i,t,e,n){let{x:s,width:r}=e,{width:o,chartArea:{left:a,right:l}}=i,c="center";return n==="center"?c=s<=(a+l)/2?"left":"right":s<=r/2?c="left":s>=o-r/2&&(c="right"),Yct(c,i,t,e)&&(c="center"),c}function s8(i,t,e){let n=e.yAlign||t.yAlign||qct(i,e);return{xAlign:e.xAlign||t.xAlign||Xct(i,t,e,n),yAlign:n}}function Kct(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function Jct(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function r8(i,t,e,n){let{caretSize:s,caretPadding:r,cornerRadius:o}=i,{xAlign:a,yAlign:l}=e,c=s+r,{topLeft:u,topRight:h,bottomLeft:d,bottomRight:p}=td(o),g=Kct(t,a),y=Jct(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(u,d)+s:a==="right"&&(g+=Math.max(h,p)+s),{x:_r(g,0,n.width-t.width),y:_r(y,0,n.height-t.height)}}function NC(i,t,e){let n=Kr(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function o8(i){return Fc([],Ru(i))}function Zct(i,t,e){return ku(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function a8(i,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}var N8={beforeTitle:Nc,title(i){if(i.length>0){let t=i[0],e=t.chart.data.labels,n=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex<n)return e[t.dataIndex]}return""},afterTitle:Nc,beforeBody:Nc,beforeLabel:Nc,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");let e=i.formattedValue;return di(e)||(t+=e),t},labelColor(i){let e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){let e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Nc,afterBody:Nc,beforeFooter:Nc,footer:Nc,afterFooter:Nc};function ua(i,t,e,n){let s=i[t].call(e,n);return typeof s>"u"?N8[t].call(e,n):s}var qC=class extends Wl{static positioners=by;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,r=new zC(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=Zct(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:n}=e,s=ua(n,"beforeTitle",this,t),r=ua(n,"title",this,t),o=ua(n,"afterTitle",this,t),a=[];return a=Fc(a,Ru(s)),a=Fc(a,Ru(r)),a=Fc(a,Ru(o)),a}getBeforeBody(t,e){return o8(ua(e.callbacks,"beforeBody",this,t))}getBody(t,e){let{callbacks:n}=e,s=[];return ji(t,r=>{let o={before:[],lines:[],after:[]},a=a8(n,r);Fc(o.before,Ru(ua(a,"beforeLabel",this,r))),Fc(o.lines,ua(a,"label",this,r)),Fc(o.after,Ru(ua(a,"afterLabel",this,r))),s.push(o)}),s}getAfterBody(t,e){return o8(ua(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:n}=e,s=ua(n,"beforeFooter",this,t),r=ua(n,"footer",this,t),o=ua(n,"afterFooter",this,t),a=[];return a=Fc(a,Ru(s)),a=Fc(a,Ru(r)),a=Fc(a,Ru(o)),a}_createItems(t){let e=this._active,n=this.chart.data,s=[],r=[],o=[],a=[],l,c;for(l=0,c=e.length;l<c;++l)a.push(Gct(this.chart,e[l]));return t.filter&&(a=a.filter((u,h,d)=>t.filter(u,h,d,n))),t.itemSort&&(a=a.sort((u,h)=>t.itemSort(u,h,n))),ji(a,u=>{let h=a8(t.callbacks,u);s.push(ua(h,"labelColor",this,u)),r.push(ua(h,"labelPointStyle",this,u)),o.push(ua(h,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(t,e){let n=this.options.setContext(this.getContext()),s=this._active,r,o=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{let a=by[n.position].call(this,s,this._eventPosition);o=this._createItems(n),this.title=this.getTitle(o,n),this.beforeBody=this.getBeforeBody(o,n),this.body=this.getBody(o,n),this.afterBody=this.getAfterBody(o,n),this.footer=this.getFooter(o,n);let l=this._size=i8(this,n),c=Object.assign({},a,l),u=s8(this.chart,n,c),h=r8(n,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,r={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){let r=this.getCaretPosition(t,n,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,n){let{xAlign:s,yAlign:r}=this,{caretSize:o,cornerRadius:a}=n,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:h}=td(a),{x:d,y:p}=t,{width:g,height:y}=e,x,w,M,A,C,R;return r==="center"?(C=p+y/2,s==="left"?(x=d,w=x-o,A=C+o,R=C-o):(x=d+g,w=x+o,A=C-o,R=C+o),M=x):(s==="left"?w=d+Math.max(l,u)+o:s==="right"?w=d+g-Math.max(c,h)-o:w=this.caretX,r==="top"?(A=p,C=A-o,x=w-o,M=w+o):(A=p+y,C=A+o,x=w+o,M=w-o),R=A),{x1:x,x2:w,x3:M,y1:A,y2:C,y3:R}}drawTitle(t,e,n){let s=this.title,r=s.length,o,a,l;if(r){let c=Vf(n.rtl,this.x,this.width);for(t.x=NC(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",o=ur(n.titleFont),a=n.titleSpacing,e.fillStyle=n.titleColor,e.font=o.string,l=0;l<r;++l)e.fillText(s[l],c.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,l+1===r&&(t.y+=n.titleMarginBottom-a)}}_drawColorBox(t,e,n,s,r){let o=this.labelColors[n],a=this.labelPointStyles[n],{boxHeight:l,boxWidth:c}=r,u=ur(r.bodyFont),h=NC(this,"left",r),d=s.x(h),p=l<u.lineHeight?(u.lineHeight-l)/2:0,g=e.y+p;if(r.usePointStyle){let y={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},x=s.leftForLtr(d,c)+c/2,w=g+l/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,TC(t,y,x,w),t.strokeStyle=o.borderColor,t.fillStyle=o.backgroundColor,TC(t,y,x,w)}else{t.lineWidth=bi(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,t.strokeStyle=o.borderColor,t.setLineDash(o.borderDash||[]),t.lineDashOffset=o.borderDashOffset||0;let y=s.leftForLtr(d,c),x=s.leftForLtr(s.xPlus(d,1),c-2),w=td(o.borderRadius);Object.values(w).some(M=>M!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Tm(t,{x:y,y:g,w:c,h:l,radius:w}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),Tm(t,{x,y:g+1,w:c-2,h:l-2,radius:w}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(y,g,c,l),t.strokeRect(y,g,c,l),t.fillStyle=o.backgroundColor,t.fillRect(x,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){let{body:s}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=n,h=ur(n.bodyFont),d=h.lineHeight,p=0,g=Vf(n.rtl,this.x,this.width),y=function(I){e.fillText(I,g.x(t.x+p),t.y+d/2),t.y+=d+r},x=g.textAlign(o),w,M,A,C,R,k,O;for(e.textAlign=o,e.textBaseline="middle",e.font=h.string,t.x=NC(this,x,n),e.fillStyle=n.bodyColor,ji(this.beforeBody,y),p=a&&x!=="right"?o==="center"?c/2+u:c+2+u:0,C=0,k=s.length;C<k;++C){for(w=s[C],M=this.labelTextColors[C],e.fillStyle=M,ji(w.before,y),A=w.lines,a&&A.length&&(this._drawColorBox(e,t,C,g,n),d=Math.max(h.lineHeight,l)),R=0,O=A.length;R<O;++R)y(A[R]),d=h.lineHeight;ji(w.after,y)}p=0,d=h.lineHeight,ji(this.afterBody,y),t.y-=r}drawFooter(t,e,n){let s=this.footer,r=s.length,o,a;if(r){let l=Vf(n.rtl,this.x,this.width);for(t.x=NC(this,n.footerAlign,n),t.y+=n.footerMarginTop,e.textAlign=l.textAlign(n.footerAlign),e.textBaseline="middle",o=ur(n.footerFont),e.fillStyle=n.footerColor,e.font=o.string,a=0;a<r;++a)e.fillText(s[a],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+n.footerSpacing}}drawBackground(t,e,n,s){let{xAlign:r,yAlign:o}=this,{x:a,y:l}=t,{width:c,height:u}=n,{topLeft:h,topRight:d,bottomLeft:p,bottomRight:g}=td(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+h,l),o==="top"&&this.drawCaret(t,e,n,s),e.lineTo(a+c-d,l),e.quadraticCurveTo(a+c,l,a+c,l+d),o==="center"&&r==="right"&&this.drawCaret(t,e,n,s),e.lineTo(a+c,l+u-g),e.quadraticCurveTo(a+c,l+u,a+c-g,l+u),o==="bottom"&&this.drawCaret(t,e,n,s),e.lineTo(a+p,l+u),e.quadraticCurveTo(a,l+u,a,l+u-p),o==="center"&&r==="left"&&this.drawCaret(t,e,n,s),e.lineTo(a,l
vendor: 4,654 bytes, line 4702
4702+h),e.quadraticCurveTo(a,l,a+h,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,n=this.$animations,s=n&&n.x,r=n&&n.y;if(s||r){let o=by[t.position].call(this,this._active,this._eventPosition);if(!o)return;let a=this._size=i8(this,t),l=Object.assign({},o,this._size),c=s8(e,t,l),u=r8(t,l,c,e);(s._to!==u.x||r._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(e);let s={width:this.width,height:this.height},r={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let o=Kr(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(r,t,s,e),vD(t,e.textDirection),r.y+=o.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),yD(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let n=this._active,s=t.map(({datasetIndex:a,index:l})=>{let c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),r=!ay(n,s),o=this._positionChanged(s,e);(r||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,r=this._active||[],o=this._getActiveElements(t,r,e,n),a=this._positionChanged(o,t),l=e||!ay(o,r)||a;return l&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){let r=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);let o=this.chart.getElementsAtEventForMode(t,r.mode,r,n);return r.reverse&&o.reverse(),o}_positionChanged(t,e){let{caretX:n,caretY:s,options:r}=this,o=by[r.position].call(this,t,e);return o!==!1&&(n!==o.x||s!==o.y)}},Qct={id:"tooltip",_element:qC,positioners:by,afterInit(i,t,e){e&&(i.tooltip=new qC({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){let t=i.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){let e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:N8},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},tut=Object.freeze({__proto__:null,Colors:dct,Decimation:mct,Filler:Nct,Legend:Hct,SubTitle:$ct,Title:Wct,Tooltip:Qct}),eut=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function nut(i,t,e,n){let s=i.indexOf(t);if(s===-1)return eut(i,t,e,n);let r=i.lastIndexOf(t);return s!==r?e:s}var iut=(i,t)=>i===null?null:_r(Math.round(i),0,t);function l8(i){let t=this.getLabels();return i>=0&&i<t.length?t[i]:i}var nL=class extends Wf{static id="category";static defaults={ticks:{callback:l8}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let n=this.getLabels();for(let{index:s,label:r}of e)n[s]===r&&n.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(di(t))return null;let n=this.getLabels();
vendor: 8,048 bytes, line 4702
4702return e=isFinite(e)&&n[e]===t?e:nut(n,t,Gn(e,t),this._addedLabels),iut(e,n.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:n,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),e||(s=this.getLabels().length-1)),this.min=n,this.max=s}buildTicks(){let t=this.min,e=this.max,n=this.options.offset,s=[],r=this.getLabels();r=t===0&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let o=t;o<=e;o++)s.push({value:o});return s}getLabelForValue(t){return l8.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};function sut(i,t){let e=[],{bounds:s,step:r,min:o,max:a,precision:l,count:c,maxTicks:u,maxDigits:h,includeBounds:d}=i,p=r||1,g=u-1,{min:y,max:x}=t,w=!di(o),M=!di(a),A=!di(c),C=(x-y)/(h+1),R=JR((x-y)/g/p)*p,k,O,I,U;if(R<1e-14&&!w&&!M)return[{value:y},{value:x}];U=Math.ceil(x/R)-Math.floor(y/R),U>g&&(R=JR(U*R/g/p)*p),di(l)||(k=Math.pow(10,l),R=Math.ceil(R*k)/k),s==="ticks"?(O=Math.floor(y/R)*R,I=Math.ceil(x/R)*R):(O=y,I=x),w&&M&&r&&X6((a-o)/r,R/1e3)?(U=Math.round(Math.min((a-o)/R,u)),R=(a-o)/U,O=o,I=a):A?(O=w?o:O,I=M?a:I,U=c-1,R=(I-O)/U):(U=(I-O)/R,Sm(U,Math.round(U),R/1e3)?U=Math.round(U):U=Math.ceil(U));let V=Math.max(QR(R),QR(O));k=Math.pow(10,di(l)?V:l),O=Math.round(O*k)/k,I=Math.round(I*k)/k;let q=0;for(w&&(d&&O!==o?(e.push({value:o}),O<o&&q++,Sm(Math.round((O+q*R)*k)/k,o,c8(o,C,i))&&q++):O<o&&q++);q<U;++q){let X=Math.round((O+q*R)*k)/k;if(M&&X>a)break;e.push({value:X})}return M&&d&&I!==a?e.length&&Sm(e[e.length-1].value,a,c8(a,C,i))?e[e.length-1].value=a:e.push({value:a}):(!M||I===a)&&e.push({value:I}),e}function c8(i,t,{horizontal:e,minRotation:n}){let s=ol(n),r=(e?Math.sin(s):Math.cos(s))||.001,o=.75*t*(""+i).length;return Math.min(t/r,o)}var Dm=class extends Wf{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return di(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:n}=this.getUserBounds(),{min:s,max:r}=this,o=l=>s=e?s:l,a=l=>r=n?r:l;if(t){let l=jl(s),c=jl(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(s===r){let l=r===0?1:Math.abs(r*.05);a(r+l),t||o(s-l)}this.min=s,this.max=r}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,n=this.getTickLimit();n=Math.max(2,n);let s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,o=sut(s,r);return t.bounds==="ticks"&&ZR(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){let t=this.ticks,e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){let s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return Mm(t,this.chart.options.locale,this.options.ticks.format)}},iL=class extends Dm{static id="linear";static defaults={ticks:{callback:ly.formatters.numeric}};determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=Is(t)?t:0,this.max=Is(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,n=ol(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},wy=i=>Math.floor(Au(i)),jf=(i,t)=>Math.pow(10,wy(i)+t);function u8(i){return i/Math.pow(10,wy(i))===1}function h8(i,t,e){let n=Math.pow(10,e),s=Math.floor(i/n);return Math.ceil(t/n)-s}function rut(i,t){let e=t-i,n=wy(e);for(;h8(i,t,n)>10;)n++;for(;h8(i,t,n)<10;)n--;return Math.min(n,wy(i))}function out(i,{min:t,max:e}){t=ca(i.min,t);let n=[],s=wy(t),r=rut(t,e),o=r<0?Math.pow(10,Math.abs(r)):1,a=Math.pow(10,r),l=s>r?Math.pow(10,s):0,c=Math.round((t-l)*o)/o,u=Math.floor((t-l)/a/10)*a*10,h=Math.floor((c-u)/Math.pow(10,r)),d=ca(i.min,Math.round((l+u+h*Math.pow(10,r))*o)/o);for(;d<e;)n.push({value:d,major:u8(d),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(r++,h=2,o=r>=0?1:o),d=Math.round((l+u+h*Math.pow(10,r))*o)/o;let p=ca(i.max,d);return n.push({value:p,major:u8(p),significand:h}),n}var sL=class extends Wf{static id="logarithmic";static defaults={ticks:{callback:ly.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let n=Dm.prototype.parse.apply(this,[t,e]);if(n===0){this._zero=!0;return}return Is(n)&&n>0?n:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=Is(t)?Math.max(0,t):null,this.max=Is(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Is(this._userMin)&&(this.min=t===jf(this.min,0)?jf(this.min,-1):jf(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),n=this.min,s=this.max,r=a=>n=t?n:a,o=a=>s=e?s:a;n===s&&(n<=0?(r(1),o(10)):(r(jf(n,-1)),o(jf(s,1)))),n<=0&&r(jf(s,-1)),s<=0&&o(jf(n,1)),this.min=n,this.max=s}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},n=out(e,this);return t.bounds==="ticks"&&ZR(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":Mm(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=Au(t),this._valueRange=Au(this.max)-Au(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Au(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};function rL(i){let t=i.ticks;if(t.display&&i.display){let e=Kr(t.backdropPadding);return Gn(t.font&&t.font.size,gs.font.size)+e.height}return 0}function aut(i,t,e){return e=os(e)?e:[e],{w:sj(i,t.string,e),h:e.length*t.lineHeight}}function d8(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:i<n||i>s?{start:t-e,end:t}:{start:t,end:t+e}}function lut(i){let t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],r=i._pointLabels.length,o=i.options.pointLabels,a=o.centerPointLabels?Ri/r:0;for(let l=0;l<r;l++){let c=o.setContext(i.getPointLabelContext(l));s[l]=c.padding;let u=i.getPointPosition(l,i.drawingArea+s[l],a),h=ur(c.font),d=aut(i.ctx,h,i._pointLabels[l]);n[l]=d;let p=Yr(i.getIndexAngle(l)+a),g=Math.round(_C(p)),y=d8(g,u.x,d.w,0,180),x=d8(g,u.y,d.h,90,270);cut(e,t,p,y,x)}i.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),i._pointLabelItems=dut(i,n,s)}function cut(i,t,e,n,s){let r=Math.abs(Math.sin(e)),o=Math.abs(Math.cos(e)),a=0,l=0;n.start<t.l?(a=(t.l-n.start)/r,i.l=Math.min(i.l,t.l-a)):n.end>
vendor: 9,017 bytes, line 4702
4702t.r&&(a=(n.end-t.r)/r,i.r=Math.max(i.r,t.r+a)),s.start<t.t?(l=(t.t-s.start)/o,i.t=Math.min(i.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/o,i.b=Math.max(i.b,t.b+l))}function uut(i,t,e){let n=i.drawingArea,{extra:s,additionalAngle:r,padding:o,size:a}=e,l=i.getPointPosition(t,n+s+o,r),c=Math.round(_C(Yr(l.angle+Us))),u=gut(l.y,a.h,c),h=fut(c),d=put(l.x,a.w,h);return{visible:!0,x:l.x,y:u,textAlign:h,left:d,top:u,right:d+a.w,bottom:u+a.h}}function hut(i,t){if(!t)return!0;let{left:e,top:n,right:s,bottom:r}=i;return!(Oc({x:e,y:n},t)||Oc({x:e,y:r},t)||Oc({x:s,y:n},t)||Oc({x:s,y:r},t))}function dut(i,t,e){let n=[],s=i._pointLabels.length,r=i.options,{centerPointLabels:o,display:a}=r.pointLabels,l={extra:rL(r)/2,additionalAngle:o?Ri/s:0},c;for(let u=0;u<s;u++){l.padding=e[u],l.size=t[u];let h=uut(i,u,l);n.push(h),a==="auto"&&(h.visible=hut(h,c),h.visible&&(c=h))}return n}function fut(i){return i===0||i===180?"center":i<180?"left":"right"}function put(i,t,e){return e==="right"?i-=t:e==="center"&&(i-=t/2),i}function gut(i,t,e){return e===90||e===270?i-=t/2:(e>270||e<90)&&(i-=t),i}function mut(i,t,e){let{left:n,top:s,right:r,bottom:o}=e,{backdropColor:a}=t;if(!di(a)){let l=td(t.borderRadius),c=Kr(t.backdropPadding);i.fillStyle=a;let u=n-c.left,h=s-c.top,d=r-n+c.width,p=o-s+c.height;Object.values(l).some(g=>g!==0)?(i.beginPath(),Tm(i,{x:u,y:h,w:d,h:p,radius:l}),i.fill()):i.fillRect(u,h,d,p)}}function but(i,t){let{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){let r=i._pointLabelItems[s];if(!r.visible)continue;let o=n.setContext(i.getPointLabelContext(s));mut(e,o,r);let a=ur(o.font),{x:l,y:c,textAlign:u}=r;Qh(e,i._pointLabels[s],l,c+a.lineHeight/2,a,{color:o.color,textAlign:u,textBaseline:"middle"})}}function B8(i,t,e,n){let{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,as);else{let r=i.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let o=1;o<n;o++)r=i.getPointPosition(o,t),s.lineTo(r.x,r.y)}}function vut(i,t,e,n,s){let r=i.ctx,o=t.circular,{color:a,lineWidth:l}=t;!o&&!n||!a||!l||e<0||(r.save(),r.strokeStyle=a,r.lineWidth=l,r.setLineDash(s.dash||[]),r.lineDashOffset=s.dashOffset,r.beginPath(),B8(i,e,o,n),r.closePath(),r.stroke(),r.restore())}function yut(i,t,e){return ku(i,{label:e,index:t,type:"pointLabel"})}var oL=class extends Dm{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ly.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=Kr(rL(this.options)/2),e=this.width=this.maxWidth-t.width,n=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+n/2+t.top),this.drawingArea=Math.floor(Math.min(e,n)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=Is(t)&&!isNaN(t)?t:0,this.max=Is(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/rL(this.options))}generateTickLabels(t){Dm.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,n)=>{let s=es(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){let t=this.options;t.display&&t.pointLabels.display?lut(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){let e=as/(this._pointLabels.length||1),n=this.options.startAngle||0;return Yr(t*e+ol(n))}getDistanceFromCenterForValue(t){if(di(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(di(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t<e.length){let n=e[t];return yut(this.getContext(),t,n)}}getPointPosition(t,e,n=0){let s=this.getIndexAngle(t)-Us+n;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:e,top:n,right:s,bottom:r}=this._pointLabelItems[t];return{left:e,top:n,right:s,bottom:r}}drawBackground(){let{backgroundColor:t,grid:{circular:e}}=this.options;if(t){let n=this.ctx;n.save(),n.beginPath(),B8(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),n.closePath(),n.fillStyle=t,n.fill(),n.restore()}}drawGrid(){let t=this.ctx,e=this.options,{angleLines:n,grid:s,border:r}=e,o=this._pointLabels.length,a,l,c;if(e.pointLabels.display&&but(this,o),s.display&&this.ticks.forEach((u,h)=>{if(h!==0||h===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);let d=this.getContext(h),p=s.setContext(d),g=r.setContext(d);vut(this,p,l,o,g)}}),n.display){for(t.save(),a=o-1;a>=0;a--){let u=n.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:d}=u;!d||!h||(t.lineWidth=d,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;let s=this.getIndexAngle(0),r,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;let c=n.setContext(this.getContext(l)),u=ur(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;let h=Kr(c.backdropPadding);t.fillRect(-o/2-h.left,-r-u.size/2-h.top,o+h.width,u.size+h.height)}Qh(t,a.label,0,-r,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}},XC={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ha=Object.keys(XC);function f8(i,t){return i-t}function p8(i,t){if(di(t))return null;let e=i._adapter,{parser:n,round:s,isoWeekday:r}=i._parseOpts,o=t;return typeof n=="function"&&(o=n(o)),Is(o)||(o=typeof n=="string"?e.parse(o,n):e.parse(o)),o===null?null:(s&&(o=s==="week"&&(zf(r)||r===!0)?e.startOf(o,"isoWeek",r):e.startOf(o,s)),+o)}function g8(i,t,e,n){let s=ha.length;for(let r=ha.indexOf(i);r<s-1;++r){let o=XC[ha[r]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((e-t)/(a*o.size))<=n)return ha[r]}return ha[s-1]}function xut(i,t,e,n,s){for(let r=ha.length-1;r>=ha.indexOf(e);r--){let o=ha[r];if(XC[o].common&&i._adapter.diff(s,n,o)>=t-1)return o}return ha[e?ha.indexOf(e):0]}function wut(i){for(let t=ha.indexOf(i)+1,e=ha.length;t<e;++t)if(XC[ha[t]].common)return ha[t]}function m8(i,t,e){if(!e)i[t]=!0;else if(e.length){let{lo:n,hi:s}=SC(e,t),r=e[n]>=t?e[n]:e[s];i[r]=!0}}function _ut(i,t,e,n){let s=i._adapter,r=+s.startOf(t[0].value,n),o=t[t.length-1].value,a,l;for(a=r;a<=o;a=+s.add(a,1,n))l=e[a],l>=0&&(t[l].major=!0);return t}function b8(i,t,e){let n=[],s={},r=t.length,o,a;for(o=0;o<r;++o)a=t[o],s[a]=o,n.push({value:a,major:!1});return r===0||!e?n:_ut(i,n,s,e)}var _y=class extends Wf{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){let n=t.time||(t.time={}),s=this._adapter=new Oat._date(t.adapters.date);s.init(e),wm(n.displayFormats,s.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:p8(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,n=t.time.unit||"day",{min:s,max:r,minDefined:o,maxDefined:a}=this.getUserBounds();
vendor: 3,323 bytes, line 4702
4702function l(c){!o&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(r=Math.max(r,c.max))}(!o||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=Is(s)&&!isNaN(s)?s:+e.startOf(Date.now(),n),r=Is(r)&&!isNaN(r)?r:+e.endOf(Date.now(),n)+1,this.min=Math.min(s,r-1),this.max=Math.max(s+1,r)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],n=t[t.length-1]),{min:e,max:n}}buildTicks(){let t=this.options,e=t.time,n=t.ticks,s=n.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);let r=this.min,o=this.max,a=Z6(s,r,o);return this._unit=e.unit||(n.autoSkip?g8(e.minUnit,this.min,this.max,this._getLabelCapacity(r)):xut(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:wut(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),b8(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,n=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?n=r:n=(r-this.getDecimalForValue(t[t.length-2]))/2);let o=t.length<3?.5:.25;e=_r(e,0,o),n=_r(n,0,o),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){let t=this._adapter,e=this.min,n=this.max,s=this.options,r=s.time,o=r.unit||g8(r.minUnit,e,n,this._getLabelCapacity(e)),a=Gn(s.ticks.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=zf(l)||l===!0,u={},h=e,d,p;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":o),t.diff(n,e,o)>1e5*a)throw new Error(e+" and "+n+" are too far apart with stepSize of "+a+" "+o);let g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=h,p=0;d<n;d=+t.add(d,a,o),p++)m8(u,d,g);return(d===n||s.bounds==="ticks"||p===1)&&m8(u,d,g),Object.keys(u).sort(f8).map(y=>+y)}getLabelForValue(t){let e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}format(t,e){let s=this.options.time.displayFormats,r=this._unit,o=e||s[r];return this._adapter.format(t,o)}_tickFormatFunction(t,e,n,s){let r=this.options,o=r.ticks.callback;if(o)return es(o,[t,e,n],this);let a=r.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],h=c&&a[c],d=n[e],p=c&&h&&d&&d.major;return this._adapter.format(t,s||(p?h:u))}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e<n;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let e=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+n)*e.factor)}getValueForPixel(t){let e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,n=this.ctx.measureText(t).width,s=ol(this.isHorizontal()?e.maxRotation:e.minRotation),r=Math.cos(s),o=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:n*r+a*o,h:n*o+a*r}}_getLabelCapacity(t){let e=this.options.time,n=e.displayFormats,s=n[e.unit]||n.millisecond,r=this._tick
4702FormatFunction(t,0,b8(this,[t],this._majorUnit),s),o=this._getLabelSize(r),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e<n;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],e,n;if(t.length)return t;let s=this.getLabels();for(e=0,n=s.length;e<n;++e)t.push(p8(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return nD(t.sort(f8))}};function BC(i,t,e){let n=0,s=i.length-1,r,o,a,l;e?(t>=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=Ic(i,"pos",t)),{pos:r,time:a}=i[n],{pos:o,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=Ic(i,"time",t)),{time:r,pos:a}=i[n],{time:o,pos:l}=i[s]);let c=o-r;return c?a+(l-a)*(t-r)/c:a}var aL=class extends _y{static id="timeseries";static defaults=_y.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=BC(e,this.min),this._tableRange=BC(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:n}=this,s=[],r=[],o,a,l,c,u;for(o=0,a=t.length;o<a;++o)c=t[o],c>=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(o=0,a=s.length;o<a;++o)u=s[o+1],l=s[o-1],c=s[o],Math.round((u+l)/2)!==c&&r.push({time:c,pos:o/(a-1)});return r}_generate(){let t=this.min,e=this.max,n=super.getDataTimestamps();return(!n.includes(t)||!n.length)&&n.splice(0,0,t),(!n.includes(e)||n.length===1)&&n.push(e),n.sort((s,r)=>s-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),n=this.getLabelTimestamps();return e.length&&n.length?t=this.normalize(e.concat(n)):t=e.length?e:n,t=this._cache.all=t,t}getDecimalForValue(t){return(BC(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return BC(this._table,n*this._tableRange+this._minPos,!0)}},Sut=Object.freeze({__proto__:null,CategoryScale:nL,LinearScale:iL,LogarithmicScale:sL,RadialLinearScale:oL,TimeScale:_y,TimeSeriesScale:aL}),F8=[Iat,rct,tut,Sut];var lL=class{constructor(t,e,n){this.eventTarget=t,this.eventName=e,this.eventOptions=n,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(t){this.unorderedBindings.add(t)}bindingDisconnected(t){this.unorderedBindings.delete(t)}handleEvent(t){let e=Cut(t);for(let n of this.bindings){if(e.immediatePropagationStopped)break;n.handleEvent(e)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((t,e)=>{let n=t.index,s=e.index;return n<s?-1:n>s?1:0})}};function Cut(i){if("immediatePropagationStopped"in i)return i;{let{stopImmediatePropagation:t}=i;return Object.assign(i,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,t.call(this)}})}}var cL=class{constructor(t){this.application=t,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(t=>t.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(t=>t.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((t,e)=>t.concat(Array.from(e.values())),[])}bindingConnected(t){this.fetchEventListenerForBinding(t).bindingConnected(t)}bindingDisconnected(t,e=!1){this.fetchEventListenerForBinding(t).bindingDisconnected(t),e&&this.clearEventListenersForBinding(t)}handleError(t,e,n={}){this.application.handleError(t,`Error ${e}`,n)}clearEventListenersForBinding(t){let e=this.fetchEventListenerForBinding(t);e.hasBindings()||(e.disconnect(),this.removeMappedEventListenerFor(t))}removeMappedEventListenerFor(t){let{eventTarget:e,eventName:n,eventOptions:s}=t,r=this.fetchEventListenerMapForEventTarget(e),o=this.cacheKey(n,s);r.delete(o),r.size==0&&this.eventListenerMaps.delete(e)}fetchEventListenerForBinding(t){let{eventTarget:e,eventName:n,eventOptions:s}=t;return this.fetchEventListener(e,n,s)}fetchEventListener(t,e,n){let s=this.fetchEventListenerMapForEventTarget(t),r=this.cacheKey(e,n),o=s.get(r);return o||(o=this.createEventListener(t,e,n),s.set(r,o)),o}createEventListener(t,e,n){let s=new lL(t,e,n);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(t){let e=this.eventListenerMaps.get(t);return e||(e=new Map,this.eventListenerMaps.set(t,e)),e}cacheKey(t,e){let n=[t];
4702return Object.keys(e).sort().forEach(s=>{n.push(`${e[s]?"":"!"}${s}`)}),n.join(":")}},Mut={stop({event:i,value:t}){return t&&i.stopPropagation(),!0},prevent({event:i,value:t}){return t&&i.preventDefault(),!0},self({event:i,value:t,element:e}){return t?e===i.target:!0}},Tut=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function Aut(i){let e=i.trim().match(Tut)||[],n=e[2],s=e[3];return s&&!["keydown","keyup","keypress"].includes(n)&&(n+=`.${s}`,s=""),{eventTarget:Eut(e[4]),eventName:n,eventOptions:e[7]?kut(e[7]):{},identifier:e[5],methodName:e[6],keyFilter:e[1]||s}}function Eut(i){if(i=="window")return window;if(i=="document")return document}function kut(i){return i.split(":").reduce((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)}),{})}function Put(i){if(i==window)return"window";if(i==document)return"document"}function RL(i){return i.replace(/(?:[_-])([a-z0-9])/g,(t,e)=>e.toUpperCase())}function uL(i){return RL(i.replace(/--/g,"-").replace(/__/g,"_"))}function My(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Y8(i){return i.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`)}function Rut(i){return i.match(/[^\s]+/g)||[]}function U8(i){return i!=null}function hL(i,t){return Object.prototype.hasOwnProperty.call(i,t)}var z8=["meta","ctrl","alt","shift"],dL=class{constructor(t,e,n,s){this.element=t,this.index=e,this.eventTarget=n.eventTarget||t,this.eventName=n.eventName||Dut(t)||KC("missing event name"),this.eventOptions=n.eventOptions||{},this.identifier=n.identifier||KC("missing identifier"),this.methodName=n.methodName||KC("missing method name"),this.keyFilter=n.keyFilter||"",this.schema=s}static forToken(t,e){return new this(t.element,t.index,Aut(t.content),e)}toString(){let t=this.keyFilter?`.${this.keyFilter}`:"",e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${t}${e}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(t){if(!this.keyFilter)return!1;let e=this.keyFilter.split("+");if(this.keyFilterDissatisfied(t,e))return!0;let n=e.filter(s=>!z8.includes(s))[0];return n?(hL(this.keyMappings,n)||KC(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[n].toLowerCase()!==t.key.toLowerCase()):!1}shouldIgnoreMouseEvent(t){if(!this.keyFilter)return!1;let e=[this.keyFilter];return!!this.keyFilterDissatisfied(t,e)}get params(){let t={},e=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:n,value:s}of Array.from(this.element.attributes)){let r=n.match(e),o=r&&r[1];o&&(t[RL(o)]=Lut(s))}return t}get eventTargetName(){return Put(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}
4702keyFilterDissatisfied(t,e){let[n,s,r,o]=z8.map(a=>e.includes(a));return t.metaKey!==n||t.ctrlKey!==s||t.altKey!==r||t.shiftKey!==o}},V8={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:i=>i.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Dut(i){let t=i.tagName.toLowerCase();if(t in V8)return V8[t](i)}function KC(i){throw new Error(i)}function Lut(i){try{return JSON.parse(i)}catch{return i}}var fL=class{constructor(t,e){this.context=t,this.action=e}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(t){let e=this.prepareActionEvent(t);this.willBeInvokedByEvent(t)&&this.applyEventModifiers(e)&&this.invokeWithEvent(e)}get eventName(){return this.action.eventName}get method(){let t=this.controller[this.methodName];if(typeof t=="function")return t;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(t){let{element:e}=this.action,{actionDescriptorFilters:n}=this.context.application,{controller:s}=this.context,r=!0;for(let[o,a]of Object.entries(this.eventOptions))if(o in n){let l=n[o];r=r&&l({name:o,value:a,event:t,element:e,controller:s})}else continue;return r}prepareActionEvent(t){return Object.assign(t,{params:this.action.params})}invokeWithEvent(t){let{target:e,currentTarget:n}=t;try{this.method.call(this.controller,t),this.context.logDebugActivity(this.methodName,{event:t,target:e,currentTarget:n,action:this.methodName})}catch(s){let{identifier:r,controller:o,element:a,index:l}=this,c={identifier:r,controller:o,element:a,index:l,event:t};this.context.handleError(s,`invoking action "${this.action}"`,c)}}willBeInvokedByEvent(t){let e=t.target;return t instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(t)||t instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(t)?!1:this.element===e?!0:e instanceof Element&&this.element.contains(e)?this.scope.containsElement(e):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},JC=class{constructor(t,e){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=t,this.started=!1,this.delegate=e,this.elements=new Set,this.mutationObserver=new MutationObserver(n=>this.processMutations(n))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(t){this.started&&(this.mutationObserver.disconnect(),this.started=!1),t(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let t=new Set(this.matchElementsInTree());for(let e of Array.from(this.elements))t.has(e)||this.removeElement(e);for(let e of Array.from(t))this.addElement(e)}}processMutations(t){if(this.started)for(let e of t)this.processMutation(e)}processMutation(t){t.type=="attributes"?this.processAttributeChange(t.target,t.attributeName):t.type=="childList"&&(this.processRemovedNodes(t.removedNodes),this.processAddedNodes(t.addedNodes))}processAttributeChange(t,e){this.elements.has(t)?this.delegate.elementAttributeChanged&&this.matchElement(t)?this.delegate.elementAttributeChanged(t,e):this.removeElement(t):this.matchElement(t)&&this.addElement(t)}processRemovedNodes(t){for(let e of Array.from(t)){let n=this.elementFromNode(e);n&&this.processTree(n,this.removeElement)}}processAddedNodes(t){for(let e of Array.from(t)){let n=this.elementFromNode(e);n&&this.elementIsActive(n)&&this.processTree(n,this.addElement)}}matchElement(t){return this.delegate.matchElement(t)}matchElementsInTree(t=this.element){return this.delegate.matchElementsInTree(t)}processTree(t,e){for(let n of this.matchElementsInTree(t))e.call(this,n)}
4702elementFromNode(t){if(t.nodeType==Node.ELEMENT_NODE)return t}elementIsActive(t){return t.isConnected!=this.element.isConnected?!1:this.element.contains(t)}addElement(t){this.elements.has(t)||this.elementIsActive(t)&&(this.elements.add(t),this.delegate.elementMatched&&this.delegate.elementMatched(t))}removeElement(t){this.elements.has(t)&&(this.elements.delete(t),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(t))}},ZC=class{constructor(t,e,n){this.attributeName=e,this.delegate=n,this.elementObserver=new JC(t,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(t){return t.hasAttribute(this.attributeName)}matchElementsInTree(t){let e=this.matchElement(t)?[t]:[],n=Array.from(t.querySelectorAll(this.selector));return e.concat(n)}elementMatched(t){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(t,this.attributeName)}elementUnmatched(t){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(t,this.attributeName)}elementAttributeChanged(t,e){this.delegate.elementAttributeValueChanged&&this.attributeName==e&&this.delegate.elementAttributeValueChanged(t,e)}};function Iut(i,t,e){X8(i,t).add(e)}function Out(i,t,e){X8(i,t).delete(e),Nut(i,t)}function X8(i,t){let e=i.get(t);return e||(e=new Set,i.set(t,e)),e}function Nut(i,t){let e=i.get(t);e!=null&&e.size==0&&i.delete(t)}var Du=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((e,n)=>e.concat(Array.from(n)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((e,n)=>e+n.size,0)}add(t,e){Iut(this.valuesByKey,t,e)}delete(t,e){Out(this.valuesByKey,t,e)}has(t,e){let n=this.valuesByKey.get(t);return n!=null&&n.has(e)}hasKey(t){return this.valuesByKey.has(t)}hasValue(t){return Array.from(this.valuesByKey.values()).some(n=>n.has(t))}getValuesForKey(t){let e=this.valuesByKey.get(t);return e?Array.from(e):[]}getKeysForValue(t){return Array.from(this.valuesByKey).filter(([e,n])=>n.has(t)).map(([e,n])=>e)}};var pL=class{constructor(t,e,n,s){this._selector=e,this.details=s,this.elementObserver=new JC(t,this),this.delegate=n,this.matchesByElement=new Du}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(t){this._selector=t,this.refresh()}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(t){let{selector:e}=this;if(e){let n=t.matches(e);return this.delegate.selectorMatchElement?n&&this.delegate.selectorMatchElement(t,this.details):n}else return!1}matchElementsInTree(t){let{selector:e}=this;if(e){let n=this.matchElement(t)?[t]:[],s=Array.from(t.querySelectorAll(e)).filter(r=>this.matchElement(r));return n.concat(s)}else return[]}elementMatched(t){let{selector:e}=this;e&&this.selectorMatched(t,e)}elementUnmatched(t){let e=this.matchesByElement.getKeysForValue(t);for(let n of e)this.selectorUnmatched(t,n)}elementAttributeChanged(t,e){let{selector:n}=this;if(n){let s=this.matchElement(t),r=this.matchesByElement.has(n,t);s&&!r?this.selectorMatched(t,n):!s&&r&&this.selectorUnmatched(t,n)}}selectorMatched(t,e){this.delegate.selectorMatched(t,e,this.details),this.matchesByElement.add(e,t)}selectorUnmatched(t,e){this.delegate.selectorUnmatched(t,e,this.details),this.matchesByElement.delete(e,t)}},gL=class{constructor(t,e){this.element=t,this.delegate=e,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(n=>this.processMutations(n))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let t of this.knownAttributeNames)this.refreshAttribute(t,null)}processMutations(t){if(this.started)for(let e of t)this.processMutation(e)}processMutation(t){let e=t.attributeName;e&&this.refreshAttribute(e,t.oldValue)}refreshAttribute(t,e){let n=this.delegate.getStringMapKeyForAttribute(t);if(n!=null){this.stringMap.has(t)||this.stringMapKeyAdded(n,t);let s=this.element.getAttribute(t);if(this.stringMap.get(t)!=s&&this.stringMapValueChanged(s,n,e),s==null){let r=this.stringMap.get(t);this.stringMap.delete(t),r&&this.stringMapKeyRemoved(n,t,r)}else this.stringMap.set(t,s)}}stringMapKeyAdded(t,e){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(t,e)}stringMapValueChanged(t,e,n){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(t,e,n)}stringMapKeyRemoved(t,e,n){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(t,e,n)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(t=>t.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},QC=class{constructor(t,e,n){this.attributeObserver=new ZC(t,e,this),this.delegate=n,this.tokensByElement=new Du}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(t){this.attributeObserver.pause(t)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}
4702get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(t){this.tokensMatched(this.readTokensForElement(t))}elementAttributeValueChanged(t){let[e,n]=this.refreshTokensForElement(t);this.tokensUnmatched(e),this.tokensMatched(n)}elementUnmatchedAttribute(t){this.tokensUnmatched(this.tokensByElement.getValuesForKey(t))}tokensMatched(t){t.forEach(e=>this.tokenMatched(e))}tokensUnmatched(t){t.forEach(e=>this.tokenUnmatched(e))}tokenMatched(t){this.delegate.tokenMatched(t),this.tokensByElement.add(t.element,t)}tokenUnmatched(t){this.delegate.tokenUnmatched(t),this.tokensByElement.delete(t.element,t)}refreshTokensForElement(t){let e=this.tokensByElement.getValuesForKey(t),n=this.readTokensForElement(t),s=Fut(e,n).findIndex(([r,o])=>!Uut(r,o));return s==-1?[[],[]]:[e.slice(s),n.slice(s)]}readTokensForElement(t){let e=this.attributeName,n=t.getAttribute(e)||"";return But(n,t,e)}};function But(i,t,e){return i.trim().split(/\s+/).filter(n=>n.length).map((n,s)=>({element:t,attributeName:e,content:n,index:s}))}function Fut(i,t){let e=Math.max(i.length,t.length);return Array.from({length:e},(n,s)=>[i[s],t[s]])}function Uut(i,t){return i&&t&&i.index==t.index&&i.content==t.content}var tM=class{constructor(t,e,n){this.tokenListObserver=new QC(t,e,this),this.delegate=n,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(t){let{element:e}=t,{value:n}=this.fetchParseResultForToken(t);n&&(this.fetchValuesByTokenForElement(e).set(t,n),this.delegate.elementMatchedValue(e,n))}tokenUnmatched(t){let{element:e}=t,{value:n}=this.fetchParseResultForToken(t);n&&(this.fetchValuesByTokenForElement(e).delete(t),this.delegate.elementUnmatchedValue(e,n))}fetchParseResultForToken(t){let e=this.parseResultsByToken.get(t);return e||(e=this.parseToken(t),this.parseResultsByToken.set(t,e)),e}fetchValuesByTokenForElement(t){let e=this.valuesByTokenByElement.get(t);return e||(e=new Map,this.valuesByTokenByElement.set(t,e)),e}parseToken(t){try{return{value:this.delegate.parseValueForToken(t)}}catch(e){return{error:e}}}},mL=class{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new tM(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(t){let e=new fL(this.context,t);this.bindingsByAction.set(t,e),this.delegate.bindingConnected(e)}disconnectAction(t){let e=this.bindingsByAction.get(t);e&&(this.bindingsByAction.delete(t),this.delegate.bindingDisconnected(e))}
4702disconnectAllActions(){this.bindings.forEach(t=>this.delegate.bindingDisconnected(t,!0)),this.bindingsByAction.clear()}parseValueForToken(t){let e=dL.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}},bL=class{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new gL(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(t){if(t in this.valueDescriptorMap)return this.valueDescriptorMap[t].name}stringMapKeyAdded(t,e){let n=this.valueDescriptorMap[e];this.hasValue(t)||this.invokeChangedCallback(t,n.writer(this.receiver[t]),n.writer(n.defaultValue))}stringMapValueChanged(t,e,n){let s=this.valueDescriptorNameMap[e];t!==null&&(n===null&&(n=s.writer(s.defaultValue)),this.invokeChangedCallback(e,t,n))}stringMapKeyRemoved(t,e,n){let s=this.valueDescriptorNameMap[t];this.hasValue(t)?this.invokeChangedCallback(t,s.writer(this.receiver[t]),n):this.invokeChangedCallback(t,s.writer(s.defaultValue),n)}invokeChangedCallbacksForDefaultValues(){for(let{key:t,name:e,defaultValue:n,writer:s}of this.valueDescriptors)n!=null&&!this.controller.data.has(t)&&this.invokeChangedCallback(e,s(n),void 0)}invokeChangedCallback(t,e,n){let s=`${t}Changed`,r=this.receiver[s];if(typeof r=="function"){let o=this.valueDescriptorNameMap[t];try{let a=o.reader(e),l=n;n&&(l=o.reader(n)),r.call(this.receiver,a,l)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){let{valueDescriptorMap:t}=this;return Object.keys(t).map(e=>t[e])}get valueDescriptorNameMap(){let t={};return Object.keys(this.valueDescriptorMap).forEach(e=>{let n=this.valueDescriptorMap[e];t[n.name]=n}),t}hasValue(t){let e=this.valueDescriptorNameMap[t],n=`has${My(e.name)}`;return this.receiver[n]}},vL=class{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new Du}start(){this.tokenListObserver||(this.tokenListObserver=new QC(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:t,content:e}){this.scope.containsElement(t)&&this.connectTarget(t,e)}tokenUnmatched({element:t,content:e}){this.disconnectTarget(t,e)}connectTarget(t,e){var n;this.targetsByName.has(e,t)||(this.targetsByName.add(e,t),(n=this.tokenListObserver)===null||n===void 0||n.pause(()=>this.delegate.targetConnected(t,e)))}disconnectTarget(t,e){var n;this.targetsByName.has(e,t)&&(this.targetsByName.delete(e,t),(n=this.tokenListObserver)===null||n===void 0||n.pause(()=>this.delegate.targetDisconnected(t,e)))}disconnectAllTargets(){for(let t of this.targetsByName.keys)for(let e of this.targetsByName.getValuesForKey(t))this.disconnectTarget(e,t)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function Ty(i,t){let e=K8(i);return Array.from(e.reduce((n,s)=>(Vut(s,t).forEach(r=>n.add(r)),n),new Set))}function zut(i,t){return K8(i).reduce((n,s)=>(n.push(...Hut(s,t)),n),[])}function K8(i){let t=[];for(;i;)t.push(i),i=Object.getPrototypeOf(i);return t.reverse()}function Vut(i,t){let e=i[t];return Array.isArray(e)?e:[]}function Hut(i,t){let e=i[t];return e?Object.keys(e).map(n=>[n,e[n]]):[]}var yL=class{constructor(t,e){this.started=!1,this.context=t,this.delegate=e,this.outletsByName=new Du,this.outletElementsByName=new Du,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(t=>{this.setupSelectorObserverForOutlet(t),this.setupAttributeObserverForOutlet(t)}
4702),this.started=!0,this.dependentContexts.forEach(t=>t.refresh()))}refresh(){this.selectorObserverMap.forEach(t=>t.refresh()),this.attributeObserverMap.forEach(t=>t.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(t=>t.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(t=>t.stop()),this.attributeObserverMap.clear())}selectorMatched(t,e,{outletName:n}){let s=this.getOutlet(t,n);s&&this.connectOutlet(s,t,n)}selectorUnmatched(t,e,{outletName:n}){let s=this.getOutletFromMap(t,n);s&&this.disconnectOutlet(s,t,n)}selectorMatchElement(t,{outletName:e}){let n=this.selector(e),s=this.hasOutlet(t,e),r=t.matches(`[${this.schema.controllerAttribute}~=${e}]`);return n?s&&r&&t.matches(n):!1}elementMatchedAttribute(t,e){let n=this.getOutletNameFromOutletAttributeName(e);n&&this.updateSelectorObserverForOutlet(n)}elementAttributeValueChanged(t,e){let n=this.getOutletNameFromOutletAttributeName(e);n&&this.updateSelectorObserverForOutlet(n)}elementUnmatchedAttribute(t,e){let n=this.getOutletNameFromOutletAttributeName(e);n&&this.updateSelectorObserverForOutlet(n)}connectOutlet(t,e,n){var s;this.outletElementsByName.has(n,e)||(this.outletsByName.add(n,t),this.outletElementsByName.add(n,e),(s=this.selectorObserverMap.get(n))===null||s===void 0||s.pause(()=>this.delegate.outletConnected(t,e,n)))}disconnectOutlet(t,e,n){var s;this.outletElementsByName.has(n,e)&&(this.outletsByName.delete(n,t),this.outletElementsByName.delete(n,e),(s=this.selectorObserverMap.get(n))===null||s===void 0||s.pause(()=>this.delegate.outletDisconnected(t,e,n)))}disconnectAllOutlets(){for(let t of this.outletElementsByName.keys)for(let e of this.outletElementsByName.getValuesForKey(t))for(let n of this.outletsByName.getValuesForKey(t))this.disconnectOutlet(n,e,t)}updateSelectorObserverForOutlet(t){let e=this.selectorObserverMap.get(t);e&&(e.selector=this.selector(t))}setupSelectorObserverForOutlet(t){let e=this.selector(t),n=new pL(document.body,e,this,{outletName:t});this.selectorObserverMap.set(t,n),n.start()}setupAttributeObserverForOutlet(t){let e=this.attributeNameForOutletName(t),n=new ZC(this.scope.element,e,this);this.attributeObserverMap.set(t,n),n.start()}selector(t){return this.scope.outlets.getSelectorForOutletName(t)}attributeNameForOutletName(t){return this.scope.schema.outletAttributeForScope(this.identifier,t)}getOutletNameFromOutletAttributeName(t){return this.outletDefinitions.find(e=>this.attributeNameForOutletName(e)===t)}get outletDependencies(){let t=new Du;return this.router.modules.forEach(e=>{let n=e.definition.controllerConstructor;Ty(n,"outlets").forEach(r=>t.add(r,e.identifier))}),t}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let t=this.dependentControllerIdentifiers;return this.router.contexts.filter(e=>t.includes(e.identifier))}hasOutlet(t,e){return!!this.getOutlet(t,e)||!!this.getOutletFromMap(t,e)}getOutlet(t,e){return this.application.getControllerForElementAndIdentifier(t,e)}getOutletFromMap(t,e){return this.outletsByName.getValuesForKey(e).find(n=>n.element===t)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},xL=class{constructor(t,e){this.logDebugActivity=(n,s={})=>{let{identifier:r,controller:o,element:a}=this;s=Object.assign({identifier:r,controller:o,element:a},s),this.application.logDebugActivity(this.identifier,n,s)},this.module=t,this.scope=e,this.controller=new t.controllerConstructor(this),this.bindingObserver=new mL(this,this.dispatcher),this.valueObserver=new bL(this,this.controller),this.targetObserver=new vL(this,this),this.outletObserver=new yL(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(n){this.handleError(n,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(t){this.handleError(t,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(t){this.handleError(t,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}
4702get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(t,e,n={}){let{identifier:s,controller:r,element:o}=this;n=Object.assign({identifier:s,controller:r,element:o},n),this.application.handleError(t,`Error ${e}`,n)}targetConnected(t,e){this.invokeControllerMethod(`${e}TargetConnected`,t)}targetDisconnected(t,e){this.invokeControllerMethod(`${e}TargetDisconnected`,t)}outletConnected(t,e,n){this.invokeControllerMethod(`${uL(n)}OutletConnected`,t,e)}outletDisconnected(t,e,n){this.invokeControllerMethod(`${uL(n)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){let n=this.controller;typeof n[t]=="function"&&n[t](...e)}};function jut(i){return Wut(i,$ut(i))}function Wut(i,t){let e=Xut(i),n=Gut(i.prototype,t);return Object.defineProperties(e.prototype,n),e}function $ut(i){return Ty(i,"blessings").reduce((e,n)=>{let s=n(i);for(let r in s){let o=e[r]||{};e[r]=Object.assign(o,s[r])}return e},{})}function Gut(i,t){return Yut(t).reduce((e,n)=>{let s=qut(i,t,n);return s&&Object.assign(e,{[n]:s}),e},{})}function qut(i,t,e){let n=Object.getOwnPropertyDescriptor(i,e);if(!(n&&"value"in n)){let r=Object.getOwnPropertyDescriptor(t,e).value;return n&&(r.get=n.get||r.get,r.set=n.set||r.set),r}}var Yut=typeof Object.getOwnPropertySymbols=="function"?i=>[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)]:Object.getOwnPropertyNames,Xut=(()=>{function i(e){function n(){return Reflect.construct(e,arguments,new.target)}return n.prototype=Object.create(e.prototype,{constructor:{value:n}}),Reflect.setPrototypeOf(n,e),n}function t(){let n=i(function(){this.a.call(this)});return n.prototype.a=function(){},new n}try{return t(),i}catch{return n=>class extends n{}}})();function Kut(i){return{identifier:i.identifier,controllerConstructor:jut(i.controllerConstructor)}}var wL=class{constructor(t,e){this.application=t,this.definition=Kut(e),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(t){let e=this.fetchContextForScope(t);this.connectedContexts.add(e),e.connect()}disconnectContextForScope(t){let e=this.contextsByScope.get(t);e&&(this.connectedContexts.delete(e),e.disconnect())}fetchContextForScope(t){let e=this.contextsByScope.get(t);return e||(e=new xL(this,t),this.contextsByScope.set(t,e)),e}},_L=class{constructor(t){this.scope=t}has(t){return this.data.has(this.getDataKey(t))}get(t){return this.getAll(t)[0]}getAll(t){let e=this.data.get(this.getDataKey(t))||"";return Rut(e)}getAttributeName(t){return this.data.getAttributeNameForKey(this.getDataKey(t))}getDataKey(t){return`${t}-class`}get data(){return this.scope.data}},SL=class{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(t){let e=this.getAttributeNameForKey(t);return this.element.getAttribute(e)}set(t,e){let n=this.getAttributeNameForKey(t);return this.element.setAttribute(n,e),this.get(t)}has(t){let e=this.getAttributeNameForKey(t);return this.element.hasAttribute(e)}delete(t){if(this.has(t)){let e=this.getAttributeNameForKey(t);return this.element.removeAttribute(e),!0}else return!1}getAttributeNameForKey(t){return`data-${this.identifier}-${Y8(t)}`}},CL=class{constructor(t){this.warnedKeysByObject=new WeakMap,this.logger=t}warn(t,e,n){let s=this.warnedKeysByObject.get(t);s||(s=new Set,this.warnedKeysByObject.set(t,s)),s.has(e)||(s.add(e),this.logger.warn(n,t))}};function ML(i,t){return`[${i}~="${t}"]`}var TL=class{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return this.find(t)!=null}find(...t){return t.reduce((e,n)=>e||this.findTarget(n)||this.findLegacyTarget(n),void 0)}findAll(...t){return t.reduce((e,n)=>[...e,...this.findAllTargets(n),...this.findAllLegacyTargets(n)],[])}findTarget(t){let e=this.getSelectorForTargetName(t);return this.scope.findElement(e)}findAllTargets(t){let e=this.getSelectorForTargetName(t);return this.scope.findAllElements(e)}getSelectorForTargetName(t){let e=this.schema.targetAttributeForScope(this.identifier);return ML(e,t)}findLegacyTarget(t){let e=this.getLegacySelectorForTargetName(t);return this.deprecate(this.scope.findElement(e),t)}findAllLegacyTargets(t){let e=this.getLegacySelectorForTargetName(t);return this.scope.findAllElements(e).map(n=>this.deprecate(n,t))}getLegacySelectorForTargetName(t){let e=`${this.identifier}.${t}`;return ML(this.schema.targetAttribute,e)}deprecate(t,e){if(t){let{identifier:n}=this,s=this.schema.targetAttribute,r=this.schema.targetAttributeForScope(n);this.guide.warn(t,`target:${e}`,`Please replace ${s}="${n}.${e}" with ${r}="${e}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return t}get guide(){return this.scope.guide}},AL=class{constructor(t,e){this.scope=t,this.controllerElement=e}
4702get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return this.find(t)!=null}find(...t){return t.reduce((e,n)=>e||this.findOutlet(n),void 0)}findAll(...t){return t.reduce((e,n)=>[...e,...this.findAllOutlets(n)],[])}getSelectorForOutletName(t){let e=this.schema.outletAttributeForScope(this.identifier,t);return this.controllerElement.getAttribute(e)}findOutlet(t){let e=this.getSelectorForOutletName(t);if(e)return this.findElement(e,t)}findAllOutlets(t){let e=this.getSelectorForOutletName(t);return e?this.findAllElements(e,t):[]}findElement(t,e){return this.scope.queryElements(t).filter(s=>this.matchesElement(s,t,e))[0]}findAllElements(t,e){return this.scope.queryElements(t).filter(s=>this.matchesElement(s,t,e))}matchesElement(t,e,n){let s=t.getAttribute(this.scope.schema.controllerAttribute)||"";return t.matches(e)&&s.split(" ").includes(n)}},EL=class i{constructor(t,e,n,s){this.targets=new TL(this),this.classes=new _L(this),this.data=new SL(this),this.containsElement=r=>r.closest(this.controllerSelector)===this.element,this.schema=t,this.element=e,this.identifier=n,this.guide=new CL(s),this.outlets=new AL(this.documentScope,e)}findElement(t){return this.element.matches(t)?this.element:this.queryElements(t).find(this.containsElement)}findAllElements(t){return[...this.element.matches(t)?[this.element]:[],...this.queryElements(t).filter(this.containsElement)]}queryElements(t){return Array.from(this.element.querySelectorAll(t))}get controllerSelector(){return ML(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new i(this.schema,document.documentElement,this.identifier,this.guide.logger)}},kL=class{constructor(t,e,n){this.element=t,this.schema=e,this.delegate=n,this.valueListObserver=new tM(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(t){let{element:e,content:n}=t;return this.parseValueForElementAndIdentifier(e,n)}parseValueForElementAndIdentifier(t,e){let n=this.fetchScopesByIdentifierForElement(t),s=n.get(e);return s||(s=this.delegate.createScopeForElementAndIdentifier(t,e),n.set(e,s)),s}elementMatchedValue(t,e){let n=(this.scopeReferenceCounts.get(e)||0)+1;this.scopeReferenceCounts.set(e,n),n==1&&this.delegate.scopeConnected(e)}elementUnmatchedValue(t,e){let n=this.scopeReferenceCounts.get(e);n&&(this.scopeReferenceCounts.set(e,n-1),n==1&&this.delegate.scopeDisconnected(e))}fetchScopesByIdentifierForElement(t){let e=this.scopesByIdentifierByElement.get(t);return e||(e=new Map,this.scopesByIdentifierByElement.set(t,e)),e}},PL=class{constructor(t){this.application=t,this.scopeObserver=new kL(this.element,this.schema,this),this.scopesByIdentifier=new Du,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((t,e)=>t.concat(e.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(t){this.unloadIdentifier(t.identifier);let e=new wL(this.application,t);this.connectModule(e);let n=t.controllerConstructor.afterLoad;n&&n.call(t.controllerConstructor,t.identifier,this.application)}unloadIdentifier(t){let e=this.modulesByIdentifier.get(t);e&&this.disconnectModule(e)}getContextForElementAndIdentifier(t,e){let n=this.modulesByIdentifier.get(e);if(n)return n.contexts.find(s=>s.element==t)}proposeToConnectScopeForElementAndIdentifier(t,e){let n=this.scopeObserver.parseValueForElementAndIdentifier(t,e);n?this.scopeObserver.elementMatchedValue(n.element,n):console.error(`Couldn't find or create scope for identifier: "${e}" and element:`,t)}handleError(t,e,n){this.application.handleError(t,e,n)}createScopeForElementAndIdentifier(t,e){return new EL(this.schema,t,e,this.logger)}scopeConnected(t){this.scopesByIdentifier.add(t.identifier,t);let e=this.modulesByIdentifier.get(t.identifier);e&&e.connectContextForScope(t)}scopeDisconnected(t){this.scopesByIdentifier.delete(t.identifier,t);let e=this.modulesByIdentifier.get(t.identifier);e&&e.disconnectContextForScope(t)}
4702connectModule(t){this.modulesByIdentifier.set(t.identifier,t),this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(n=>t.connectContextForScope(n))}disconnectModule(t){this.modulesByIdentifier.delete(t.identifier),this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(n=>t.disconnectContextForScope(n))}},Jut={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:i=>`data-${i}-target`,outletAttributeForScope:(i,t)=>`data-${i}-${t}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},H8("abcdefghijklmnopqrstuvwxyz".split("").map(i=>[i,i]))),H8("0123456789".split("").map(i=>[i,i])))};function H8(i){return i.reduce((t,[e,n])=>Object.assign(Object.assign({},t),{[e]:n}),{})}var eM=class{constructor(t=document.documentElement,e=Jut){this.logger=console,this.debug=!1,this.logDebugActivity=(n,s,r={})=>{this.debug&&this.logFormattedMessage(n,s,r)},this.element=t,this.schema=e,this.dispatcher=new cL(this),this.router=new PL(this),this.actionDescriptorFilters=Object.assign({},Mut)}static start(t,e){let n=new this(t,e);return n.start(),n}async start(){await Zut(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(t,e){this.load({identifier:t,controllerConstructor:e})}registerActionOption(t,e){this.actionDescriptorFilters[t]=e}load(t,...e){(Array.isArray(t)?t:[t,...e]).forEach(s=>{s.controllerConstructor.shouldLoad&&this.router.loadDefinition(s)})}unload(t,...e){(Array.isArray(t)?t:[t,...e]).forEach(s=>this.router.unloadIdentifier(s))}get controllers(){return this.router.contexts.map(t=>t.controller)}getControllerForElementAndIdentifier(t,e){let n=this.router.getContextForElementAndIdentifier(t,e);return n?n.controller:null}handleError(t,e,n){var s;this.logger.error(`%s
4703
4704%o
4705
4706%o`,e,t,n),(s=window.onerror)===null||s===void 0||s.call(window,e,"",0,0,t)}logFormattedMessage(t,e,n={}){n=Object.assign({application:this},n),this.logger.groupCollapsed(`${t} #${e}`),this.logger.log("details:",Object.assign({},n)),this.logger.groupEnd()}};function Zut(){return new Promise(i=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>i()):i()})}function Qut(i){return Ty(i,"classes").reduce((e,n)=>Object.assign(e,tht(n)),{})}function tht(i){return{[`${i}Class`]:{get(){let{classes:t}=this;if(t.has(i))return t.get(i);{let e=t.getAttributeName(i);throw new Error(`Missing attribute "${e}"`)}}},[`${i}Classes`]:{get(){return this.classes.getAll(i)}},[`has${My(i)}Class`]:{get(){return this.classes.has(i)}}}}function eht(i){return Ty(i,"outlets").reduce((e,n)=>Object.assign(e,nht(n)),{})}function j8(i,t,e){return i.application.getControllerForElementAndIdentifier(t,e)}function W8(i,t,e){let n=j8(i,t,e);if(n||(i.application.router.proposeToConnectScopeForElementAndIdentifier(t,e),n=j8(i,t,e),n))return n}function nht(i){let t=uL(i);return{[`${t}Outlet`]:{get(){let e=this.outlets.find(i),n=this.outlets.getSelectorForOutletName(i);if(e){let s=W8(this,e,i);if(s)return s;throw new Error(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${n}".`)}},[`${t}Outlets`]:{get(){let e=this.outlets.findAll(i);return e.length>0?e.map(n=>{let s=W8(this,n,i);if(s)return s;console.warn(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`,n)}).filter(n=>n):[]}},[`${t}OutletElement`]:{get(){let e=this.outlets.find(i),n=this.outlets.getSelectorForOutletName(i);if(e)return e;throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${n}".`)}},[`${t}OutletElements`]:{get(){return this.outlets.findAll(i)}},[`has${My(t)}Outlet`]:{get(){return this.outlets.has(i)}}}}function iht(i){return Ty(i,"targets").reduce((e,n)=>Object.assign(e,sht(n)),{})}function sht(i){return{[`${i}Target`]:{get(){let t=this.targets.find(i);if(t)return t;throw new Error(`Missing target element "${i}" for "${this.identifier}" controller`)}},[`${i}Targets`]:{get(){return this.targets.findAll(i)}},[`has${My(i)}Target`]:{get(){return this.targets.has(i)}}}}function rht(i){let t=zut(i,"values"),e={valueDescriptorMap:{get(){return t.reduce((n,s)=>{let r=J8(s,this.identifier),o=this.data.getAttributeNameForKey(r.key);return Object.assign(n,{[o]:r})},{})}}};return t.reduce((n,s)=>Object.assign(n,oht(s)),e)}function oht(i,t){let e=J8(i,t),{key:n,name:s,reader:r,writer:o}=e;return{[s]:{get(){let a=this.data.get(n);
4706return a!==null?r(a):e.defaultValue},set(a){a===void 0?this.data.delete(n):this.data.set(n,o(a))}},[`has${My(s)}`]:{get(){return this.data.has(n)||e.hasCustomDefaultValue}}}}function J8([i,t],e){return uht({controller:e,token:i,typeDefinition:t})}function nM(i){switch(i){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Cy(i){switch(typeof i){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(i))return"array";if(Object.prototype.toString.call(i)==="[object Object]")return"object"}function aht(i){let{controller:t,token:e,typeObject:n}=i,s=U8(n.type),r=U8(n.default),o=s&&r,a=s&&!r,l=!s&&r,c=nM(n.type),u=Cy(i.typeObject.default);if(a)return c;if(l)return u;if(c!==u){let h=t?`${t}.${e}`:e;throw new Error(`The specified default value for the Stimulus Value "${h}" must match the defined type "${c}". The provided default value of "${n.default}" is of type "${u}".`)}if(o)return c}function lht(i){let{controller:t,token:e,typeDefinition:n}=i,r=aht({controller:t,token:e,typeObject:n}),o=Cy(n),a=nM(n),l=r||o||a;if(l)return l;let c=t?`${t}.${n}`:e;throw new Error(`Unknown value type "${c}" for "${e}" value`)}function cht(i){let t=nM(i);if(t)return $8[t];let e=hL(i,"default"),n=hL(i,"type"),s=i;if(e)return s.default;if(n){let{type:r}=s,o=nM(r);if(o)return $8[o]}return i}function uht(i){let{token:t,typeDefinition:e}=i,n=`${Y8(t)}-value`,s=lht(i);return{type:s,key:n,name:RL(n),get defaultValue(){return cht(e)},get hasCustomDefaultValue(){return Cy(e)!==void 0},reader:hht[s],writer:G8[s]||G8.default}}var $8={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},hht={array(i){let t=JSON.parse(i);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${i}" of type "${Cy(t)}"`);return t},boolean(i){return!(i=="0"||String(i).toLowerCase()=="false")},number(i){return Number(i.replace(/_/g,""))},object(i){let t=JSON.parse(i);if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${i}" of type "${Cy(t)}"`);return t},string(i){return i}},G8={default:dht,array:q8,object:q8};function q8(i){return JSON.stringify(i)}function dht(i){return`${i}`}var le=class{constructor(t){this.context=t}static get shouldLoad(){return!0}static afterLoad(t,e){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:n={},prefix:s=this.identifier,bubbles:r=!0,cancelable:o=!0}={}){let a=s?`${s}:${t}`:t,l=new CustomEvent(a,{detail:n,bubbles:r,cancelable:o});return e.dispatchEvent(l),l}};le.blessings=[Qut,iht,rht,eht];le.targets=[];le.outlets=[];le.values={};var Vc=eM.start();Vc.debug=!1;window.Stimulus=Vc;var FL={};Le(FL,{default:()=>BL});var sM={logger:typeof console<"u"?console:void 0,WebSocket:typeof WebSocket<"u"?WebSocket:void 0},Os={log(...i){this.enabled&&(i.push(Date.now()),sM.logger.log("[ActionCable]",...i))}},Ey=()=>new Date().getTime(),iM=i=>(Ey()-i)/1e3,ky=class{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=Ey(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),Os.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=Ey(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),Os.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordMessage(){this.pingedAt=Ey()}recordConnect(){this.reconnectAttempts=0,delete this.disconnectedAt,Os.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=Ey(),Os.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:e}=this.constructor,n=Math.pow(1+e,Math.min(this.reconnectAttempts,10)),r=(this.reconnectAttempts===0?1:e)*Math.random();return t*1e3*n*(1+r)}reconnectIfStale(){this.connectionIsStale()&&(Os.log(`ConnectionMonitor detected stale c
4706onnection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${iM(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?Os.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${iM(this.disconnectedAt)} s`):(Os.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return iM(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&iM(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout((()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(Os.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())}),200)}};ky.staleThreshold=6;ky.reconnectionBackoffRate=.15;var Q8={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"]},{message_types:Ay,protocols:DL}=Q8,fht=DL.slice(0,DL.length-1),Z8=[].indexOf,Py=class{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new ky(this),this.disconnected=!0}send(t){return this.isOpen()?(this.webSocket.send(JSON.stringify(t)),!0):!1}open(){if(this.isActive())return Os.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{let t=[...DL,...this.consumer.subprotocols||[]];return Os.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${t}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new sM.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(Os.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(t){Os.log("Failed to reopen WebSocket",t)}finally{Os.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 Z8.call(fht,this.getProtocol())>=0}isState(...t){return Z8.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in sM.WebSocket)if(sM.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){let e=this.events[t].bind(this);this.webSocket[`on${t}`]=e}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){}}};Py.reopenDelay=500;Py.prototype.events={message(i){if(!this.isProtocolSupported())return;let{identifier:t,message:e,reason:n,reconnect:s,type:r}=JSON.parse(i.data);switch(this.monitor.recordMessage(),r){case Ay.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case Ay.disconnect:return Os.log(`Disconnecting. Reason: ${n}`),this.close({allowReconnect:s});case Ay.ping:return null;case Ay.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 Ay.rejection:return this.subscriptions.reject(t);default:return this.subscriptions.notify(t,"received",e)}},open(){if(Os.log(`WebSocket onopen event, using '${this.getProtocol()}
4706' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return Os.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(i){if(Os.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){Os.log("WebSocket onerror event")}};var pht=function(i,t){if(t!=null)for(let e in t){let n=t[e];i[e]=n}return i},LL=class{constructor(t,e={},n){this.consumer=t,this.identifier=JSON.stringify(e),pht(this,n)}perform(t,e={}){return e.action=t,this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}},IL=class{constructor(t){this.subscriptions=t,this.pendingSubscriptions=[]}guarantee(t){this.pendingSubscriptions.indexOf(t)==-1?(Os.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):Os.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing()}forget(t){Os.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter((e=>e!==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=>{Os.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t)}))}),500)}},OL=class{constructor(t){this.consumer=t,this.guarantor=new IL(this),this.subscriptions=[]}create(t,e){let n=t,s=typeof n=="object"?n:{channel:n},r=new LL(this.consumer,s,e);return this.add(r)}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((e=>(this.forget(e),this.notify(e,"rejected"),e)))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter((e=>e!==t)),t}findAll(t){return this.subscriptions.filter((e=>e.identifier===t))}reload(){return this.subscriptions.map((t=>this.subscribe(t)))}notifyAll(t,...e){return this.subscriptions.map((n=>this.notify(n,t,...e)))}notify(t,e,...n){let s;return typeof t=="string"?s=this.findAll(t):s=[t],s.map((r=>typeof r[e]=="function"?r[e](...n):void 0))}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t)}confirmSubscription(t){Os.log(`Subscription confirmed ${t}`),this.findAll(t).map((e=>this.guarantor.forget(e)))}sendCommand(t,e){let{identifier:n}=t;return this.consumer.send({command:e,identifier:n})}},NL=class{constructor(t){this._url=t,this.subscriptions=new OL(this),this.connection=new Py(this),this.subprotocols=[]}get url(){return ght(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]}};function ght(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}function tW(i=mht("url")||Q8.default_mount_path){return new NL(i)}function mht(i){let t=document.head.querySelector(`meta[name='action-cable-${i}']`);if(t)return t.getAttribute("content")}var Ry=tW();var BL=class extends le{reconnect(i){Ry.connection.isActive()&&Ry.connection.reopen()}};var zL={};Le(zL,{default:()=>UL});var UL=class extends le{static values={event:String};track(){window.posthog&&posthog.capture(this.eventValue)}};var FN={};Le(FN,{default:()=>Tp});var qT={};Le(qT,{Circle:()=>oY,Edge:()=>VT,Ellipse:()=>aY,HTML:()=>T0,Image:()=>gY,Path:()=>mY,Polygon:()=>bY,Polyline:()=>vY,Rect:()=>yY,TextBlock:()=>xY});Sn();
4706function bht(i){i.forEach(t=>{Object.hasOwn(t,"append")||Object.defineProperty(t,"append",{configurable:!0,enumerable:!0,writable:!0,value(...e){let n=document.createDocumentFragment();e.forEach(s=>{let r=s instanceof Node;n.appendChild(r?s:document.createTextNode(String(s)))}),this.appendChild(n)}})})}typeof window=="object"&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach);typeof window<"u"&&(i=>{bht(i)})([Element.prototype,Document.prototype,DocumentFragment.prototype]);var cs={};Le(cs,{castArray:()=>qL,difference:()=>tI,groupBy:()=>eI,max:()=>aI,sortBy:()=>uI,sortedIndex:()=>hI,sortedIndexBy:()=>dI,union:()=>fI,uniq:()=>pI});var vht=typeof global=="object"&&global&&global.Object===Object&&global,oM=vht;var yht=typeof self=="object"&&self&&self.Object===Object&&self,xht=oM||yht||Function("return this")(),zs=xht;var wht=zs.Symbol,Ir=wht;var eW=Object.prototype,_ht=eW.hasOwnProperty,Sht=eW.toString,Dy=Ir?Ir.toStringTag:void 0;function Cht(i){var t=_ht.call(i,Dy),e=i[Dy];try{i[Dy]=void 0;var n=!0}catch{}var s=Sht.call(i);return n&&(t?i[Dy]=e:delete i[Dy]),s}var nW=Cht;var Mht=Object.prototype,Tht=Mht.toString;function Aht(i){return Tht.call(i)}var iW=Aht;var Eht="[object Null]",kht="[object Undefined]",sW=Ir?Ir.toStringTag:void 0;function Pht(i){return i==null?i===void 0?kht:Eht:sW&&sW in Object(i)?nW(i):iW(i)}var No=Pht;function Rht(i){return i!=null&&typeof i=="object"}var Zs=Rht;var Dht="[object Symbol]";function Lht(i){return typeof i=="symbol"||Zs(i)&&No(i)==Dht}var Or=Lht;function Iht(i,t){for(var e=-1,n=i==null?0:i.length,s=Array(n);++e<n;)s[e]=t(i[e],e,i);return s}var id=Iht;var Oht=Array.isArray,Di=Oht;var Nht=1/0,rW=Ir?Ir.prototype:void 0,oW=rW?rW.toString:void 0;function aW(i){if(typeof i=="string")return i;if(Di(i))return id(i,aW)+"";if(Or(i))return oW?oW.call(i):"";var t=i+"";return t=="0"&&1/i==-Nht?"-0":t}var lW=aW;var Bht=/\s/;function Fht(i){for(var t=i.length;t--&&Bht.test(i.charAt(t)););return t}var cW=Fht;var Uht=/^\s+/;function zht(i){return i&&i.slice(0,cW(i)+1).replace(Uht,"")}var uW=zht;function Vht(i){var t=typeof i;return i!=null&&(t=="object"||t=="function")}var ki=Vht;var hW=NaN,Hht=/^[-+]0x[0-9a-f]+$/i,jht=/^0b[01]+$/i,Wht=/^0o[0-7]+$/i,$ht=parseInt;function Ght(i){if(typeof i=="number")return i;if(Or(i))return hW;if(ki(i)){var t=typeof i.valueOf=="function"?i.valueOf():i;i=ki(t)?t+"":t}if(typeof i!="string")return i===0?i:+i;i=uW(i);var e=jht.test(i);return e||Wht.test(i)?$ht(i.slice(2),e?2:8):Hht.test(i)?hW:+i}var $f=Ght;function qht(i){return i}var al=qht;var Yht="[object AsyncFunction]",Xht="[object Function]",Kht="[object GeneratorFunction]",Jht="[object Proxy]";function Zht(i){if(!ki(i))return!1;var t=No(i);return t==Xht||t==Kht||t==Yht||t==Jht}var Lm=Zht;var Qht=zs["__core-js_shared__"],aM=Qht;var dW=(function(){var i=/[^.]+$/.exec(aM&&aM.keys&&aM.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function tdt(i){return!!dW&&dW in i}var fW=tdt;var edt=Function.prototype,ndt=edt.toString;function idt(i){if(i!=null){try{return ndt.call(i)}catch{}try{return i+""}catch{}}return""}var Lu=idt;var sdt=/[\\^$.*+?()[\]{}|]/g,rdt=/^\[object .+?Constructor\]$/,odt=Function.prototype,adt=Object.prototype,ldt=odt.toString,cdt=adt.hasOwnProperty,udt=RegExp("^"+ldt.call(cdt).replace(sdt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function hdt(i){if(!ki(i)||fW(i))return!1;var t=Lm(i)?udt:rdt;return t.test(Lu(i))}var pW=hdt;function ddt(i,t){return i?.[t]}var gW=ddt;function fdt(i,t){var e=gW(i,t);return pW(e)?e:void 0}var da=fdt;var pdt=da(zs,"WeakMap"),lM=pdt;var mW=Object.create,gdt=(function(){function i(){}return function(t){if(!ki(t))return{};if(mW)return mW(t);i.prototype=t;var e=new i;return i.prototype=void 0,e}})(),bW=gdt;function mdt(i,t,e){switch(e.length){case 0:return i.call(t);case 1:return i.call(t,e[0]);case 2:return i.call(t,e[0],e[1]);case 3:return i.call(t,e[0],e[1],e[2])}return i.apply(t,e)}var cM=mdt;function bdt(){}var vW=bdt;function vdt(i,t){var e=-1,n=i.length;for(t||(t=Array(n));++e<n;)t[e]=i[e];return t}var uM=vdt;var ydt=800,xdt=16,wdt=Date.now;function _dt(i){var t=0,e=0;return function(){var n=wdt(),s=xdt-(n-e);if(e=n,s>0){if(++t>=ydt)return arguments[0]}else t=0;return i.apply(void 0,arguments)}}var yW=_dt;function Sdt(i){return function(){return i}}var xW=Sdt;var Cdt=(function(){try{var i=da(Object,"defineProperty");return i({},"",{}),i}catch{}})(),Im=Cdt;var Mdt=Im?function(i,t){return Im(i,"toString",{configurable:!0,enumerable:!1,value:xW(t),writable:!0})}:al,wW=Mdt;var Tdt=yW(wW),hM=Tdt;function Adt(i,t){for(var e=-1,n=i==null?0:i.length;++e<n&&t(i[e],e,i)!==!1;);return i}var _W=Adt;function Edt(i,t,e,n){for(var s=i.length,r=e+(n?1:-1);n?r--:++r<s;)if(t(i[r],r,i))return r;return-1}var SW=Edt;function kdt(i){return i!==i}var CW=kdt;function Pdt(i,t,e){for(var n=e-1,s=i.length;++n<s;)if(i[n]===t)return n;return-1}var MW=Pdt;function Rdt(i,t,e){return t===t?MW(i,t,e):SW(i,CW,e)}var TW=Rdt;function Ddt(i,t){var e=i==null?0:i.length;return!!e&&TW(i,t,0)>-1}var dM=Ddt;var Ldt=9007199254740991,Idt=/^(?:0|[1-9]\d*)$/;function Odt(i,t){var e=typeof i;return t=t??Ldt,!!t&&(e=="number"||e!="symbol"&&Idt.test(i))&&i>-1&&i%1==0&&i<t}var sd=Odt;function Ndt(i,t,e){t=="__proto__"&&Im?Im(i,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):i[t]=e}var rd=Ndt;function Bdt(i,t){return i===t||i!==i&&t!==t}var ll=Bdt;var Fdt=Object.prototype,Udt=Fdt.hasOwnProperty;function zdt(i,t,e){var n=i[t];(!(Udt.call(i,t)&&ll(n,e))||e===void 0&&!(t in i))&&rd(i,t,e)}var Om=zdt;function Vdt(i,t,e,n){var s=!e;e||(e={});for(var r=-1,o=t.length;++r<o;){var a=t[r],l=n?n(e[a],i[a],a,e,i):void 0;
vendor: 6,963 bytes, line 4706
4706l===void 0&&(l=i[a]),s?rd(e,a,l):Om(e,a,l)}return e}var Hc=Vdt;var AW=Math.max;function Hdt(i,t,e){return t=AW(t===void 0?i.length-1:t,0),function(){for(var n=arguments,s=-1,r=AW(n.length-t,0),o=Array(r);++s<r;)o[s]=n[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=n[s];return a[t]=e(o),cM(i,this,a)}}var fM=Hdt;function jdt(i,t){return hM(fM(i,t,al),i+"")}var cl=jdt;var Wdt=9007199254740991;function $dt(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=Wdt}var Nm=$dt;function Gdt(i){return i!=null&&Nm(i.length)&&!Lm(i)}var fa=Gdt;function qdt(i,t,e){if(!ki(e))return!1;var n=typeof t;return(n=="number"?fa(e)&&sd(t,e.length):n=="string"&&t in e)?ll(e[t],i):!1}var Gf=qdt;function Ydt(i){return cl(function(t,e){var n=-1,s=e.length,r=s>1?e[s-1]:void 0,o=s>2?e[2]:void 0;for(r=i.length>3&&typeof r=="function"?(s--,r):void 0,o&&Gf(e[0],e[1],o)&&(r=s<3?void 0:r,s=1),t=Object(t);++n<s;){var a=e[n];a&&i(t,a,n,r)}return t})}var pM=Ydt;var Xdt=Object.prototype;function Kdt(i){var t=i&&i.constructor,e=typeof t=="function"&&t.prototype||Xdt;return i===e}var od=Kdt;function Jdt(i,t){for(var e=-1,n=Array(i);++e<i;)n[e]=t(e);return n}var EW=Jdt;var Zdt="[object Arguments]";function Qdt(i){return Zs(i)&&No(i)==Zdt}var VL=Qdt;var kW=Object.prototype,tft=kW.hasOwnProperty,eft=kW.propertyIsEnumerable,nft=VL((function(){return arguments})())?VL:function(i){return Zs(i)&&tft.call(i,"callee")&&!eft.call(i,"callee")},$l=nft;function ift(){return!1}var PW=ift;var LW=typeof exports=="object"&&exports&&!exports.nodeType&&exports,RW=LW&&typeof module=="object"&&module&&!module.nodeType&&module,sft=RW&&RW.exports===LW,DW=sft?zs.Buffer:void 0,rft=DW?DW.isBuffer:void 0,oft=rft||PW,Gl=oft;var aft="[object Arguments]",lft="[object Array]",cft="[object Boolean]",uft="[object Date]",hft="[object Error]",dft="[object Function]",fft="[object Map]",pft="[object Number]",gft="[object Object]",mft="[object RegExp]",bft="[object Set]",vft="[object String]",yft="[object WeakMap]",xft="[object ArrayBuffer]",wft="[object DataView]",_ft="[object Float32Array]",Sft="[object Float64Array]",Cft="[object Int8Array]",Mft="[object Int16Array]",Tft="[object Int32Array]",Aft="[object Uint8Array]",Eft="[object Uint8ClampedArray]",kft="[object Uint16Array]",Pft="[object Uint32Array]",ms={};ms[_ft]=ms[Sft]=ms[Cft]=ms[Mft]=ms[Tft]=ms[Aft]=ms[Eft]=ms[kft]=ms[Pft]=!0;ms[aft]=ms[lft]=ms[xft]=ms[cft]=ms[wft]=ms[uft]=ms[hft]=ms[dft]=ms[fft]=ms[pft]=ms[gft]=ms[mft]=ms[bft]=ms[vft]=ms[yft]=!1;function Rft(i){return Zs(i)&&Nm(i.length)&&!!ms[No(i)]}var IW=Rft;function Dft(i){return function(t){return i(t)}}var jc=Dft;var OW=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ly=OW&&typeof module=="object"&&module&&!module.nodeType&&module,Lft=Ly&&Ly.exports===OW,HL=Lft&&oM.process,Ift=(function(){try{var i=Ly&&Ly.require&&Ly.require("util").types;return i||HL&&HL.binding&&HL.binding("util")}catch{}})(),Iu=Ift;var NW=Iu&&Iu.isTypedArray,Oft=NW?jc(NW):IW,ad=Oft;var Nft=Object.prototype,Bft=Nft.hasOwnProperty;function Fft(i,t){var e=Di(i),n=!e&&$l(i),s=!e&&!n&&Gl(i),r=!e&&!n&&!s&&ad(i),o=e||n||s||r,a=o?EW(i.length,String):[],l=a.length;for(var c in i)(t||Bft.call(i,c))&&!(o&&(c=="length"||s&&(c=="offset"||c=="parent")||r&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||sd(c,l)))&&a.push(c);return a}var gM=Fft;function Uft(i,t){return function(e){return i(t(e))}}var mM=Uft;var zft=mM(Object.keys,Object),BW=zft;var Vft=Object.prototype,Hft=Vft.hasOwnProperty;function jft(i){if(!od(i))return BW(i);var t=[];for(var e in Object(i))Hft.call(i,e)&&e!="constructor"&&t.push(e);return t}var bM=jft;function Wft(i){return fa(i)?gM(i):bM(i)}var Wc=Wft;function $ft(i){var t=[];if(i!=null)for(var e in Object(i))t.push(e);return t}var FW=$ft;var Gft=Object.prototype,qft=Gft.hasOwnProperty;function Yft(i){if(!ki(i))return FW(i);var t=od(i),e=[];for(var n in i)n=="constructor"&&(t||!qft.call(i,n))||e.push(n);return e}var UW=Yft;function Xft(i){return fa(i)?gM(i,!0):UW(i)}var ul=Xft;var Kft=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Jft=/^\w*$/;function Zft(i,t){if(Di(i))return!1;var e=typeof i;return e=="number"||e=="symbol"||e=="boolean"||i==null||Or(i)?!0:Jft.test(i)||!Kft.test(i)||t!=null&&i in Object(t)}var Bm=Zft;var Qft=da(Object,"create"),Ou=Qft;function tpt(){this.__data__=Ou?Ou(null):{},this.size=0}var zW=tpt;function ept(i){var t=this.has(i)&&delete this.__data__[i];return this.size-=t?1:0,t}var VW=ept;var npt="__lodash_hash_undefined__",ipt=Object.prototype,spt=ipt.hasOwnProperty;function rpt(i){var t=this.__data__;if(Ou){var e=t[i];return e===npt?void 0:e}return spt.call(t,i)?t[i]:void 0}var HW=rpt;var opt=Object.prototype,apt=opt.hasOwnProperty;function lpt(i){var t=this.__data__;return Ou?t[i]!==void 0:apt.call(t,i)}var jW=lpt;var cpt="__lodash_hash_undefined__";function upt(i,t){var e=this.__data__;return this.size+=this.has(i)?0:1,e[i]=Ou&&t===void 0?cpt:t,this}var WW=upt;function Fm(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}Fm.prototype.clear=zW;Fm.prototype.delete=VW;Fm.prototype.get=HW;Fm.prototype.has=jW;Fm.prototype.set=WW;var jL=Fm;function hpt(){this.__data__=[],this.size=0}var $W=hpt;function dpt(i,t){for(var e=i.length;e--;)if(ll(i[e][0],t))return e;return-1}var ld=dpt;var fpt=Array.prototype,ppt=fpt.splice;function gpt(i){var t=this.__data__,e=ld(t,i);if(e<0)return!1;var n=t.length-1;return e==n?t.pop():ppt.call(t,e,1),--this.size,!0}var GW=gpt;function mpt(i){var t=this.__data__,e=ld(t,i);return e<0?void 0:t[e][1]}var qW=mpt;function bpt(i){return ld(this.__data__,i)>-1}var YW=bpt;function vpt(i,t){var e=this.__data__,n=ld(e,i);return n<0?(++this.size,e.push([i,t])):e[n][1]=t,this}var XW=vpt;function Um(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}Um.prototype.clear=$W;Um.prototype.delete=GW;Um.prototype.get=qW;Um.prototype.has=YW;Um.prototype.set=XW;var cd=Um;var ypt=da(zs,"Map"),ud=ypt;function xpt(){this.size=0,this.__data__={hash:new jL,map:new(ud||cd),string:new jL}}var KW=xpt;function wpt(i){var t=typeof i;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?i!=="__proto__":i===null}var JW=wpt;function _pt(i,t){var e=i.__data__;return JW(t)?e[typeof t=="string"?"string":"hash"]:e.map}var hd=_pt;function Spt(i){var t=hd(this,i).delete(i);return this.size-=t?1:0,t}var ZW=Spt;function Cpt(i){return hd(this,i).get(i)}var QW=Cpt;function Mpt(i){return hd(this,i).has(i)}var t$=Mpt;function Tpt(i,t){var e=hd(this,i),n=e.size;return e.set(i,t),this.size+=e.size==n?0:1,this}var e$=Tpt;function zm(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}zm.prototype.clear=KW;zm.prototype.delete=ZW;zm.prototype.get=QW;zm.prototype.has=t$;zm.prototype.set=e$;var qf=zm;var Apt="Expected a function";function WL(i,t){if(typeof i!="function"||t!=null&&typeof t!="function")throw new TypeError(Apt);var e=function(){var n=arguments,s=t?t.apply(this,n):n[0],r=e.cac
4706he;if(r.has(s))return r.get(s);var o=i.apply(this,n);return e.cache=r.set(s,o)||r,o};return e.cache=new(WL.Cache||qf),e}WL.Cache=qf;var n$=WL;var Ept=500;function kpt(i){var t=n$(i,function(n){return e.size===Ept&&e.clear(),n}),e=t.cache;return t}var i$=kpt;var Ppt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rpt=/\\(\\)?/g,Dpt=i$(function(i){var t=[];return i.charCodeAt(0)===46&&t.push(""),i.replace(Ppt,function(e,n,s,r){t.push(s?r.replace(Rpt,"$1"):n||e)}),t}),s$=Dpt;function Lpt(i){return i==null?"":lW(i)}var hl=Lpt;function Ipt(i,t){return Di(i)?i:Bm(i,t)?[i]:s$(hl(i))}var dd=Ipt;var Opt=1/0;function Npt(i){if(typeof i=="string"||Or(i))return i;var t=i+"";return t=="0"&&1/i==-Opt?"-0":t}var $c=Npt;function Bpt(i,t){t=dd(t,i);for(var e=0,n=t.length;i!=null&&e<n;)i=i[$c(t[e++])];return e&&e==n?i:void 0}var fd=Bpt;function Fpt(i,t,e){var n=i==null?void 0:fd(i,t);return n===void 0?e:n}var r$=Fpt;function Upt(i,t){for(var e=-1,n=t.length,s=i.length;++e<n;)i[s+e]=t[e];return i}var Vm=Upt;var o$=Ir?Ir.isConcatSpreadable:void 0;function zpt(i){return Di(i)||$l(i)||!!(o$&&i&&i[o$])}var a$=zpt;function l$(i,t,e,n,s){var r=-1,o=i.length;for(e||(e=a$),s||(s=[]);++r<o;){var a=i[r];t>0&&e(a)?t>1?l$(a,t-1,e,n,s):Vm(s,a):n||(s[s.length]=a)}return s}var pd=l$;function Vpt(i){var t=i==null?0:i.length;return t?pd(i,1):[]}var c$=Vpt;function Hpt(i){return hM(fM(i,void 0,c$),i+"")}var u$=Hpt;var jpt=mM(Object.getPrototypeOf,Object),Hm=jpt;var Wpt="[object Object]",$pt=Function.prototype,Gpt=Object.prototype,h$=$pt.toString,qpt=Gpt.hasOwnProperty,Ypt=h$.call(Object);function Xpt(i){if(!Zs(i)||No(i)!=Wpt)return!1;var t=Hm(i);if(t===null)return!0;var e=qpt.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&h$.call(e)==Ypt}var Iy=Xpt;function Kpt(i,t,e){var n=-1,s=i.length;t<0&&(t=-t>s?0:s+t),e=e>s?s:e,e<0&&(e+=s),s=t>e?0:e-t>>>0,t>>>=0;for(var r=Array(s);++n<s;)r[n]=i[n+t];return r}var d$=Kpt;function Jpt(i,t,e){var n=i.length;return e=e===void 0?n:e,!t&&e>=n?i:d$(i,t,e)}var f$=Jpt;var Zpt="\\ud800-\\udfff",Qpt="\\u0300-\\u036f",tgt="\\ufe20-\\ufe2f",egt="\\u20d0-\\u20ff",ngt=Qpt+tgt+egt,igt="\\ufe0e\\ufe0f",sgt="\\u200d",rgt=RegExp("["+sgt+Zpt+ngt+igt+"]");function ogt(i){return rgt.test(i)}var vM=ogt;function agt(i){return i.split("")}var p$=agt;var g$="\\ud800-\\udfff",lgt="\\u0300-\\u036f",cgt="\\ufe20-\\ufe2f",ugt="\\u20d0-\\u20ff",hgt=lgt+cgt+ugt,dgt="\\ufe0e\\ufe0f",fgt="["+g$+"]",$L="["+hgt+"]",GL="\\ud83c[\\udffb-\\udfff]",pgt="(?:"+$L+"|"+GL+")",m$="[^"+g$+"]",b$="(?:\\ud83c[\\udde6-\\uddff]){2}",v$="[\\ud800-\\udbff][\\udc00-\\udfff]",ggt="\\u200d",y$=pgt+"?",x$="["+dgt+"]?",mgt="(?:"+ggt+"(?:"+[m$,b$,v$].join("|")+")"+x$+y$+")*",bgt=x$+y$+mgt,vgt="(?:"+[m$+$L+"?",$L,b$,v$,fgt].join("|")+")",ygt=RegExp(GL+"(?="+GL+")|"+vgt+bgt,"g");function xgt(i){return i.match(ygt)||[]}var w$=xgt;function wgt(i){return vM(i)?w$(i):p$(i)}var _$=wgt;function _gt(i){return function(t){t=hl(t);var e=vM(t)?_$(t):void 0,n=e?e[0]:t.charAt(0),s=e?f$(e,1).join(""):t.slice(1);return n[i]()+s}}var yM=_gt;var Sgt=yM("toUpperCase"),Nu=Sgt;function Cgt(i){return Nu(hl(i).toLowerCase())}var S$=Cgt;function Mgt(i,t,e,n){var s=-1,r=i==null?0:i.length;for(n&&r&&(e=i[++s]);++s<r;)e=t(e,i[s],s,i);return e}var C$=Mgt;function Tgt(i){return function(t){return i?.[t]}}var M$=Tgt;var Agt={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Egt=M$(Agt),T$=Egt;
4706var kgt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Pgt="\\u0300-\\u036f",Rgt="\\ufe20-\\ufe2f",Dgt="\\u20d0-\\u20ff",Lgt=Pgt+Rgt+Dgt,Igt="["+Lgt+"]",Ogt=RegExp(Igt,"g");function Ngt(i){return i=hl(i),i&&i.replace(kgt,T$).replace(Ogt,"")}var A$=Ngt;var Bgt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Fgt(i){return i.match(Bgt)||[]}var E$=Fgt;var Ugt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function zgt(i){return Ugt.test(i)}var k$=zgt;var I$="\\ud800-\\udfff",Vgt="\\u0300-\\u036f",Hgt="\\ufe20-\\ufe2f",jgt="\\u20d0-\\u20ff",Wgt=Vgt+Hgt+jgt,O$="\\u2700-\\u27bf",N$="a-z\\xdf-\\xf6\\xf8-\\xff",$gt="\\xac\\xb1\\xd7\\xf7",Ggt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",qgt="\\u2000-\\u206f",Ygt=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",B$="A-Z\\xc0-\\xd6\\xd8-\\xde",Xgt="\\ufe0e\\ufe0f",F$=$gt+Ggt+qgt+Ygt,U$="['\u2019]",P$="["+F$+"]",Kgt="["+Wgt+"]",z$="\\d+",Jgt="["+O$+"]",V$="["+N$+"]",H$="[^"+I$+F$+z$+O$+N$+B$+"]",Zgt="\\ud83c[\\udffb-\\udfff]",Qgt="(?:"+Kgt+"|"+Zgt+")",tmt="[^"+I$+"]",j$="(?:\\ud83c[\\udde6-\\uddff]){2}",W$="[\\ud800-\\udbff][\\udc00-\\udfff]",jm="["+B$+"]",emt="\\u200d",R$="(?:"+V$+"|"+H$+")",nmt="(?:"+jm+"|"+H$+")",D$="(?:"+U$+"(?:d|ll|m|re|s|t|ve))?",L$="(?:"+U$+"(?:D|LL|M|RE|S|T|VE))?",$$=Qgt+"?",G$="["+Xgt+"]?",imt="(?:"+emt+"(?:"+[tmt,j$,W$].join("|")+")"+G$+$$+")*",smt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",rmt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",omt=G$+$$+imt,amt="(?:"+[Jgt,j$,W$].join("|")+")"+omt,lmt=RegExp([jm+"?"+V$+"+"+D$+"(?="+[P$,jm,"$"].join("|")+")",nmt+"+"+L$+"(?="+[P$,jm+R$,"$"].join("|")+")",jm+"?"+R$+"+"+D$,jm+"+"+L$,rmt,smt,z$,amt].join("|"),"g");function cmt(i){return i.match(lmt)||[]}var q$=cmt;function umt(i,t,e){return i=hl(i),t=e?void 0:t,t===void 0?k$(i)?q$(i):E$(i):i.match(t)||[]}var Y$=umt;var hmt="['\u2019]",dmt=RegExp(hmt,"g");function fmt(i){return function(t){return C$(Y$(A$(t).replace(dmt,"")),i,"")}}var gd=fmt;var pmt=gd(function(i,t,e){return t=t.toLowerCase(),i+(e?S$(t):t)}),Wm=pmt;function gmt(){if(!arguments.length)return[];var i=arguments[0];return Di(i)?i:[i]}var qL=gmt;function mmt(i,t,e){return i===i&&(e!==void 0&&(i=i<=e?i:e),t!==void 0&&(i=i>=t?i:t)),i}var X$=mmt;function bmt(i,t,e){return e===void 0&&(e=t,t=void 0),e!==void 0&&(e=$f(e),e=e===e?e:0),t!==void 0&&(t=$f(t),t=t===t?t:0),X$($f(i),t,e)}var YL=bmt;function vmt(){this.__data__=new cd,this.size=0}var K$=vmt;function ymt(i){var t=this.__data__,e=t.delete(i);return this.size=t.size,e}var J$=ymt;function xmt(i){return this.__data__.get(i)}var Z$=xmt;function wmt(i){return this.__data__.has(i)}var Q$=wmt;var _mt=200;function Smt(i,t){var e=this.__data__;if(e instanceof cd){var n=e.__data__;if(!ud||n.length<_mt-1)return n.push([i,t]),this.size=++e.size,this;e=this.__data__=new qf(n)}return e.set(i,t),this.size=e.size,this}var tG=Smt;function $m(i){var t=this.__data__=new cd(i);this.size=t.size}$m.prototype.clear=K$;$m.prototype.delete=J$;$m.prototype.get=Z$;$m.prototype.has=Q$;$m.prototype.set=tG;var Gc=$m;function Cmt(i,t){return i&&Hc(t,Wc(t),i)}var eG=Cmt;function Mmt(i,t){return i&&Hc(t,ul(t),i)}var nG=Mmt;var oG=typeof exports=="object"&&exports&&!exports.nodeType&&exports,iG=oG&&typeof module=="object"&&module&&!module.nodeType&&module,Tmt=iG&&iG.exports===oG,sG=Tmt?zs.Buffer:void 0,rG=sG?sG.allocUnsafe:void 0;function Amt(i,t){if(t)return i.slice();var e=i.length,n=rG?rG(e):new i.constructor(e);return i.copy(n),n}var xM=Amt;function Emt(i,t){for(var e=-1,n=i==null?0:i.length,s=0,r=[];++e<n;){var o=i[e];t(o,e,i)&&(r[s++]=o)}return r}var aG=Emt;function kmt(){return[]}var wM=kmt;var Pmt=Object.prototype,Rmt=Pmt.propertyIsEnumerable,lG=Object.getOwnPropertySymbols,Dmt=lG?function(i){return i==null?[]:(i=Object(i),aG(lG(i),function(t){return Rmt.call(i,t)}))}:wM,Gm=Dmt;function Lmt(i,t){return Hc(i,Gm(i),t)}var cG=Lmt;var Imt=Object.getOwnPropertySymbols,Omt=Imt?function(i){for(var t=[];i;)Vm(t,Gm(i)),i=Hm(i);return t}:wM,_M=Omt;function Nmt(i,t){return Hc(i,_M(i),t)}var uG=Nmt;function Bmt(i,t,e){var n=t(i);return Di(i)?n:Vm(n,e(i))}var SM=Bmt;function Fmt(i){return SM(i,Wc,Gm)}var Oy=Fmt;function Umt(i){return SM(i,ul,_M)}var hG=Umt;var zmt=da(zs,"DataView"),CM=zmt;var Vmt=da(zs,"Promise"),MM=Vmt;var Hmt=da(zs,"Set"),md=Hmt;var dG="[object Map]",jmt="[object Object]",fG="[object Promise]",pG="[object Set]",gG="[object WeakMap]",mG="[object DataView]",Wmt=Lu(CM),$mt=Lu(ud),Gmt=Lu(MM),qmt=Lu(md),Ymt=Lu(lM),Yf=No;
vendor: 7,068 bytes, line 4706
4706(CM&&Yf(new CM(new ArrayBuffer(1)))!=mG||ud&&Yf(new ud)!=dG||MM&&Yf(MM.resolve())!=fG||md&&Yf(new md)!=pG||lM&&Yf(new lM)!=gG)&&(Yf=function(i){var t=No(i),e=t==jmt?i.constructor:void 0,n=e?Lu(e):"";if(n)switch(n){case Wmt:return mG;case $mt:return dG;case Gmt:return fG;case qmt:return pG;case Ymt:return gG}return t});var ql=Yf;var Xmt=Object.prototype,Kmt=Xmt.hasOwnProperty;function Jmt(i){var t=i.length,e=new i.constructor(t);return t&&typeof i[0]=="string"&&Kmt.call(i,"index")&&(e.index=i.index,e.input=i.input),e}var bG=Jmt;var Zmt=zs.Uint8Array,qm=Zmt;function Qmt(i){var t=new i.constructor(i.byteLength);return new qm(t).set(new qm(i)),t}var Ym=Qmt;function t0t(i,t){var e=t?Ym(i.buffer):i.buffer;return new i.constructor(e,i.byteOffset,i.byteLength)}var vG=t0t;var e0t=/\w*$/;function n0t(i){var t=new i.constructor(i.source,e0t.exec(i));return t.lastIndex=i.lastIndex,t}var yG=n0t;var xG=Ir?Ir.prototype:void 0,wG=xG?xG.valueOf:void 0;function i0t(i){return wG?Object(wG.call(i)):{}}var _G=i0t;function s0t(i,t){var e=t?Ym(i.buffer):i.buffer;return new i.constructor(e,i.byteOffset,i.length)}var TM=s0t;var r0t="[object Boolean]",o0t="[object Date]",a0t="[object Map]",l0t="[object Number]",c0t="[object RegExp]",u0t="[object Set]",h0t="[object String]",d0t="[object Symbol]",f0t="[object ArrayBuffer]",p0t="[object DataView]",g0t="[object Float32Array]",m0t="[object Float64Array]",b0t="[object Int8Array]",v0t="[object Int16Array]",y0t="[object Int32Array]",x0t="[object Uint8Array]",w0t="[object Uint8ClampedArray]",_0t="[object Uint16Array]",S0t="[object Uint32Array]";function C0t(i,t,e){var n=i.constructor;switch(t){case f0t:return Ym(i);case r0t:case o0t:return new n(+i);case p0t:return vG(i,e);case g0t:case m0t:case b0t:case v0t:case y0t:case x0t:case w0t:case _0t:case S0t:return TM(i,e);case a0t:return new n;case l0t:case h0t:return new n(i);case c0t:return yG(i);case u0t:return new n;case d0t:return _G(i)}}var SG=C0t;function M0t(i){return typeof i.constructor=="function"&&!od(i)?bW(Hm(i)):{}}var AM=M0t;var T0t="[object Map]";function A0t(i){return Zs(i)&&ql(i)==T0t}var CG=A0t;var MG=Iu&&Iu.isMap,E0t=MG?jc(MG):CG,TG=E0t;var k0t="[object Set]";function P0t(i){return Zs(i)&&ql(i)==k0t}var AG=P0t;var EG=Iu&&Iu.isSet,R0t=EG?jc(EG):AG,kG=R0t;var D0t=1,L0t=2,I0t=4,PG="[object Arguments]",O0t="[object Array]",N0t="[object Boolean]",B0t="[object Date]",F0t="[object Error]",RG="[object Function]",U0t="[object GeneratorFunction]",z0t="[object Map]",V0t="[object Number]",DG="[object Object]",H0t="[object RegExp]",j0t="[object Set]",W0t="[object String]",$0t="[object Symbol]",G0t="[object WeakMap]",q0t="[object ArrayBuffer]",Y0t="[object DataView]",X0t="[object Float32Array]",K0t="[object Float64Array]",J0t="[object Int8Array]",Z0t="[object Int16Array]",Q0t="[object Int32Array]",tbt="[object Uint8Array]",ebt="[object Uint8ClampedArray]",nbt="[object Uint16Array]",ibt="[object Uint32Array]",ls={};ls[PG]=ls[O0t]=ls[q0t]=ls[Y0t]=ls[N0t]=ls[B0t]=ls[X0t]=ls[K0t]=ls[J0t]=ls[Z0t]=ls[Q0t]=ls[z0t]=ls[V0t]=ls[DG]=ls[H0t]=ls[j0t]=ls[W0t]=ls[$0t]=ls[tbt]=ls[ebt]=ls[nbt]=ls[ibt]=!0;ls[F0t]=ls[RG]=ls[G0t]=!1;function EM(i,t,e,n,s,r){var o,a=t&D0t,l=t&L0t,c=t&I0t;if(e&&(o=s?e(i,n,s,r):e(i)),o!==void 0)return o;if(!ki(i))return i;var u=Di(i);if(u){if(o=bG(i),!a)return uM(i,o)}else{var h=ql(i),d=h==RG||h==U0t;if(Gl(i))return xM(i,a);if(h==DG||h==PG||d&&!s){if(o=l||d?{}:AM(i),!a)return l?uG(i,nG(o,i)):cG(i,eG(o,i))}else{if(!ls[h])return s?i:{};o=SG(i,h,a)}}r||(r=new Gc);var p=r.get(i);if(p)return p;r.set(i,o),kG(i)?i.forEach(function(x){o.add(EM(x,t,e,x,i,r))}):TG(i)&&i.forEach(function(x,w){o.set(w,EM(x,t,e,w,i,r))});var g=c?l?hG:Oy:l?ul:Wc,y=u?void 0:g(i);return _W(y||i,function(x,w){y&&(w=x,x=i[w]),Om(o,w,EM(x,t,e,w,i,r))}),o}var kM=EM;var sbt=4;function rbt(i){return kM(i,sbt)}var XL=rbt;var obt=1,abt=4;function lbt(i){return kM(i,obt|abt)}var KL=lbt;var cbt="__lodash_hash_undefined__";function ubt(i){return this.__data__.set(i,cbt),this}var LG=ubt;function hbt(i){return this.__data__.has(i)}var IG=hbt;function PM(i){var t=-1,e=i==null?0:i.length;for(this.__data__=new qf;++t<e;)this.add(i[t])}PM.prototype.add=PM.prototype.push=LG;PM.prototype.has=IG;var Xm=PM;function dbt(i,t){for(var e=-1,n=i==null?0:i.length;++e<n;)if(t(i[e],e,i))return!0;return!1}var OG=dbt;function fbt(i,t){return i.has(t)}var Km=fbt;var pbt=1,gbt=2;function mbt(i,t,e,n,s,r){var o=e&pbt,a=i.length,l=t.length;if(a!=l&&!(o&&l>a))return!1;var c=r.get(i),u=r.get(t);if(c&&u)return c==t&&u==i;var h=-1,d=!0,p=e&gbt?new Xm:void 0;for(r.set(i,t),r.set(t,i);++h<a;){var g=i[h],y=t[h];if(n)var x=o?n(y,g,h,t,i,r):n(g,y,h,i,t,r);if(x!==void 0){if(x)continue;d=!1;break}if(p){if(!OG(t,function(w,M){if(!Km(p,M)&&(g===w||s(g,w,e,n,r)))return p.push(M)})){d=!1;break}}else if(!(g===y||s(g,y,e,n,r))){d=!1;break}}return r.delete(i),r.delete(t),d}var RM=mbt;function bbt(i){var t=-1,e=Array(i.size);return i.forEach(function(n,s){e[++t]=[s,n]}),e}var NG=bbt;function vbt(i){var t=-1,e=Array(i.size);return i.forEach(function(n){e[++t]=n}),e}var Jm=vbt;var ybt=1,xbt=2,wbt="[object Boolean]",_bt="[object Date]",Sbt="[object Error]",Cbt="[object Map]",Mbt="[object Number]",Tbt="[object RegExp]",Abt="[object Set]",Ebt="[object String]",kbt="[object Symbol]",Pbt="[object ArrayBuffer]",Rbt="[object DataView]",BG=Ir?Ir.prototype:void 0,JL=BG?BG.valueOf:void 0;function Dbt(i,t,e,n,s,r,o){switch(e){case Rbt:if(i.byteLength!=t.byteLength||i.byteOffset!=t.byteOffset)return!1;i=i.buffer,t=t.buffer;case Pbt:return!(i.byteLength!=t.byteLength||!r(new qm(i),new qm(t)));case wbt:case _bt:case Mbt:return ll(+i,+t);case Sbt:return i.name==t.name&&i.message==t.message;case Tbt:case Ebt:return i==t+"";case Cbt:var a=NG;case Abt:var l=n&ybt;if(a||(a=Jm),i.size!=t.size&&!l)return!1;var c=o.get(i);if(c)return c==t;n|=xbt,o.set(i,t);var u=RM(a(i),a(t),n,s,r,o);return o.delete(i),u;case kbt:if(JL)return JL.call(i)==JL.call(t)}return!1}var FG=Dbt;var Lbt=1,Ibt=Object.prototype,Obt=Ibt.hasOwnProperty;function Nbt(i,t,e,n,s,r){var o=e&Lbt,a=Oy(i),l=a.length,c=Oy(t),u=c.length;if(l!=u&&!o)return!1;for(var h=l;h--;){var d=a[h];if(!(o?d in t:Obt.call(t,d)))return!1}var p=r.get(i),g=r.get(t);if(p&&g)return p==t&&g==i;var y=!0;r.set(i,t),r.set(t,i);for(var x=o;++h<l;){d=a[h];var w=i[d],M=t[d];if(n)var A=o?n(M,w,d,t,i,r):n(w,M,d,i,t,r);if(!(A===void 0?w===M||s(w,M,e,n,r):A)){y=!1;break}x||(x=d=="constructor")}if(y&&!x){var C=i.constructor,R=t.constructor;C!=R&&"constructor"in i&&"constructor"in t&&!(typeof C=="function"&&C instanceof C&&typeof R=="function"&&R instanceof R)&&(y=!1)}return r.delete(i),r.delete(t),y}var UG=Nbt;var Bbt=1,zG="[object Arguments]",VG="[object Array]",DM="[object Object]",Fbt=Object.prototype,HG=Fbt.hasOwnProperty;function Ubt(i,t,e,n,s,r){var o=Di(i),a=Di(t),l=o?VG:ql(i),c=a?VG:ql(t);l=l==zG?DM:l,c=c==zG?DM:c;var u=l==DM,h=c==DM,d=l==c;if(d&&Gl(i)){if(!Gl(t))return!1;o=!0,u=!1}if(d&&!u)return r||(r=new Gc),o||ad(i)?RM(i,t,e,n,s,r):FG(i,t,l,e,n,s,r);if(!(e&Bbt)){var p=u&&HG.call(i,"__wrapped__"),g=h&&HG.call(t,"__wrapped__");
4706if(p||g){var y=p?i.value():i,x=g?t.value():t;return r||(r=new Gc),s(y,x,e,n,r)}}return d?(r||(r=new Gc),UG(i,t,e,n,s,r)):!1}var jG=Ubt;function WG(i,t,e,n,s){return i===t?!0:i==null||t==null||!Zs(i)&&!Zs(t)?i!==i&&t!==t:jG(i,t,e,n,WG,s)}var Zm=WG;var zbt=1,Vbt=2;function Hbt(i,t,e,n){var s=e.length,r=s,o=!n;if(i==null)return!r;for(i=Object(i);s--;){var a=e[s];if(o&&a[2]?a[1]!==i[a[0]]:!(a[0]in i))return!1}for(;++s<r;){a=e[s];var l=a[0],c=i[l],u=a[1];if(o&&a[2]){if(c===void 0&&!(l in i))return!1}else{var h=new Gc;if(n)var d=n(c,u,l,i,t,h);if(!(d===void 0?Zm(u,c,zbt|Vbt,n,h):d))return!1}}return!0}var $G=Hbt;function jbt(i){return i===i&&!ki(i)}var LM=jbt;function Wbt(i){for(var t=Wc(i),e=t.length;e--;){var n=t[e],s=i[n];t[e]=[n,s,LM(s)]}return t}var GG=Wbt;function $bt(i,t){return function(e){return e==null?!1:e[i]===t&&(t!==void 0||i in Object(e))}}var IM=$bt;function Gbt(i){var t=GG(i);return t.length==1&&t[0][2]?IM(t[0][0],t[0][1]):function(e){return e===i||$G(e,i,t)}}var qG=Gbt;function qbt(i,t){return i!=null&&t in Object(i)}var YG=qbt;function Ybt(i,t,e){t=dd(t,i);for(var n=-1,s=t.length,r=!1;++n<s;){var o=$c(t[n]);if(!(r=i!=null&&e(i,o)))break;i=i[o]}return r||++n!=s?r:(s=i==null?0:i.length,!!s&&Nm(s)&&sd(o,s)&&(Di(i)||$l(i)))}var OM=Ybt;function Xbt(i,t){return i!=null&&OM(i,t,YG)}var NM=Xbt;var Kbt=1,Jbt=2;function Zbt(i,t){return Bm(i)&&LM(t)?IM($c(i),t):function(e){var n=r$(e,i);return n===void 0&&n===t?NM(e,i):Zm(t,n,Kbt|Jbt)}}var XG=Zbt;function Qbt(i){return function(t){return t?.[i]}}var KG=Qbt;function tvt(i){return function(t){return fd(t,i)}}var JG=tvt;function evt(i){return Bm(i)?KG($c(i)):JG(i)}var ZG=evt;function nvt(i){return typeof i=="function"?i:i==null?al:typeof i=="object"?Di(i)?XG(i[0],i[1]):qG(i):ZG(i)}var Qm=nvt;function ivt(i,t,e,n){for(var s=-1,r=i==null?0:i.length;++s<r;){var o=i[s];t(n,o,e(o),i)}return n}var QG=ivt;function svt(i){return function(t,e,n){for(var s=-1,r=Object(t),o=n(t),a=o.length;a--;){var l=o[i?a:++s];if(e(r[l],l,r)===!1)break}return t}}var t9=svt;var rvt=t9(),BM=rvt;function ovt(i,t){return i&&BM(i,t,Wc)}var e9=ovt;function avt(i,t){return function(e,n){if(e==null)return e;if(!fa(e))return i(e,n);for(var s=e.length,r=t?s:-1,o=Object(e);(t?r--:++r<s)&&n(o[r],r,o)!==!1;);return e}}var n9=avt;var lvt=n9(e9),FM=lvt;function cvt(i,t,e,n){return FM(i,function(s,r,o){t(n,s,e(s),o)}),n}var i9=cvt;function uvt(i,t){return function(e,n){var s=Di(e)?QG:i9,r=t?t():{};return s(e,i,Qm(n,2),r)}}var s9=uvt;var hvt=function(){return zs.Date.now()},UM=hvt;var dvt="Expected a function",fvt=Math.max,pvt=Math.min;function gvt(i,t,e){var n,s,r,o,a,l,c=0,u=!1,h=!1,d=!0;if(typeof i!="function")throw new TypeError(dvt);t=$f(t)||0,ki(e)&&(u=!!e.leading,h="maxWait"in e,r=h?fvt($f(e.maxWait)||0,t):r,d="trailing"in e?!!e.trailing:d);function p(k){var O=n,I=s;return n=s=void 0,c=k,o=i.apply(I,O),o}function g(k){return c=k,a=setTimeout(w,t),u?p(k):o}function y(k){var O=k-l,I=k-c,U=t-O;return h?pvt(U,r-I):U}function x(k){var O=k-l,I=k-c;return l===void 0||O>=t||O<0||h&&I>=r}function w(){var k=UM();if(x(k))return M(k);a=setTimeout(w,y(k))}function M(k){return a=void 0,d&&n?p(k):(n=s=void 0,o)}function A(){a!==void 0&&clearTimeout(a),c=0,n=l=s=a=void 0}function C(){return a===void 0?o:M(UM())}function R(){var k=UM(),O=x(k);if(n=arguments,s=this,l=k,O){if(a===void 0)return g(l);if(h)return clearTimeout(a),a=setTimeout(w,t),p(l)}return a===void 0&&(a=setTimeout(w,t)),o}return R.cancel=A,R.flush=C,R}var t0=gvt;var r9=Object.prototype,mvt=r9.hasOwnProperty,bvt=cl(function(i,t){i=Object(i);var e=-1,n=t.length,s=n>2?t[2]:void 0;for(s&&Gf(t[0],t[1],s)&&(n=1);++e<n;)for(var r=t[e],o=ul(r),a=-1,l=o.length;++a<l;){var c=o[a],u=i[c];(u===void 0||ll(u,r9[c])&&!mvt.call(i,c))&&(i[c]=r[c])}return i}),ZL=bvt;function vvt(i,t,e){(e!==void 0&&!ll(i[t],e)||e===void 0&&!(t in i))&&rd(i,t,e)}var Ny=vvt;function yvt(i){return Zs(i)&&fa(i)}var Xf=yvt;function xvt(i,t){if(!(t==="constructor"&&typeof i[t]=="function")&&t!="__proto__")return i[t]}var By=xvt;function wvt(i){return Hc(i,ul(i))}var o9=wvt;function _vt(i,t,e,n,s,r,o){var a=By(i,e),l=By(t,e),c=o.get(l);if(c){Ny(i,e,c);return}var u=r?r(a,l,e+"",i,t,o):void 0,h=u===void 0;if(h){var d=Di(l),p=!d&&Gl(l),g=!d&&!p&&ad(l);u=l,d||p||g?Di(a)?u=a:Xf(a)?u=uM(a):p?(h=!1,u=xM(l,!0)):g?(h=!1,u=TM(l,!0)):u=[]:Iy(l)||$l(l)?(u=a,$l(a)?u=o9(a):(!ki(a)||Lm(a))&&(u=AM(l))):h=!1}h&&(o.set(l,u),s(u,l,n,r,o),o.delete(l)),Ny(i,e,u)}var a9=_vt;function l9(i,t,e,n,s){i!==t&&BM(t,function(r,o){if(s||(s=new Gc),ki(r))a9(i,t,o,e,l9,n,s);else{var a=n?n(By(i,o),r,o+"",i,t,s):void 0;a===void 0&&(a=r),Ny(i,o,a)}},ul)}var e0=l9;function c9(i,t,e,n,s,r){return ki(i)&&ki(t)&&(r.set(t,i),e0(i,t,void 0,c9,r),r.delete(t)),i}var u9=c9;var Svt=pM(function(i,t,e,n){e0(i,t,e,n)}),h9=Svt;var Cvt=cl(function(i){return i.push(void 0,u9),cM(h9,void 0,i)}),QL=Cvt;function Mvt(i,t,e){for(var n=-1,s=i==null?0:i.length;++n<s;)if(e(t,i[n]))return!0;return!1}var zM=Mvt;var Tvt=200;function Avt(i,t,e,n){var s=-1,r=dM,o=!0,a=i.length,l=[],c=t.length;if(!a)return l;e&&(t=id(t,jc(e))),n?(r=zM,o=!1):t.length>=Tvt&&(r=Km,o=!1,t=new Xm(t));t:for(;++s<a;){var u=i[s],h=e==null?u:e(u);if(u=n||u!==0?u:0,o&&h===h){for(var d=c;d--;
4706)if(t[d]===h)continue t;l.push(u)}else r(t,h,n)||l.push(u)}return l}var d9=Avt;var Evt=cl(function(i,t){return Xf(i)?d9(i,pd(t,1,Xf,!0)):[]}),tI=Evt;function kvt(i,t){var e=-1,n=fa(i)?Array(i.length):[];return FM(i,function(s,r,o){n[++e]=t(s,r,o)}),n}var f9=kvt;var Pvt=Object.prototype,Rvt=Pvt.hasOwnProperty,Dvt=s9(function(i,t,e){Rvt.call(i,e)?i[e].push(t):rd(i,e,[t])}),eI=Dvt;function Lvt(i,t){return i>t}var p9=Lvt;var Ivt=Object.prototype,Ovt=Ivt.hasOwnProperty;function Nvt(i,t){return i!=null&&Ovt.call(i,t)}var g9=Nvt;function Bvt(i,t){return i!=null&&OM(i,t,g9)}var nI=Bvt;var Fvt="[object Map]",Uvt="[object Set]",zvt=Object.prototype,Vvt=zvt.hasOwnProperty;function Hvt(i){if(i==null)return!0;if(fa(i)&&(Di(i)||typeof i=="string"||typeof i.splice=="function"||Gl(i)||ad(i)||$l(i)))return!i.length;var t=ql(i);if(t==Fvt||t==Uvt)return!i.size;if(od(i))return!bM(i).length;for(var e in i)if(Vvt.call(i,e))return!1;return!0}var iI=Hvt;function jvt(i,t){return Zm(i,t)}var sI=jvt;var Wvt="[object Number]";function $vt(i){return typeof i=="number"||Zs(i)&&No(i)==Wvt}var rI=$vt;var Gvt=gd(function(i,t,e){return i+(e?" ":"")+t.toLowerCase()}),Fy=Gvt;var qvt=yM("toLowerCase"),oI=qvt;function Yvt(i,t,e){for(var n=-1,s=i.length;++n<s;){var r=i[n],o=t(r);if(o!=null&&(a===void 0?o===o&&!Or(o):e(o,a)))var a=o,l=r}return l}var m9=Yvt;function Xvt(i){return i&&i.length?m9(i,al,p9):void 0}var aI=Xvt;var Kvt=pM(function(i,t,e){e0(i,t,e)}),lI=Kvt;function Jvt(i,t,e,n){if(!ki(i))return i;t=dd(t,i);for(var s=-1,r=t.length,o=r-1,a=i;a!=null&&++s<r;){var l=$c(t[s]),c=e;if(l==="__proto__"||l==="constructor"||l==="prototype")return i;if(s!=o){var u=a[l];c=n?n(u,l,a):void 0,c===void 0&&(c=ki(u)?u:sd(t[s+1])?[]:{})}Om(a,l,c),a=a[l]}return i}var b9=Jvt;function Zvt(i,t,e){for(var n=-1,s=t.length,r={};++n<s;){var o=t[n],a=fd(i,o);e(a,o)&&b9(r,dd(o,i),a)}return r}var v9=Zvt;function Qvt(i,t){var e=i.length;for(i.sort(t);e--;)i[e]=i[e].value;return i}var y9=Qvt;function tyt(i,t){if(i!==t){var e=i!==void 0,n=i===null,s=i===i,r=Or(i),o=t!==void 0,a=t===null,l=t===t,c=Or(t);if(!a&&!c&&!r&&i>t||r&&o&&l&&!a&&!c||n&&o&&l||!e&&l||!s)return 1;if(!n&&!r&&!c&&i<t||c&&e&&s&&!n&&!r||a&&e&&s||!o&&s||!l)return-1}return 0}var x9=tyt;function eyt(i,t,e){for(var n=-1,s=i.criteria,r=t.criteria,o=s.length,a=e.length;++n<o;){var l=x9(s[n],r[n]);if(l){if(n>=a)return l;var c=e[n];return l*(c=="desc"?-1:1)}}return i.index-t.index}var w9=eyt;function nyt(i,t,e){t.length?t=id(t,function(r){return Di(r)?function(o){return fd(o,r.length===1?r[0]:r)}:r}):t=[al];var n=-1;t=id(t,jc(Qm));var s=f9(i,function(r,o,a){var l=id(t,function(c){return c(r)});return{criteria:l,index:++n,value:r}});return y9(s,function(r,o){return w9(r,o,e)})}var _9=nyt;function iyt(i,t){return v9(i,t,function(e,n){return NM(i,n)})}var S9=iyt;var syt=u$(function(i,t){return i==null?{}:S9(i,t)}),cI=syt;var ryt=cl(function(i,t){if(i==null)return[];var e=t.length;return e>1&&Gf(i,t[0],t[1])?t=[]:e>2&&Gf(t[0],t[1],t[2])&&(t=[t[0]]),_9(i,pd(t,1),[])}),uI=ryt;var oyt=4294967295,ayt=oyt-1,lyt=Math.floor,cyt=Math.min;function uyt(i,t,e,n){var s=0,r=i==null?0:i.length;if(r===0)return 0;t=e(t);for(var o=t!==t,a=t===null,l=Or(t),c=t===void 0;s<r;){var u=lyt((s+r)/2),h=e(i[u]),d=h!==void 0,p=h===null,g=h===h,y=Or(h);if(o)var x=n||g;else c?x=g&&(n||d):a?x=g&&d&&(n||!p):l?x=g&&d&&!p&&(n||!y):p||y?x=!1:x=n?h<=t:h<t;x?s=u+1:r=u}return cyt(r,ayt)}var VM=uyt;var hyt=4294967295,dyt=hyt>>>1;function fyt(i,t,e){var n=0,s=i==null?n:i.length;if(typeof t=="number"&&t===t&&s<=dyt){for(;n<s;){var r=n+s>>>1,o=i[r];o!==null&&!Or(o)&&(e?o<=t:o<t)?n=r+1:s=r}return s}return VM(i,t,al,e)}var C9=fyt;function pyt(i,t){return C9(i,t)}var hI=pyt;function gyt(i,t,e){return VM(i,t,Qm(e,2))}var dI=gyt;var myt=gd(function(i,t,e){return i+(e?" ":"")+Nu(t)}),HM=myt;var byt="Expected a function";function vyt(i,t,e){var n=!0,s=!0;if(typeof i!="function")throw new TypeError(byt);return ki(e)&&(n="leading"in e?!!e.leading:n,s="trailing"in e?!!e.trailing:s),t0(i,t,{leading:n,maxWait:t,trailing:s})}var jM=vyt;var yyt=1/0,xyt=md&&1/Jm(new md([,-0]))[1]==yyt?function(i){return new md(i)}:vW,M9=xyt;var wyt=200;function _yt(i,t,e){var n=-1,s=dM,r=i.length,o=!0,a=[],l=a;if(e)o=!1,s=zM;else if(r>=wyt){var c=t?null:M9(i);if(c)return Jm(c);o=!1,s=Km,l=new Xm}else l=t?[]:a;t:for(;++n<r;){var u=i[n],h=t?t(u):u;if(u=e||u!==0?u:0,o&&h===h){for(var d=l.length;d--;)if(l[d]===h)continue t;t&&l.push(h),a.push(u)}else s(l,h,e)||(l!==a&&l.push(h),a.push(u))}return a}var WM=_yt;var Syt=cl(function(i){return WM(pd(i,1,Xf,!0))}),fI=Syt;function Cyt(i){return i&&i.length?WM(i):[]}var pI=Cyt;var Myt=0;function Tyt(i){var t=++Myt;return hl(i)+t}var gI=Tyt;var Ayt=gd(function(i,t,e){return i+(e?" ":"")+t.toUpperCase()}),mI=Ayt;var dn={};Le(dn,{clamp:()=>YL,isNumber:()=>rI,isPercentage:()=>T9,mod:()=>Eyt,normalizePercentage:()=>Pyt,normalizeSides:()=>Dyt,parseCssNumeric:()=>Ryt,random:()=>kyt});function Eyt(i,t){return(i%t+t)%t}function kyt(i,t){if(t==null)t=i??1,i=0;else if(t<i){let e=i;i=t,t=e}return Math.floor(Math.random()*(t-i+1)+i)}function T9(i){return typeof i=="string"&&i.slice(-1)==="%"}function Pyt(i,t){if(i==null)return 0;let e;if(typeof i=="string"){if(e=parseFloat(i),T9(i)&&(e/=100,Number.isFinite(e)))return e*t}else e=i;return Number.isFinite(e)?e>0&&e<1?e*t:e:0}function Ryt(i,t){function e(o){let a=new RegExp(`(?:\\d+(?:\\.\\d+)*)(${o})$`).exec(i);return a?a[1]:null}let n=parseFloat(i);if(Number.isNaN(n))return null;let s;if(t==null)s="[A-Za-z]*";else if(Array.isArray(t)){if(t.length===0)return null;s=t.join("|")}else typeof t=="string"&&(s=t);let r=e(s);return r===null?null:{unit:r,value:n}}function Dyt(i){if(typeof i=="object"){let e=0,n=0,s=0,r=0;return i.vertical!=null&&Number.isFinite(i.vertical)&&(n=r=i.vertical),i.horizontal!=null&&Number.isFinite(i.horizontal)&&(s=e=i.horizontal),i.left!=null&&Number.isFinite(i.left)&&(e=i.left),i.top!=null&&Number.isFinite(i.top)&&(n=i.top),i.right!=null&&Number.isFinite(i.right)&&(s=i.right),i.bottom!=null&&Number.isFinite(i.bottom)&&(r=i.bottom),{top:n,r
4706ight:s,bottom:r,left:e}}let t=0;return i!=null&&Number.isFinite(i)&&(t=i),{top:t,right:t,bottom:t,left:t}}var us={};Le(us,{clean:()=>Xyt,ensure:()=>Yyt});var A9=!1,Iyt=!1,Oyt=!1,E9=!1,Nyt=!1,k9=!1,Byt=!1,Fyt=!1,Uyt=!1,zyt=!1,Vyt=!1,P9=!1,Hyt=!1,jyt=!1,Wyt=!1,R9=!1;if(typeof navigator=="object"){let i=navigator.userAgent;A9=i.indexOf("Macintosh")>=0,Iyt=!!i.match(/(iPad|iPhone|iPod)/g),Oyt=i.indexOf("Windows")>=0,E9=i.indexOf("MSIE")>=0,Nyt=!!i.match(/Trident\/7\./),k9=!!i.match(/Edge\//),Byt=i.indexOf("Mozilla/")>=0&&i.indexOf("MSIE")<0&&i.indexOf("Edge/")<0,Uyt=i.indexOf("Chrome/")>=0&&i.indexOf("Edge/")<0,zyt=i.indexOf("Opera/")>=0||i.indexOf("OPR/")>=0,Vyt=i.indexOf("Firefox/")>=0,P9=i.indexOf("AppleWebKit/")>=0&&i.indexOf("Chrome/")<0&&i.indexOf("Edge/")<0,typeof document=="object"&&(R9=!document.createElementNS||`${document.createElementNS("http://www.w3.org/2000/svg","foreignObject")}`!="[object SVGForeignObjectElement]"||i.indexOf("Opera/")>=0)}typeof window=="object"&&(Fyt=window.chrome!=null&&window.chrome.app!=null&&window.chrome.app.runtime!=null,jyt=window.PointerEvent!=null&&!A9);if(typeof document=="object"){Hyt="ontouchstart"in document.documentElement;try{let i=Object.defineProperty({},"passive",{get(){Wyt=!0}}),t=document.createElement("div");t.addEventListener&&t.addEventListener("click",()=>{},i)}catch{}}var bI=E9;var vI=k9;var D9=P9;var $yt=R9,L9=!$yt;function Gyt(){let i=window.module;return i!=null&&i.hot!=null&&i.hot.status!=null?i.hot.status():"unkonwn"}function $M(){return Gyt()==="apply"}var qyt={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};function I9(i){let t=document.createElement(qyt[i]||"div"),e=`on${i}`,n=e in t;return n||(t.setAttribute(e,"return;"),n=typeof t[e]=="function"),n}var Uy=[];function Yyt(i,t){let e=Uy.find(n=>n.name===i);if(!(e&&(e.loadTimes+=1,e.loadTimes>1))&&!$M()){let n=document.createElement("style");n.setAttribute("type","text/css"),n.textContent=t;let s=document.querySelector("head");s&&s.insertBefore(n,s.firstChild),Uy.push({name:i,loadTimes:1,styleElement:n})}}function Xyt(i){let t=Uy.findIndex(e=>e.name===i);if(t>-1){let e=Uy[t];if(e.loadTimes-=1,e.loadTimes>0)return;let n=e.styleElement;n&&n.parentNode&&n.parentNode.removeChild(n),n=null,Uy.splice(t,1)}}var bd={};Le(bd,{dataUriToBlob:()=>B9,downloadBlob:()=>F9,downloadDataUri:()=>Zyt,imageToDataUri:()=>Jyt,isDataUrl:()=>N9,svgToDataUrl:()=>Qyt});function Kyt(i){let t=i.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return t&&t[2]?t[2].replace(/\s+/," ").split(" "):null}function O9(i){let t=parseFloat(i);return Number.isNaN(t)?null:t}function N9(i){let t="data:";return i.substr(0,t.length)===t}function Jyt(i,t){if(!i||N9(i)){setTimeout(()=>t(null,i));return}let e=()=>{t(new Error(`Failed to load image: ${i}`))},n=window.FileReader?r=>{if(r.status===200){let o=new FileReader;o.onload=a=>{let l=a.target.result;t(null,l)},o.onerror=e,o.readAsDataURL(r.response)}else e()}:r=>{let o=a=>{let c=[];for(let u=0;u<a.length;u+=32768)c.push(String.fromCharCode.apply(null,a.subarray(u,u+32768)));return c.join("")};if(r.status===200){let a=i.split(".").pop()||"png";a==="svg"&&(a="svg+xml");let l=`data:image/${a};base64,`,c=new Uint8Array(r.response),u=l+btoa(o(c));t(null,u)}else e()},s=new XMLHttpRequest;s.responseType=window.FileReader?"blob":"arraybuffer",s.open("GET",i,!0),s.addEventListener("error",e),s.addEventListener("load",()=>n(s)),s.send()}function B9(i){let t=i.replace(/\s/g,"");t=decodeURIComponent(t);let e=t.indexOf(","),n=t.slice(0,e),s=n.split(":")[1].split(";")[0],r=t.slice(e+1),o;n.indexOf("base64")>=0?o=atob(r):o=unescape(encodeURIComponent(r));let a=new Uint8Array(o.length);for(let l=0;l<o.length;l+=1)a[l]=o.charCodeAt(l);return new Blob([a],{type:s})}function F9(i,t){let e=window.navigator.msSaveBlob;if(e)e(i,t);else{let n=window.URL.createObjectURL(i),s=document.createElement("a");s.href=n,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(n)}}function Zyt(i,t){let e=B9(i);F9(e,t)}function Qyt(i,t={}){let e=null,n=u=>(e==null&&(e=Kyt(i)),e!=null?O9(e[u]):null),s=u=>{let h=i.match(u);return h&&h[2]?O9(h[2]):null},r=t.width;if(r==null&&(r=s(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i)),r==null&&(r=n(2)),r==null)throw new Error("Can not parse width from svg string");let o=t.height;if(o==null&&(o=s(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i)),o==null&&(o=n(3)),o==null)throw new Error("Can not parse height from svg string");return`data:image/svg+xml,${encodeURIComponent(i).replace(/'/g,"%27").replace(/"/g,"%22")}`}var ke={};Le(ke,{apply:()=>zy,call:()=>z9,debounce:()=>t0,isAsync:()=>GM,isAsyncLike:()=>yI,throttle:()=>jM,toAsyncBoolean:()=>Kf,toDeferredBoolean:()=>U9});function yI(i){return typeof i=="object"&&i.then&&typeof i.then=="function"}function GM(i){return i!=null&&(i instanceof Promise||yI(i))}function Kf(...i){let t=[];if(i.forEach(n=>{Array.isArray(n)?t.push(...n):t.push(n)}),t.some(n=>GM(n))){let n=t.map(s=>GM(s)?s:Promise.resolve(s!==!1));return Promise.all(n).then(s=>s.reduce((r,o)=>o!==!1&&r,!0))}return t.every(n=>n!==!1)}
4706function U9(...i){let t=Kf(i);return typeof t=="boolean"?Promise.resolve(t):t}function zy(i,t,e){if(e)switch(e.length){case 0:return i.call(t);case 1:return i.call(t,e[0]);case 2:return i.call(t,e[0],e[1]);case 3:return i.call(t,e[0],e[1],e[2]);case 4:return i.call(t,e[0],e[1],e[2],e[3]);case 5:return i.call(t,e[0],e[1],e[2],e[3],e[4]);case 6:return i.call(t,e[0],e[1],e[2],e[3],e[4],e[5]);default:return i.apply(t,e)}return i.call(t)}function z9(i,t,...e){return zy(i,t,e)}var ei={};Le(ei,{bbox:()=>gwt,findShapeNode:()=>O7,getBBox:()=>h0,getBBoxV2:()=>bwt,getBoundingOffsetRect:()=>dO,normalizeMarker:()=>dwt,toGeometryShape:()=>I7,transformLine:()=>fwt,transformPoint:()=>fT,transformPolyline:()=>pwt,transformRectangle:()=>hO,translateAndAutoOrient:()=>mwt});function xI(i){return 180*i/Math.PI%360}var bs=function(i,t=!1){return(t?i:i%360)*Math.PI/180};function Ts(i){return i%360+(i<0?360:0)}function qc(i,t=0){return Number.isInteger(i)?i:+i.toFixed(t)}function _I(i,t){let e,n;if(t==null?(n=i??1,e=0):(n=t,e=i??0),n<e){let s=e;e=n,n=s}return Math.floor(Math.random()*(n-e+1)+e)}function Jf(i,t,e){return Number.isNaN(i)?NaN:Number.isNaN(t)||Number.isNaN(e)?0:t<e?i<t?t:i>e?e:i:i<e?e:i>t?t:i}function fo(i,t){return t*Math.round(i/t)}function qM(i,t){return t!=null&&i!=null&&t.x>=i.x&&t.x<=i.x+i.width&&t.y>=i.y&&t.y<=i.y+i.height}function SI(i,t){let e=i.x-t.x,n=i.y-t.y;return e*e+n*n}var Nr=class{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}};var Mt=class i extends Nr{static create(t,e){return t==null||typeof t=="number"?new i(t,e):i.clone(t)}static clone(t){return i.isPoint(t)?new i(t.x,t.y):Array.isArray(t)?new i(t[0],t[1]):new i(t.x,t.y)}static equals(t,e){return t===e?!0:t!=null&&e!=null?t.x===e.x&&t.y===e.y:!1}static rotateEx(t,e,n,s=new i){let r=i.clone(t),o=i.clone(s),a=r.x-o.x,l=r.y-o.y,c=a*e-l*n,u=l*e+a*n;return new i(c+o.x,u+o.y)}static toJSON(t){return i.isPoint(t)?{x:t.x,y:t.y}:Array.isArray(t)?{x:t[0],y:t[1]}:{x:t.x,y:t.y}}static fromPolar(t,e,n=new i){let s=Math.abs(t*Math.cos(e)),r=Math.abs(t*Math.sin(e)),o=i.clone(n),a=Ts(xI(e));return a<90?r=-r:a<180?(s=-s,r=-r):a<270&&(s=-s),new i(o.x+s,o.y+r)}static toPolar(t,e=new i){let n=i.clone(t),s=i.clone(e),r=n.x-s.x,o=n.y-s.y;return new i(Math.sqrt(r*r+o*o),bs(s.theta(n)))}static equalPoints(t,e){if(t==null&&e!=null||t!=null&&e==null||t!=null&&e!=null&&t.length!==e.length)return!1;if(t!=null&&e!=null){for(let n=0,s=t.length;n<s;n+=1)if(!i.equals(t[n],e[n]))return!1}return!0}static random(t,e,n,s){return new i(_I(t,e),_I(n,s))}static rotate(t,e,n){let s=bs(Ts(-e)),r=Math.sin(s),o=Math.cos(s);return i.rotateEx(t,o,r,n)}static isPoint(t){return t!=null&&t instanceof i}static isPointLike(t){return t!=null&&typeof t=="object"&&typeof t.x=="number"&&typeof t.y=="number"}static isPointData(t){return t!=null&&Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}constructor(t,e){super(),this.x=t??0,this.y=e??0}round(t=0){return this.x=qc(this.x,t),this.y=qc(this.y,t),this}add(t,e){let n=i.create(t,e);return this.x+=n.x,this.y+=n.y,this}update(t,e){let n=i.create(t,e);return this.x=n.x,this.y=n.y,this}translate(t,e){let n=i.create(t,e);return this.x+=n.x,this.y+=n.y,this}rotate(t,e){let n=i.rotate(this,t,e);return this.x=n.x,this.y=n.y,this}scale(t,e,n=new i){let s=i.create(n);return this.x=s.x+t*(this.x-s.x),this.y=s.y+e*(this.y-s.y),this}closest(t){if(t.length===1)return i.create(t[0]);let e=null,n=1/0;return t.forEach(s=>{let r=this.squaredDistance(s);r<n&&(e=s,n=r)}),e?i.create(e):null}distance(t){return Math.sqrt(this.squaredDistance(t))}squaredDistance(t){let e=i.create(t),n=this.x-e.x,s=this.y-e.y;return n*n+s*s}manhattanDistance(t){let e=i.create(t);return Math.abs(e.x-this.x)+Math.abs(e.y-this.y)}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y)||.01}theta(t=new i){let e=i.create(t),n=-(e.y-this.y),s=e.x-this.x,r=Math.atan2(n,s);return r<0&&(r=2*Math.PI+r),180*r/Math.PI}angleBetween(t,e){if(this.equals(t)||this.equals(e))return NaN;let n=this.theta(e)-this.theta(t);return n<0&&(n+=360),n}vectorAngle(t){return new i(0,0).angleBetween(this,t)}toPolar(t){return this.update(i.toPolar(this,t)),this}changeInAngle(t,e,n=new i){return this.clone().translate(-t,-e).theta(n)-this.theta(n)}adhereToRect(t){return qM(t,this)||(this.x=Math.min(Math.max(this.x,t.x),t.x+t.width),this.y=Math.min(Math.max(this.y,t.y),t.y+t.height)),this}bearing(t){let e=i.create(t),n=bs(this.y),s=bs(e.y),r=this.x,o=e.x,a=bs(o-r),l=Math.sin(a)*Math.cos(s),c=Math.cos(n)*Math.sin(s)-Math.sin(n)*Math.cos(s)*Math.cos(a),u=xI(Math.atan2(l,c)),h=["NE","E","SE","S","SW","W","NW","N"],d=u-22.5;return d<0&&(d+=360),d=parseInt(d/45,10),h[d]}cross(t,e){if(t!=null&&e!=null){let n=i.create(t),s=i.create(e);return(s.x-this.x)*(n.y-this.y)-(s.y-this.y)*(n.x-this.x)}return NaN}dot(t){let e=i.create(t);return this.x*e.x+this.y*e.y}diff(t,e){if(typeof t=="number")return new i(this.x-t,this.y-e);let n=i.create(t);return new i(this.x-n.x,this.y-n.y)}lerp(t,e){let n=i.create(t);return new i((1-e)*this.x+e*n.x,(1-e)*this.y+e*n.y)}normalize(t=1){let e=t/this.magnitude();return this.scale(e,e)}move(t,e){let n=i.create(t),s=bs(n.theta(this));return this.translate(Math.cos(s)*e,-Math.sin(s)*e)}reflection(t){return i.create(t).move(this,this.distance(t))}
4706snapToGrid(t,e){return this.x=fo(this.x,t),this.y=fo(this.y,e??t),this}equals(t){let e=i.create(t);return e!=null&&e.x===this.x&&e.y===this.y}clone(){return i.clone(this)}toJSON(){return i.toJSON(this)}serialize(){return`${this.x} ${this.y}`}};var Pe=class i extends Nr{static isRectangle(t){return t!=null&&t instanceof i}static isRectangleLike(t){return t!=null&&typeof t=="object"&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.width=="number"&&typeof t.height=="number"}static create(t,e,n,s){return t==null||typeof t=="number"?new i(t,e,n,s):i.clone(t)}static clone(t){return i.isRectangle(t)?t.clone():Array.isArray(t)?new i(t[0],t[1],t[2],t[3]):new i(t.x,t.y,t.width,t.height)}static fromEllipse(t){return new i(t.x-t.a,t.y-t.b,2*t.a,2*t.b)}static fromSize(t){return new i(0,0,t.width,t.height)}static fromPositionAndSize(t,e){return new i(t.x,t.y,e.width,e.height)}get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get origin(){return new Mt(this.x,this.y)}get topLeft(){return new Mt(this.x,this.y)}get topCenter(){return new Mt(this.x+this.width/2,this.y)}get topRight(){return new Mt(this.x+this.width,this.y)}get center(){return new Mt(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new Mt(this.x,this.y+this.height)}get bottomCenter(){return new Mt(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new Mt(this.x+this.width,this.y+this.height)}get corner(){return new Mt(this.x+this.width,this.y+this.height)}get rightMiddle(){return new Mt(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new Mt(this.x,this.y+this.height/2)}get topLine(){return new Qe(this.topLeft,this.topRight)}get rightLine(){return new Qe(this.topRight,this.bottomRight)}get bottomLine(){return new Qe(this.bottomLeft,this.bottomRight)}get leftLine(){return new Qe(this.topLeft,this.bottomLeft)}constructor(t,e,n,s){super(),this.x=t??0,this.y=e??0,this.width=n??0,this.height=s??0}getOrigin(){return this.origin}getTopLeft(){return this.topLeft}getTopCenter(){return this.topCenter}getTopRight(){return this.topRight}getCenter(){return this.center}getCenterX(){return this.x+this.width/2}getCenterY(){return this.y+this.height/2}getBottomLeft(){return this.bottomLeft}getBottomCenter(){return this.bottomCenter}getBottomRight(){return this.bottomRight}getCorner(){return this.corner}getRightMiddle(){return this.rightMiddle}getLeftMiddle(){return this.leftMiddle}getTopLine(){return this.topLine}getRightLine(){return this.rightLine}getBottomLine(){return this.bottomLine}getLeftLine(){return this.leftLine}bbox(t){if(!t)return this.clone();let e=bs(t),n=Math.abs(Math.sin(e)),s=Math.abs(Math.cos(e)),r=this.width*s+this.height*n,o=this.width*n+this.height*s;return new i(this.x+(this.width-r)/2,this.y+(this.height-o)/2,r,o)}round(t=0){return this.x=qc(this.x,t),this.y=qc(this.y,t),this.width=qc(this.width,t),this.height=qc(this.height,t),this}add(t,e,n,s){let r=i.create(t,e,n,s),o=Math.min(this.x,r.x),a=Math.min(this.y,r.y),l=Math.max(this.x+this.width,r.x+r.width),c=Math.max(this.y+this.height,r.y+r.height);return this.x=o,this.y=a,this.width=l-o,this.height=c-a,this}update(t,e,n,s){let r=i.create(t,e,n,s);return this.x=r.x,this.y=r.y,this.width=r.width,this.height=r.height,this}inflate(t,e){let n=t,s=e??t;return this.x-=n,this.y-=s,this.width+=2*n,this.height+=2*s,this}
4706snapToGrid(t,e){let n=this.origin.snapToGrid(t,e),s=this.corner.snapToGrid(t,e);return this.x=n.x,this.y=n.y,this.width=s.x-n.x,this.height=s.y-n.y,this}translate(t,e){let n=Mt.create(t,e);return this.x+=n.x,this.y+=n.y,this}scale(t,e,n=new Mt){let s=this.origin.scale(t,e,n);return this.x=s.x,this.y=s.y,this.width*=t,this.height*=e,this}rotate(t,e=this.getCenter()){if(t!==0){let n=bs(t),s=Math.cos(n),r=Math.sin(n),o=this.getOrigin(),a=this.getTopRight(),l=this.getBottomRight(),c=this.getBottomLeft();o=Mt.rotateEx(o,s,r,e),a=Mt.rotateEx(a,s,r,e),l=Mt.rotateEx(l,s,r,e),c=Mt.rotateEx(c,s,r,e);let u=new i(o.x,o.y,0,0);u.add(a.x,a.y,0,0),u.add(l.x,l.y,0,0),u.add(c.x,c.y,0,0),this.update(u)}return this}rotate90(){let t=(this.width-this.height)/2;this.x+=t,this.y-=t;let e=this.width;return this.width=this.height,this.height=e,this}moveAndExpand(t){let e=i.clone(t);return this.x+=e.x||0,this.y+=e.y||0,this.width+=e.width||0,this.height+=e.height||0,this}getMaxScaleToFit(t,e=this.center){let n=i.clone(t),s=e.x,r=e.y,o=1/0,a=1/0,l=1/0,c=1/0,u=1/0,h=1/0,d=1/0,p=1/0,g=n.topLeft;g.x<s&&(o=(this.x-s)/(g.x-s)),g.y<r&&(u=(this.y-r)/(g.y-r));let y=n.bottomRight;y.x>s&&(a=(this.x+this.width-s)/(y.x-s)),y.y>r&&(h=(this.y+this.height-r)/(y.y-r));let x=n.topRight;x.x>s&&(l=(this.x+this.width-s)/(x.x-s)),x.y<r&&(d=(this.y-r)/(x.y-r));let w=n.bottomLeft;return w.x<s&&(c=(this.x-s)/(w.x-s)),w.y>r&&(p=(this.y+this.height-r)/(w.y-r)),{sx:Math.min(o,a,l,c),sy:Math.min(u,h,d,p)}}getMaxUniformScaleToFit(t,e=this.center){let n=this.getMaxScaleToFit(t,e);return Math.min(n.sx,n.sy)}containsPoint(t,e){return qM(this,Mt.create(t,e))}containsRect(t,e,n,s){let r=i.create(t,e,n,s),o=this.x,a=this.y,l=this.width,c=this.height,u=r.x,h=r.y,d=r.width,p=r.height;return l===0||c===0||d===0||p===0?!1:u>=o&&h>=a&&u+d<=o+l&&h+p<=a+c}intersectsWithLine(t){let e=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],n=[],s=[];return e.forEach(r=>{let o=t.intersectsWithLine(r);o!==null&&s.indexOf(o.toString())<0&&(n.push(o),s.push(o.toString()))}),n.length>0?n:null}intersectsWithLineFromCenterToPoint(t,e){let n=Mt.clone(t),s=this.center,r=null;e!=null&&e!==0&&n.rotate(e,s);let o=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],a=new Qe(s,n);for(let l=o.length-1;l>=0;l-=1){let c=o[l].intersectsWithLine(a);if(c!==null){r=c;break}}return r&&e!=null&&e!==0&&r.rotate(-e,s),r}intersectsWithRect(t,e,n,s){let r=i.create(t,e,n,s);if(!this.isIntersectWithRect(r))return null;let o=this.origin,a=this.corner,l=r.origin,c=r.corner,u=Math.max(o.x,l.x),h=Math.max(o.y,l.y);return new i(u,h,Math.min(a.x,c.x)-u,Math.min(a.y,c.y)-h)}isIntersectWithRect(t,e,n,s){let r=i.create(t,e,n,s),o=this.origin,a=this.corner,l=r.origin,c=r.corner;return!(c.x<=o.x||c.y<=o.y||l.x>=a.x||l.y>=a.y)}normalize(){let t=this.x,e=this.y,n=this.width,s=this.height;return this.width<0&&(t=this.x+this.width,n=-this.width),this.height<0&&(e=this.y+this.height,s=-this.height),this.x=t,this.y=e,this.width=n,this.height=s,this}union(t){let e=i.clone(t),n=this.origin,s=this.corner,r=e.origin,o=e.corner,a=Math.min(n.x,r.x),l=Math.min(n.y,r.y),c=Math.max(s.x,o.x),u=Math.max(s.y,o.y);return new i(a,l,c-a,u-l)}getNearestSideToPoint(t){let e=Mt.clone(t),n=e.x-this.x,s=this.x+this.width-e.x,r=e.y-this.y,o=this.y+this.height-e.y,a=n,l="left";return s<a&&(a=s,l="right"),r<a&&(a=r,l="top"),o<a&&(l="bottom"),l}getNearestPointToPoint(t){let e=Mt.clone(t);if(this.containsPoint(e)){let n=this.getNearestSideToPoint(e);if(n==="left")return new Mt(this.x,e.y);if(n==="top")return new Mt(e.x,this.y);if(n==="right")return new Mt(this.x+this.width,e.y);if(n==="bottom")return new Mt(e.x,this.y+this.height)}return e.adhereToRect(this)}equals(t){return t!=null&&t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height}clone(){return new i(this.x,this.y,this.width,this.height)}toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height}}serialize(){return`${this.x} ${this.y} ${this.width} ${this.height}`}};var Qe=class i extends Nr{static isLine(t){return t!=null&&t instanceof i}get center(){return new Mt((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}constructor(t,e,n,s){super(),typeof t=="number"&&typeof e=="number"?(this.start=new Mt(t,e),this.end=new Mt(n,s)):(this.start=Mt.create(t),this.end=Mt.create(e))}getCenter(){return this.center}round(t=0){return this.start.round(t),this.end.round(t),this}translate(t,e){return typeof t=="number"?(this.start.translate(t,e),this.end.translate(t,e)):(this.start.translate(t),this.end.translate(t)),this}rotate(t,e){return this.start.rotate(t,e),this.end.rotate(t,e),this}scale(t,e,n){return this.start.scale(t,e,n),this.end.scale(t,e,n),this}length(){return Math.sqrt(this.squaredLength())}squaredLength(){let t=this.start.x-this.end.x,e=this.start.y-this.end.y;return t*t+e*e}setLength(t){let e=this.length();if(!e)return this;let n=t/e;return this.scale(n,n,this.start)}parallel(t){let e=this.clone();if(!e.isDifferentiable())return e;let{start:n,end:s}=e,r=n.clone().rotate(270,s),o=s.clone().rotate(90,n);return n.move(o,t),s.move(r,t),e}vector(){return new Mt(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){let t=new Mt(this.start.x+1,this.start.y);return this.start.angleBetween(this.end,t)}bbox(){let t=Math.min(this.start.x,this.end.x),e=Math.min(this.start.y,this.end.y),n=Math.max(this.start.x,this.end.x),s=Math.max(this.start.y,this.end.y);return new Pe(t,e,n-t,s-e)}bearing(){return this.start.bearing(this.end)}closestPoint(t){return this.pointAt(this.closestPointNormalizedLength(t))}closestPointLength(t){return this.closestPointNormalizedLength(t)*this.length()}closestPointTangent(t){return this.tangentAt(this.closestPointNormalizedLength(t))}closestPointNormalizedLength(t){let e=this.vector().dot(new i(this.start,t).vector()),n=Math.min(1,Math.max(0,e/this.squaredLength()));return Number.isNaN(n)?0:n}pointAt(t){let e=this.start,n=this.end;return t<=0?e.clone():t>=1?n.clone():e.lerp(n,t)}pointAtLength(t){let e=this.start,n=this.end,s=!0;t<0&&(s=!1,t=-t);let r=this.length();if(t>=r)return s?n.clone():e.clone();let o=(s?t:r-t)/r;return this.pointAt(o)}divideAt(t){let e=this.pointAt(t);return[new i(this.start,e),new i(e,this.end)]}divideAtLength(t){let e=this.pointAtLength(t);return[new i(this.start,e),new i(e,this.end)]}containsPoint(t){let e=this.start,n=this.end;if(e.cross(t,n)!==0)return!1;let s=this.length();return!(new i(e,t).length()>s||new i(t,n).length()>s)}intersect(t,e){let n=t.intersectsWithLine(this,e);return n?Array.isArray(n)?n:[n]:null}intersectsWithLine(t){let e=new Mt(this.end.x-this.start.x,this.end.y-this.start.y),n=new Mt(t.end.x-t.start.x,t.end.y-t.start.y),s=e.x*n.y-e.y*n.x,r=new Mt(t.start.x-this.start.x,t.start.y-this.start.y),o=r.x*n.y-r.y*n.x,a=r.x*e.y-r.y*e.x;if(s===0||o*s<0||a*s<0)return null;if(s>0){if(o>s||a>s)return null}else if(o<s||a<s)return null;return new Mt(this.start.x+o*e.x/s,this.start.y+o*e.y/s)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(t){let e=Mt.clone(t),n=this.start,s=this.end;return((s.x-n.x)*(e.y-n.y)-(s.y-n.y)*(e.x-n.x))/this.length()}pointSquaredDistance(t,e){let n=Mt.create(t,e);return this.closestPoint(n).squaredDistance(n)}pointDistance(t,e){let n=Mt.create(t,e);return this.closestPoint(n).distance(n)}tangentAt(t){if(!this.isDifferentiable())return null;let e=this.start,n=this.end,s=this.pointAt(t),r=new i(e,n);return r.translate(s.x-e.x,s.y-e.y),r}tangentAtLength(t){if(!this.isDifferentiable())return null;let e=this.start,n=this.end,s=this.pointAtLength(t),r=new i(e,n);return r.translate(s.x-e.x,s.y-e.y),r}relativeCcw(t,e){let n=Mt.create(t,e),s=n.x-this.start.x,r=n.y-this.start.y,o=this.end.x-this.start.x,a=this.end.y-this.start.y,l=s*a-r*o;return l===0&&(l=s*o+r*a,l>0&&(s-=o,r-=a,l=s*o+r*a,l<0&&(l=0))),l<0?-1:l>0?1:0}equals(t){return t!=null&&this.start.x===t.start.x&&this.start.y===t.start.y&&this.end.x===t.end.x&&this.end.y===t.end.y}clone(){return new i(this.start,this.end)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.end.serialize()].join(" ")}};var Bu=class i extends Nr{static isEllipse(t){return t!=null&&t instanceof i}static create(t,e,n,s){return t==null||typeof t=="number"?new i(t,e,n,s):i.parse(t)}static parse(t){return i.isEllipse(t)?t.clone():Array.isArray(t)?new i(t[0],t[1],t[2],t[3]):new i(t.x,t.y,t.a,t.b)}static fromRect(t){let e=t.center;return new i(e.x,e.y,t.width/2,t.height/2)}get center(){return new Mt(this.x,this.y)}constructor(t,e,n,s){super(),this.x=t??0,this.y=e??0,this.a=n??0,this.b=s??0}bbox(){return Pe.fromEllipse(this)}getCenter(){return this.center}inflate(t,e){let n=t,s=e??t;return this.a+=2*n,this.b+=2*s,this}normalizedDistance(t,e){let n=Mt.create(t,e),s=n.x-this.x,r=n.y-this.y,o=this.a,a=this.b;
4706return s*s/(o*o)+r*r/(a*a)}containsPoint(t,e){return this.normalizedDistance(t,e)<=1}intersectsWithLine(t){let e=[],n=this.a,s=this.b,r=t.start,o=t.end,a=t.vector(),l=r.diff(new Mt(this.x,this.y)),c=new Mt(a.x/(n*n),a.y/(s*s)),u=new Mt(l.x/(n*n),l.y/(s*s)),h=a.dot(c),d=a.dot(u),p=l.dot(u)-1,g=d*d-h*p;if(g<0)return null;if(g>0){let y=Math.sqrt(g),x=(-d-y)/h,w=(-d+y)/h;if((x<0||x>1)&&(w<0||w>1))return null;x>=0&&x<=1&&e.push(r.lerp(o,x)),w>=0&&w<=1&&e.push(r.lerp(o,w))}else{let y=-d/h;if(y>=0&&y<=1)e.push(r.lerp(o,y));else return null}return e}intersectsWithLineFromCenterToPoint(t,e=0){let n=Mt.clone(t);e&&n.rotate(e,this.getCenter());let s=n.x-this.x,r=n.y-this.y,o;if(s===0)return o=this.bbox().getNearestPointToPoint(n),e?o.rotate(-e,this.getCenter()):o;let a=r/s,l=a*a,c=this.a*this.a,u=this.b*this.b,h=Math.sqrt(1/(1/c+l/u));h=s<0?-h:h;let d=a*h;return o=new Mt(this.x+h,this.y+d),e?o.rotate(-e,this.getCenter()):o}tangentTheta(t){let e=Mt.clone(t),n=e.x,s=e.y,r=this.a,o=this.b,a=this.bbox().center,l=a.x,c=a.y,u=30,h=n>a.x+r/2,d=n<a.x-r/2,p,g;return h||d?(g=n>a.x?s-u:s+u,p=r*r/(n-l)-r*r*(s-c)*(g-c)/(o*o*(n-l))+l):(p=s>a.y?n+u:n-u,g=o*o/(s-c)-o*o*(n-l)*(p-l)/(r*r*(s-c))+c),new Mt(p,g).theta(e)}scale(t,e){return this.a*=t,this.b*=e,this}rotate(t,e){let n=Pe.fromEllipse(this);n.rotate(t,e);let s=i.fromRect(n);return this.a=s.a,this.b=s.b,this.x=s.x,this.y=s.y,this}translate(t,e){let n=Mt.create(t,e);return this.x+=n.x,this.y+=n.y,this}equals(t){return t!=null&&t.x===this.x&&t.y===this.y&&t.a===this.a&&t.b===this.b}clone(){return new i(this.x,this.y,this.a,this.b)}toJSON(){return{x:this.x,y:this.y,a:this.a,b:this.b}}serialize(){return`${this.x} ${this.y} ${this.a} ${this.b}`}};var ext=new RegExp("^[\\s\\dLMCZz,.]*$");function V9(i){return typeof i!="string"?!1:ext.test(i)}function CI(i,t){return(i%t+t)%t}function nxt(i,t,e,n,s){if(!i||i.length===0)return"";let r=[],o=i[i.length-1],a=t!=null&&t>0,l=t||0;if(n&&a){i=i.slice();let h=i[0],d=new Mt(o.x+(h.x-o.x)/2,o.y+(h.y-o.y)/2);i.splice(0,0,d)}let c=i[0],u=1;for(e?r.push("M",c.x,c.y):r.push("L",c.x,c.y);u<(n?i.length:i.length-1);){let h=i[CI(u,i.length)],d=c.x-h.x,p=c.y-h.y;if(a&&(d!==0||p!==0)&&(s==null||s.indexOf(u-1)<0)){let g=Math.sqrt(d*d+p*p),y=d*Math.min(l,g/2)/g,x=p*Math.min(l,g/2)/g,w=h.x+y,M=h.y+x;r.push("L",w,M);let A=i[CI(u+1,i.length)];for(;u<i.length-2&&Math.round(A.x-h.x)===0&&Math.round(A.y-h.y)===0;)A=i[CI(u+2,i.length)],u+=1;d=A.x-h.x,p=A.y-h.y,g=Math.max(1,Math.sqrt(d*d+p*p));let C=d*Math.min(l,g/2)/g,R=p*Math.min(l,g/2)/g,k=h.x+C,O=h.y+R;r.push("Q",h.x,h.y,k,O),h=new Mt(k,O)}else r.push("L",h.x,h.y);c=h,u+=1}return n?r.push("Z"):r.push("L",o.x,o.y),r.map(h=>typeof h=="string"?h:+h.toFixed(3)).join(" ")}function H9(i,t={}){let e=[];return i&&i.length&&i.forEach(n=>{Array.isArray(n)?e.push({x:n[0],y:n[1]}):e.push({x:n.x,y:n.y})}),nxt(e,t.round,t.initialMove==null||t.initialMove,t.close,t.exclude)}function MI(i,t,e,n,s=0,r=0,o=0,a,l){if(e===0||n===0)return[];a-=i,l-=t,e=Math.abs(e),n=Math.abs(n);let c=-a/2,u=-l/2,h=Math.cos(s*Math.PI/180),d=Math.sin(s*Math.PI/180),p=h*c+d*u,g=-1*d*c+h*u,y=p*p,x=g*g,w=e*e,M=n*n,A=y/w+x/M,C;if(A>1)e=Math.sqrt(A)*e,n=Math.sqrt(A)*n,C=0;else{let Bt=1;r===o&&(Bt=-1),C=Bt*Math.sqrt((w*M-w*x-M*y)/(w*x+M*y))}let R=C*e*g/n,k=-1*C*n*p/e,O=h*R-d*k+a/2,I=d*R+h*k+l/2,U=Math.atan2((g-k)/n,(p-R)/e)-Math.atan2(0,1),V=U>=0?U:2*Math.PI+U;U=Math.atan2((-g-k)/n,(-p-R)/e)-Math.atan2((g-k)/n,(p-R)/e);let q=U>=0?U:2*Math.PI+U;o===0&&q>0?q-=2*Math.PI:o!==0&&q<0&&(q+=2*Math.PI);let X=q*2/Math.PI,j=Math.ceil(X<0?-1*X:X),W=q/j,_=8/3*Math.sin(W/4)*Math.sin(W/4)/Math.sin(W/2),at=h*e,ct=h*n,pt=d*e,Et=d*n,vt=Math.cos(V),yt=Math.sin(V),kt=-_*(at*yt+Et*vt),Wt=-_*(pt*yt-ct*vt),jt=0,ae=0,ee=[];for(let Bt=0;Bt<j;Bt+=1){V+=W,vt=Math.cos(V),yt=Math.sin(V),jt=at*vt-Et*yt+O,ae=pt*vt+ct*yt+I;let Gt=-_*(at*yt+Et*vt),Qt=-_*(pt*yt-ct*vt),xe=Bt*6;ee[xe]=Number(kt+i),ee[xe+1]=Number(Wt+t),ee[xe+2]=Number(jt-Gt+i),ee[xe+3]=Number(ae-Qt+t),ee[xe+4]=Number(jt+i),ee[xe+5]=Number(ae+t),kt=jt+Gt,Wt=ae+Qt}return ee.map(Bt=>+Bt.toFixed(2))}var Qs=class i extends Nr{static isPolyline(t){return t!=null&&t instanceof i}static parse(t){let e=t.trim();if(e==="")return new i;let n=[],s=e.split(/\s*,\s*|\s+/);for(let r=0,o=s.length;r<o;r+=2)n.push({x:+s[r],y:+s[r+1]});return new i(n)}get start(){return this.points[0]||null}get end(){return this.points[this.points.length-1]||null}constructor(t){if(super(),t!=null){if(typeof t=="string")return i.parse(t);this.points=t.map(e=>Mt.create(e))}else this.points=[]}
4706scale(t,e,n=new Mt){return this.points.forEach(s=>s.scale(t,e,n)),this}rotate(t,e){return this.points.forEach(n=>n.rotate(t,e)),this}translate(t,e){let n=Mt.create(t,e);return this.points.forEach(s=>s.translate(n.x,n.y)),this}round(t=0){return this.points.forEach(e=>e.round(t)),this}bbox(){if(this.points.length===0)return new Pe;let t=1/0,e=-1/0,n=1/0,s=-1/0,r=this.points;for(let o=0,a=r.length;o<a;o+=1){let l=r[o],c=l.x,u=l.y;c<t&&(t=c),c>e&&(e=c),u<n&&(n=u),u>s&&(s=u)}return new Pe(t,n,e-t,s-n)}closestPoint(t){let e=this.closestPointLength(t);return this.pointAtLength(e)}closestPointLength(t){let e=this.points,n=e.length;if(n===0||n===1)return 0;let s=0,r=0,o=1/0;for(let a=0,l=n-1;a<l;a+=1){let c=new Qe(e[a],e[a+1]),u=c.length(),h=c.closestPointNormalizedLength(t),p=c.pointAt(h).squaredDistance(t);p<o&&(o=p,r=s+h*u),s+=u}return r}closestPointNormalizedLength(t){let e=this.length();return e===0?0:this.closestPointLength(t)/e}closestPointTangent(t){let e=this.closestPointLength(t);return this.tangentAtLength(e)}containsPoint(t){if(this.points.length===0)return!1;let e=Mt.clone(t),n=e.x,s=e.y,r=this.points,o=r.length,a=o-1,l=0;for(let c=0;c<o;c+=1){let u=r[a],h=r[c];if(e.equals(u))return!0;let d=new Qe(u,h);if(d.containsPoint(t))return!0;if(s<=u.y&&s>h.y||s>u.y&&s<=h.y){let p=u.x-n>h.x-n?u.x-n:h.x-n;if(p>=0){let g=new Mt(n+p,s),y=new Qe(t,g);d.intersectsWithLine(y)&&(l+=1)}}a=c}return l%2===1}intersectsWithLine(t){let e=[];for(let n=0,s=this.points.length-1;n<s;n+=1){let r=this.points[n],o=this.points[n+1],a=t.intersectsWithLine(new Qe(r,o));a&&e.push(a)}return e.length>0?e:null}isDifferentiable(){for(let t=0,e=this.points.length-1;t<e;t+=1){let n=this.points[t],s=this.points[t+1];if(new Qe(n,s).isDifferentiable())return!0}return!1}length(){let t=0;for(let e=0,n=this.points.length-1;e<n;e+=1){let s=this.points[e],r=this.points[e+1];t+=s.distance(r)}return t}pointAt(t){let e=this.points,n=e.length;if(n===0)return null;if(n===1||t<=0)return e[0].clone();if(t>=1)return e[n-1].clone();let r=this.length()*t;return this.pointAtLength(r)}pointAtLength(t){let e=this.points,n=e.length;if(n===0)return null;if(n===1)return e[0].clone();let s=!0;t<0&&(s=!1,t=-t);let r=0;for(let a=0,l=n-1;a<l;a+=1){let c=s?a:l-1-a,u=e[c],h=e[c+1],d=new Qe(u,h),p=u.distance(h);if(t<=r+p)return d.pointAtLength((s?1:-1)*(t-r));r+=p}return(s?e[n-1]:e[0]).clone()}tangentAt(t){let n=this.points.length;if(n===0||n===1)return null;t<0&&(t=0),t>1&&(t=1);let r=this.length()*t;return this.tangentAtLength(r)}tangentAtLength(t){let e=this.points,n=e.length;if(n===0||n===1)return null;let s=!0;t<0&&(s=!1,t=-t);let r,o=0;for(let a=0,l=n-1;a<l;a+=1){let c=s?a:l-1-a,u=e[c],h=e[c+1],d=new Qe(u,h),p=u.distance(h);if(d.isDifferentiable()){if(t<=o+p)return d.tangentAtLength((s?1:-1)*(t-o));r=d}o+=p}if(r){let a=s?1:0;return r.tangentAt(a)}return null}simplify(t={}){let e=this.points;if(e.length<3)return this;let n=t.threshold||0,s=0;for(;e[s+2];){let r=s,o=s+1,a=s+2,l=e[r],c=e[o],u=e[a];new Qe(l,u).closestPoint(c).distance(c)<=n?e.splice(o,1):s+=1}return this}toHull(){let t=this.points,e=t.length;if(e===0)return new i;let n=t[0];for(let d=1;d<e;d+=1)(t[d].y<n.y||t[d].y===n.y&&t[d].x>n.x)&&(n=t[d]);let s=[];for(let d=0;d<e;d+=1){let p=n.theta(t[d]);p===0&&(p=360),s.push([t[d],d,p])}if(s.sort((d,p)=>{let g=d[2]-p[2];return g===0&&(g=p[1]-d[1]),g}),s.length>2){let d=s[s.length-1];s.unshift(d)}let r={},o=[],a=d=>`${d[0].toString()}@${d[1]}`;for(;s.length!==0;){let d=s.pop(),p=d[0];if(r[a(d)])continue;let g=!1;for(;!g;)if(o.length<2)o.push(d),g=!0;else{let y=o.pop(),x=y[0],w=o.pop(),M=w[0],A=M.cross(x,p);if(A<0)o.push(w),o.push(y),o.push(d),g=!0;else if(A===0){let R=x.angleBetween(M,p);Math.abs(R-180)<1e-10||x.equals(p)||M.equals(x)?(r[a(y)]=x,o.push(w)):Math.abs((R+1)%360-1)<1e-10&&(o.push(w),s.push(y))}else r[a(y)]=x,o.push(w)}}o.length>2&&o.pop();let l,c=-1;for(let d=0,p=o.length;d<p;d+=1){let g=o[d][1];(l===void 0||g<l)&&(l=g,c=d)}let u=[];if(c>0){let d=o.slice(c),p=o.slice(0,c);u=d.concat(p)}else u=o;let h=[];for(let d=0,p=u.length;d<p;d+=1)h.push(u[d][0]);return new i(h)}equals(t){return t==null||t.points.length!==this.points.length?!1:t.points.every((e,n)=>e.equals(this.points[n]))}clone(){return new i(this.points.map(t=>t.clone()))}toJSON(){return this.points.map(t=>t.toJSON())}serialize(){return this.points.map(t=>`${t.serialize()}`).join(" ")}};var Bo=class i extends Nr{static isCurve(t){return t!=null&&t instanceof i}static throughPoints(t){if(t==null||Array.isArray(t)&&t.length<2)throw new Error("At least 2 points are required");let e=sxt(t),n=[];for(let s=0,r=e[0].length;s<r;s+=1){let o=new Mt(e[0][s].x,e[0][s].y),a=new Mt(e[1][s].x,e[1][s].y);n.push(new i(t[s],o,a,t[s+1]))}return n}constructor(t,e,n,s){super(),this.PRECISION=3,this.start=Mt.create(t),this.controlPoint1=Mt.create(e),this.controlPoint2=Mt.create(n),this.end=Mt.create(s)}bbox(){let t=this.start,e=this.controlPoint1,n=this.controlPoint2,s=this.end,r=t.x,o=t.y,a=e.x,l=e.y,c=n.x,u=n.y,h=s.x,d=s.y,p=[],g=[],y=[[],[]],x,w,M,A,C,R,k,O;for(let ct=0;ct<2;ct+=1){if(ct===0?(w=6*r-12*a+6*c,x=-3*r+9*a-9*c+3*h,M=3*a-3*r):(w=6*o-12*l+6*u,x=-3*o+9*l-9*u+3*d,M=3*l-3*o),Math.abs(x)<1e-12){if(Math.abs(w)<1e-12)continue;A=-M/w,A>0&&A<1&&g.push(A);continue}k=w*w-4*M*x,O=Math.sqrt(k),!(k<0)&&(C=(-w+O)/(2*x),C>0&&C<1&&g.push(C),R=(-w-O)/(2*x),R>0&&R<1&&g.push(R))}let I,U,V,q=g.length,X=q;for(;q;)q-=1,A=g[q],V=1-A,I=V*V*V*r+3*V*V*A*a+3*V*A*A*c+A*A*A*h,y[0][q]=I,U=V*V*V*o+3*V*V*A*l+3*V*A*A*u+A*A*A*d,y[1][q]=U,p[q]={X:I,Y:U};g[X]=0,g[X+1]=1,p[X]={X:r,Y:o},p[X+1]={X:h,Y:d},y[0][X]=r,y[1][X]=o,y[0][X+1]=h,y[1][X+1]=d,g.length=X+2,y[0].length=X+2,y[1].length=X+2,p.length=X+2;let j=Math.min.apply(null,y[0]),W=Math.min.apply(null,y[1]),_=Math.max.apply(null,y[0]),at=Math.max.apply(null,y[1]);return new Pe(j,W,_-j,at-W)}closestPoint(t,e={}){return this.pointAtT(this.closestPointT(t,e))}closestPointLength(t,e={}){let n=this.getOptions(e);return this.lengthAtT(this.closestPointT(t,n),n)}closestPointNormalizedLength(t,e={}){let n=this.getOptions(e),s=this.closestPointLength(t,n);if(!s)return 0;let r=this.length(n);return r===0?0:s/r}closestPointT(t,e={}
4706){let n=this.getPrecision(e),s=this.getDivisions(e),r=Math.pow(10,-n),o=null,a=0,l=0,c=0,u=0,h=0,d=null,p=s.length,g=p>0?1/p:0;for(s.forEach((y,x)=>{let w=y.start.distance(t),M=y.end.distance(t),A=w+M;(d==null||A<d)&&(o=y,a=x*g,l=(x+1)*g,c=w,u=M,d=A,h=y.endpointDistance())});;){let y=c?Math.abs(c-u)/c:0,x=u!=null?Math.abs(c-u)/u:0,w=y<r||x<r,M=c?c<h*r:!0,A=u?u<h*r:!0;if(w||(M||A))return c<=u?a:l;let R=o.divide(.5);g/=2;let k=R[0].start.distance(t),O=R[0].end.distance(t),I=k+O,U=R[1].start.distance(t),V=R[1].end.distance(t),q=U+V;I<=q?(o=R[0],l-=g,c=k,u=O):(o=R[1],a+=g,c=U,u=V)}}closestPointTangent(t,e={}){return this.tangentAtT(this.closestPointT(t,e))}containsPoint(t,e={}){return this.toPolyline(e).containsPoint(t)}divideAt(t,e={}){if(t<=0)return this.divideAtT(0);if(t>=1)return this.divideAtT(1);let n=this.tAt(t,e);return this.divideAtT(n)}divideAtLength(t,e={}){let n=this.tAtLength(t,e);return this.divideAtT(n)}divide(t){return this.divideAtT(t)}divideAtT(t){let e=this.start,n=this.controlPoint1,s=this.controlPoint2,r=this.end;if(t<=0)return[new i(e,e,e,e),new i(e,n,s,r)];if(t>=1)return[new i(e,n,s,r),new i(r,r,r,r)];let o=this.getSkeletonPoints(t),a=o.startControlPoint1,l=o.startControlPoint2,c=o.divider,u=o.dividerControlPoint1,h=o.dividerControlPoint2;return[new i(e,a,l,c),new i(c,u,h,r)]}endpointDistance(){return this.start.distance(this.end)}getSkeletonPoints(t){let e=this.start,n=this.controlPoint1,s=this.controlPoint2,r=this.end;if(t<=0)return{startControlPoint1:e.clone(),startControlPoint2:e.clone(),divider:e.clone(),dividerControlPoint1:n.clone(),dividerControlPoint2:s.clone()};if(t>=1)return{startControlPoint1:n.clone(),startControlPoint2:s.clone(),divider:r.clone(),dividerControlPoint1:r.clone(),dividerControlPoint2:r.clone()};let o=new Qe(e,n).pointAt(t),a=new Qe(n,s).pointAt(t),l=new Qe(s,r).pointAt(t),c=new Qe(o,a).pointAt(t),u=new Qe(a,l).pointAt(t),h=new Qe(c,u).pointAt(t);return{startControlPoint1:o,startControlPoint2:c,divider:h,dividerControlPoint1:u,dividerControlPoint2:l}}getSubdivisions(t={}){let e=this.getPrecision(t),n=[new i(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(e===0)return n;let s=this.endpointDistance(),r=Math.pow(10,-e),o=0;for(;;){o+=1;let a=[];n.forEach(u=>{let h=u.divide(.5);a.push(h[0],h[1])});let l=a.reduce((u,h)=>u+h.endpointDistance(),0),c=l!==0?(l-s)/l:0;if(o>1&&c<r)return a;n=a,s=l}}length(t={}){return this.getDivisions(t).reduce((n,s)=>n+s.endpointDistance(),0)}lengthAtT(t,e={}){if(t<=0)return 0;let n=e.precision===void 0?this.PRECISION:e.precision;return this.divide(t)[0].length({precision:n})}pointAt(t,e={}){if(t<=0)return this.start.clone();if(t>=1)return this.end.clone();let n=this.tAt(t,e);return this.pointAtT(n)}pointAtLength(t,e={}){let n=this.tAtLength(t,e);return this.pointAtT(n)}pointAtT(t){return t<=0?this.start.clone():t>=1?this.end.clone():this.getSkeletonPoints(t).divider}isDifferentiable(){let t=this.start,e=this.controlPoint1,n=this.controlPoint2,s=this.end;return!(t.equals(e)&&e.equals(n)&&n.equals(s))}tangentAt(t,e={}){if(!this.isDifferentiable())return null;t<0?t=0:t>1&&(t=1);let n=this.tAt(t,e);return this.tangentAtT(n)}tangentAtLength(t,e={}){if(!this.isDifferentiable())return null;let n=this.tAtLength(t,e);return this.tangentAtT(n)}tangentAtT(t){if(!this.isDifferentiable())return null;t<0&&(t=0),t>1&&(t=1);let e=this.getSkeletonPoints(t),n=e.startControlPoint2,s=e.dividerControlPoint1,r=e.divider,o=new Qe(n,s);return o.translate(r.x-n.x,r.y-n.y),o}getPrecision(t={}){return t.precision==null?this.PRECISION:t.precision}getDivisions(t={}){if(t.subdivisions!=null)return t.subdivisions;let e=this.getPrecision(t);return this.getSubdivisions({precision:e})}getOptions(t={}){let e=this.getPrecision(t),n=this.getDivisions(t);return{precision:e,subdivisions:n}}tAt(t,e={}){if(t<=0)return 0;if(t>=1)return 1;let n=this.getOptions(e),r=this.length(n)*t;return this.tAtLength(r,n)}tAtLength(t,e={}){let n=!0;t<0&&(n=!1,t=-t);let s=this.getPrecision(e),r=this.getDivisions(e),o={precision:s,subdivisions:r},a=null,l,c,u=0,h=0,d=0,p=r.length,g=p>0?1/p:0;for(let w=0;w<p;w+=1){let M=n?w:p-1-w,A=r[w],C=A.endpointDistance();if(t<=d+C){a=A,l=M*g,c=(M+1)*g,u=n?t-d:C+d-t,h=n?C+d-t:t-d;break}d+=C}if(a==null)return n?1:0;let y=this.length(o),x=Math.pow(10,-s);for(;;){let w;if(w=y!==0?u/y:0,w<x)return l;if(w=y!==0?h/y:0,w<x)return c;let M,A,C=a.divide(.5);g/=2;let R=C[0].endpointDistance(),k=C[1].endpointDistance();u<=R?(a=C[0],c-=g,M=u,A=R-M):(a=C[1],l+=g,M=u-R,A=k-M),u=M,h=A}}toPoints(t={}){let e=this.getDivisions(t),n=[e[0].start.clone()];return e.forEach(s=>n.push(s.end.clone())),n}toPolyline(t={}){return new Qs(this.toPoints(t))}scale(t,e,n){return this.start.scale(t,e,n),this.controlPoint1.scale(t,e,n),this.controlPoint2.scale(t,e,n),this.end.scale(t,e,n),this}rotate(t,e){return this.start.rotate(t,e),this.controlPoint1.rotate(t,e),this.controlPoint2.rotate(t,e),this.end.rotate(t,e),this}translate(t,e){return typeof t=="number"?(this.start.translate(t,e),this.controlPoint1.translate(t,e),this.controlPoint2.translate(t,e),this.end.translate(t,e)):(this.start.translate(t),this.controlPoint1.translate(t),this.controlPoint2.translate(t),this.end.translate(t)),this}equals(t){return t!=null&&this.start.equals(t.start)&&this.controlPoint1.equals(t.controlPoint1)&&this.controlPoint2.equals(t.controlPoint2)&&this.end.equals(t.end)}clone(){return new i(this.start,this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.controlPoint1.serialize(),this.controlPoint2.serialize(),this.end.serialize()].join(" ")}};function j9(i){let t=i.length,e=[],n=[],s=2;e[0]=i[0]/s;for(let r=1;r<t;r+=1)n[r]=1/s,s=(r<t-1?4:3.5)-n[r],e[r]=(i[r]-e[r-1])/s;for(let r=1;r<t;r+=1)e[t-r-1]-=n[t-r]*e[t-r];return e}function sxt(i){let t=i.map(l=>Mt.clone(l)),e=[],n=[],s=t.length-1;if(s===1)return e[0]=new Mt((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),n[0]=new Mt(2*e[0].x-t[0].x,2*e[0].y-t[0].y),[e,n];let r=[];for(let l=1;l<s-1;l+=1)r[l]=4*t[l].x+2*t[l+1].x;r[0]=t[0].x+2*t[1].x,r[s-1]=(8*t[s-1].x+t[s].x)/2;let o=j9(r);for(let l=1;l<s-1;l+=1)r[l]=4*t[l].y+2*t[l+1].y;r[0]=t[0].y+2*t[1].y,r[s-1]=(8*t[s-1].y+t[s].y)/2;let a=j9(r);for(let l=0;l<s;l+=1)e.push(new Mt(o[l],a[l])),l<s-1?n.push(new Mt(2*t[l+1].x-o[l+1],2*t[l+1].y-a[l+1])):n.push(new Mt((t[s].x+o[s-1])/2,(t[s].y+a[s-1])/2));return[e,n]}var Yc=class extends Nr{constructor(){super(...arguments),this.isVisible=!0,this.isSegment=!0,this.isSubpathStart=!1}get end(){return this.endPoint}
4706get start(){if(this.previousSegment==null)throw new Error("Missing previous segment. (This segment cannot be the first segment of a path, or segment has not yet been added to a path.)");return this.previousSegment.end}closestPointT(t,e){if(this.closestPointNormalizedLength)return this.closestPointNormalizedLength(t);throw new Error("Neither `closestPointT` nor `closestPointNormalizedLength` method is implemented.")}lengthAtT(t,e){if(t<=0)return 0;let n=this.length();return t>=1?n:n*t}divideAtT(t){if(this.divideAt)return this.divideAt(t);throw new Error("Neither `divideAtT` nor `divideAt` method is implemented.")}pointAtT(t){if(this.pointAt)return this.pointAt(t);throw new Error("Neither `pointAtT` nor `pointAt` method is implemented.")}tangentAtT(t){if(this.tangentAt)return this.tangentAt(t);throw new Error("Neither `tangentAtT` nor `tangentAt` method is implemented.")}};var Oa=class i extends Yc{static create(...t){let e=t.length,n=t[0];if(Qe.isLine(n))return new i(n);if(Mt.isPointLike(n))return e===1?new i(n):t.map(r=>new i(r));if(e===2)return new i(+t[0],+t[1]);let s=[];for(let r=0;r<e;r+=2){let o=+t[r],a=+t[r+1];s.push(new i(o,a))}return s}constructor(t,e){super(),Qe.isLine(t)?this.endPoint=t.end.clone().round(2):this.endPoint=Mt.create(t,e).round(2)}get type(){return"L"}get line(){return new Qe(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(t){return this.line.closestPoint(t)}closestPointLength(t){return this.line.closestPointLength(t)}closestPointNormalizedLength(t){return this.line.closestPointNormalizedLength(t)}closestPointTangent(t){return this.line.closestPointTangent(t)}length(){return this.line.length()}divideAt(t){let e=this.line.divideAt(t);return[new i(e[0]),new i(e[1])]}divideAtLength(t){let e=this.line.divideAtLength(t);return[new i(e[0]),new i(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.line.pointAt(t)}pointAtLength(t){return this.line.pointAtLength(t)}tangentAt(t){return this.line.tangentAt(t)}tangentAtLength(t){return this.line.tangentAtLength(t)}isDifferentiable(){return this.previousSegment==null?!1:!this.start.equals(this.end)}clone(){return new i(this.end)}scale(t,e,n){return this.end.scale(t,e,n),this}rotate(t,e){return this.end.rotate(t,e),this}translate(t,e){return typeof t=="number"?this.end.translate(t,e):this.end.translate(t),this}equals(t){return this.type===t.type&&this.start.equals(t.start)&&this.end.equals(t.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){let t=this.end;return`${this.type} ${t.x} ${t.y}`}};var Vy=class i extends Yc{static create(){return new i}get end(){if(!this.subpathStartSegment)throw new Error("Missing subpath start segment. (This segment needs a subpath start segment (e.g. MoveTo), or segment has not yet been added to a path.)");return this.subpathStartSegment.end}get type(){return"Z"}get line(){return new Qe(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(t){return this.line.closestPoint(t)}closestPointLength(t){return this.line.closestPointLength(t)}closestPointNormalizedLength(t){return this.line.closestPointNormalizedLength(t)}closestPointTangent(t){return this.line.closestPointTangent(t)}length(){return this.line.length()}divideAt(t){let e=this.line.divideAt(t);return[e[1].isDifferentiable()?new Oa(e[0]):this.clone(),new Oa(e[1])]}divideAtLength(t){let e=this.line.divideAtLength(t);return[e[1].isDifferentiable()?new Oa(e[0]):this.clone(),new Oa(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.line.pointAt(t)}pointAtLength(t){return this.line.pointAtLength(t)}tangentAt(t){return this.line.tangentAt(t)}tangentAtLength(t){return this.line.tangentAtLength(t)}isDifferentiable(){return!this.previousSegment||!this.subpathStartSegment?!1:!this.start.equals(this.end)}scale(){return this}rotate(){return this}translate(){return this}equals(t){return this.type===t.type&&this.start.equals(t.start)&&this.end.equals(t.end)}clone(){return new i}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}};var Hy=class i extends Yc{static create(...t){let e=t.length,n=t[0];if(Qe.isLine(n))return new i(n);if(Bo.isCurve(n))return new i(n);if(Mt.isPointLike(n)){if(e===1)return new i(n);let r=[];for(let o=0;o<e;o+=1)o===0?r.push(new i(t[o])):r.push(new Oa(t[o]));return r}if(e===2)return new i(+t[0],+t[1]);let s=[];for(let r=0;r<e;r+=2){let o=+t[r],a=+t[r+1];r===0?s.push(new i(o,a)):s.push(new Oa(o,a))}return s}constructor(t,e){super(),this.isVisible=!1,this.isSubpathStart=!0,Qe.isLine(t)||Bo.isCurve(t)?this.endPoint=t.end.clone().round(2):this.endPoint=Mt.create(t,e).round(2)}get start(){throw new Error("Illegal access. Moveto segments should not need a start property.")}get type(){return"M"}bbox(){return null}closestPoint(){return this.end.clone()}closestPointLength(){return 0}closestPointNormalizedLength(){return 0}closestPointT(){return 1}closestPointTangent(){return null}length(){return 0}lengthAtT(){return 0}divideAt(){return[this.clone(),this.clone()]}divideAtLength(){return[this.clone(),this.clone()]}getSubdivisions(){return[]}pointAt(){return this.end.clone()}pointAtLength(){return this.end.clone()}pointAtT(){return this.end.clone()}tangentAt(){return null}tangentAtLength(){return null}tangentAtT(){return null}isDifferentiable(){return!1}scale(t,e,n){return this.end.scale(t,e,n),this}rotate(t,e){return this.end.rotate(t,e),this}translate(t,e){return typeof t=="number"?this.end.translate(t,e):this.end.translate(t),this}clone(){return new i(this.end)}equals(t){return this.type===t.type&&this.end.equals(t.end)}
4706toJSON(){return{type:this.type,end:this.end.toJSON()}}serialize(){let t=this.end;return`${this.type} ${t.x} ${t.y}`}};var jy=class i extends Yc{static create(...t){let e=t.length,n=t[0];if(Bo.isCurve(n))return new i(n);if(Mt.isPointLike(n)){if(e===3)return new i(t[0],t[1],t[2]);let r=[];for(let o=0;o<e;o+=3)r.push(new i(t[o],t[o+1],t[o+2]));return r}if(e===6)return new i(t[0],t[1],t[2],t[3],t[4],t[5]);let s=[];for(let r=0;r<e;r+=6)s.push(new i(t[r],t[r+1],t[r+2],t[r+3],t[r+4],t[r+5]));return s}constructor(t,e,n,s,r,o){super(),Bo.isCurve(t)?(this.controlPoint1=t.controlPoint1.clone().round(2),this.controlPoint2=t.controlPoint2.clone().round(2),this.endPoint=t.end.clone().round(2)):typeof t=="number"?(this.controlPoint1=new Mt(t,e).round(2),this.controlPoint2=new Mt(n,s).round(2),this.endPoint=new Mt(r,o).round(2)):(this.controlPoint1=Mt.create(t).round(2),this.controlPoint2=Mt.create(e).round(2),this.endPoint=Mt.create(n).round(2))}get type(){return"C"}get curve(){return new Bo(this.start,this.controlPoint1,this.controlPoint2,this.end)}bbox(){return this.curve.bbox()}closestPoint(t){return this.curve.closestPoint(t)}closestPointLength(t){return this.curve.closestPointLength(t)}closestPointNormalizedLength(t){return this.curve.closestPointNormalizedLength(t)}closestPointTangent(t){return this.curve.closestPointTangent(t)}length(){return this.curve.length()}divideAt(t,e={}){let n=this.curve.divideAt(t,e);return[new i(n[0]),new i(n[1])]}divideAtLength(t,e={}){let n=this.curve.divideAtLength(t,e);return[new i(n[0]),new i(n[1])]}divideAtT(t){let e=this.curve.divideAtT(t);return[new i(e[0]),new i(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.curve.pointAt(t)}pointAtLength(t){return this.curve.pointAtLength(t)}tangentAt(t){return this.curve.tangentAt(t)}tangentAtLength(t){return this.curve.tangentAtLength(t)}isDifferentiable(){if(!this.previousSegment)return!1;let t=this.start,e=this.controlPoint1,n=this.controlPoint2,s=this.end;return!(t.equals(e)&&e.equals(n)&&n.equals(s))}scale(t,e,n){return this.controlPoint1.scale(t,e,n),this.controlPoint2.scale(t,e,n),this.end.scale(t,e,n),this}rotate(t,e){return this.controlPoint1.rotate(t,e),this.controlPoint2.rotate(t,e),this.end.rotate(t,e),this}translate(t,e){return typeof t=="number"?(this.controlPoint1.translate(t,e),this.controlPoint2.translate(t,e),this.end.translate(t,e)):(this.controlPoint1.translate(t),this.controlPoint2.translate(t),this.end.translate(t)),this}equals(t){return this.start.equals(t.start)&&this.end.equals(t.end)&&this.controlPoint1.equals(t.controlPoint1)&&this.controlPoint2.equals(t.controlPoint2)}clone(){return new i(this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){let t=this.controlPoint1,e=this.controlPoint2,n=this.end;return[this.type,t.x,t.y,e.x,e.y,n.x,n.y].join(" ")}};function YM(i,t,e){return{x:i*Math.cos(e)-t*Math.sin(e),y:i*Math.sin(e)+t*Math.cos(e)}}function W9(i,t,e,n,s,r){let o=.3333333333333333,a=2/3;return[o*i+a*e,o*t+a*n,o*s+a*e,o*r+a*n,s,r]}function $9(i,t,e,n,s,r,o,a,l,c){let u=Math.PI*120/180,h=Math.PI/180*(+s||0),d=[],p,g,y,x,w;if(c)g=c[0],y=c[1],x=c[2],w=c[3];else{p=YM(i,t,-h),i=p.x,t=p.y,p=YM(a,l,-h),a=p.x,l=p.y;let W=(i-a)/2,_=(t-l)/2,at=W*W/(e*e)+_*_/(n*n);at>1&&(at=Math.sqrt(at),e=at*e,n=at*n);let ct=e*e,pt=n*n,Et=(r===o?-1:1)*Math.sqrt(Math.abs((ct*pt-ct*_*_-pt*W*W)/(ct*_*_+pt*W*W)));x=Et*e*_/n+(i+a)/2,w=Et*-n*W/e+(t+l)/2,g=Math.asin((t-w)/n),y=Math.asin((l-w)/n),g=i<x?Math.PI-g:g,y=a<x?Math.PI-y:y,g<0&&(g=Math.PI*2+g),y<0&&(y=Math.PI*2+y),o&&g>y&&(g-=Math.PI*2),!o&&y>g&&(y-=Math.PI*2)}let M=y-g;if(Math.abs(M)>u){let W=y,_=a,at=l;y=g+u*(o&&y>g?1:-1),a=x+e*Math.cos(y),l=w+n*Math.sin(y),d=$9(a,l,e,n,s,0,o,_,at,[y,W,x,w])}M=y-g;let A=Math.cos(g),C=Math.sin(g),R=Math.cos(y),k=Math.sin(y),O=Math.tan(M/4),I=4/3*(e*O),U=4/3*(n*O),V=[i,t],q=[i+I*C,t-U*A],X=[a+I*k,l-U*R],j=[a,l];if(q[0]=2*V[0]-q[0],q[1]=2*V[1]-q[1],c)return[q,X,j].concat(d);{d=[q,X,j].concat(d).join().split(",");let W=[],_=d.length;for(let at=0;at<_;at+=1)W[at]=at%2?YM(+d[at-1],+d[at],h).y:YM(+d[at],+d[at+1],h).x;return W}}function rxt(i){if(!i)return null;let t=`	
4707\v\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029`,e=new RegExp(`([a-z])[${t},]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[${t}]*,?[${t}]*)+)`,"ig"),n=new RegExp(`(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[${t}]*,?[${t}]*`,"ig"),s={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=[];return i.replace(e,(o,a,l)=>{let c=[],u=a.toLowerCase();
4707l.replace(n,(d,p)=>(p&&c.push(+p),d)),u==="m"&&c.length>2&&(r.push([a,...c.splice(0,2)]),u="l",a=a==="m"?"l":"L");let h=s[u];for(;c.length>=h&&(r.push([a,...c.splice(0,h)]),!!h););return o}),r}function oxt(i){let t=rxt(i);if(!t||!t.length)return[["M",0,0]];let e=0,n=0,s=0,r=0,o=[];for(let a=0,l=t.length;a<l;a+=1){let c=[];o.push(c);let u=t[a],h=u[0];if(h!==h.toUpperCase())switch(c[0]=h.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+e,c[7]=+u[7]+n;break;case"V":c[1]=+u[1]+n;break;case"H":c[1]=+u[1]+e;break;case"M":s=+u[1]+e,r=+u[2]+n;for(let d=1,p=u.length;d<p;d+=1)c[d]=+u[d]+(d%2?e:n);break;default:for(let d=1,p=u.length;d<p;d+=1)c[d]=+u[d]+(d%2?e:n);break}else for(let d=0,p=u.length;d<p;d+=1)c[d]=u[d];switch(c[0]){case"Z":e=+s,n=+r;break;case"H":e=c[1];break;case"V":n=c[1];break;case"M":s=c[c.length-2],r=c[c.length-1],e=c[c.length-2],n=c[c.length-1];break;default:e=c[c.length-2],n=c[c.length-1];break}}return o}function axt(i){let t=oxt(i),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function n(l,c,u){let h,d;if(!l)return["C",c.x,c.y,c.x,c.y,c.x,c.y];switch(l[0]in{T:1,Q:1}||(c.qx=null,c.qy=null),l[0]){case"M":c.X=l[1],c.Y=l[2];break;case"A":return parseFloat(l[1])===0||parseFloat(l[2])===0?["L",l[6],l[7]]:["C"].concat($9.apply(0,[c.x,c.y].concat(l.slice(1))));case"S":return u==="C"||u==="S"?(h=c.x*2-c.bx,d=c.y*2-c.by):(h=c.x,d=c.y),["C",h,d].concat(l.slice(1));case"T":return u==="Q"||u==="T"?(c.qx=c.x*2-c.qx,c.qy=c.y*2-c.qy):(c.qx=c.x,c.qy=c.y),["C"].concat(W9(c.x,c.y,c.qx,c.qy,l[1],l[2]));case"Q":return c.qx=l[1],c.qy=l[2],["C"].concat(W9(c.x,c.y,l[1],l[2],l[3],l[4]));case"H":return["L"].concat(l[1],c.y);case"V":return["L"].concat(c.x,l[1]);case"L":break;case"Z":break;default:break}return l}function s(l,c){if(l[c].length>7){l[c].shift();let u=l[c];for(;u.length;)r[c]="A",c+=1,l.splice(c,0,["C"].concat(u.splice(0,6)));l.splice(c,1),a=t.length}}let r=[],o="",a=t.length;for(let l=0;l<a;l+=1){let c="";t[l]&&(c=t[l][0]),c!=="C"&&(r[l]=c,l>0&&(o=r[l-1])),t[l]=n(t[l],e,o),r[l]!=="A"&&c==="C"&&(r[l]="C"),s(t,l);let u=t[l],h=u.length;e.x=u[h-2],e.y=u[h-1],e.bx=parseFloat(u[h-4])||e.x,e.by=parseFloat(u[h-3])||e.y}return(!t[0][0]||t[0][0]!=="M")&&t.unshift(["M",0,0]),t}function XM(i){return axt(i).map(t=>t.map(e=>typeof e=="string"?e:qc(e,2))).join(",").split(",").join(" ")}var Pn=class i extends Nr{static isPath(t){return t!=null&&t instanceof i}static parse(t){if(!t)return new i;let e=new i,n=/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g,s=XM(t).match(n);if(s!=null)for(let r=0,o=s.length;r<o;r+=1){let a=s[r],l=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g,c=a.match(l);if(c!=null){let u=c[0],h=c.slice(1).map(p=>+p),d=i.createSegment.call(null,u,...h);e.appendSegment(d)}}return e}static createSegment(t,...e){if(t==="M")return Hy.create.call(null,...e);if(t==="L")return Oa.create.call(null,...e);if(t==="C")return jy.create.call(null,...e);if(t==="z"||t==="Z")return Vy.create();throw new Error(`Invalid path segment type "${t}"`)}constructor(t){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(t))if(Qe.isLine(t[0])||Bo.isCurve(t[0])
4707){let e=null;t.forEach((s,r)=>{r===0&&this.appendSegment(i.createSegment("M",s.start)),e!=null&&!e.end.equals(s.start)&&this.appendSegment(i.createSegment("M",s.start)),Qe.isLine(s)?this.appendSegment(i.createSegment("L",s.end)):Bo.isCurve(s)&&this.appendSegment(i.createSegment("C",s.controlPoint1,s.controlPoint2,s.end)),e=s})}else t.forEach(n=>{n.isSegment&&this.appendSegment(n)});else t!=null&&(Qe.isLine(t)?(this.appendSegment(i.createSegment("M",t.start)),this.appendSegment(i.createSegment("L",t.end))):Bo.isCurve(t)?(this.appendSegment(i.createSegment("M",t.start)),this.appendSegment(i.createSegment("C",t.controlPoint1,t.controlPoint2,t.end))):Qs.isPolyline(t)?t.points&&t.points.length&&t.points.forEach((e,n)=>{let s=n===0?i.createSegment("M",e):i.createSegment("L",e);this.appendSegment(s)}):t.isSegment&&this.appendSegment(t))}get start(){let t=this.segments,e=t.length;if(e===0)return null;for(let n=0;n<e;n+=1){let s=t[n];if(s.isVisible)return s.start}return t[e-1].end}get end(){let t=this.segments,e=t.length;if(e===0)return null;for(let n=e-1;n>=0;n-=1){let s=t[n];if(s.isVisible)return s.end}return t[e-1].end}moveTo(...t){return this.appendSegment(Hy.create.call(null,...t))}lineTo(...t){return this.appendSegment(Oa.create.call(null,...t))}curveTo(...t){return this.appendSegment(jy.create.call(null,...t))}arcTo(t,e,n,s,r,o,a){let l=this.end||new Mt,c=typeof o=="number"?MI(l.x,l.y,t,e,n,s,r,o,a):MI(l.x,l.y,t,e,n,s,r,o.x,o.y);if(c!=null)for(let u=0,h=c.length;u<h;u+=6)this.curveTo(c[u],c[u+1],c[u+2],c[u+3],c[u+4],c[u+5]);return this}quadTo(t,e,n,s){let r=this.end||new Mt,o=["M",r.x,r.y];if(typeof t=="number")o.push("Q",t,e,n,s);else{let l=e;o.push("Q",t.x,t.y,l.x,l.y)}let a=i.parse(o.join(" "));return this.appendSegment(a.segments.slice(1)),this}close(){return this.appendSegment(Vy.create())}drawPoints(t,e={}){let n=H9(t,e),s=i.parse(n);s&&s.segments&&this.appendSegment(s.segments)}bbox(){let t=this.segments,e=t.length;if(e===0)return null;let n;for(let r=0;r<e;r+=1){let o=t[r];if(o.isVisible){let a=o.bbox();a!=null&&(n=n?n.union(a):a)}}if(n!=null)return n;let s=t[e-1];return new Pe(s.end.x,s.end.y,0,0)}appendSegment(t){let e=this.segments.length,n=e!==0?this.segments[e-1]:null,s,r=null;if(Array.isArray(t))for(let o=0,a=t.length;o<a;o+=1){let l=t[o];s=this.prepareSegment(l,n,r),this.segments.push(s),n=s}else t!=null&&t.isSegment&&(s=this.prepareSegment(t,n,r),this.segments.push(s));return this}insertSegment(t,e){let n=this.segments.length;if(t<0&&(t=n+t+1),t>n||t<0)throw new Error("Index out of range.");let s,r=null,o=null;if(n!==0&&(t>=1?(r=this.segments[t-1],o=r.nextSegment):(r=null,o=this.segments[0])),!Array.isArray(e))s=this.prepareSegment(e,r,o),this.segments.splice(t,0,s);else for(let a=0,l=e.length;a<l;a+=1){let c=e[a];s=this.prepareSegment(c,r,o),this.segments.splice(t+a,0,s),r=s}return this}removeSegment(t){let e=this.fixIndex(t),n=this.segments.splice(e,1)[0],s=n.previousSegment,r=n.nextSegment;return s&&(s.nextSegment=r),r&&(r.previousSegment=s),n.isSubpathStart&&r&&this.updateSubpathStartSegment(r),n}replaceSegment(t,e){let n=this.fixIndex(t),s,r=this.segments[n],o=r.previousSegment,a=r.nextSegment,l=r.isSubpathStart;if(!Array.isArray(e))s=this.prepareSegment(e,o,a),this.segments.splice(n,1,s),l&&s.isSubpathStart&&(l=!1);else{this.segments.splice(t,1);for(let c=0,u=e.length;c<u;c+=1){let h=e[c];s=this.prepareSegment(h,o,a),this.segments.splice(t+c,0,s),o=s,l&&s.isSubpathStart&&(l=!1)}}l&&a&&this.updateSubpathStartSegment(a)}getSegment(t){let e=this.fixIndex(t);return this.segments[e]}fixIndex(t){let e=this.segments.length;if(e===0)throw new Error("Path has no segments.");let n=t;for(;n<0;)n=e+n;if(n>=e||n<0)throw new Error("Index out of range.");return n}segmentAt(t,e={}){let n=this.segmentIndexAt(t,e);return n?this.getSegment(n):null}segmentAtLength(t,e={}){let n=this.segmentIndexAtLength(t,e);return n?this.getSegment(n):null}segmentIndexAt(t,e={}){if(this.segments.length===0)return null;let n=Jf(t,0,1),s=this.getOptions(e),o=this.length(s)*n;return this.segmentIndexAtLength(o,s)}segmentIndexAtLength(t,e={}){let n=this.segments.length;if(n===0)return null;let s=!0;t<0&&(s=!1,t=-t);
4707let r=this.getPrecision(e),o=this.getSubdivisions(e),a=0,l=null;for(let c=0;c<n;c+=1){let u=s?c:n-1-c,h=this.segments[u],d=o[u],p=h.length({precision:r,subdivisions:d});if(h.isVisible){if(t<=a+p)return u;l=u}a+=p}return l}getSegmentSubdivisions(t={}){let e=this.getPrecision(t),n=[];for(let s=0,r=this.segments.length;s<r;s+=1){let a=this.segments[s].getSubdivisions({precision:e});n.push(a)}return n}updateSubpathStartSegment(t){let e=t.previousSegment,n=t;for(;n&&!n.isSubpathStart;)e!=null?n.subpathStartSegment=e.subpathStartSegment:n.subpathStartSegment=null,e=n,n=n.nextSegment}prepareSegment(t,e,n){t.previousSegment=e,t.nextSegment=n,e!=null&&(e.nextSegment=t),n!=null&&(n.previousSegment=t);let s=t;return t.isSubpathStart&&(t.subpathStartSegment=t,s=n),s!=null&&this.updateSubpathStartSegment(s),t}closestPoint(t,e={}){let n=this.closestPointT(t,e);return n?this.pointAtT(n):null}closestPointLength(t,e={}){let n=this.getOptions(e),s=this.closestPointT(t,n);return s?this.lengthAtT(s,n):0}closestPointNormalizedLength(t,e={}){let n=this.getOptions(e),s=this.closestPointLength(t,n);if(s===0)return 0;let r=this.length(n);return r===0?0:s/r}closestPointT(t,e={}){if(this.segments.length===0)return null;let n=this.getPrecision(e),s=this.getSubdivisions(e),r,o=1/0;for(let a=0,l=this.segments.length;a<l;a+=1){let c=this.segments[a],u=s[a];if(c.isVisible){let h=c.closestPointT(t,{precision:n,subdivisions:u}),d=c.pointAtT(h),p=SI(d,t);p<o&&(r={segmentIndex:a,value:h},o=p)}}return r||{segmentIndex:this.segments.length-1,value:1}}closestPointTangent(t,e={}){if(this.segments.length===0)return null;let n=this.getPrecision(e),s=this.getSubdivisions(e),r,o=1/0;for(let a=0,l=this.segments.length;a<l;a+=1){let c=this.segments[a],u=s[a];if(c.isDifferentiable()){let h=c.closestPointT(t,{precision:n,subdivisions:u}),d=c.pointAtT(h),p=SI(d,t);p<o&&(r=c.tangentAtT(h),o=p)}}return r||null}containsPoint(t,e={}){let n=this.toPolylines(e);if(!n)return!1;let s=0;for(let r=0,o=n.length;r<o;r+=1)n[r].containsPoint(t)&&(s+=1);return s%2===1}pointAt(t,e={}){if(this.segments.length===0)return null;if(t<=0)return this.start.clone();if(t>=1)return this.end.clone();let n=this.getOptions(e),r=this.length(n)*t;return this.pointAtLength(r,n)}pointAtLength(t,e={}){if(this.segments.length===0)return null;if(t===0)return this.start.clone();let n=!0;t<0&&(n=!1,t=-t);let s=this.getPrecision(e),r=this.getSubdivisions(e),o,a=0;for(let c=0,u=this.segments.length;c<u;c+=1){let h=n?c:u-1-c,d=this.segments[h],p=r[h],g=d.length({precision:s,subdivisions:p});if(d.isVisible){if(t<=a+g)return d.pointAtLength((n?1:-1)*(t-a),{precision:s,subdivisions:p});o=d}a+=g}return o?n?o.end:o.start:this.segments[this.segments.length-1].end.clone()}pointAtT(t){let e=this.segments,n=e.length;if(n===0)return null;let s=t.segmentIndex;if(s<0)return e[0].pointAtT(0);if(s>=n)return e[n-1].pointAtT(1);let r=Jf(t.value,0,1);return e[s].pointAtT(r)}divideAt(t,e={}){if(this.segments.length===0)return null;let n=Jf(t,0,1),s=this.getOptions(e),o=this.length(s)*n;return this.divideAtLength(o,s)}divideAtLength(t,e={}){if(this.segments.length===0)return null;let n=!0;t<0&&(n=!1,t=-t);let s=this.getPrecision(e),r=this.getSubdivisions(e),o=0,a,l,c,u,h;for(let R=0,k=this.segments.length;R<k;R+=1){let O=n?R:k-1-R,I=this.getSegment(O),U=r[O],V={precision:s,subdivisions:U},q=I.length(V);if(I.isDifferentiable()&&(c=I,u=O,t<=o+q)){l=O,a=I.divideAtLength((n?1:-1)*(t-o),V);break}o+=q}if(!c)return null;a||(l=u,h=n?1:0,a=c.divideAtT(h));let d=this.clone(),p=l;d.replaceSegment(p,a);let g=p,y=p+1,x=p+2;a[0].isDifferentiable()||(d.removeSegment(g),y-=1,x-=1);let w=d.getSegment(y).start;d.insertSegment(y,i.createSegment("M",w)),x+=1,a[1].isDifferentiable()||(d.removeSegment(x-1),x-=1);let M=x-g-1;for(let R=x,k=d.segments.length;R<k;R+=1){let O=this.getSegment(R-M),I=d.getSegment(R);if(I.type==="Z"&&!O.subpathStartSegment.end.equals(I.subpathStartSegment.end)){let U=i.createSegment("L",O.end);d.replaceSegment(R,U)}}let A=new i(d.segments.slice(0,y)),C=new i(d.segments.slice(y));return[A,C]}intersectsWithLine(t,e={}){let n=this.toPolylines(e);if(n==null)return null;let s=null;for(let r=0,o=n.length;r<o;r+=1){let a=n[r],l=t.intersect(a);l&&(s==null&&(s=[]),Array.isArray(l)?s.push(...l):s.push(l))}return s}isDifferentiable(){for(let t=0,e=this.segments.length;t<e;t+=1)if(this.segments[t].isDifferentiable())return!0;return!1}isValid(){let t=this.segments;return t.length===0||t[0].type==="M"}length(t={}){if(this.segments.length===0)return 0;let e=this.getSubdivisions(t),n=0;for(let s=0,r=this.segments.length;s<r;s+=1){let o=this.segments[s],a=e[s];n+=o.length({subdivisions:a})}return n}lengthAtT(t,e={}){let n=this.segments.length;if(n===0)return 0;let s=t.segmentIndex;if(s<0)return 0;let r=Jf(t.value,0,1);s>=n&&(s=n-1,r=1);
4707let o=this.getPrecision(e),a=this.getSubdivisions(e),l=0;for(let h=0;h<s;h+=1){let d=this.segments[h],p=a[h];l+=d.length({precision:o,subdivisions:p})}let c=this.segments[s],u=a[s];return l+=c.lengthAtT(r,{precision:o,subdivisions:u}),l}tangentAt(t,e={}){if(this.segments.length===0)return null;let n=Jf(t,0,1),s=this.getOptions(e),o=this.length(s)*n;return this.tangentAtLength(o,s)}tangentAtLength(t,e={}){if(this.segments.length===0)return null;let n=!0;t<0&&(n=!1,t=-t);let s=this.getPrecision(e),r=this.getSubdivisions(e),o,a=0;for(let l=0,c=this.segments.length;l<c;l+=1){let u=n?l:c-1-l,h=this.segments[u],d=r[u],p=h.length({precision:s,subdivisions:d});if(h.isDifferentiable()){if(t<=a+p)return h.tangentAtLength((n?1:-1)*(t-a),{precision:s,subdivisions:d});o=h}a+=p}if(o){let l=n?1:0;return o.tangentAtT(l)}return null}tangentAtT(t){let e=this.segments.length;if(e===0)return null;let n=t.segmentIndex;if(n<0)return this.segments[0].tangentAtT(0);if(n>=e)return this.segments[e-1].tangentAtT(1);let s=Jf(t.value,0,1);return this.segments[n].tangentAtT(s)}getPrecision(t={}){return t.precision==null?this.PRECISION:t.precision}getSubdivisions(t={}){if(t.segmentSubdivisions==null){let e=this.getPrecision(t);return this.getSegmentSubdivisions({precision:e})}return t.segmentSubdivisions}getOptions(t={}){let e=this.getPrecision(t),n=this.getSubdivisions(t);return{precision:e,segmentSubdivisions:n}}toPoints(t={}){let e=this.segments,n=e.length;if(n===0)return null;let s=this.getSubdivisions(t),r=[],o=[];for(let a=0;a<n;a+=1){let l=e[a];if(l.isVisible){let c=s[a];c.length>0?c.forEach(u=>o.push(u.start)):o.push(l.start)}else o.length>0&&(o.push(e[a-1].end),r.push(o),o=[])}return o.length>0&&(o.push(this.end),r.push(o)),r}toPolylines(t={}){let e=this.toPoints(t);return e?e.map(n=>new Qs(n)):null}scale(t,e,n){return this.segments.forEach(s=>s.scale(t,e,n)),this}rotate(t,e){return this.segments.forEach(n=>n.rotate(t,e)),this}translate(t,e){return typeof t=="number"?this.segments.forEach(n=>n.translate(t,e)):this.segments.forEach(n=>n.translate(t)),this}clone(){let t=new i;return this.segments.forEach(e=>t.appendSegment(e.clone())),t}equals(t){if(t==null)return!1;let e=this.segments,n=t.segments,s=e.length;if(n.length!==s)return!1;for(let r=0;r<s;r+=1){let o=e[r],a=n[r];if(o.type!==a.type||!o.equals(a))return!1}return!0}toJSON(){return this.segments.map(t=>t.toJSON())}serialize(){if(!this.isValid())throw new Error("Invalid path segments.");return this.segments.map(t=>t.serialize()).join(" ")}toString(){return this.serialize()}};function Fo(i,t,e){let n,s;typeof t=="object"?(n=t.x,s=t.y):(n=t,s=e);let r=Pn.parse(i),o=r.bbox();if(o){let a=-o.height/2-o.y,l=-o.width/2-o.x;typeof n=="number"&&(l-=n),typeof s=="number"&&(a-=s),r.translate(l,a)}return r.serialize()}var et={};Le(et,{CASE_SENSITIVE_ATTR:()=>K9,Event:()=>lO,EventObject:()=>xd,KAPPA:()=>cT,MouseWheelHandle:()=>cO,addClass:()=>i0,after:()=>uxt,append:()=>JM,appendTo:()=>BI,attr:()=>Br,before:()=>ZM,breakText:()=>d7,children:()=>dxt,circleToPathData:()=>b7,clearSelection:()=>Mxt,computeStyle:()=>o0,computeStyleInt:()=>a0,contains:()=>II,createElement:()=>cxt,createElementNS:()=>Y9,createSVGMatrix:()=>ep,createSVGPoint:()=>Qxt,createSVGTransform:()=>ZI,createSlicePathData:()=>Kxt,createSvgDocument:()=>Wy,createSvgElement:()=>Fu,css:()=>e7,data:()=>s7,decomposeMatrix:()=>_7,ellipseToPathData:()=>v7,empty:()=>$y,ensureId:()=>lxt,find:()=>RI,findOne:()=>DI,findParentByClass:()=>LI,get:()=>vd,getAttribute:()=>zI,getClass:()=>Zf,getComputedStyle:()=>Q9,getData:()=>n7,getPointsFromSvgElement:()=>KI,getTransformToElement:()=>aT,getTransformToParentElement:()=>iwt,getVendorPrefixedName:()=>Xy,hasClass:()=>Qf,hasScrollbars:()=>Cxt,height:()=>uwt,index:()=>PI,isCSSVariable:()=>t7,isElement:()=>FI,isHTMLElement:()=>hxt,isSVGGraphicsElement:()=>r0,kebablizeAttrs:()=>yxt,lineToPathData:()=>f7,matrixToRotation:()=>ewt,matrixToScale:()=>twt,matrixToTransformString:()=>QI,matrixToTranslation:()=>nwt,measureText:()=>l0,mergeAttrs:()=>Yy,ns:()=>dl,offset:()=>uO,parseTransformString:()=>Zy,parseXML:()=>X9,polygonToPathData:()=>p7,polylineToPathData:()=>g7,position:()=>
4707hwt,prepend:()=>NI,prop:()=>r7,qualifyAttr:()=>VI,rectToPathData:()=>x7,rectangleToPathData:()=>y7,register:()=>c0,remove:()=>OI,removeAttribute:()=>QM,removeClass:()=>s0,rotate:()=>sT,sample:()=>GI,scale:()=>rT,setAttribute:()=>qy,setAttributes:()=>tT,setData:()=>i7,setPrefixedStyle:()=>Sxt,splitTextByLength:()=>XI,styleToObject:()=>Gy,svgVersion:()=>EI,tagName:()=>kI,text:()=>$I,toLocalPoint:()=>YI,toPath:()=>qI,toPathData:()=>oT,toggleClass:()=>KM,transform:()=>nT,transformStringToMatrix:()=>Jy,translate:()=>iT,uniqueId:()=>q9,unregister:()=>swt,width:()=>cwt});var TI=/[\t\r\n\f]/g,AI=/\S+/g,n0=i=>` ${i} `;function Zf(i){return i&&i.getAttribute&&i.getAttribute("class")||""}function Qf(i,t){if(i==null||t==null)return!1;let e=n0(Zf(i)),n=n0(t);return i.nodeType===1?e.replace(TI," ").includes(n):!1}function i0(i,t){if(!(i==null||t==null)){if(typeof t=="function")return i0(i,t(Zf(i)));if(typeof t=="string"&&i.nodeType===1){let e=t.match(AI)||[],n=n0(Zf(i)).replace(TI," "),s=e.reduce((r,o)=>r.indexOf(n0(o))<0?`${r}${o} `:r,n);s=s.trim(),n!==s&&i.setAttribute("class",s)}}}function s0(i,t){if(i!=null){if(typeof t=="function")return s0(i,t(Zf(i)));if((!t||typeof t=="string")&&i.nodeType===1){let e=(t||"").match(AI)||[],n=n0(Zf(i)).replace(TI," "),s=e.reduce((r,o)=>{let a=n0(o);return r.indexOf(a)>-1?r.replace(a," "):r},n);s=t?s.trim():"",n!==s&&i.setAttribute("class",s)}}}function KM(i,t,e){if(!(i==null||t==null)){if(e!=null&&typeof t=="string"){e?i0(i,t):s0(i,t);return}if(typeof t=="function")return KM(i,t(Zf(i),e),e);typeof t=="string"&&(t.match(AI)||[]).forEach(s=>{Qf(i,s)?s0(i,s):i0(i,s)})}}var G9=0;function q9(){return G9+=1,`v${G9}`}function lxt(i){return(i.id==null||i.id==="")&&(i.id=q9()),i.id}function r0(i){return i==null?!1:typeof i.getScreenCTM=="function"&&i instanceof SVGElement}var dl={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml"},EI="1.1";function cxt(i,t=document){return t.createElement(i)}function Y9(i,t=dl.xhtml,e=document){return e.createElementNS(t,i)}function Fu(i,t=document){return Y9(i,dl.svg,t)}function Wy(i){if(i){let e=`<svg xmlns="${dl.svg}" xmlns:xlink="${dl.xlink}" version="${EI}">${i}</svg>`,{documentElement:n}=X9(e,{async:!1});return n}let t=document.createElementNS(dl.svg,"svg");return t.setAttributeNS(dl.xmlns,"xmlns:xlink",dl.xlink),t.setAttribute("version",EI),t}function X9(i,t={}){let e;try{let n=new DOMParser;if(t.async!=null){let s=n;s.async=t.async}e=n.parseFromString(i,t.mimeType||"text/xml")}catch{e=void 0}if(!e||e.getElementsByTagName("parsererror").length)throw new Error(`Invalid XML: ${i}`);return e}function kI(i,t=!0){let e=i.nodeName;return t?e.toLowerCase():e.toUpperCase()}function PI(i){let t=0,e=i.previousSibling;for(;e;)e.nodeType===1&&(t+=1),e=e.previousSibling;return t}function RI(i,t){return i.querySelectorAll(t)}function DI(i,t){return i.querySelector(t)}function LI(i,t,e){let n=i.ownerSVGElement,s=i.parentNode;for(;s&&s!==e&&s!==n;){if(Qf(s,t))return s;s=s.parentNode}return null}function II(i,t){let e=t&&t.parentNode;return i===e||!!(e&&e.nodeType===1&&i.compareDocumentPosition(e)&16)}function OI(i){i&&(Array.isArray(i)?i:[i]).forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)})}function $y(i){for(;i.firstChild;)i.removeChild(i.firstChild)}function JM(i,t){(Array.isArray(t)?t:[t]).forEach(n=>{n!=null&&i.appendChild(n)})}function NI(i,t){let e=i.firstChild;return e?ZM(e,t):JM(i,t)}function ZM(i,t){let e=i.parentNode;e&&(Array.isArray(t)?t:[t]).forEach(s=>{s!=null&&e.insertBefore(s,i)})}function uxt(i,t){let e=i.parentNode;e&&(Array.isArray(t)?t:[t]).forEach(s=>{s!=null&&e.insertBefore(s,i.nextSibling)})}function BI(i,t){t?.appendChild(i)}function FI(i){return!!i&&i.nodeType===1}function hxt(i){try{return i instanceof HTMLElement}catch{return typeof i=="object"&&i.nodeType===1&&typeof i.style=="object"&&typeof i.ownerDocument=="object"}}function dxt(i,t){let e=[],n=i.firstChild;for(;n;n=n.nextSibling)n.nodeType===1&&(!t||Qf(n,t))&&e.push(n);return e}var tp=i=>{let t=Object.create(null);return(e=>t[e]||(t[e]=i(e)))},UI=tp(i=>i.replace(/\B([A-Z])/g,"-$1").toLowerCase()),fxt=tp(i=>HM(Wm(i)).replace(/ /g,"")),pxt=tp(i=>mI(i).replace(/ /g,"_")),gxt=tp(i=>Fy(i).replace(/ /g,".")),mxt=tp(i=>Fy(i).replace(/ /g,"/")),bxt=tp(i=>
4707Nu(Fy(i))),vxt=tp(i=>HM(Wm(i)));var K9=["viewBox","attributeName","attributeType","repeatCount","textLength","lengthAdjust","gradientUnits","preserveAspectRatio"];function zI(i,t){return i.getAttribute(t)}function QM(i,t){let e=VI(t);e.ns?i.hasAttributeNS(e.ns,e.local)&&i.removeAttributeNS(e.ns,e.local):i.hasAttribute(t)&&i.removeAttribute(t)}function qy(i,t,e){if(e==null)return QM(i,t);let n=VI(t);n.ns&&typeof e=="string"?i.setAttributeNS(n.ns,t,e):t==="id"?i.id=`${e}`:i.setAttribute(t,`${e}`)}function tT(i,t){Object.keys(t).forEach(e=>{qy(i,e,t[e])})}function Br(i,t,e){if(t==null){let n=i.attributes,s={};for(let r=0;r<n.length;r+=1)s[n[r].name]=n[r].value;return s}if(typeof t=="string"&&e===void 0)return i.getAttribute(t);typeof t=="object"?tT(i,t):qy(i,t,e)}function VI(i){if(i.indexOf(":")!==-1){let t=i.split(":");return{ns:dl[t[0]],local:t[1]}}return{ns:null,local:i}}function yxt(i){let t={};return Object.keys(i).forEach(e=>{let n=K9.includes(e)?e:UI(e);t[n]=i[e]}),t}function Gy(i){let t={};return i.split(";").forEach(n=>{let s=n.trim();if(s){let r=s.split("=");r.length&&(t[r[0].trim()]=r[1]?r[1].trim():"")}}),t}function Yy(i,t){return Object.keys(t).forEach(e=>{if(e==="class")i[e]=i[e]?`${i[e]} ${t[e]}`:t[e];else if(e==="style"){let n=typeof i[e]=="object",s=typeof t[e]=="object",r,o;n&&s?(r=i[e],o=t[e]):n?(r=i[e],o=Gy(t[e])):s?(r=Gy(i[e]),o=t[e]):(r=Gy(i[e]),o=Gy(t[e])),i[e]=Yy(r,o)}else i[e]=t[e]}),i}var xxt=/-(.)/g;function wxt(i){return i.replace(xxt,(t,e)=>e.toUpperCase())}var HI={},J9=["webkit","ms","moz","o"],Z9=typeof document<"u"?document.createElement("div").style:{};function _xt(i){for(let t=0;t<J9.length;t+=1){let e=J9[t]+i;if(e in Z9)return e}return null}function Xy(i){let t=wxt(i);if(HI[t]==null){let e=t.charAt(0).toUpperCase()+t.slice(1);HI[t]=t in Z9?t:_xt(e)}return HI[t]}function Sxt(i,t,e){let n=Xy(t);n!=null&&(i[n]=e),i[t]=e}function Q9(i,t){let e=i.ownerDocument&&i.ownerDocument.defaultView&&i.ownerDocument.defaultView.opener?i.ownerDocument.defaultView.getComputedStyle(i,null):window.getComputedStyle(i,null);return e&&t?e.getPropertyValue(t)||e[t]:e}function Cxt(i){let t=Q9(i);return t!=null&&(t.overflow==="scroll"||t.overflow==="auto")}var Mxt=(function(){if(typeof document>"u")return function(){};let i=document;return i.selection?function(){i.selection.empty()}:window.getSelection?function(){let t=window.getSelection();t&&(t.empty?t.empty():t.removeAllRanges&&t.removeAllRanges())}:function(){}})();var Txt={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function t7(i){return/^--/.test(i)}function o0(i,t,e){let n=window.getComputedStyle(i,null);return e?n.getPropertyValue(t)||void 0:n[t]||i.style[t]}function a0(i,t){return parseInt(o0(i,t),10)||0}function Axt(i,t){return!Txt[i]&&typeof t=="number"?`${t}px`:t}function e7(i,t,e){if(typeof t=="string"){let n=t7(t);if(n||(t=Xy(t)),e===void 0)return o0(i,t,n);n||(e=Axt(t,e));let s=i.style;n?s.setProperty(t,e):s[t]=e;return}for(let n in t)e7(i,n,t[n])}var Li={};Le(Li,{camelCase:()=>Wm,constantCase:()=>pxt,dotCase:()=>gxt,getSpellingSuggestion:()=>Pxt,hashcode:()=>Ext,kebabCase:()=>UI,lowerFirst:()=>oI,pascalCase:()=>fxt,pathCase:()=>mxt,sentenceCase:()=>bxt,titleCase:()=>vxt,uniqueId:()=>gI,upperFirst:()=>Nu,uuid:()=>kxt});function Ext(i){let t=2166136261,e=!1,n=i;for(let s=0,r=n.length;s<r;s+=1){let o=n.charCodeAt(s);o>127&&!e&&(n=unescape(encodeURIComponent(n)),o=n.charCodeAt(s),e=!0),t^=o,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}return t>>>0}function kxt(){let i="",t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";for(let e=0,n=t.length;e<n;e+=1){let s=t[e],r=Math.random()*16|0,o=s==="x"?r:s==="y"?r&3|8:s;i+=o.toString(16)}return i}function Pxt(i,t,e){let n=Math.min(2,Math.floor(i.length*.34)),s=Math.floor(i.length*.4)+1,r,o=!1,a=i.toLowerCase();for(let l of t){let c=e(l);if(c!==void 0&&Math.abs(c.length-a.length)<=n){let u=c.toLowerCase();if(u===a){if(c===i)continue;return l}if(o||c.length<3)continue;let h=Rxt(a,u,s-1);if(h===void 0)continue;h<3?(o=!0,r=l):(s=h,r=l)}}return r}function Rxt(i,t,e){let n=new Array(t.length+1),s=new Array(t.length+1),r=e+1;for(let a=0;a<=t.length;a+=1)n[a]=a;for(let a=1;a<=i.length;a+=1){let l=i.charCodeAt(a-1),c=a>
4707e?a-e:1,u=t.length>e+a?e+a:t.length;s[0]=a;let h=a;for(let p=1;p<c;p+=1)s[p]=r;for(let p=c;p<=u;p+=1){let g=l===t.charCodeAt(p-1)?n[p-1]:Math.min(n[p]+1,s[p-1]+1,n[p-1]+2);s[p]=g,h=Math.min(h,g)}for(let p=u+1;p<=t.length;p+=1)s[p]=r;if(h>e)return;let d=n;n=s,s=d}let o=n[t.length];return o>e?void 0:o}var eT=new WeakMap;function n7(i,t){let e=Li.camelCase(t),n=eT.get(i);if(n)return n[e]}function i7(i,t,e){let n=Li.camelCase(t),s=eT.get(i);s?s[n]=e:eT.set(i,{[n]:e})}function s7(i,t,e){if(!t)return eT.get(i);if(typeof t=="string"){if(e===void 0)return n7(i,t);i7(i,t,e);return}for(let n in t)s7(i,n,t[n])}var Dxt={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};function r7(i,t,e){if(t){if(typeof t=="string"){if(t=Dxt[t]||t,arguments.length<3)return i[t];i[t]=e;return}for(let n in t)r7(i,n,t[n])}}var Ky={};Le(Ky,{annotate:()=>Hxt,findAnnotationsAtIndex:()=>jxt,findAnnotationsBetweenIndexes:()=>Wxt,sanitize:()=>Gxt,shiftAnnotations:()=>$xt});var ge={};Le(ge,{applyMixins:()=>Lxt,clone:()=>XL,cloneDeep:()=>KL,createClass:()=>Nxt,defaults:()=>ZL,defaultsDeep:()=>QL,ensure:()=>a7,flatten:()=>c7,getBoolean:()=>Uxt,getByPath:()=>l7,getNumber:()=>Fxt,getValue:()=>Bxt,has:()=>nI,inherit:()=>o7,isEmpty:()=>iI,isEqual:()=>sI,isMaliciousProp:()=>WI,isObject:()=>ki,isPlainObject:()=>Iy,merge:()=>lI,pick:()=>cI,setByPath:()=>zxt,unsetByPath:()=>Vxt});function Lxt(i,...t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{n!=="constructor"&&Object.defineProperty(i.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))})})}var Ixt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,t){i.__proto__=t}||function(i,t){for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e])};function o7(i,t){Ixt(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var jI=class{},Oxt=/^\s*class\s+/.test(`${jI}`)||/^\s*class\s*\{/.test(`${class{}}`);function Nxt(i,t){let e;return Oxt?e=class extends t{}:(e=function(){return t.apply(this,arguments)},o7(e,t)),Object.defineProperty(e,"name",{value:i}),e}function a7(i,t){return i??t}function Bxt(i,t,e){let n=i!=null?i[t]:null;return e!==void 0?a7(n,e):n}function Fxt(i,t,e){let n=i!=null?i[t]:null;return n==null||(n=+n,Number.isNaN(n)||!Number.isFinite(n))?e:n}function Uxt(i,t,e){let n=i!=null?i[t]:null;return n==null?e:!!n}function WI(i){return i==="__proto__"}function l7(i,t,e="/"){let n,s=Array.isArray(t)?t:t.split(e);if(s.length)for(n=i;s.length;){let r=s.shift();if(Object(n)===n&&r&&r in n)n=n[r];else return}return n}function zxt(i,t,e,n="/"){let s=Array.isArray(t)?t:t.split(n),r=s.pop();if(r&&!WI(r)){let o=i;s.forEach(a=>{WI(a)||(o[a]==null&&(o[a]={}),o=o[a])}),o[r]=e}return i}function Vxt(i,t,e="/"){let n=Array.isArray(t)?t.slice():t.split(e),s=n.pop();if(s)if(n.length>0){let r=l7(i,n);r&&delete r[s]}else delete i[s];return i}function c7(i,t="/",e){let n={};
4707Object.keys(i).forEach(s=>{let r=i[s],o=typeof r=="object"||Array.isArray(r);if(o&&e&&e(r)&&(o=!1),o){let a=c7(r,t,e);Object.keys(a).forEach(l=>{n[s+t+l]=a[l]})}else n[s]=r});for(let s in i)Object.prototype.hasOwnProperty.call(i,s);return n}function Hxt(i,t,e={}){let n=e.offset||0,s=[],r=[],o,a,l=null;for(let c=0;c<i.length;c+=1){o=r[c]=i[c];for(let u=0,h=t.length;u<h;u+=1){let d=t[u],p=d.start+n,g=d.end+n;c>=p&&c<g&&(typeof o=="string"?o=r[c]={t:i[c],attrs:d.attrs}:o.attrs=Yy(Yy({},o.attrs),d.attrs),e.includeAnnotationIndices&&(o.annotations==null&&(o.annotations=[]),o.annotations.push(u)))}a=r[c-1],a?ge.isObject(o)&&ge.isObject(a)?(l=l,JSON.stringify(o.attrs)===JSON.stringify(a.attrs)?l.t+=o.t:(s.push(l),l=o)):ge.isObject(o)||ge.isObject(a)?(l=l,s.push(l),l=o):l=String(l||"")+String(o):l=o}return l!=null&&s.push(l),s}function jxt(i,t){return i?i.filter(e=>e.start<t&&t<=e.end):[]}function Wxt(i,t,e){return i?i.filter(n=>t>=n.start&&t<n.end||e>n.start&&e<=n.end||n.start>=t&&n.end<e):[]}function $xt(i,t,e){return i&&i.forEach(n=>{n.start<t&&n.end>=t?n.end+=e:n.start>=t&&(n.start+=e,n.end+=e)}),i}function Gxt(i){return i.replace(/ /g,"\xA0")}var _i=class i{get[Symbol.toStringTag](){return u7}get type(){return this.node.nodeName}get id(){return this.node.id}set id(t){this.node.id=t}static isVector(t){if(t==null)return!1;if(t instanceof i)return!0;let e=t[Symbol.toStringTag],n=t;return(e==null||e===u7)&&n.node instanceof SVGElement&&typeof n.sample=="function"&&typeof n.toPath=="function"}static create(t,e,n){return new i(t,e,n)}static createVectors(t){if(t[0]==="<"){let e=Wy(t),n=[];for(let s=0,r=e.childNodes.length;s<r;s+=1){let o=e.childNodes[s];n.push(i.create(document.importNode(o,!0)))}return n}return[i.create(t)]}static toNode(t){return i.isVector(t)?t.node:t}static toNodes(t){return Array.isArray(t)?t.map(e=>i.toNode(e)):[i.toNode(t)]}constructor(t,e,n){if(!t)throw new TypeError("Invalid element to create vector");let s;if(i.isVector(t))s=t.node;else if(typeof t=="string")if(t.toLowerCase()==="svg")s=Wy();else if(t[0]==="<"){let r=Wy(t);s=document.importNode(r.firstChild,!0)}else s=document.createElementNS(dl.svg,t);else s=t;this.node=s,e&&this.setAttributes(e),n&&this.append(n)}transform(t,e){return t==null?nT(this.node):(nT(this.node,t,e),this)}translate(t,e=0,n={}){return t==null?iT(this.node):(iT(this.node,t,e,n),this)}rotate(t,e,n,s={}){return t==null?sT(this.node):(sT(this.node,t,e,n,s),this)}scale(t,e){return t==null?rT(this.node):(rT(this.node,t,e),this)}getTransformToElement(t){let e=i.toNode(t);return aT(this.node,e)}removeAttribute(t){return QM(this.node,t),this}getAttribute(t){return zI(this.node,t)}setAttribute(t,e){return qy(this.node,t,e),this}setAttributes(t){return tT(this.node,t),this}attr(t,e){return t==null?Br(this.node):typeof t=="string"&&e===void 0?Br(this.node,t):(typeof t=="object"?Br(this.node,t):Br(this.node,t,e),this)}svg(){return this.node instanceof SVGSVGElement?this:i.create(this.node.ownerSVGElement)}defs(){let t=this.svg()||this,e=t.node.getElementsByTagName("defs")[0];return e?i.create(e):i.create("defs").appendTo(t)}text(t,e={}){return $I(this.node,t,e),this}tagName(){return kI(this.node)}clone(){return i.create(this.node.cloneNode(!0))}remove(){return OI(this.node),this}empty(){return $y(this.node),this}append(t){return JM(this.node,i.toNodes(t)),this}appendTo(t){return BI(this.node,i.isVector(t)?t.node:t),this}prepend(t){return NI(this.node,i.toNodes(t)),this}before(t){return ZM(this.node,i.toNodes(t)),this}replace(t){return this.node.parentNode&&this.node.parentNode.replaceChild(i.toNode(t),this.node),i.create(t)}first(){return this.node.firstChild?i.create(this.node.firstChild):null}last(){return this.node.lastChild?i.create(this.node.lastChild):null}get(t){let e=this.node.childNodes[t];return e?i.create(e):null}indexOf(t){return Array.prototype.slice.call(this.node.childNodes).indexOf(i.toNode(t))}find(t){let e=[],n=RI(this.node,t);if(n)for(let s=0,r=n.length;s<r;s+=1)e.push(i.create(n[s]));return e}findOne(t){let e=DI(this.node,t);return e?i.create(e):null}findParentByClass(t,e){let n=LI(this.node,t,e);return n?i.create(n):null}matches(t){let e=this.node,n=this.node.matches,s=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null;return s&&s.call(e,t)}contains(t){return II(this.node,i.isVector(t)?t.node:t)}wrap(t){let e=i.create(t),n=this.node.parentNode;return n?.insertBefore(e.node,this.node),e.append(this)}parent(t){let e=this;if(e.node.parentNode==null)return null;if(e=i.create(e.node.parentNode),t==null)return e;do if(typeof t=="string"?e.matches(t):e instanceof t)return e;while(e=i.create(e.node.parentNode));return e}children(){let t=this.node.childNodes,e=[];for(let n=0;n<t.length;n+=1)t[n].nodeType===1&&e.push(i.create(t[n]));return e}eachChild(t,e){let n=this.children();for(let s=0,r=n.length;s<r;s+=1)t.call(n[s],n[s],s,n),e&&n[s].eachChild(t,e);return this}index(){return PI(this.node)}hasClass(t){return Qf(this.node,t)}addClass(t){return i0(this.node,t),this}removeClass(t){return s0(this.node,t),this}toggleClass(t,e){return KM(this.node,t,e),this}toLocalPoint(t,e){return YI(this.node,t,e)}sample(t=1){return this.node instanceof SVGPathElement?GI(this.node,t):[]}toPath(){return i.create(qI(this.node))}toPathData(){return oT(this.node)}},u7=`X6.${_i.name}`;function qxt(i,t){let e=_i.create(t),n=_i.create("textPath"),s=i.d;if(s&&i["xlink:href"]===void 0){let r=_i.create("path").attr("d",s).appendTo(e.defs());n.attr("xlink:href",`#${r.id}`)}return typeof i=="object"&&n.attr(i),n.node}function Yxt(i,t,e){let n=e.eol,s=e.baseSize,r=e.lineHeight,o=0,a,l={},c=t.length-1;for(let u=0;u<=c;u+=1){let h=t[u],d=null;if(typeof h=="object"){let p=h.attrs,g=_i.create("tspan",p);a=g.node;let y=h.t;n&&u===c&&(y+=n),a.textContent=y;let x=p.class;
4707x&&g.addClass(x),e.includeAnnotationIndices&&g.attr("annotations",h.annotations.join(",")),d=parseFloat(p["font-size"]),d===void 0&&(d=s),d&&d>o&&(o=d)}else n&&u===c&&(h+=n),a=document.createTextNode(h||" "),s&&s>o&&(o=s);i.appendChild(a)}return o&&(l.maxFontSize=o),r?l.lineHeight=r:o&&(l.lineHeight=o*1.2),l}var h7=/em$/;function lT(i,t){let e=parseFloat(i);return h7.test(i)?e*t:e}function Xxt(i,t,e,n){if(!Array.isArray(t))return 0;let s=t.length;if(!s)return 0;let r=t[0],o=lT(r.maxFontSize,e)||e,a=0,l=lT(n,e);for(let h=1;h<s;h+=1){r=t[h];let d=lT(r.lineHeight,e)||l;a+=d}let c=lT(r.maxFontSize,e)||e,u;switch(i){case"middle":u=o/2-.15*c-a/2;break;case"bottom":u=-(.25*c)-a;break;default:u=.8*o;break}return u}function $I(i,t,e={}){t=Ky.sanitize(t);let n=e.eol,s=e.textPath,r=e.textVerticalAnchor,o=r==="middle"||r==="bottom"||r==="top",a=e.x;a===void 0&&(a=i.getAttribute("x")||0);let l=e.includeAnnotationIndices,c=e.annotations;c&&!Array.isArray(c)&&(c=[c]);let u=e.lineHeight,h=u==="auto",d=h?"1.5em":u||"1em",p=!0,g=i.childNodes;if(g.length===1){let U=g[0];U&&U.tagName.toUpperCase()==="TITLE"&&(p=!1)}p&&$y(i),Br(i,{"xml:space":"preserve",display:t||e.displayEmpty?null:"none"});let y=Br(i,"font-size"),x=parseFloat(y);x||(x=16,(o||c)&&!y&&Br(i,"font-size",`${x}`));let w;s?(typeof s=="string"&&(s={d:s}),w=qxt(s,i)):w=document.createDocumentFragment();let M,A=0,C,R=t.split(`
4708`),k=[],O=R.length-1;for(let U=0;U<=O;U+=1){M=d;let V="v-line",q=Fu("tspan"),X,j=R[U];if(j)if(c){let W=Ky.annotate(j,c,{offset:-A,includeAnnotationIndices:l});X=Yxt(q,W,{eol:U!==O&&n,baseSize:x,lineHeight:h?null:d,includeAnnotationIndices:l});let _=X.lineHeight;_&&h&&U!==0&&(M=_),U===0&&(C=X.maxFontSize*.8)}else n&&U!==O&&(j+=n),q.textContent=j;else{q.textContent="-",V+=" v-empty-line";let W=q.style;W.fillOpacity=0,W.strokeOpacity=0,c&&(X={})}X&&k.push(X),U>0&&q.setAttribute("dy",M),(U>0||s)&&q.setAttribute("x",a),q.className.baseVal=V,w.appendChild(q),A+=j.length+1}if(o)if(c)M=Xxt(r,k,x,d);else if(r==="top")M="0.8em";else{let U;switch(O>0?(U=parseFloat(d)||1,U*=O,h7.test(d)||(U/=x)):U=0,r){case"middle":M=`${.3-U/2}em`;break;case"bottom":M=`${-U-.3}em`;break;default:break}}else r===0?M="0em":r?M=r:(M=0,i.getAttribute("y")==null&&i.setAttribute("y",`${C||"0.8em"}`));w.firstChild.setAttribute("dy",M),i.appendChild(w)}function l0(i,t={}){let e=document.createElement("canvas").getContext("2d");if(!i)return{width:0};let n=[],s=t["font-size"]?`${parseFloat(t["font-size"])}px`:"14px";return n.push(t["font-style"]||"normal"),n.push(t["font-variant"]||"normal"),n.push(t["font-weight"]||400),n.push(s),n.push(t["font-family"]||"sans-serif"),e.font=n.join(" "),e.measureText(i)}function XI(i,t,e,n={}){if(t>=e)return[i,""];let s=i.length,r={},o=Math.round(t/e*s-1);for(o<0&&(o=0);o>=0&&o<s;){let a=i.slice(0,o),l=r[a]||l0(a,n).width,c=i.slice(0,o+1),u=r[c]||l0(c,n).width;if(r[a]=l,r[c]=u,l>t)o-=1;else if(u<=t)o+=1;else break}return[i.slice(0,o),i.slice(o)]}function d7(i,t,e={},n={}){let s=t.width,r=t.height,o=n.eol||`
4709`,a=e.fontSize||14,l=e.lineHeight?parseFloat(e.lineHeight):Math.ceil(a*1.4),c=Math.floor(r/l);if(i.indexOf(o)>-1){let x=Li.uuid(),w=[];return i.split(o).forEach(M=>{let A=d7(M,Object.assign(Object.assign({},t),{height:Number.MAX_SAFE_INTEGER}),e,Object.assign(Object.assign({},n),{eol:x}));A&&w.push(...A.split(x))}),w.slice(0,c).join(o)}let{width:u}=l0(i,e);if(u<s)return i;let h=[],d=i,p=u,g=n.ellipsis,y=0;g&&(typeof g!="string"&&(g="\u2026"),y=l0(g,e).width);for(let x=0;x<c;x+=1)if(p>s)if(x===c-1){let[M]=XI(d,s-y,p,e);h.push(g?`${M}${g}`:M)}else{let[M,A]=XI(d,s,p,e);h.push(M),d=A,p=l0(d,e).width}else{h.push(d);break}return h.join(o)}var cT=.551784;function Jr(i,t,e=NaN){let n=i.getAttribute(t);if(n==null)return e;let s=parseFloat(n);return Number.isNaN(s)?e:s}function GI(i,t=1){let e=i.getTotalLength(),n=[],s=0,r;for(;s<e;)r=i.getPointAtLength(s),n.push({distance:s,x:r.x,y:r.y}),s+=t;return n}function f7(i){return["M",Jr(i,"x1"),Jr(i,"y1"),"L",Jr(i,"x2"),Jr(i,"y2")].join(" ")}function p7(i){let t=KI(i);return t.length===0?null:`${m7(t)} Z`}function g7(i){let t=KI(i);return t.length===0?null:m7(t)}function m7(i){return`M ${i.map(e=>`${e.x} ${e.y}`).join(" L")}
4709`}function KI(i){let t=[],e=i.points;if(e)for(let n=0,s=e.numberOfItems;n<s;n+=1)t.push(e.getItem(n));return t}function b7(i){let t=Jr(i,"cx",0),e=Jr(i,"cy",0),n=Jr(i,"r"),s=n*cT;return["M",t,e-n,"C",t+s,e-n,t+n,e-s,t+n,e,"C",t+n,e+s,t+s,e+n,t,e+n,"C",t-s,e+n,t-n,e+s,t-n,e,"C",t-n,e-s,t-s,e-n,t,e-n,"Z"].join(" ")}function v7(i){let t=Jr(i,"cx",0),e=Jr(i,"cy",0),n=Jr(i,"rx"),s=Jr(i,"ry")||n,r=n*cT,o=s*cT;return["M",t,e-s,"C",t+r,e-s,t+n,e-o,t+n,e,"C",t+n,e+o,t+r,e+s,t,e+s,"C",t-r,e+s,t-n,e+o,t-n,e,"C",t-n,e-o,t-r,e-s,t,e-s,"Z"].join(" ")}function y7(i){return x7({x:Jr(i,"x",0),y:Jr(i,"y",0),width:Jr(i,"width",0),height:Jr(i,"height",0),rx:Jr(i,"rx",0),ry:Jr(i,"ry",0)})}function x7(i){let t,e=i.x,n=i.y,s=i.width,r=i.height,o=Math.min(i.rx||i["top-rx"]||0,s/2),a=Math.min(i.rx||i["bottom-rx"]||0,s/2),l=Math.min(i.ry||i["top-ry"]||0,r/2),c=Math.min(i.ry||i["bottom-ry"]||0,r/2);return o||a||l||c?t=["M",e,n+l,"v",r-l-c,"a",a,c,0,0,0,a,c,"h",s-2*a,"a",a,c,0,0,0,a,-c,"v",-(r-c-l),"a",o,l,0,0,0,-o,-l,"h",-(s-2*o),"a",o,l,0,0,0,-o,l,"Z"]:t=["M",e,n,"H",e+s,"V",n+r,"H",e,"V",n,"Z"],t.join(" ")}function qI(i){let t=Fu("path");Br(t,Br(i));let e=oT(i);return e&&t.setAttribute("d",e),t}function oT(i){let t=i.tagName.toLowerCase();switch(t){case"path":return i.getAttribute("d");case"line":return f7(i);case"polygon":return p7(i);case"polyline":return g7(i);case"ellipse":return v7(i);case"circle":return b7(i);case"rect":return y7(i);default:break}throw new Error(`"${t}" cannot be converted to svg path element.`)}function Kxt(i,t,e,n){let s=2*Math.PI-1e-6,r=i,o=t,a=e,l=n;if(l<a){let y=a;a=l,l=y}let c=l-a,u=c<Math.PI?"0":"1",h=Math.cos(a),d=Math.sin(a),p=Math.cos(l),g=Math.sin(l);return c>=s?r?`M0,${o}A${o},${o} 0 1,1 0,${-o}A${o},${o} 0 1,1 0,${o}M0,${r}A${r},${r} 0 1,0 0,${-r}A${r},${r} 0 1,0 0,${r}Z`:`M0,${o}A${o},${o} 0 1,1 0,${-o}A${o},${o} 0 1,1 0,${o}Z`:r?`M${o*h},${o*d}A${o},${o} 0 ${u},1 ${o*p},${o*g}L${r*p},${r*g}A${r},${r} 0 ${u},0 ${r*h},${r*d}Z`:`M${o*h},${o*d}A${o},${o} 0 ${u},1 ${o*p},${o*g}L0,0Z`}var Jxt=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,w7=/[ ,]+/,Zxt=/^(\w+)\((.*)\)/;function Qxt(i,t){let n=Fu("svg").createSVGPoint();return n.x=i,n.y=t,n}function ep(i){let e=Fu("svg").createSVGMatrix();if(i!=null){let n=i,s=["a","b","c","d","e","f"];for(let r of s)n[r]!==void 0&&(e[r]=n[r])}return e}function ZI(i){let t=Fu("svg");return i!=null?(i instanceof DOMMatrix||(i=ep(i)),t.createSVGTransformFromMatrix(i)):t.createSVGTransform()}function Jy(i){let t=ep(),e=i!=null&&i.match(Jxt);if(!e)return t;for(let n=0,s=e.length;n<s;n+=1){let o=e[n].match(Zxt);if(o){let a,l,c,u,h,d=ep(),p=o[2].split(w7);switch(o[1].toLowerCase()){case"scale":a=parseFloat(p[0]),l=p[1]===void 0?a:parseFloat(p[1]),d=d.scaleNonUniform(a,l);break;case"translate":c=parseFloat(p[0]),u=parseFloat(p[1]),d=d.translate(c,u);break;case"rotate":h=parseFloat(p[0]),c=parseFloat(p[1])||0,u=parseFloat(p[2])||0,c!==0||u!==0?d=d.translate(c,u).rotate(h).translate(-c,-u):d=d.rotate(h);break;case"skewx":h=parseFloat(p[0]),d=d.skewX(h);break;case"skewy":h=parseFloat(p[0]),d=d.skewY(h);break;case"matrix":d.a=parseFloat(p[0]),d.b=parseFloat(p[1]),d.c=parseFloat(p[2]),d.d=parseFloat(p[3]),d.e=parseFloat(p[4]),d.f=parseFloat(p[5]);break;default:continue}t=t.multiply(d)}}return t}function QI(i){let t=i||{},e=t.a!=null?t.a:1,n=t.b!=null?t.b:0,s=t.c!=null?t.c:0,r=t.d!=null?t.d:1,o=t.e!=null?t.e:0,a=t.f!=null?t.f:0;return`matrix(${e},${n},${s},${r},${o},${a})`}function Zy(i){let t,e,n;if(i){let r=w7;if(i.trim().indexOf("matrix")>=0){let o=Jy(i),a=_7(o);t=[a.translateX,a.translateY],e=[a.rotation],n=[a.scaleX,a.scaleY];let l=[];(t[0]!==0||t[1]!==0)&&l.push(`translate(${t.join(",")})`),(n[0]!==1||n[1]!==1)&&l.push(`scale(${n.join(",")})`),e[0]!==0&&l.push(`rotate(${e[0]})`),i=l.join(" ")}else{let o=i.match(/translate\((.*?)\)/);o&&(t=o[1].split(r));let a=i.match(/rotate\((.*?)\)/);a&&(e=a[1].split(r));let l=i.match(/scale\((.*?)\)/);l&&(n=l[1].split(r))}}let s=n&&n[0]?parseFloat(n[0]):1;return{raw:i||"",translation:{tx:t&&t[0]?parseInt(t[0],10):0,ty:t&&t[1]?parseInt(t[1],10):0},rotation:{angle:e&&e[0]?parseInt(e[0],10):0,cx:e&&e[1]?parseInt(e[1],10):void 0,cy:e&&e[2]?parseInt(e[2],10):void 0},scale:{sx:s,sy:n&&n[1]?parseFloat(n[1]):s}}}function JI(i,t){let e=t.x*i.a+t.y*i.c+0,n=t.x*i.b+t.y*i.d+0;return{x:e,y:n}}function _7(i){let t=JI(i,{x:0,y:1}),e=JI(i,{x:1,y:0}),n=180/Math.PI*Math.atan2(t.y,t.x)-90,s=180/Math.PI*Math.atan2(e.y,e.x);return{skewX:n,skewY:s,translateX:i.e,translateY:i.f,scaleX:Math.sqrt(i.a*i.a+i.b*i.b),scaleY:Math.sqrt(i.c*i.c+i.d*i.d),rotation:n}}function twt(i){let t,e,n,s;return i?(t=i.a==null?1:i.a,s=i.d==null?1:i.d,e=i.b,n=i.c):t=s=1,{sx:e?Math.sqrt(t*t+e*e):t,sy:n?Math.sqrt(n*n+s*s):s}}function ewt(i){let t={x:0,y:1};i&&(t=JI(i,t));let e=180*Math.atan2(t.y,t.x)/Math.PI%360-90;return{angle:e%360+(e<0?360:0)}}function nwt(i){return{tx:i&&i.e||0,ty:i&&i.f||0}}function nT(i,t,e={}){if(t==null)return Jy(Br(i,"transform"));if(e.absolute){i.setAttribute("transform",QI(t));return}let n=i.transform,s=ZI(t);n.baseVal.appendItem(s)}function iT(i,t,e=0,n={}){let s=Br(i,"transform"),r=Zy(s);if(t==null)return r.translation;s=r.raw,s=s.replace(/translate\([^)]*\)/g,"").trim();let o=n.absolute?t:r.translation.tx+t,a=n.absolute?e:r.translation.ty+e,l=`translate(${o},${a})`;i.setAttribute("transform",`${l} ${s}`.trim())}function sT(i,t,e,n,s={}){let r=Br(i,"transform"),o=Zy(r);if(t==null)return o.rotation;r=o.raw,r=r.replace(/rotate\([^)]*\)/g,"").trim(),t%=360;let a=s.absolute?t:o.rotation.angle+t,l=e!=null&&n!=null?`,${e},${n}`:"",c=`rotate(${a}${l})`;i.setAttribute("transform",`${r} ${c}`.trim())}function rT(i,t,e){let n=Br(i,"transform"),s=Zy(n);if(t==null)return s.scale;e=e??t,n=s.raw,n=n.replace(/scale\([^)]*\)/g,"").trim();let r=`scale(${t},${e})`;i.setAttribute("transform",`${n} ${r}`.trim())}function aT(i,t){if(r0(t)&&r0(i)){let e=t.getScreenCTM(),n=i.getScreenCTM();if(e&&n)return e.inverse().multiply(n)}return ep()}function iwt(i,t){let e=ep();if(r0(t)&&r0(i)){let n=i,s=[];for(;n&&n!==t;){let r=n.getAttribute("transform")||null,o=Jy(r);s.push(o),n=n.parentNode}
4709s.reverse().forEach(r=>{e=e.multiply(r)})}return e}function YI(i,t,e){let n=i instanceof SVGSVGElement?i:i.ownerSVGElement,s=n.createSVGPoint();s.x=t,s.y=e;try{let r=n.getScreenCTM(),o=s.matrixTransform(r.inverse()),a=aT(i,n).inverse();return o.matrixTransform(a)}catch{return s}}var tO={};function vd(i){return tO[i]||{}}function c0(i,t){tO[i]=t}function swt(i){delete tO[i]}Sn();var Qy=new WeakMap;function S7(i){return Qy.has(i)||Qy.set(i,{events:Object.create(null)}),Qy.get(i)}function tx(i){return Qy.get(i)}function C7(i){return Qy.delete(i)}var ex=()=>!0,yd=()=>!1;function eO(i){i.stopPropagation()}function T7(i,t,e){i.addEventListener!=null&&i.addEventListener(t,e)}function A7(i,t,e){i.removeEventListener!=null&&i.removeEventListener(t,e)}var rwt=/[^\x20\t\r\n\f]+/g,owt=/^([^.]*)(?:\.(.+)|)/;function nO(i){return(i||"").match(rwt)||[""]}function iO(i){let t=owt.exec(i)||[];return{originType:t[1]?t[1].trim():t[1],namespaces:t[2]?t[2].split(".").map(e=>e.trim()).sort():[]}}function uT(i){return i.nodeType===1||i.nodeType===9||!+i.nodeType}var M7=0,u0=new WeakMap;function hT(i){return u0.has(i)||(u0.set(i,M7),M7+=1),u0.get(i)}function E7(i){return u0.get(i)}function k7(i){return u0.delete(i)}function dT(i,t){return u0.set(i,t)}function P7(i,t){let e=[],n=tx(i),s=n&&n.events&&n.events[t.type],r=s&&s.handlers||[],o=s?s.delegateCount:0;if(o>0&&!(t.type==="click"&&typeof t.button=="number"&&t.button>=1)){for(let a=t.target;a!==i;a=a.parentNode||i)if(a.nodeType===1&&!(t.type==="click"&&a.disabled===!0)){let l=[],c={};for(let u=0;u<o;u+=1){let h=r[u],d=h.selector;if(d!=null&&c[d]==null){let p=i,g=[];p.querySelectorAll(d).forEach(y=>{g.push(y)}),c[d]=g.includes(a)}c[d]&&l.push(h)}l.length&&e.push({elem:a,handlers:l})}}return o<r.length&&e.push({elem:i,handlers:r.slice(o)}),e}function sO(i){return i!=null&&i===i.window}function rO(i,t){let e=i.nodeType===9?i.documentElement:i,n=t&&t.parentNode;return i===n||!!(n&&n.nodeType===1&&(e.contains?e.contains(n):i.compareDocumentPosition&&i.compareDocumentPosition(n)&16))}var xd=class i{static create(t){return t instanceof i?t:new i(t)}static addProperty(t,e){Object.defineProperty(i.prototype,t,{enumerable:!0,configurable:!0,get:typeof e=="function"?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set(n){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:n})}})}constructor(t,e){this.isDefaultPrevented=yd,this.isPropagationStopped=yd,this.isImmediatePropagationStopped=yd,this.isSimulated=!1,this.preventDefault=()=>{let n=this.originalEvent;this.isDefaultPrevented=ex,n&&!this.isSimulated&&n.preventDefault()},this.stopPropagation=()=>{let n=this.originalEvent;this.isPropagationStopped=ex,n&&!this.isSimulated&&n.stopPropagation()},this.stopImmediatePropagation=()=>{let n=this.originalEvent;this.isImmediatePropagationStopped=ex,n&&!this.isSimulated&&n.stopImmediatePropagation(),this.stopPropagation()},typeof t=="string"?this.type=t:t.type&&(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented?ex:yd,this.target=t.target,this.currentTarget=t.currentTarget,this.relatedTarget=t.relatedTarget,this.timeStamp=t.timeStamp),e&&Object.assign(this,e),this.timeStamp||(this.timeStamp=Date.now())}},R7={bubbles:!0,cancelable:!0,eventPhase:!0,detail:!0,view:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pageX:!0,pageY:!0,screenX:!0,screenY:!0,toElement:!0,pointerId:!0,pointerType:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,touches:!0,changedTouches:!0,targetTouches:!0,which:!0,altKey:!0,ctrlKey:!0,metaKey:!0,shiftKey:!0};Object.keys(R7).forEach(i=>xd.addProperty(i,R7[i]));c0("load",{noBubble:!0});c0("beforeunload",{postDispatch(i,t){t.result!==void 0&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}});c0("mouseenter",{delegateType:"mouseover",bindType:"mouseover",handle(i,t){let e,n=t.relatedTarget,s=t.handleObj;return(!n||n!==i&&!rO(i,n))&&(t.type=s.originType,e=s.handler.call(i,t),t.type="mouseover"),e}});c0("mouseleave",{delegateType:"mouseout",bindType:"mouseout",handle(i,t){let e,n=t.relatedTarget,s=t.handleObj;return(!n||n!==i&&!rO(i,n))&&(t.type=s.originType,e=s.handler.call(i,t),t.type="mouseout"),e}});var oO;function D7(i,t,e,n,s){if(!uT(i))return;let r;if(typeof e!="function"){let{handler:c,selector:u}=e,h=hn(e,["handler","selector"]);e=c,s=u,r=h}let o=S7(i),a=o.handler;a==null&&(a=o.handler=function(c,...u){return oO!==c.type?awt(i,c,...u):void 0});let l=hT(e);nO(t).forEach(c=>{let{originType:u,namespaces:h}=iO(c);if(!u)return;let d=u,p=vd(d);d=(s?p.delegateType:p.bindType)||d,p=vd(d);let g=Object.assign({type:d,originType:u,data:n,selector:s,guid:l,handler:e,namespace:h.join(".")},r),y=o.events,x=y[d];x||(x=y[d]={handlers:[],delegateCount:0},(!p.setup||p.setup(i,n,h,a)===!1)&&T7(i,d,a)),p.add&&(k7(g.handler),p.add(i,g),dT(g.handler,l)),s?(x.handlers.splice(
4709x.delegateCount,0,g),x.delegateCount+=1):x.handlers.push(g)})}function aO(i,t,e,n,s){let r=tx(i);if(!r)return;let o=r.events;o&&(nO(t).forEach(a=>{let{originType:l,namespaces:c}=iO(a);if(!l){Object.keys(o).forEach(y=>{aO(i,y+a,e,n,!0)});return}let u=l,h=vd(u);u=(n?h.delegateType:h.bindType)||u;let d=o[u];if(!d)return;let p=c.length>0?new RegExp(`(^|\\.)${c.join("\\.(?:.*\\.|)")}(\\.|$)`):null,g=d.handlers.length;for(let y=d.handlers.length-1;y>=0;y-=1){let x=d.handlers[y];(s||l===x.originType)&&(!e||E7(e)===x.guid)&&(p==null||x.namespace&&p.test(x.namespace))&&(n==null||n===x.selector||n==="**"&&x.selector)&&(d.handlers.splice(y,1),x.selector&&(d.delegateCount-=1),h.remove&&h.remove(i,x))}g&&d.handlers.length===0&&((!h.teardown||h.teardown(i,c,r.handler)===!1)&&A7(i,u,r.handler),delete o[u])}),Object.keys(o).length===0&&C7(i))}function awt(i,t,...e){let n=xd.create(t);n.delegateTarget=i;let s=vd(n.type);if(s.preDispatch&&s.preDispatch(i,n)===!1)return;let r=P7(i,n);for(let o=0,a=r.length;o<a&&!n.isPropagationStopped();o+=1){let l=r[o];n.currentTarget=l.elem;for(let c=0,u=l.handlers.length;c<u&&!n.isImmediatePropagationStopped();c+=1){let h=l.handlers[c];if(n.rnamespace==null||h.namespace&&n.rnamespace.test(h.namespace)){n.handleObj=h,n.data=h.data;let d=vd(h.originType).handle,p=d?d(l.elem,n,...e):h.handler.call(l.elem,n,...e);p!==void 0&&(n.result=p,p===!1&&(n.preventDefault(),n.stopPropagation()))}}}return s.postDispatch&&s.postDispatch(i,n),n.result}function L7(i,t,e,n){let s=i,r=typeof i=="string"?i:i.type,o=typeof i=="string"||s.namespace==null?[]:s.namespace.split("."),a=e;if(a.nodeType===3||a.nodeType===8)return;r.indexOf(".")>-1&&(o=r.split("."),r=o.shift(),o.sort());let l=r.indexOf(":")<0&&`on${r}`;s=i instanceof xd?i:new xd(r,typeof i=="object"?i:null),s.namespace=o.join("."),s.rnamespace=s.namespace?new RegExp(`(^|\\.)${o.join("\\.(?:.*\\.|)")}(\\.|$)`):null,s.result=void 0,s.target||(s.target=a);let c=[s];Array.isArray(t)?c.push(...t):c.push(t);let u=vd(r);if(!n&&u.trigger&&u.trigger(a,s,t)===!1)return;let h,d=[a];if(!n&&!u.noBubble&&!sO(a)){h=u.delegateType||r;let g=a,y=a.parentNode;for(;y!=null;)d.push(y),g=y,y=y.parentNode;let x=a.ownerDocument||document;if(g===x){let w=g.defaultView||g.parentWindow||window;d.push(w)}}let p=a;for(let g=0,y=d.length;g<y&&!s.isPropagationStopped();g+=1){let x=d[g];p=x,s.type=g>1?h:u.bindType||r;let w=tx(x);w&&w.events[s.type]&&w.handler&&w.handler.call(x,...c);let M=l&&x[l]||null;M&&uT(x)&&(s.result=M.call(x,...c),s.result===!1&&s.preventDefault())}if(s.type=r,!n&&!s.isDefaultPrevented()){let g=u.preventDefault;if((g==null||g(d.pop(),s,t)===!1)&&uT(a)&&l&&typeof a[r]=="function"&&!sO(a)){let y=a[l];y&&(a[l]=null),oO=r,s.isPropagationStopped()&&p.addEventListener(r,eO),a[r](),s.isPropagationStopped()&&p.removeEventListener(r,eO),oO=void 0,y&&(a[l]=y)}}return s.result}var lO=class{static on(t,e,n,s,r){return nx.on(t,e,n,s,r),t}static once(t,e,n,s,r){return nx.on(t,e,n,s,r,!0),t}static off(t,e,n,s){return nx.off(t,e,n,s),t}static trigger(t,e,n,s){return L7(e,n,t,s),t}},nx;(function(i){function t(n,s,r,o,a,l){if(typeof s=="object"){typeof r!="string"&&(o=o||r,r=void 0),Object.keys(s).forEach(c=>t(n,c,r,o,s[c],l));return}if(o==null&&a==null?(a=r,o=r=void 0):a==null&&(typeof r=="string"?(a=o,o=void 0):(a=o,o=r,r=void 0)),a===!1)a=yd;else if(!a)return;if(l){let c=a;a=function(u,...h){return i.off(n,u),c.call(this,u,...h)},dT(a,hT(c))}D7(n,s,a,o,r)}i.on=t;function e(n,s,r,o){let a=s;if(a&&a.preventDefault!=null&&a.handleObj!=null){let l=a.handleObj;e(a.delegateTarget,l.namespace?`${l.originType}.${l.namespace}`:l.originType,l.selector,l.handler);return}if(typeof s=="object"){let l=s;Object.keys(l).forEach(c=>e(n,c,r,l[c]));return}(r===!1||typeof r=="function")&&(o=r,r=void 0),o===!1&&(o=yd),aO(n,s,o,r)}i.off=e})(nx||(nx={}));var cO=class{constructor(t,e,n){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=I9("wheel")?"wheel":"mousewheel",this.target=t,this.onWheelCallback=e,this.onWheelGuard=n,this.onWheel=this.onWheel.bind(this),this.didWheel=this.didWheel.bind(this)}enable(){this.target.addEventListener(this.eventName,this.onWheel,{passive:!1})}disable(){this.target.removeEventListener(this.eventName,this.onWheel)}onWheel(t){if(this.onWheelGuard!=null&&!this.onWheelGuard(t))return;this.deltaX+=t.deltaX,this.deltaY+=t.deltaY,t.preventDefault();let e;(this.deltaX!==0||this.deltaY!==0)&&(t.stopPropagation(),e=!0),e===!0&&this.animationFrameId===0&&(this.animationFrameId=requestAnimationFrame(()=>{this.didWheel(t)}))}didWheel(t){this.animationFrameId=0,this.onWheelCallback(t,this.deltaX,this.deltaY),this.deltaX=0,this.deltaY=0}};function uO(i){let t=i.getBoundingClientRect(),e=i.ownerDocument.defaultView;return{top:t.top+e.pageYOffset,left:t.left+e.pageXOffset}}function cwt(i){return i.getBoundingClientRect().width}function uwt(i){return i.getBoundingClientRect().height}
4709function hwt(i){let t=o0(i,"position")==="fixed",e;if(t){let n=i.getBoundingClientRect();e={left:n.left,top:n.top}}else e=uO(i);if(!t){let n=i.ownerDocument,s=i.offsetParent||n.documentElement;for(;(s===n.body||s===n.documentElement)&&o0(s,"position")==="static";)s=s.parentNode;if(s!==i&&FI(s)){let r=uO(s);e.top-=r.top+a0(s,"borderTopWidth"),e.left-=r.left+a0(s,"borderLeftWidth")}}return{top:e.top-a0(i,"marginTop"),left:e.left-a0(i,"marginLeft")}}var dwt=Fo;function fT(i,t){let e=et.createSVGPoint(i.x,i.y).matrixTransform(t);return new Mt(e.x,e.y)}function fwt(i,t){return new Qe(fT(i.start,t),fT(i.end,t))}function pwt(i,t){let e=i instanceof Qs?i.points:i;return Array.isArray(e)||(e=[]),new Qs(e.map(n=>fT(n,t)))}function hO(i,t){let n=et.createSvgElement("svg").createSVGPoint();n.x=i.x,n.y=i.y;let s=n.matrixTransform(t);n.x=i.x+i.width,n.y=i.y;let r=n.matrixTransform(t);n.x=i.x+i.width,n.y=i.y+i.height;let o=n.matrixTransform(t);n.x=i.x,n.y=i.y+i.height;let a=n.matrixTransform(t),l=Math.min(s.x,r.x,o.x,a.x),c=Math.max(s.x,r.x,o.x,a.x),u=Math.min(s.y,r.y,o.y,a.y),h=Math.max(s.y,r.y,o.y,a.y);return new Pe(l,u,c-l,h-u)}function gwt(i,t,e){let n=null,s=i.ownerSVGElement;if(!s)return new Pe(0,0,0,0);try{n=i.getBBox()}catch{n={x:i.clientLeft,y:i.clientTop,width:i.clientWidth,height:i.clientHeight}}if(t)return Pe.create(n);let r=et.getTransformToElement(i,e||s);return hO(n,r)}function h0(i,t={}){let e=null;if(!i.ownerSVGElement||!et.isSVGGraphicsElement(i)){if(et.isHTMLElement(i)){let{left:o,top:a,width:l,height:c}=dO(i);return new Pe(o,a,l,c)}return new Pe(0,0,0,0)}let s=t.target;if(!t.recursive){try{e=i.getBBox()}catch{e={x:i.clientLeft,y:i.clientTop,width:i.clientWidth,height:i.clientHeight}}if(!s)return Pe.create(e);let o=et.getTransformToElement(i,s);return hO(e,o)}{let o=i.childNodes,a=o.length;if(a===0)return h0(i,{target:s});s||(s=i);let l=null;for(let c=0;c<a;c+=1){let u=o[c],h=null;u.childNodes.length===0?h=h0(u,{target:s}):h=h0(u,{target:s,recursive:!0}),l?l=l.union(h):l=Pe.create(h)}return l||new Pe(0,0,0,0)}}function dO(i){let t=0,e=0,n=0,s=0;if(i){let r=i;for(;r;)t+=r.offsetLeft,e+=r.offsetTop,r=r.offsetParent,r&&(t+=parseInt(et.getComputedStyle(r,"borderLeft"),10),e+=parseInt(et.getComputedStyle(r,"borderTop"),10));n=i.offsetWidth,s=i.offsetHeight}return{left:t,top:e,width:n,height:s}}function I7(i){let t=e=>{let n=i.getAttribute(e),s=n?parseFloat(n):0;return Number.isNaN(s)?0:s};switch(i instanceof SVGElement&&i.nodeName.toLowerCase()){case"rect":return new Pe(t("x"),t("y"),t("width"),t("height"));case"circle":return new Bu(t("cx"),t("cy"),t("r"),t("r"));case"ellipse":return new Bu(t("cx"),t("cy"),t("rx"),t("ry"));case"polyline":{let e=et.getPointsFromSvgElement(i);return new Qs(e)}case"polygon":{let e=et.getPointsFromSvgElement(i);return e.length>1&&e.push(e[0]),new Qs(e)}case"path":{let e=i.getAttribute("d");return V9(e)||(e=XM(e)),Pn.parse(e)}case"line":return new Qe(t("x1"),t("y1"),t("x2"),t("y2"));default:break}return h0(i)}function mwt(i,t,e,n){let s=Mt.create(t),r=Mt.create(e);n||(n=i instanceof SVGSVGElement?i:i.ownerSVGElement);let o=et.scale(i);i.setAttribute("transform","");let a=h0(i,{target:n}).scale(o.sx,o.sy),l=et.createSVGTransform();l.setTranslate(-a.x-a.width/2,-a.y-a.height/2);let c=et.createSVGTransform(),u=s.angleBetween(r,s.clone().translate(1,0));u&&c.setRotate(u,0,0);let h=et.createSVGTransform(),d=s.clone().move(r,a.width/2);h.setTranslate(2*s.x-d.x,2*s.y-d.y);let p=et.getTransformToElement(i,n),g=et.createSVGTransform();g.setMatrix(h.matrix.multiply(c.matrix.multiply(l.matrix.multiply(p.scale(o.sx,o.sy))))),i.setAttribute("transform",et.matrixToTransformString(g.matrix))}function O7(i){if(i==null)return null;let t=i;do{let e=t.tagName;if(typeof e!="string")return null;if(e=e.toUpperCase(),et.hasClass(t,"x6-port"))t=t.nextElementSibling;else if(e==="G")t=t.firstElementChild;else if(e==="TITLE")t=t.nextElementSibling;else break}while(t);return t}function bwt(i){let t=O7(i);if(!et.isSVGGraphicsElement(t)){if(et.isHTMLElement(i)){let{left:s,top:r,width:o,height:a}=dO(i);return new Pe(s,r,o,a)}return new Pe(0,0,0,0)}return I7(t).bbox()||Pe.create()}var vwt=(i,t)=>i-t,ix=class{constructor(t={}){this.comparator=t.comparator||vwt,this.index={},this.data=t.data||[],this.heapify()}isEmpty(){return this.data.length===0}insert(t,e,n){let s={priority:t,value:e},r=this.data.length;return n&&(s.id=n,this.index[n]=r),this.data.push(s),this.bubbleUp(r),this}peek(){return this.data[0]?this.data[0].value:null}peekPriority(){return this.data[0]?this.data[0].priority:null}updatePriority(t,e){let n=this.index[t];if(typeof n>
4709"u")throw new Error(`Node with id '${t}' was not found in the heap.`);let s=this.data,r=s[n].priority,o=this.comparator(e,r);o<0?(s[n].priority=e,this.bubbleUp(n)):o>0&&(s[n].priority=e,this.bubbleDown(n))}remove(){let t=this.data,e=t[0],n=t.pop();return e?.id&&delete this.index[e.id],t.length>0&&(t[0]=n,n.id&&(this.index[n.id]=0),this.bubbleDown(0)),e?e.value:null}heapify(){for(let t=0;t<this.data.length;t+=1)this.bubbleUp(t)}bubbleUp(t){let e=this.data,n,s,r=t;for(;r>0&&(s=r-1>>>1,this.comparator(e[r].priority,e[s].priority)<0);){n=e[s],e[s]=e[r];let o=e[r].id;o!=null&&(this.index[o]=s),e[r]=n,o=e[r].id,o!=null&&(this.index[o]=r),r=s}}bubbleDown(t){let e=this.data,n=e.length-1,s=t;for(;;){let r=(s<<1)+1,o=r+1,a=s;if(r<=n&&this.comparator(e[r].priority,e[a].priority)<0&&(a=r),o<=n&&this.comparator(e[o].priority,e[a].priority)<0&&(a=o),a!==s){let l=e[a];e[a]=e[s];let c=e[s].id;c!=null&&(this.index[c]=a),e[s]=l,c=e[s].id,c!=null&&(this.index[c]=s),s=a}else break}}};function fO(i,t,e=(n,s)=>1){let n={},s={},r={},o=new ix;
4709for(n[t]=0,Object.keys(i).forEach(a=>{a!==t&&(n[a]=1/0),o.insert(n[a],a,a)});!o.isEmpty();){let a=o.remove();r[a]=!0;let l=i[a];for(let c=0;c<l.length;c+=1){let u=l[c];if(!r[u]){let h=n[a]+e(a,u);h<n[u]&&(n[u]=h,s[u]=a,o.updatePriority(u,h))}}}return s}var ip={};Le(ip,{color:()=>xwt,number:()=>N7,object:()=>ywt,transform:()=>wwt,unit:()=>B7});var np=/(-?(?:\d*\.\d+|\d+))\s*(px|em|rem|ch|vh|vw|vmin|vmax|%|cm|mm|in|pt|pc|ex|fr|deg|rad|turn)$/;var N7=(i,t)=>{let e=t-i;return n=>i+e*n},ywt=(i,t)=>{let e=Object.keys(i);return n=>{let s={};for(let r=e.length-1;r!==-1;r-=1){let o=e[r];s[o]=i[o]+(t[o]-i[o])*n}return s}},B7=(i,t)=>{let e=np,n=e.exec(i),s=e.exec(t),r=s?s[1]:"",o=n?+n[1]:0,a=s?+s[1]:0,l=r.indexOf("."),c=l>0?r[1].length-l-1:0,u=a-o,h=n?n[2]:"";return d=>(o+u*d).toFixed(c)+h},xwt=(i,t)=>{let e=parseInt(i.slice(1),16),n=parseInt(t.slice(1),16),s=e&255,r=(n&255)-s,o=e&65280,a=(n&65280)-o,l=e&16711680,c=(n&16711680)-l;return u=>{let h=s+r*u&255,d=o+a*u&65280,p=l+c*u&16711680;return`#${(1<<24|h|d|p).toString(16).slice(1)}`}},wwt=(i,t)=>{let e=r=>{let o=[];if(!r)return o;let a=/(\w+)\(([^)]+)\)/g,l=a.exec(r);for(;l!==null;)l[1]&&l[2]&&o.push({name:l[1],values:l[2].split(/\s*,\s*/).filter(Boolean)}),l=a.exec(r);return o},n=e(i),s=e(t);return n.length===0||s.length===0?()=>i:r=>{let o=[];for(let a=0;a<Math.min(n.length,s.length);a++){let l=n[a],c=s[a];if(!(!l||!c)&&l.name===c.name&&l.values.length>0&&l.values.length===c.values.length){let u=[];for(let h=0;h<l.values.length;h++){let d=l.values[h],p=c.values[h];if(!(d===void 0||p===void 0))if(np.test(d)||np.test(p)){let g=B7(d,p);u.push(g(r))}else if(!Number.isNaN(parseFloat(d))&&!Number.isNaN(parseFloat(p))){let g=N7(parseFloat(d),parseFloat(p));u.push(g(r).toString())}else u.push(d)}u.length>0&&o.push(`${l.name}(${u.join(", ")})`)}}return o.length>0?o.join(" "):i}};var sx={};Le(sx,{bounce:()=>Awt,cubic:()=>Cwt,decorators:()=>Ewt,easeInBack:()=>Kwt,easeInBounce:()=>F7,easeInCirc:()=>qwt,easeInCubic:()=>Owt,easeInElastic:()=>Qwt,easeInExpo:()=>Wwt,easeInOutBack:()=>Zwt,easeInOutBounce:()=>n1t,easeInOutCirc:()=>Xwt,easeInOutCubic:()=>Bwt,easeInOutElastic:()=>e1t,easeInOutExpo:()=>Gwt,easeInOutQuad:()=>Iwt,easeInOutQuart:()=>zwt,easeInOutQuint:()=>jwt,easeInOutSine:()=>Rwt,easeInQuad:()=>Dwt,easeInQuart:()=>Fwt,easeInQuint:()=>Vwt,easeInSine:()=>kwt,easeOutBack:()=>Jwt,easeOutBounce:()=>pO,easeOutCirc:()=>Ywt,easeOutCubic:()=>Nwt,easeOutElastic:()=>t1t,easeOutExpo:()=>$wt,easeOutQuad:()=>Lwt,easeOutQuart:()=>Uwt,easeOutQuint:()=>Hwt,easeOutSine:()=>Pwt,exponential:()=>Twt,inout:()=>Mwt,linear:()=>_wt,quad:()=>Swt});var _wt=i=>i,Swt=i=>i*i,Cwt=i=>i*i*i,Mwt=i=>{if(i<=0)return 0;if(i>=1)return 1;let t=i*i,e=t*i;return 4*(i<.5?e:3*(i-t)+e-.75)},Twt=i=>Math.pow(2,10*(i-1)),Awt=(i=>{for(let t=0,e=1;;t+=e,e/=2)if(i>=(7-4*t)/11){let n=(11-6*t-11*i)/4;return-n*n+e*e}}),Ewt={reverse(i){return t=>1-i(1-t)},reflect(i){return t=>.5*(t<.5?i(2*t):2-i(2-2*t))},clamp(i,t=0,e=1){return n=>{let s=i(n);return s<t?t:s>e?e:s}},back(i=1.70158){return t=>t*t*((i+1)*t-i)},elastic(i=1.5){return t=>Math.pow(2,10*(t-1))*Math.cos(20*Math.PI*i/3*t)}};function kwt(i){return-1*Math.cos(i*(Math.PI/2))+1}function Pwt(i){return Math.sin(i*(Math.PI/2))}function Rwt(i){return-.5*(Math.cos(Math.PI*i)-1)}function Dwt(i){return i*i}function Lwt(i){return i*(2-i)}function Iwt(i){return i<.5?2*i*i:-1+(4-2*i)*i}function Owt(i){return i*i*i}function Nwt(i){let t=i-1;return t*t*t+1}function Bwt(i){return i<.5?4*i*i*i:(i-1)*(2*i-2)*(2*i-2)+1}function Fwt(i){return i*i*i*i}function Uwt(i){let t=i-1;return 1-t*t*t*t}function zwt(i){let t=i-1;return i<.5?8*i*i*i*i:1-8*t*t*t*t}function Vwt(i){return i*i*i*i*i}function Hwt(i){let t=i-1;return 1+t*t*t*t*t}function jwt(i){let t=i-1;return i<.5?16*i*i*i*i*i:1+16*t*t*t*t*t}function Wwt(i){return i===0?0:Math.pow(2,10*(i-1))}function $wt(i){return i===1?1:-Math.pow(2,-10*i)+1}function Gwt(i){if(i===0||i===1)return i;let t=i*2,e=t-1;return t<1?.5*Math.pow(2,10*e):.5*(-Math.pow(2,-10*e)+2)}function qwt(i){let t=i/1;return-1*(Math.sqrt(1-t*i)-1)}function Ywt(i){let t=i-1;return Math.sqrt(1-t*t)}function Xwt(i){let t=i*2,e=t-2;return t<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-e*e)+1)}
4709function Kwt(i,t=1.70158){return i*i*((t+1)*i-t)}function Jwt(i,t=1.70158){let e=i/1-1;return e*e*((t+1)*e+t)+1}function Zwt(i,t=1.70158){let e=i*2,n=e-2,s=t*1.525;return e<1?.5*e*e*((s+1)*e-s):.5*(n*n*((s+1)*n+s)+2)}function Qwt(i,t=.7){if(i===0||i===1)return i;let n=i/1-1,s=1-t,r=s/(2*Math.PI)*Math.asin(1);return-(Math.pow(2,10*n)*Math.sin((n-r)*(2*Math.PI)/s))}function t1t(i,t=.7){let e=1-t,n=i*2;if(i===0||i===1)return i;let s=e/(2*Math.PI)*Math.asin(1);return Math.pow(2,-10*n)*Math.sin((n-s)*(2*Math.PI)/e)+1}function e1t(i,t=.65){let e=1-t;if(i===0||i===1)return i;let n=i*2,s=n-1,r=e/(2*Math.PI)*Math.asin(1);return n<1?-.5*(Math.pow(2,10*s)*Math.sin((s-r)*(2*Math.PI)/e)):Math.pow(2,-10*s)*Math.sin((s-r)*(2*Math.PI)/e)*.5+1}function pO(i){let t=i/1;if(t<1/2.75)return 7.5625*t*t;if(t<2/2.75){let e=t-.5454545454545454;return 7.5625*e*e+.75}if(t<2.5/2.75){let e=t-.8181818181818182;return 7.5625*e*e+.9375}{let e=t-.9545454545454546;return 7.5625*e*e+.984375}}function F7(i){return 1-pO(1-i)}function n1t(i){return i<.5?F7(i*2)*.5:pO(i*2-1)*.5+.5}Sn();function pT(i,t){let e=[];for(let n=0;n<i.length;n+=2){let s=i[n],r=i[n+1],o=Array.isArray(t)?t:[t],a=zy(s,r,o);e.push(a)}return Kf(e)}var rx=class{constructor(){this.listeners={}}on(t,e,n){return e==null?this:(this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e,n),this)}once(t,e,n){let s=(...r)=>(this.off(t,s),pT([e,n],r));return this.on(t,s,this)}off(t,e,n){if(!(t||e||n))return this.listeners={},this;let s=this.listeners;return(t?[t]:Object.keys(s)).forEach(o=>{let a=s[o];if(a){if(!(e||n)){delete s[o];return}for(let l=a.length-2;l>=0;l-=2)e&&a[l]!==e||n&&a[l+1]!==n||a.splice(l,2)}}),this}trigger(t,...e){let n=!0;if(t!=="*"){let r=this.listeners[t];r!=null&&(n=pT([...r],e))}let s=this.listeners["*"];return s!=null?Kf([n,pT([...s],[t,...e])]):n}emit(t,...e){return this.trigger(t,...e)}};var Uo=class{get disposed(){return this._disposed===!0}dispose(){this._disposed=!0}};function ln(){return(i,t,e)=>{let n=e.value,s=i.__proto__;e.value=function(...r){this.disposed||(n.call(this,...r),s.dispose.call(this))}}}var Ii=class extends rx{dispose(){this.off()}};rn([ln()],Ii.prototype,"dispose",null);ge.applyMixins(Ii,Uo);var sp=class{constructor(){this.clear()}clear(){this.map=new WeakMap,this.arr=[]}has(t){return this.map.has(t)}get(t){return this.map.get(t)}set(t,e){this.map.set(t,e),this.arr.push(t)}delete(t){let e=this.arr.indexOf(t);e>=0&&this.arr.splice(e,1);let n=this.map.get(t);return this.map.delete(t),n}each(t){this.arr.forEach(e=>{let n=this.map.get(e);t(n,e)})}dispose(){this.clear()}};function gT(i){let t=[],e=[];return Array.isArray(i)?t.push(...i):i.split("|").forEach(n=>{n.indexOf("&")===-1?t.push(n):e.push(...n.split("&"))}),{or:t,and:e}}function gO(i,t){if(i!=null&&t!=null){let e=gT(i),n=gT(t),s=e.or.sort(),r=n.or.sort(),o=e.and.sort(),a=n.and.sort(),l=(c,u)=>c.length===u.length&&(c.length===0||c.every((h,d)=>h===u[d]));return l(s,r)&&l(o,a)}return i==null&&t==null}function zo(i,t,e){if(t==null||Array.isArray(t)&&t.length===0)return e?i.altKey!==!0&&i.ctrlKey!==!0&&i.metaKey!==!0&&i.shiftKey!==!0:!0;let{or:n,and:s}=gT(t),r=o=>{let a=`${o.toLowerCase()}Key`;return i[a]===!0};return n.some(o=>r(o))&&s.every(o=>r(o))}Sn();Sn();var ui=class i{static create(t){return new i(t)}constructor(t){this.options=Object.assign({},t),this.data=this.options.data||{},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this)}get names(){return Object.keys(this.data)}register(t,e,n=!1){if(typeof t=="object"){Object.entries(t).forEach(([o,a])=>{this.register(o,a,e)});return}this.exist(t)&&!n&&!$M()&&this.onDuplicated(t);let s=this.options.process,r=s?ke.call(s,this,t,e):e;return this.data[t]=r,r}unregister(t){let e=t?this.data[t]:null;return delete this.data[t],e}get(t){return t?this.data[t]:null}exist(t){return t?this.data[t]!=null:!1}onDuplicated(t){try{throw this.options.onConflict&&ke.call(this.options.onConflict,this,t),new Error(`${Li.upperFirst(this.options.type)} with name '${t}' already registered.`)}catch(e){throw e}}onNotFound(t,e){throw new Error(this.getSpellingSuggestion(t,e))}getSpellingSuggestion(t,e){let n=this.getSpellingSuggestionForName(t),s=e?`${e} ${Li.lowerFirst(this.options.type)}`:this.options.type;return`${Li.upperFirst(s)} with name '${t}' does not exist.${n?` Did you mean '${n}'?`:""}`}getSpellingSuggestionForName(t){return Li.getSpellingSuggestion(t,Object.keys(this.data),e=>e)}};var yO={};Le(yO,{annotations:()=>T1t,atConnectionLength:()=>Q1t,atConnectionLengthIgnoreGradient:()=>J1t,atConnectionLengthKeepGradient:()=>Q7,atConnectionRatio:()=>t_t,atConnectionRatioIgnoreGradient:()=>Z1t,atConnectionRatioKeepGradient:()=>tq,connection:()=>K1t,displayEmpty:()=>E1t,eol:()=>A1t,fill:()=>x1t,filter:()=>O1t,html:()=>I1t,lineHeight:()=>S1t,port:()=>N1t,ref:()=>i1t,refCx:()=>c1t,refCy:()=>u1t,refD:()=>p1t,refDKeepOffset:()=>h1t,refDResetOffset:()=>W7,refDx:()=>s1t,refDy:()=>r1t,refHeight:()=>H7,refHeight2:()=>y1t,refPoints:()=>g1t,refPointsKeepOffset:()=>d1t,refPointsResetOffset:()=>$7,refR:()=>f1t,refRCircumscribed:()=>l1t,refRInscribed:()=>j7,refRx:()=>o1t,refRy:()=>a1t,refWidth:()=>V7,refWidth2:()=>v1t,refX:()=>U7,refX2:()=>m1t,refY:()=>z7,refY2:()=>b1t,resetOffset:()=>D1t,sourceMarker:()=>G1t,stroke:()=>w1t,style:()=>L1t,targetMarker:()=>q1t,text:()=>X7,textPath:()=>M1t,textVerticalAnchor:()=>C1t,textWrap:()=>
4709_1t,title:()=>k1t,vertexMarker:()=>Y1t,xAlign:()=>P1t,yAlign:()=>R1t});var i1t={},U7={position:mT("x","width","origin")},z7={position:mT("y","height","origin")},s1t={position:mT("x","width","corner")},r1t={position:mT("y","height","corner")},V7={set:wd("width","width")},H7={set:wd("height","height")},o1t={set:wd("rx","width")},a1t={set:wd("ry","height")},j7={set:(i=>{let t=wd(i,"width"),e=wd(i,"height");return function(n,s){let r=s.refBBox,o=r.height>r.width?t:e;return ke.call(o,this,n,s)}})("r")},l1t={set(i,{refBBox:t}){let e=parseFloat(i),n=dn.isPercentage(i);n&&(e/=100);let s=Math.sqrt(t.height*t.height+t.width*t.width),r;return Number.isFinite(e)&&(n||e>=0&&e<=1?r=e*s:r=Math.max(e+s,0)),{r}}},c1t={set:wd("cx","width")},u1t={set:wd("cy","height")},W7={set:q7({resetOffset:!0})},h1t={set:q7({resetOffset:!1})},$7={set:Y7({resetOffset:!0})},d1t={set:Y7({resetOffset:!1})},f1t=j7,p1t=W7,g1t=$7,m1t=U7,b1t=z7,v1t=V7,y1t=H7;function mT(i,t,e){return(n,{refBBox:s})=>{if(n==null)return null;let r=parseFloat(n),o=dn.isPercentage(n);o&&(r/=100);let a;if(Number.isFinite(r)){let c=s[e];o||r>0&&r<1?a=c[i]+s[t]*r:a=c[i]+r}let l=new Mt;return l[i]=a||0,l}}function wd(i,t){return(e,{refBBox:n})=>{let s=parseFloat(e),r=dn.isPercentage(e);r&&(s/=100);let o={};if(Number.isFinite(s)){let a=r||s>=0&&s<=1?s*n[t]:Math.max(s+n[t],0);o[i]=a}return o}}function G7(i,t){let e="x6-shape",n=t&&t.resetOffset;return(s,{elem:r,refBBox:o})=>{let a=et.data(r,e);if(!a||a.value!==s){let y=i(s);a={value:s,shape:y,shapeBBox:y.bbox()},et.data(r,e,a)}let l=a.shape.clone(),c=a.shapeBBox.clone(),u=c.getOrigin(),h=o.getOrigin();c.x=h.x,c.y=h.y;let d=o.getMaxScaleToFit(c,h),p=c.width===0||o.width===0?1:d.sx,g=c.height===0||o.height===0?1:d.sy;return l.scale(p,g,u),n&&l.translate(-u.x,-u.y),l}}function q7(i){function t(n){return Pn.parse(n)}let e=G7(t,i);return(n,s)=>({d:e(n,s).serialize()})}function Y7(i){let t=G7(e=>new Qs(e),i);return(e,n)=>({points:t(e,n).serialize()})}var x1t={qualify:ge.isPlainObject,set(i,{view:t}){return`url(#${t.graph.defineGradient(i)})`}};var w1t={qualify:ge.isPlainObject,set(i,{view:t}){let e=t.cell,n=Object.assign({},i);if(e.isEdge()&&n.type==="linearGradient"){let s=t,r=s.sourcePoint,o=s.targetPoint;n.id=`gradient-${n.type}-${e.id}`,n.attrs=Object.assign(Object.assign({},n.attrs),{x1:r.x,y1:r.y,x2:o.x,y2:o.y,gradientUnits:"userSpaceOnUse"}),t.graph.defs.remove(n.id)}return`url(#${t.graph.defineGradient(n)})`}};var X7={qualify(i,{attrs:t}){return t.textWrap==null||!ge.isPlainObject(t.textWrap)},set(i,{view:t,elem:e,attrs:n}){let s="x6-text",r=et.data(e,s),o=u=>{try{if(typeof u=="string")return JSON.parse(u)}catch{}return u},a={x:n.x,eol:n.eol,annotations:o(n.annotations),textPath:o(n["text-path"]||n.textPath),textVerticalAnchor:n["text-vertical-anchor"]||n.textVerticalAnchor,displayEmpty:(n["display-empty"]||n.displayEmpty)==="true",lineHeight:n["line-height"]||n.lineHeight},l=n["font-size"]||n.fontSize,c=JSON.stringify([i,a]);if(l&&e.setAttribute("font-size",l),r==null||r!==c){let u=a.textPath;if(u!=null&&typeof u=="object"){let h=u.selector;if(typeof h=="string"){let d=t.find(h)[0];d instanceof SVGPathElement&&(et.ensureId(d),a.textPath=Object.assign({"xlink:href":`#${d.id}`},u))}}et.text(e,`${i}`,a),et.data(e,s,c)}}},_1t={qualify:ge.isPlainObject,set(i,{view:t,elem:e,attrs:n,refBBox:s}){var r,o;let a=i,l=a.width||0;dn.isPercentage(l)?s.width*=parseFloat(l)/100:l<=0?s.width+=l:s.width=l;let c=a.height||0;dn.isPercentage(c)?s.height*=parseFloat(c)/100:c<=0?s.height+=c:s.height=c;let u,h=(o=(r=a.text)!==null&&r!==void 0?r:n.text)!==null&&o!==void 0?o:e?.textContent;h!=null?u=et.breakText(`${h}`,s,{"font-weight":n["font-weight"]||n.fontWeight,"font-size":n["font-size"]||n.fontSize,"font-family":n["font-family"]||n.fontFamily,lineHeight:n.lineHeight},{ellipsis:a.ellipsis}):u="",ke.call(X7.set,this,u,{view:t,elem:e,attrs:n,refBBox:s,cell:t.cell})}},d0=(i,{attrs:t})=>t.text!==void 0,S1t={qualify:d0},C1t={qualify:d0},M1t={qualify:d0},T1t={qualify:d0},A1t={qualify:d0},E1t={qualify:d0};var k1t={qualify(i,{elem:t}){return t instanceof SVGElement},set(i,{elem:t}){let e="x6-title",n=`${i}`,s=et.data(t,e);if(s==null||s!==n){et.data(t,e,n);let r=t.firstChild;if(r&&r.tagName.toUpperCase()==="TITLE"){let o=r;o.textContent=n}else{let o=document.createElementNS(t.namespaceURI,"title");o.textContent=n,t.insertBefore(o,r)}}}};var P1t={offset:K7("x","width","right")},R1t={offset:K7("y","height","bottom")},D1t={offset(i,{refBBox:t}){return i?{x:-t.x,y:-t.y}:{x:0,y:0}}};function K7(i,t,e){return(n,{refBBox:s})=>{let r=new Mt,o;return n==="middle"?o=s[t]/2:n===e?o=s[t]:typeof n=="number"&&Number.isFinite(n)?o=n>-1&&n<1?-s[t]*n:-n:dn.isPercentage(n)?o=s[t]*parseFloat(n)/100:o=0,r[i]=-(s[i]+o),r}}var L1t={qualify:ge.isPlainObject,set(i,{elem:t}){et.css(t,i)}};var I1t={set(i,{elem:t}){t.innerHTML=`${i}`}};var O1t={qualify:ge.isPlainObject,set(i,{view:t}){return`url(#${t.graph.defineFilter(i)})`}};var N1t={set(i){return i!=null&&typeof i=="object"&&i.id?i.id:i}};Sn();var mO={};Le(mO,{async:()=>H1t,block:()=>B1t,circle:()=>Z7,circlePlus:()=>j1t,classic:()=>F1t,cross:()=>V1t,diamond:()=>U1t,ellipse:()=>W1t,path:()=>z1t});Sn();var B1t=i=>{var{size:t,width:e,height:n,offset:s,open:r}=i,o=hn(i,["size","width","height","offset","open"]);return J7({size:t,width:e,height:n,offset:s},r===!0,!0,void 0,o)},F1t=i=>{var{size:t,width:e,height:n,offset:s,factor:r}=i,o=hn(i,["size","width","height","offset","factor"]);return J7({size:t,width:e,height:n,offset:s},!1,!1,r,o)};function J7(i,t,e,n=3/4,s={}){let r=i.size||10,o=i.width||r,a=i.height||r,l=new Pn,c={};if(t)l.moveTo(o,0).lineTo(0,a/2).lineTo(o,a),c.fill="none";else{if(l.moveTo(0,a/2),l.lineTo(o,0),!e){let u=dn.clamp(n,0,1);l.lineTo(o*u,a/2)}l.lineTo(o,a),l.close()}return Object.assign(Object.assign(Object.assign({},c),s),{tagName:"path",d:Fo(l.serialize(),{x:i.offset!=null?i.offset:-o/2})})}Sn();var U1t=i=>{var{size:t,width:e,height:n,offset:s}=i,r=hn(i,["size","width","height","offset"]);let o=t||10,a=e||o,l=n||o,c=new Pn;return c.moveTo(0,l/2).lineTo(a/2,0).lineTo(a,l/2).lineTo(a/2,l).close(),Object.assign(Object.assign({},r),{tagName:"path",d:Fo(c.serialize(),s??-a/2)})};Sn();var z1t=i=>{var{d:t,offsetX:e,offsetY:n}=i,s=hn(i,["d","offsetX","offsetY"]);return Object.assign(Object.assign({},s),{tagName:"path",d:Fo(t,e,n)})};Sn();var V1t=i=>{var{size:t,width:e,height:n,offset:s}=i,r=hn(i,["size","width","height","offset"]);let o=t||10,a=e||o,l=n||o,c=new Pn;return c.moveTo(0,0).lineTo(a,l).moveTo(0,l).lineTo(a,0),Object.assign(Object.assign({},r),{tagName:"path",fill:"none",d:Fo(c.serialize(),s||-a/2)})};Sn();var H1t=i=>{var{width:t,height:e,offset:n,open:s,flip:r}=i,o=hn(i,["width","height","offset","open","flip"]);let a=e||6,l=t||10,c=s===!0,u=r===!0,h=Object.assign(Object.assign({},o),{tagName:"path"});u&&(a=-a);let d=new Pn;return d.moveTo(0,a).lineTo(l,0),c?h.fill="none":(d.lineTo(l,a),d.close()),h.d=Fo(d.serialize(),{x:n||-l/2,y:a/2}),h};Sn();var Z7=i=>{var{r:t}=i,e=hn(i,["r"]);let n=t||5;return Object.assign(Object.assign({cx:n},e),{tagName:"circle",r:n})},j1t=i=>{var{r:t}=i,e=hn(i,["r"]);let n=t||5,s=new Pn;return s.moveTo(n,0).lineTo(n,n*2),s.moveTo(0,n).lineTo(n*2,n),{children:[Object.assign(Object.assign({},Z7({r:n})),{fill:"none"}),Object.assign(Object.assign({},e),{tagName:"path",d:Fo(s.serialize(),-n)})]}};Sn();var W1t=i=>{var{rx:t,ry:e}=i,n=hn(i,["rx","ry"]);let s=t||5,r=e||5;return Object.assign(Object.assign({cx:s},n),{tagName:"ellipse",rx:s,ry:r})};var $1t=mO,rp=ui.create({type:"marker"});rp.register($1t,!0);function bO(i){return typeof i=="string"||ge.isPlainObject(i)}var G1t={qualify:bO,set(i,{view:t,attrs:e}){return vO("marker-start",i,t,e)}
4709},q1t={qualify:bO,set(i,{view:t,attrs:e}){return vO("marker-end",i,t,e,{transform:"rotate(180)"})}},Y1t={qualify:bO,set(i,{view:t,attrs:e}){return vO("marker-mid",i,t,e)}};function vO(i,t,e,n,s={}){let r=typeof t=="string"?{name:t}:t,{name:o,args:a}=r,l=hn(r,["name","args"]),c=l;if(o&&typeof o=="string"){let h=rp.get(o);if(h)c=h(Object.assign(Object.assign({},l),a));else return rp.onNotFound(o)}let u=Object.assign(Object.assign(Object.assign({},X1t(n,i)),s),c);return{[i]:`url(#${e.graph.defineMarker(u)})`}}function X1t(i,t){let e={},n=i.stroke;if(typeof n=="string"&&(e.stroke=n,e.fill=n),t!=="marker-mid"){let s=parseFloat(i.strokeWidth||i["stroke-width"]);if(Number.isFinite(s)&&s>1){let r=Math.ceil(s/2);e.refX=t==="marker-start"?r:-r}}return e}var ox=(i,{view:t})=>t.cell.isEdge(),K1t={qualify:ox,set(i,t){var e,n,s,r;let o=t.view,a=i.reverse||!1,l=i.stubs||0,c;if(Number.isFinite(l)&&l!==0)if(a){let u,h,d=o.getConnectionLength()||0;l<0?(u=(d+l)/2,h=-l):(u=l,h=d-l*2);let p=o.getConnection();c=(r=(s=(n=(e=p?.divideAtLength(u))===null||e===void 0?void 0:e[1])===null||n===void 0?void 0:n.divideAtLength(h))===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.serialize()}else{let u;l<0?u=((o.getConnectionLength()||0)+l)/2:u=l;let h=o.getConnection();if(h){let d=h.divideAtLength(u),p=h.divideAtLength(-u);d&&p&&(c=`${d[0].serialize()} ${p[1].serialize()}`)}}return{d:c||o.getConnectionPathData()}}},Q7={qualify:ox,set:bT("getTangentAtLength",{rotate:!0})},J1t={qualify:ox,set:bT("getTangentAtLength",{rotate:!1})},tq={qualify:ox,set:bT("getTangentAtRatio",{rotate:!0})},Z1t={qualify:ox,set:bT("getTangentAtRatio",{rotate:!1})},Q1t=Q7,t_t=tq;function bT(i,t){let e={x:1,y:0};return(n,s)=>{let r,o,a=s.view,l=a[i](Number(n));return l?(o=t.rotate?l.vector().vectorAngle(e):0,r=l.start):(r=a.path.start,o=0),o===0||Number.isNaN(o)?{transform:`translate(${r.x},${r.y})`}:{transform:`translate(${r.x},${r.y}) rotate(${o})`}}}var eq={xlinkHref:"xlink:href",xlinkShow:"xlink:show",xlinkRole:"xlink:role",xlinkType:"xlink:type",xlinkArcrole:"xlink:arcrole",xlinkTitle:"xlink:title",xlinkActuate:"xlink:actuate",xmlSpace:"xml:space",xmlBase:"xml:base",xmlLang:"xml:lang",preserveAspectRatio:"preserveAspectRatio",requiredExtension:"requiredExtension",requiredFeatures:"requiredFeatures",systemLanguage:"systemLanguage",externalResourcesRequired:"externalResourceRequired"};function nq(i,t,e){return!!(i!=null&&(typeof i=="string"||typeof i.qualify!="function"||ke.call(i.qualify,this,t,e)))}var xO=Object.assign(Object.assign({},eq),yO),op=ui.create({type:"attribute definition"});op.register(xO,!0);var CO={};Le(CO,{flipX:()=>wO,flipXY:()=>SO,flipY:()=>_O,watermark:()=>e_t});var wO=i=>{let t=document.createElement("canvas"),e=i.width,n=i.height;t.width=e*2,t.height=n;let s=t.getContext("2d");return s.drawImage(i,0,0,e,n),s.translate(2*e,0),s.scale(-1,1),s.drawImage(i,0,0,e,n),t};var _O=i=>{let t=document.createElement("canvas"),e=i.width,n=i.height;t.width=e,t.height=n*2;let s=t.getContext("2d");return s.drawImage(i,0,0,e,n),s.translate(0,2*n),s.scale(1,-1),s.drawImage(i,0,0,e,n),t};var SO=i=>{let t=document.createElement("canvas"),e=i.width,n=i.height;t.width=2*e,t.height=2*n;let s=t.getContext("2d");return s.drawImage(i,0,0,e,n),s.setTransform(-1,0,0,-1,t.width,t.height),s.drawImage(i,0,0,e,n),s.setTransform(-1,0,0,1,t.width,0),s.drawImage(i,0,0,e,n),s.setTransform(1,0,0,-1,0,t.height),s.drawImage(i,0,0,e,n),t};var e_t=(i,t)=>{let e=i.width,n=i.height,s=document.createElement("canvas");s.width=e*3,s.height=n*3;let r=s.getContext("2d"),o=t.angle!=null?-t.angle:-20,a=bs(o),l=s.width/4,c=s.height/4;for(let u=0;u<4;u+=1)for(let h=0;h<4;h+=1)(u+h)%2>0&&(r.setTransform(1,0,0,1,(2*u-1)*l,(2*h-1)*c),r.rotate(a),r.drawImage(i,-e/2,-n/2,e,n));return s};var vT=Object.assign({},CO);vT["flip-x"]=wO;vT["flip-y"]=_O;vT["flip-xy"]=SO;var f0=ui.create({type:"background pattern"});f0.register(vT,!0);var TO={};Le(TO,{anchor:()=>r_t,bbox:()=>MO,boundary:()=>i_t,rect:()=>n_t});function _d(i,t,e){let n;if(typeof e=="object"){if(Number.isFinite(e.y)){let r=new Qe(t,i),{start:o,end:a}=r.parallel(e.y);t=o,i=a}n=e.x}else n=e;if(n==null||!Number.isFinite(n))return i;let s=i.distance(t);return n===0&&s>0?i:i.move(t,-Math.min(n,s-1))}function ap(i){let t=i.getAttribute("stroke-width");return t===null?0:parseFloat(t)||0}function iq(i){if(i==null)return null;let t=i;do{let e=t.tagName;if(typeof e!="string")return null;if(e=e.toUpperCase(),e==="G")t=t.firstElementChild;else if(e==="TITLE")t=t.nextElementSibling;else break}while(t);return t}var MO=(i,t,e,n)=>{let s=t.getBBoxOfElement(e);n.stroked&&s.inflate(ap(e)/2);
4709let r=i.intersect(s),o=r&&r.length?i.start.closest(r):i.end;return _d(o,i.start,n.offset)};var n_t=function(i,t,e,n,s){let r=t.cell,o=r.isNode()?r.getAngle():0;if(o===0)return ke.call(MO,this,i,t,e,n,s);let a=t.getUnrotatedBBoxOfElement(e);n.stroked&&a.inflate(ap(e)/2);let l=a.getCenter(),c=i.clone().rotate(o,l),u=c.setLength(1e6).intersect(a),h=u&&u.length?c.start.closest(u).rotate(-o,l):i.end;return _d(h,i.start,n.offset)};var i_t=(i,t,e,n)=>{let s,r,o=i.end,a=n.selector;if(typeof a=="string"?s=t.findOne(a):Array.isArray(a)?s=ge.getByPath(e,a):s=iq(e),!et.isSVGGraphicsElement(s)){if(s===e||!et.isSVGGraphicsElement(e))return o;s=e}let l=t.getShapeOfElement(s),c=t.getMatrixOfElement(s),u=t.getRootTranslatedMatrix(),h=t.getRootRotatedMatrix(),d=u.multiply(h).multiply(c),p=d.inverse(),g=ei.transformLine(i,p),y=g.start.clone(),x=t.getDataOfElement(s);if(n.insideout===!1){x.shapeBBox==null&&(x.shapeBBox=l.bbox());let C=x.shapeBBox;if(C!=null&&C.containsPoint(y))return o}n.extrapolate===!0&&g.setLength(1e6);let w;if(Pn.isPath(l)){let C=n.precision||2;x.segmentSubdivisions==null&&(x.segmentSubdivisions=l.getSegmentSubdivisions({precision:C})),w={precision:C,segmentSubdivisions:x.segmentSubdivisions},r=g.intersect(l,w)}else r=g.intersect(l);r?Array.isArray(r)&&(r=y.closest(r)):n.sticky===!0&&(Pe.isRectangle(l)?r=l.getNearestPointToPoint(y):Bu.isEllipse(l)?r=l.intersectsWithLineFromCenterToPoint(y):r=l.closestPoint(y,w));let M=r?ei.transformPoint(r,d):o,A=n.offset||0;return n.stroked!==!1&&(typeof A=="object"?(A=Object.assign({},A),A.x==null&&(A.x=0),A.x+=ap(s)/2):A+=ap(s)/2),_d(M,i.start,A)};function s_t(i,t,e=0){let{start:n,end:s}=i,r,o,a,l;switch(t){case"left":l="x",r=s,o=n,a=-1;break;case"right":l="x",r=n,o=s,a=1;break;case"top":l="y",r=s,o=n,a=-1;break;case"bottom":l="y",r=n,o=s,a=1;break;default:return}n[l]<s[l]?r[l]=o[l]:o[l]=r[l],Number.isFinite(e)&&(r[l]+=a*e,o[l]+=a*e)}var r_t=(i,t,e,n)=>{let{alignOffset:s,align:r}=n;return r&&s_t(i,r,s),_d(i.end,i.start,n.offset)};var o_t=TO,lp=ui.create({type:"connection point"});lp.register(o_t,!0);var EO={};Le(EO,{jumpover:()=>aq,loop:()=>lq,normal:()=>cq,rounded:()=>uq,smooth:()=>hq});var sq=1,yT=1/3,xT=2/3,ax=[],wT=[];function a_t(i){let t=i.graph._jumpOverUpdateList;if(t==null&&(t=i.graph._jumpOverUpdateList=[],i.graph.on("cell:mouseup",()=>{let e=i.graph._jumpOverUpdateList;setTimeout(()=>{for(let n=0;n<e.length;n+=1)e[n].update()})}),i.graph.on("model:reseted",()=>{t=i.graph._jumpOverUpdateList=[]})),t.indexOf(i)<0){t.push(i);let e=()=>t.splice(t.indexOf(i),1);i.cell.once("change:connector",e),i.cell.once("removed",e)}}function AO(i,t,e=[]){let n=[i,...e,t],s=[];return n.forEach((r,o)=>{let a=n[o+1];a!=null&&s.push(new Qe(r,a))}),s}function l_t(i,t){let e=[];return t.forEach(n=>{let s=i.intersectsWithLine(n);if(s){let{x:r,y:o}=s,{start:a,end:l}=n,c=Math.round(a.x)===Math.round(r)&&Math.round(a.y)===Math.round(o),u=Math.round(l.x)===Math.round(r)&&Math.round(l.y)===Math.round(o);if(c||u)return;e.push(s)}}),e}function rq(i,t){return new Qe(i,t).squaredLength()}function c_t(i,t,e){return t.reduce((n,s,r)=>{if(wT.includes(s))return n;let o=n.pop()||i,a=Mt.create(s).move(o.start,-e),l=Mt.create(s).move(o.start,+e),c=t[r+1];if(c!=null){let d=l.distance(c);d<=e&&(l=c.move(o.start,d),wT.push(c))}else if(a.distance(o.end)<e*2+sq)return n.push(o),n;if(l.distance(o.start)<e*2+sq)return n.push(o),n;let h=new Qe(a,l);return ax.push(h),n.push(new Qe(o.start,a),h,new Qe(l,o.end)),n},[])}function oq(i,t,e,n){let s=new Pn,r;return r=Pn.createSegment("M",i[0].start),s.appendSegment(r),i.forEach((o,a)=>{if(ax.includes(o)){let l,c,u,h;if(e==="arc"){l=-90,c=o.start.diff(o.end),(c.x<0||c.x===0&&c.y<0)&&(l+=180);let p=o.getCenter(),g=new Qe(p,o.end).rotate(l,p),y;y=new Qe(o.start,p),u=y.pointAt(2/3).rotate(l,o.start),h=g.pointAt(1/3).rotate(-l,g.end),r=Pn.createSegment("C",u,h,g.end),s.appendSegment(r),y=new Qe(p,o.end),u=g.pointAt(1/3).rotate(l,g.end),h=y.pointAt(1/3).rotate(-l,o.end),r=Pn.createSegment("C",u,h,o.end),s.appendSegment(r)}else if(e==="gap")r=Pn.createSegment("M",o.end),s.appendSegment(r);else if(e==="cubic"){l=o.start.theta(o.end);let d=t*.6,p=t*1.35;
4709c=o.start.diff(o.end),(c.x<0||c.x===0&&c.y<0)&&(p*=-1),u=new Mt(o.start.x+d,o.start.y+p).rotate(l,o.start),h=new Mt(o.end.x-d,o.end.y+p).rotate(l,o.end),r=Pn.createSegment("C",u,h,o.end),s.appendSegment(r)}}else{let l=i[a+1];n===0||!l||ax.includes(l)?(r=Pn.createSegment("L",o.end),s.appendSegment(r)):u_t(n,s,o.end,o.start,l.end)}}),s}function u_t(i,t,e,n,s){let r=e.distance(n)/2,o=e.distance(s)/2,a=-Math.min(i,r),l=-Math.min(i,o),c=e.clone().move(n,a).round(),u=e.clone().move(s,l).round(),h=new Mt(yT*c.x+xT*e.x,xT*e.y+yT*c.y),d=new Mt(yT*u.x+xT*e.x,xT*e.y+yT*u.y),p;p=Pn.createSegment("L",c),t.appendSegment(p),p=Pn.createSegment("C",h,d,u),t.appendSegment(p)}var aq=function(i,t,e,n={}){ax=[],wT=[],a_t(this);let s=n.size||5,r=n.type||"arc",o=n.radius||0,a=n.ignoreConnectors||["smooth"],l=this.graph,u=l.model.getEdges();if(u.length===1)return oq(AO(i,t,e),s,r,o);let h=this.cell,d=u.indexOf(h),p=l.options.connecting.connector||{},g=u.filter((C,R)=>{let k=C.getConnector()||p;return a.includes(k.name)?!1:R>d?k.name!=="jumpover":!0}),y=g.map(C=>l.findViewByCell(C)),x=AO(i,t,e),w=y.map(C=>C==null?[]:C===this?x:AO(C.sourcePoint,C.targetPoint,C.routePoints)),M=[];x.forEach(C=>{let R=g.reduce((k,O,I)=>{if(O!==h){let U=l_t(C,w[I]);k.push(...U)}return k},[]).sort((k,O)=>rq(C.start,k)-rq(C.start,O));R.length>0?M.push(...c_t(C,R,s)):M.push(C)});let A=oq(M,s,r,o);return ax=[],wT=[],n.raw?A:A.serialize()};var lq=(i,t,e,n={})=>{let s=e.length===3?0:1,r=Mt.create(e[0+s]),o=Mt.create(e[2+s]),a=Mt.create(e[1+s]);if(!Mt.equals(i,t)){let c=new Mt((i.x+t.x)/2,(i.y+t.y)/2),u=c.angleBetween(Mt.create(i).rotate(90,c),a);u>1&&(r.rotate(180-u,c),o.rotate(180-u,c),a.rotate(180-u,c))}let l=`
4710     M ${i.x} ${i.y}
4711     Q ${r.x} ${r.y} ${a.x} ${a.y}
4712     Q ${o.x} ${o.y} ${t.x} ${t.y}
4713  `;return n.raw?Pn.parse(l):l};var cq=(i,t,e,n={})=>{let s=[i,...e,t],r=new Qs(s),o=new Pn(r);return n.raw?o:o.serialize()};var uq=(i,t,e,n={})=>{let s=new Pn;s.appendSegment(Pn.createSegment("M",i));let r=1/3,o=2/3,a=n.radius||10,l,c;for(let u=0,h=e.length;u<h;u+=1){let d=Mt.create(e[u]),p=e[u-1]||i,g=e[u+1]||t;l=c||d.distance(p)/2,c=d.distance(g)/2;let y=-Math.min(a,l),x=-Math.min(a,c),w=d.clone().move(p,y).round(),M=d.clone().move(g,x).round(),A=new Mt(r*w.x+o*d.x,o*d.y+r*w.y),C=new Mt(r*M.x+o*d.x,o*d.y+r*M.y);s.appendSegment(Pn.createSegment("L",w)),s.appendSegment(Pn.createSegment("C",A,C,M))}return s.appendSegment(Pn.createSegment("L",t)),n.raw?s:s.serialize()};var hq=(i,t,e,n={})=>{let s,r=n.direction;if(e&&e.length!==0){let o=[i,...e,t],a=Bo.throughPoints(o);s=new Pn(a)}else if(s=new Pn,s.appendSegment(Pn.createSegment("M",i)),r||(r=Math.abs(i.x-t.x)>=Math.abs(i.y-t.y)?"H":"V"),r==="H"){let o=(i.x+t.x)/2;s.appendSegment(Pn.createSegment("C",o,i.y,o,t.y,t.x,t.y))}else{let o=(i.y+t.y)/2;s.appendSegment(Pn.createSegment("C",i.x,o,t.x,o,t.x,t.y))}return n.raw?s:s.serialize()};var kO=EO,cp=ui.create({type:"connector"});cp.register(kO,!0);var DO={};Le(DO,{closest:()=>dq,length:()=>h_t,orth:()=>f_t,ratio:()=>p_t});function Sd(i){return function(t,e,n,s){if(n instanceof Element){let r=this.graph.findViewByElem(n),o;if(r)if(r.isEdgeElement(n)){let a=s.fixedAt!=null?s.fixedAt:"50%";o=PO(r,a)}else o=r.getBBoxOfElement(n).getCenter();else o=new Mt;return i.call(this,t,e,o,s)}return i.apply(this,arguments)}}function PO(i,t){let e=dn.isPercentage(t),n=typeof t=="string"?parseFloat(t):t;return e?i.getPointAtRatio(n/100):i.getPointAtLength(n)}var RO=(i,t,e,n)=>{let s=i.getClosestPoint(e);return s??new Mt},dq=Sd(RO);var h_t=(i,t,e,n)=>{let s=n.length!=null?n.length:20;return i.getPointAtLength(s)};var d_t=function(i,t,e,n){let r=i.getConnection(),o=i.getConnectionSubdivisions(),a=new Qe(e.clone().translate(0,1e6),e.clone().translate(0,-1e6)),l=new Qe(e.clone().translate(1e6,0),e.clone().translate(-1e6,0)),c=a.intersect(r,{segmentSubdivisions:o}),u=l.intersect(r,{segmentSubdivisions:o}),h=[];return c&&h.push(...c),u&&h.push(...u),h.length>0?e.closest(h):n.fallbackAt!=null?PO(i,n.fallbackAt):ke.call(RO,this,i,t,e,n)},f_t=Sd(d_t);var p_t=(i,t,e,n)=>{let s=n.ratio!=null?n.ratio:.5;return s>1&&(s/=100),i.getPointAtRatio(s)};var g_t=DO,up=ui.create({type:"edge endpoint"});up.register(g_t,!0);var LO={};Le(LO,{blur:()=>v_t,brightness:()=>M_t,contrast:()=>T_t,dropShadow:()=>y_t,grayScale:()=>x_t,highlight:()=>b_t,hueRotate:()=>S_t,invert:()=>C_t,outline:()=>m_t,saturate:()=>__t,sepia:()=>w_t});function p0(i,t){return i??t}function Ji(i,t){return i!=null&&Number.isFinite(i)?i:t}function m_t(i={}){let t=p0(i.color,"blue"),e=Ji(i.width,1),n=Ji(i.margin,2),s=Ji(i.opacity,1),r=n,o=n+e;return`
4714    <filter>
4715      <feFlood flood-color="${t}" flood-opacity="${s}" result="colored"/>
4716      <feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${o}" />
4717      <feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${r}" />
4718      <feComposite result="morphedOuterColored" in="colored" in2="morphedOuter" operator="in"/>
4719      <feComposite operator="xor" in="morphedOuterColored" in2="morphedInner" result="outline"/>
4720      <feMerge>
4721        <feMergeNode in="outline"/>
4722        <feMergeNode in="SourceGraphic"/>
4723      </feMerge>
4724    </filter>
4725  `.trim()}function b_t(i={}){let t=p0(i.color,"red"),e=Ji(i.blur,0),n=Ji(i.width,1),s=Ji(i.opacity,1);return`
4726      <filter>
4727        <feFlood flood-color="${t}" flood-opacity="${s}" result="colored"/>
4728        <feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${n}"/>
4729        <feComposite result="composed" in="colored" in2="morphed" operator="in"/>
4730        <feGaussianBlur result="blured" in="composed" stdDeviation="${e}"/>
4731        <feBlend in="SourceGraphic" in2="blured" mode="normal"/>
4732      </filter>
4733    `.trim()}function v_t(i={}){let t=Ji(i.x,2);return`
4734    <filter>
4735      <feGaussianBlur stdDeviation="${i.y!=null&&Number.isFinite(i.y)?[t,i.y]:t}"/>
4736    </filter>
4737  `.trim()}function y_t(i={}
4737){let t=Ji(i.dx,0),e=Ji(i.dy,0),n=p0(i.color,"black"),s=Ji(i.blur,4),r=Ji(i.opacity,1);return"SVGFEDropShadowElement"in window?`<filter>
4738         <feDropShadow stdDeviation="${s}" dx="${t}" dy="${e}" flood-color="${n}" flood-opacity="${r}" />
4739       </filter>`.trim():`<filter>
4740         <feGaussianBlur in="SourceAlpha" stdDeviation="${s}" />
4741         <feOffset dx="${t}" dy="${e}" result="offsetblur" />
4742         <feFlood flood-color="${n}" />
4743         <feComposite in2="offsetblur" operator="in" />
4744         <feComponentTransfer>
4745           <feFuncA type="linear" slope="${r}" />
4746         </feComponentTransfer>
4747         <feMerge>
4748           <feMergeNode/>
4749           <feMergeNode in="SourceGraphic"/>
4750         </feMerge>
4751       </filter>`.trim()}function x_t(i={}){let t=Ji(i.amount,1),e=.2126+.7874*(1-t),n=.7152-.7152*(1-t),s=.0722-.0722*(1-t),r=.2126-.2126*(1-t),o=.7152+.2848*(1-t),a=.0722-.0722*(1-t),l=.2126-.2126*(1-t),c=.0722+.9278*(1-t);return`
4752    <filter>
4753      <feColorMatrix type="matrix" values="${e} ${n} ${s} 0 0 ${r} ${o} ${a} 0 0 ${l} ${n} ${c} 0 0 0 0 0 1 0"/>
4754    </filter>
4755  `.trim()}function w_t(i={}){let t=Ji(i.amount,1),e=.393+.607*(1-t),n=.769-.769*(1-t),s=.189-.189*(1-t),r=.349-.349*(1-t),o=.686+.314*(1-t),a=.168-.168*(1-t),l=.272-.272*(1-t),c=.534-.534*(1-t),u=.131+.869*(1-t);return`
4756      <filter>
4757        <feColorMatrix type="matrix" values="${e} ${n} ${s} 0 0 ${r} ${o} ${a} 0 0 ${l} ${c} ${u} 0 0 0 0 0 1 0"/>
4758      </filter>
4759    `.trim()}function __t(i={}){return`
4760      <filter>
4761        <feColorMatrix type="saturate" values="${1-Ji(i.amount,1)}"/>
4762      </filter>
4763    `.trim()}function S_t(i={}){return`
4764      <filter>
4765        <feColorMatrix type="hueRotate" values="${Ji(i.angle,0)}"/>
4766      </filter>
4767    `.trim()}function C_t(i={}){let t=Ji(i.amount,1),e=1-t;return`
4768      <filter>
4769        <feComponentTransfer>
4770          <feFuncR type="table" tableValues="${t} ${e}"/>
4771          <feFuncG type="table" tableValues="${t} ${e}"/>
4772          <feFuncB type="table" tableValues="${t} ${e}"/>
4773        </feComponentTransfer>
4774      </filter>
4775    `.trim()}function M_t(i={}){let t=Ji(i.amount,1);return`
4776    <filter>
4777      <feComponentTransfer>
4778        <feFuncR type="linear" slope="${t}"/>
4779        <feFuncG type="linear" slope="${t}"/>
4780        <feFuncB type="linear" slope="${t}"/>
4781      </feComponentTransfer>
4782    </filter>
4783  `.trim()}function T_t(i={}){let t=Ji(i.amount,1),e=.5-t/2;return`
4784    <filter>
4785     <feComponentTransfer>
4786        <feFuncR type="linear" slope="${t}" intercept="${e}"/>
4787        <feFuncG type="linear" slope="${t}" intercept="${e}"/>
4788        <feFuncB type="linear" slope="${t}" intercept="${e}"/>
4789      </feComponentTransfer>
4790    </filter>
4791  `.trim()}var A_t=LO,hp=ui.create({type:"filter"});hp.register(A_t,!0);var IO={};Le(IO,{dot:()=>E_t,doubleMesh:()=>R_t,fixedDot:()=>k_t,mesh:()=>P_t});var E_t={color:"#aaaaaa",thickness:1,markup:"rect",update(i,t){let e=t.thickness*t.sx,n=t.thickness*t.sy;et.attr(i,{width:e,height:n,rx:e,ry:n,fill:t.color})}};var k_t={color:"#aaaaaa",thickness:1,markup:"rect",update(i,t){let e=t.sx<=1?t.thickness*t.sx:t.thickness;et.attr(i,{width:e,height:e,rx:e,ry:e,fill:t.color})}};var P_t={color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(i,t){let e,n=t.width,s=t.height,r=t.thickness;n-r>=0&&s-r>=0?e=["M",n,0,"H0 M0 0 V0",s].join(" "):e="M 0 0 0 0",et.attr(i,{d:e,stroke:t.color,"stroke-width":t.thickness})}};var R_t=[{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(i,t){let e,n=t.width,s=t.height,r=t.thickness;n-r>=0&&s-r>=0?e=["M",n,0,"H0 M0 0 V0",s].join(" "):e="M 0 0 0 0",et.attr(i,{d:e,stroke:t.color,"stroke-width":t.thickness})}},{color:"rgba(224,224,224,0.2)",thickness:3,factor:4,markup:"path",update(i,t){let e,n=t.factor||1,s=t.width*n,r=t.height*n,o=t.thickness;s-o>=0&&r-o>=0?e=["M",s,0,"H0 M0 0 V0",r].join(" "):e="M 0 0 0 0",t.width=s,t.height=r,et.attr(i,{d:e,stroke:t.color,"stroke-width":t.thickness})}}];var _T=class{constructor(){this.patterns={},this.root=_i.create(et.createSvgDocument(),{width:"100%",height:"100%"},[et.createSvgElement("defs")]).node}add(t,e){let n=this.root.childNodes[0];n&&n.appendChild(e),this.patterns[t]=e,_i.create("rect",{width:"100%",height:"100%",fill:`url(#${t})`}).appendTo(this.root)}get(t){return this.patterns[t]}has(t){return this.patterns[t]!=null}},OO=IO,dp=ui.create({type:"grid"});dp.register(OO,!0);var NO={};Le(NO,{className:()=>D_t,opacity:()=>L_t,stroke:()=>O_t});var In={prefixCls:"x6",autoInsertCSS:!0,useCSSSelector:!0,prefix(i){return`${In.prefixCls}-${i}`}};var fq=In.prefix("highlighted"),D_t={highlight(i,t,e){let n=e&&e.className||fq;et.addClass(t,n)},unhighlight(i,t,e){let n=e&&e.className||fq;et.removeClass(t,n)}};var pq=In.prefix("highlight-opacity"),L_t={highlight(i,t){et.addClass(t,pq)},unhighlight(i,t){et.removeClass(t,pq)}};var I_t={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},O_t={highlight(i,t,e){let n=gq(t,e);if(B_t(n))return;e=ge.defaultsDeep({},e,I_t);let s=_i.create(t),r,o;try{r=s.toPathData()}catch{o=ei.bbox(s.node,!0),r=et.rectToPathData(Object.assign(Object.assign({},e),o))}let a=et.createSvgElement("path");if(et.attr(a,Object.assign({d:r,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"},e.attrs?et.kebablizeAttrs(e.attrs):null)),i.isEdgeElement(t))et.attr(a,"d",i.getConnectionPathData());else{let u=s.getTransformToElement(i.container),h=e.padding;if(h){o==null&&(o=ei.bbox(s.node,!0));let d=o.x+o.width/2,p=o.y+o.height/2;o=ei.transformRectangle(o,u);let g=Math.max(o.width,1),y=Math.max(o.height,1),x=(g+h)/g,w=(y+h)/y,M=et.createSVGMatrix({a:x,b:0,c:0,d:w,e:d-x*d,f:p-w*p});u=u.multiply(M)}et.transform(a,u)}et.addClass(a,In.prefix("highlight-stroke"));let l=i.cell,c=()=>mq(n);l.on("removed",c),l.model&&l.model.on("reseted",c),i.container.appendChild(a),N_t(n,a)},unhighlight(i,t,e){mq(gq(t,e))}};function gq(i,t){return et.ensureId(i),i.id+JSON.stringify(t)}var ST={};function N_t(i,t){ST[i]=t}function B_t(i){return ST[i]!=null}function mq(i){let t=ST[i];t&&(et.remove(t),delete ST[i])}function bq(i,t){if(typeof t.highlight!="function")throw new Error(`Highlighter '${i}' is missing required \`highlight()\` method`);
4791if(typeof t.unhighlight!="function")throw new Error(`Highlighter '${i}' is missing required \`unhighlight()\` method`)}var F_t=NO,fp=ui.create({type:"highlighter"});fp.register(F_t,!0);var BO={};Le(BO,{bottom:()=>V_t,bottomLeft:()=>G_t,bottomRight:()=>q_t,center:()=>U_t,left:()=>H_t,midSide:()=>Z_t,nodeCenter:()=>K_t,orth:()=>X_t,right:()=>j_t,top:()=>z_t,topLeft:()=>W_t,topRight:()=>$_t});var U_t=Uu("center"),z_t=Uu("topCenter"),V_t=Uu("bottomCenter"),H_t=Uu("leftMiddle"),j_t=Uu("rightMiddle"),W_t=Uu("topLeft"),$_t=Uu("topRight"),G_t=Uu("bottomLeft"),q_t=Uu("bottomRight");function Uu(i){return(t,e,n,s={})=>{let r;t.cell.visible?r=s.rotate?t.getUnrotatedBBoxOfElement(e):t.getBBoxOfElement(e):r=t.cell.getBBox();let o=r[i];o.x+=dn.normalizePercentage(s.dx,r.width),o.y+=dn.normalizePercentage(s.dy,r.height);let a=t.cell;return s.rotate?o.rotate(-a.getAngle(),a.getBBox().getCenter()):o}}var Y_t=(i,t,e,n)=>{let s=Ts(i.cell.getAngle()),r=i.cell.visible?i.getBBoxOfElement(t):i.cell.getBBox(),o=r.getCenter(),a=r.getTopLeft(),l=r.getBottomRight(),c=n.padding;if(Number.isFinite(c)||(c=0),a.y+c<=e.y&&e.y<=l.y-c){let u=e.y-o.y;o.x+=s===0||s===180?0:u*1/Math.tan(bs(s)),o.y+=u}else if(a.x+c<=e.x&&e.x<=l.x-c){let u=e.x-o.x;o.y+=s===90||s===270?0:u*Math.tan(bs(s)),o.x+=u}return o},X_t=Sd(Y_t);var K_t=function(i,t,e,n,s){let r=i.cell.getConnectionPoint(this.cell,s);return(n.dx||n.dy)&&r.translate(n.dx||0,n.dy||0),r};var J_t=(i,t,e,n)=>{let s,r=0,o,a=i.cell;n.rotate?(s=i.getUnrotatedBBoxOfElement(t),o=a.getBBox().getCenter(),r=a.getAngle()):a.visible?s=i.getBBoxOfElement(t):s=i.cell.getBBox();let l=n.padding;l!=null&&Number.isFinite(l)&&s.inflate(l),n.rotate&&e.rotate(r,o);let c=s.getNearestSideToPoint(e),u;switch(c){case"left":u=s.getLeftMiddle();break;case"right":u=s.getRightMiddle();break;case"top":u=s.getTopCenter();break;case"bottom":u=s.getBottomCenter();break;default:break}let h=n.direction;return h==="H"?(c==="top"||c==="bottom")&&(e.x<=s.x+s.width?u=s.getLeftMiddle():u=s.getRightMiddle()):h==="V"&&(e.y<=s.y+s.height?u=s.getTopCenter():u=s.getBottomCenter()),n.rotate?u.rotate(-r,o):u},Z_t=Sd(J_t);var Q_t=BO,pp=ui.create({type:"node endpoint"});pp.register(Q_t,!0);var FO={};Le(FO,{bottom:()=>rSt,inside:()=>lSt,insideOriented:()=>cSt,left:()=>nSt,manual:()=>eSt,outside:()=>oSt,outsideOriented:()=>aSt,radial:()=>uSt,radialOriented:()=>hSt,right:()=>iSt,top:()=>sSt});var tSt={position:{x:0,y:0},angle:0,attrs:{".":{y:"0","text-anchor":"start"}}};function Yl(i,t){let{x:e,y:n,angle:s,attrs:r}=t||{};return ge.defaultsDeep({},{angle:s,attrs:r,position:{x:e,y:n}},i,tSt)}var eSt=(i,t,e)=>Yl({position:t.getTopLeft()},e),nSt=(i,t,e)=>Yl({position:{x:-15,y:0},attrs:{".":{y:".3em","text-anchor":"end"}}},e),iSt=(i,t,e)=>Yl({position:{x:15,y:0},attrs:{".":{y:".3em","text-anchor":"start"}}},e),sSt=(i,t,e)=>Yl({position:{x:0,y:-15},attrs:{".":{"text-anchor":"middle"}}},e),rSt=(i,t,e)=>Yl({position:{x:0,y:15},attrs:{".":{y:".6em","text-anchor":"middle"}}},e);var oSt=(i,t,e)=>vq(i,t,!1,e),aSt=(i,t,e)=>vq(i,t,!0,e),lSt=(i,t,e)=>yq(i,t,!1,e),cSt=(i,t,e)=>yq(i,t,!0,e);function vq(i,t,e,n){let s=n.offset!=null?n.offset:15,r=t.getCenter().theta(i),o=xq(t),a,l,c,u,h=0;return r<o[1]||r>o[2]?(a=".3em",l=s,c=0,u="start"):r<o[0]?(a="0",l=0,c=-s,e?(h=-90,u="start"):u="middle"):r<o[3]?(a=".3em",l=-s,c=0,u="end"):(a=".6em",l=0,c=s,e?(h=90,u="start"):u="middle"),Yl({position:{x:Math.round(l),y:Math.round(c)},angle:h,attrs:{".":{y:a,"text-anchor":u}}},n)}function yq(i,t,e,n){let s=n.offset!=null?n.offset:15,r=t.getCenter().theta(i),o=xq(t),a,l,c,u,h=0;return r<o[1]||r>o[2]?(a=".3em",l=-s,c=0,u="end"):r<o[0]?(a=".6em",l=0,c=s,e?(h=90,u="start"):u="middle"):r<o[3]?(a=".3em",l=s,c=0,u="start"):(a="0em",l=0,c=-s,e?(h=-90,u="start"):u="middle"),Yl({position:{x:Math.round(l),y:Math.round(c)},angle:h,attrs:{".":{y:a,"text-anchor":u}}},n)}function xq(i){let t=i.getCenter(),e=t.theta(i.getTopLeft()),n=t.theta(i.getBottomLeft()),s=t.theta(i.getBottomRight()),r=t.theta(i.getTopRight());return[e,r,s,n]}var uSt=(i,t,e)=>wq(i.diff(t.getCenter()),!1,e),hSt=(i,t,e)=>wq(i.diff(t.getCenter()),!0,e);function wq(i,t,e){let n=e.offset!=null?e.offset:20,s=new Mt(0,0),r=-i.theta(s),o=i.clone().move(s,n).diff(i).roun
4791d(),a=".3em",l,c=r;return(r+90)%180===0?(l=t?"end":"middle",!t&&r===-270&&(a="0em")):r>-270&&r<-90?(l="start",c=r-180):l="end",Yl({position:o.round().toJSON(),angle:t?c:0,attrs:{".":{y:a,"text-anchor":l}}},e)}var UO=FO,g0=ui.create({type:"port label layout"});g0.register(UO,!0);var zO={};Le(zO,{absolute:()=>dSt,bottom:()=>ySt,ellipse:()=>fSt,ellipseSpread:()=>pSt,left:()=>mSt,line:()=>gSt,right:()=>bSt,top:()=>vSt});function lx(i,t={}){return new Mt(dn.normalizePercentage(t.x,i.width),dn.normalizePercentage(t.y,i.height))}function m0(i,t,e){return Object.assign({angle:t,position:i.toJSON()},e)}var dSt=(i,t)=>i.map(({x:e,y:n,angle:s})=>m0(lx(t,{x:e,y:n}),s||0));var fSt=(i,t,e)=>{let n=e.start||0,s=e.step||20;return _q(i,t,n,(r,o)=>(r+.5-o/2)*s)},pSt=(i,t,e)=>{let n=e.start||0,s=e.step||360/i.length;return _q(i,t,n,r=>r*s)};function _q(i,t,e,n){let s=t.getCenter(),r=t.getTopCenter(),o=t.width/t.height,a=Bu.fromRect(t),l=i.length;return i.map((c,u)=>{let h=e+n(u,l),d=r.clone().rotate(-h,s).scale(o,1,s),p=c.compensateRotate?-a.tangentTheta(d):0;return(c.dx||c.dy)&&d.translate(c.dx||0,c.dy||0),c.dr&&d.move(s,c.dr),m0(d.round(),p,c)})}Sn();var gSt=(i,t,e)=>{let n=lx(t,e.start||t.getOrigin()),s=lx(t,e.end||t.getCorner());return cx(i,n,s,e)},mSt=(i,t,e)=>cx(i,t.getTopLeft(),t.getBottomLeft(),e),bSt=(i,t,e)=>cx(i,t.getTopRight(),t.getBottomRight(),e),vSt=(i,t,e)=>cx(i,t.getTopLeft(),t.getTopRight(),e),ySt=(i,t,e)=>cx(i,t.getBottomLeft(),t.getBottomRight(),e);function cx(i,t,e,n){let s=new Qe(t,e),r=i.length;return i.map((o,a)=>{var{strict:l}=o,c=hn(o,["strict"]);let u=l||n.strict?(a+1)/(r+1):(a+.5)/r,h=s.pointAt(u);return(c.dx||c.dy)&&h.translate(c.dx||0,c.dy||0),m0(h.round(),0,c)})}var VO=zO,gp=ui.create({type:"port layout"});gp.register(VO,!0);var eN={};Le(eN,{er:()=>NSt,loop:()=>BSt,manhattan:()=>tN,metro:()=>OSt,normal:()=>xSt,oneSide:()=>wSt,orth:()=>GO});var xSt=i=>[...i];var wSt=(i,t,e)=>{let n=t.side||"bottom",s=dn.normalizeSides(t.padding||40),r=e.sourceBBox,o=e.targetBBox,a=r.getCenter(),l=o.getCenter(),c,u,h;switch(n){case"top":h=-1,c="y",u="height";break;case"left":h=-1,c="x",u="width";break;case"right":h=1,c="x",u="width";break;default:h=1,c="y",u="height";break}return a[c]+=h*(r[u]/2+s[n]),l[c]+=h*(o[u]/2+s[n]),h*(a[c]-l[c])>0?l[c]=a[c]:a[c]=l[c],[a.toJSON(),...i,l.toJSON()]};function ux(i){return new Pe(i.x,i.y,0,0)}function hx(i={}){let t=dn.normalizeSides(i.padding||20);return{x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}function HO(i,t={}){return i.sourceBBox.clone().moveAndExpand(hx(t))}function jO(i,t={}){return i.targetBBox.clone().moveAndExpand(hx(t))}function Sq(i,t={}){return i.sourceAnchor?i.sourceAnchor:HO(i,t).getCenter()}function Cq(i,t={}){return i.targetAnchor?i.targetAnchor:jO(i,t).getCenter()}var GO=(i,t,e)=>{let n=HO(e,t),s=jO(e,t),r=Sq(e,t),o=Cq(e,t);n=n.union(ux(r)),s=s.union(ux(o));let a=i.map(u=>Mt.create(u));a.unshift(r),a.push(o);let l=null,c=[];for(let u=0,h=a.length-1;u<h;u+=1){let d=null,p=a[u],g=a[u+1],y=Vo(p,g)!=null;if(u===0)u+1===h?n.intersectsWithRect(s.clone().inflate(1))?d=WO(p,g,n,s):y||(d=TSt(p,g,n,s)):n.containsPoint(g)?d=WO(p,g,n,ux(g).moveAndExpand(hx(t))):y||(d=CT(p,g,n));else if(u+1===h){let x=y&&Vo(g,p)===l;s.containsPoint(p)||x?d=WO(p,g,ux(p).moveAndExpand(hx(t)),s,l):y||(d=MSt(p,g,s,l))}else y||(d=Mq(p,g,l));d?(c.push(...d.points),l=d.direction):l=Vo(p,g),u+1<h&&c.push(g)}return c},SSt={N:"S",S:"N",E:"W",W:"E"},CSt={N:-Math.PI/2*3,S:-Math.PI/2,E:0,W:Math.PI};function MT(i,t,e){let n=new Mt(i.x,t.y);return e.containsPoint(n)&&(n=new Mt(t.x,i.y)),n}function $O(i,t){return i[t==="W"||t==="E"?"width":"height"]}function Vo(i,t){return i.x===t.x?i.y>t.y?"N":"S":i.y===t.y?i.x>t.x?"W":"E":null}function Mq(i,t,e){let n=new Mt(i.x,t.y),s=new Mt(t.x,i.y),r=Vo(i,n),o=Vo(i,s),a=e?SSt[e]:null,l=r===e||r!==a&&(o===a||o!==e)?n:s;return{points:[l],direction:Vo(l,t)}}function CT(i,t,e){let n=MT(i,t,e);return{points:[n],direction:Vo(n,t)}}function MSt(i,t,e,n){let s=[new Mt(i.x,t.y),new Mt(t.x,i.y)],r=s.filter(l=>!e.containsPoint(l)),o=r.filter(l=>Vo(l,i)!==n),a;if(o.length>0)return a=o.filter(l=>Vo(i,l)===n).pop(),a=a||o[0],{points:[a],direction:Vo(a,t)};{a=cs.difference(s,r)[0];let l=Mt.create(t).move(a,-$O(e,n)/2);return{points:[MT(l,i,e),l],direction:Vo(l,t)}}}function TSt(i,t,e,n){let s=CT(t,i,n),r=s.points[0];if(e.containsPoint(r)){s=CT(i,t,e);let o=s.points[0];if(n.containsPoint(o)){let a=Mt.create(i).move(o,-$O(e,Vo(i,o))/2),l=Mt.create(t).move(r,-$O(n,Vo(t,r))/2),c=new Qe(a,l).getCenter(),u=CT(i,c,e),h=Mq(c,t,u.direction);s.points=[u.points[0],h.points[0]],s.direction=h.direction}}return s}function WO(i,t,e,n,s){let r=e.union(n).inflate(1),o=r.getCenter(),a=o.distance(t)>o.distance(i),l=a?t:i,c=a?i:t,u,h,d;s?(u=Mt.fromPolar(r.width+r.height,CSt[s],l),u=r.getNearestPointToPoint(u).move(u,-1)):u=r.getNearestPointToPoint(l).move(l,1),h=MT(u,c,r);let p;u.round().equals(h.round())?(h=Mt.fromPolar(r.width+r.height,bs(u.theta(l))+Math.PI/2,c),h=r.getNearestPointToPoint(h).move(c,1).round(),d=MT(u,h,r),p=a?[h,d,u]:[u,d,h]):p=a?[h,u]:[u,h];let g=Vo(a?u:h,t);return{points:p,direction:g}}var Tq={step:10,maxLoopCount:2e3,precision:1,maxDirectionChange:90,perpendicular:!0,excludeTerminals:[],excludeNodes:[],excludeShapes:[],startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{top:{x:0,y:-1},right:{x:1,y:0},bottom:{x:0,y:1}
4791,left:{x:-1,y:0}},cost(){return zu(this.step,this)},directions(){let i=zu(this.step,this),t=zu(this.cost,this);return[{cost:t,offsetX:i,offsetY:0},{cost:t,offsetX:-i,offsetY:0},{cost:t,offsetX:0,offsetY:i},{cost:t,offsetX:0,offsetY:-i}]},penalties(){let i=zu(this.step,this);return{0:0,45:i/2,90:i/2}},paddingBox(){let i=zu(this.step,this);return{x:-i,y:-i,width:2*i,height:2*i}},fallbackRouter:GO,draggingRouter:null,snapToGrid:!0};function zu(i,t){return typeof i=="function"?i.call(t):i}function Aq(i){let t=Object.keys(i).reduce((e,n)=>{let s=e;return n==="fallbackRouter"||n==="draggingRouter"||n==="fallbackRoute"?s[n]=i[n]:s[n]=zu(i[n],i),e},{});if(t.padding){let e=dn.normalizeSides(t.padding);t.paddingBox={x:-e.left,y:-e.top,width:e.left+e.right,height:e.top+e.bottom}}return t.directions.forEach(e=>{let n=new Mt(0,0),s=new Mt(e.offsetX,e.offsetY);e.angle=Ts(n.theta(s))}),t}var TT=class{constructor(t){this.options=t,this.mapGridSize=100,this.map={}}build(t,e){let n=this.options,s=n.excludeTerminals.reduce((c,u)=>{let h=e[u];if(h){let d=t.getCell(h.cell);d&&c.push(d)}return c},[]),r=[],o=t.getCell(e.getSourceCellId());o&&(r=cs.union(r,o.getAncestors().map(c=>c.id)));let a=t.getCell(e.getTargetCellId());a&&(r=cs.union(r,a.getAncestors().map(c=>c.id)));let l=this.mapGridSize;return t.getNodes().reduce((c,u)=>{let h=s.some(x=>x.id===u.id),d=u.shape?n.excludeShapes.includes(u.shape):!1,p=n.excludeNodes.some(x=>typeof x=="string"?u.id===x:x===u),g=r.includes(u.id),y=d||h||p||g;if(u.isVisible()&&!y){let x=u.getBBox().moveAndExpand(n.paddingBox),w=x.getOrigin().snapToGrid(l),M=x.getCorner().snapToGrid(l);for(let A=w.x;A<=M.x;A+=l)for(let C=w.y;C<=M.y;C+=l){let R=new Mt(A,C).toString();c[R]==null&&(c[R]=[]),c[R].push(x)}}return c},this.map),this}isAccessible(t){let e=t.clone().snapToGrid(this.mapGridSize).toString(),n=this.map[e];return n?n.every(s=>!s.containsPoint(t)):!0}},AT=new WeakMap;function Cd(i){let t=AT.get(i);t&&(t.dirty=!0)}function ASt(i){let t=AT.get(i);!t||t.installed||(i.on("reseted",()=>Cd(i)),i.on("updated",()=>Cd(i)),i.on("cell:added",()=>Cd(i)),i.on("cell:removed",()=>Cd(i)),i.on("cell:change:position",()=>Cd(i)),i.on("cell:change:size",()=>Cd(i)),i.on("edge:change:source",()=>Cd(i)),i.on("edge:change:target",()=>Cd(i)),t.installed=!0)}function Eq(i){let t=i.paddingBox,e=t==null?"none":`${t.x},${t.y},${t.width},${t.height}`,n=(i.excludeTerminals||[]).map(o=>o).sort().join("|"),s=(i.excludeShapes||[]).slice().sort().join("|"),r=(i.excludeNodes||[]).map(o=>typeof o=="string"?o:o?.id||"node").slice().sort().join("|");return`${e}#${n}#${s}#${r}`}function kq(i,t,e){let n=AT.get(i);if(!n){let r=new TT(e).build(i,t);return n={map:r,dirty:!1,installed:!1,optionsKey:Eq(e)},AT.set(i,n),ASt(i),r}let s=Eq(e);return(n.dirty||n.optionsKey!==s)&&(n.map=new TT(e).build(i,t),n.dirty=!1,n.optionsKey=s),n.map}var ET=class{constructor(){this.items=[],this.hash={},this.values={},this.indexes={}}swap(t,e){let n=this.items[t],s=this.items[e];this.items[t]=s,this.items[e]=n,this.indexes[s]=t,this.indexes[n]=e}less(t,e){let n=this.items[t],s=this.items[e];return this.values[n]<this.values[s]}bubbleUp(t){for(;t>0;){let e=t-1>>1;
4791if(this.less(t,e))this.swap(t,e),t=e;else break}}bubbleDown(t){let e=this.items.length;for(;;){let n=(t<<1)+1,s=n+1,r=t;if(n<e&&this.less(n,r)&&(r=n),s<e&&this.less(s,r)&&(r=s),r!==t)this.swap(t,r),t=r;else break}}add(t,e){let n=this.hash[t]===1;if(this.values[t]=e,n){let s=this.indexes[t];s!=null&&(this.bubbleUp(s),this.bubbleDown(s))}else{this.hash[t]=1,this.items.push(t);let s=this.items.length-1;this.indexes[t]=s,this.bubbleUp(s)}}pop(){if(this.items.length===0)return;let t=this.items[0];this.hash[t]=2;let e=this.items.pop();return delete this.indexes[t],this.items.length>0&&e!=null&&(this.items[0]=e,this.indexes[e]=0,this.bubbleDown(0)),t}isOpen(t){return this.hash[t]===1}isClose(t){return this.hash[t]===2}isEmpty(){return this.items.length===0}};function YO(i,t){let e=i.sourceBBox.clone();return t&&t.paddingBox?e.moveAndExpand(t.paddingBox):e}function XO(i,t){let e=i.targetBBox.clone();return t&&t.paddingBox?e.moveAndExpand(t.paddingBox):e}function KO(i,t){return i.sourceAnchor?i.sourceAnchor:YO(i,t).getCenter()}function Rq(i,t){return i.targetAnchor?i.targetAnchor:XO(i,t).getCenter()}function kT(i,t,e,n,s){let r=360/e,o=i.theta(ESt(i,t,n,s)),a=Ts(o+r/2);return r*Math.floor(a/r)}function ESt(i,t,e,n){let s=n.step,r=t.x-i.x,o=t.y-i.y,a=r/e.x,l=o/e.y,c=a*s,u=l*s;return new Mt(i.x+c,i.y+u)}function JO(i,t){let e=Math.abs(i-t);return e>180?360-e:e}function Dq(i,t){let e=t.step;return t.directions.forEach(n=>{n.gridOffsetX=n.offsetX/e*i.x,n.gridOffsetY=n.offsetY/e*i.y}),t.directions}function Lq(i,t,e){return{source:t.clone(),x:Pq(e.x-t.x,i),y:Pq(e.y-t.y,i)}}function Pq(i,t){if(!i)return t;let e=Math.abs(i),n=Math.round(e/t);if(!n)return e;let s=n*t,o=(e-s)/n;return t+o}function kSt(i,t){let e=t.source,n=fo(i.x-e.x,t.x)+e.x,s=fo(i.y-e.y,t.y)+e.y;return new Mt(n,s)}function v0(i,t){return i.round(t)}function dx(i,t,e){return v0(kSt(i.clone(),t),e)}function b0(i){return i.toString()}function qO(i){return new Mt(i.x===0?0:Math.abs(i.x)/i.x,i.y===0?0:Math.abs(i.y)/i.y)}function ZO(i,t){let e=1/0;for(let n=0,s=t.length;n<s;n+=1){let r=i.manhattanDistance(t[n]);r<e&&(e=r)}return e}function QO(i,t,e,n,s){let r=s.precision,o=s.directionMap,a=i.diff(t.getCenter()),l=Object.keys(o).reduce((c,u)=>{if(e.includes(u)){let h=o[u],d=new Mt(i.x+h.x*(Math.abs(a.x)+t.width),i.y+h.y*(Math.abs(a.y)+t.height)),g=new Qe(i,d).intersect(t)||[],y,x=null;for(let w=0;w<g.length;w+=1){let M=g[w],A=i.squaredDistance(M);(y==null||A>y)&&(y=A,x=M)}if(x){let w=dx(x,n,r);t.containsPoint(w)&&(w=dx(w.translate(h.x*n.x,h.y*n.y),n,r)),c.push(w)}}return c},[]);return t.containsPoint(i)||l.push(dx(i,n,r)),l}function Iq(i,t,e,n,s){let r=[],o=qO(s.diff(e)),a=b0(e),l=i[a],c;for(;l;){c=t[a];let d=qO(c.diff(l));d.equals(o)||(r.unshift(c),o=d),a=b0(l),l=i[a]}let u=t[a];return qO(u.diff(n)).equals(o)||r.unshift(u),r}function RSt(i,t,e,n,s){var r;let o=s.precision,a,l;Pe.isRectangle(t)?a=v0(KO(i,s).clone(),o):a=v0(t.clone(),o),Pe.isRectangle(e)?l=v0(Rq(i,s).clone(),o):l=v0(e.clone(),o);let c=Lq(s.step,a,l),u=a,h=l,d,p;if(Pe.isRectangle(t)?d=QO(u,t,s.startDirections,c,s):d=[u],Pe.isRectangle(e)?p=QO(l,e,s.endDirections,c,s):p=[h],d=d.filter(g=>n.isAccessible(g)),p=p.filter(g=>n.isAccessible(g)),d.length>0&&p.length>0){let g=new ET,y={},x={},w={};for(let q=0,X=d.length;q<X;q+=1){let j=d[q],W=b0(j);g.add(W,ZO(j,p)),y[W]=j,w[W]=0}let M=s.previousDirectionAngle,A=M===void 0,C,R,k=Dq(c,s),O=k.length,I=p.map(q=>b0(q)),U=Mt.equalPoints(d,p),V=s.maxLoopCount;for(;!g.isEmpty()&&V>0;){let q=g.pop();if(q==null)break;let X=y[q],j=x[q],W=w[q],_=X.equals(u),at=j==null,ct;if(at?A?_?ct=null:ct=kT(u,X,O,c,s):ct=M:ct=kT(j,X,O,c,s),!(at&&U)&&I.indexOf(q)>=0)return s.previousDirectionAngle=ct,Iq(x,y,X,u,h);for(let Et=0;Et<O;Et+=1){C=k[Et];let vt=(r=C.angle)!==null&&r!==void 0?r:0;if(R=ct==null?0:JO(ct,vt),!(A&&_)&&R>s.maxDirectionChange)continue;let yt=dx(X.clone().translate(C.gridOffsetX||0,C.gridOffsetY||0),c,o),kt=b0(yt);if(g.isClose(kt)||!n.isAccessible(yt))continue;if(I.indexOf(kt)>=0&&!yt.equals(h)){let Bt=kT(yt,h,O,c,s);if(JO(vt,Bt)>s.maxDirectionChange)continue}let Wt=C.cost,jt=_?0:s.penalties[R],ae=W+Wt+jt;(!g.isOpen(kt)||ae<w[kt])&&(y[kt]=yt,x[kt]=X,w[kt]=ae,g.add(kt,ae+ZO(yt,p)))}V-=1}}return s.fallbackRoute?ke.call(s.fallbackRoute,this,u,h,s):null}function DSt(i,t=10){if(i.length<=1)return i;for(let e=0,n=i.length;e<n-1;e+=1){let s=i[e],r=i[e+1];if(s.x===r.x){let o=t*Math.round(s.x/t);s.x!==o&&(s.x=o,r.x=o)}else if(s.y===r.y){let o=t*Math.round(s.y/t);s.y!==o&&(s.y=o,r.y=o)}}return i}var Oq=function(i,t,e){let n=Aq(t),s=YO(e,n),r=XO(e,n),o=KO(e,n),a=kq(e.graph.model,e.cell,n),l=i.map(p=>Mt.create(p)),c=[],u=o,h,d;for(let p=0,g=l.length;p<=g;p+=1){let y=null;if(h=d||s,d=l[p],d==null){d=r;let w=e.cell;
4791if((w.getSourceCellId()==null||w.getTargetCellId()==null)&&typeof n.draggingRouter=="function"){let A=h===s?o:h,C=d.getOrigin();y=ke.call(n.draggingRouter,e,A,C,n)}}if(y==null&&(y=RSt(e,h,d,a,n)),y===null)return console.warn("Unable to execute manhattan algorithm, use orth instead"),ke.call(n.fallbackRouter,this,i,n,e);let x=y[0];x?.equals(u)&&y.shift(),u=y[y.length-1]||u,c.push(...y)}return n.snapToGrid?DSt(c,e.graph.grid.getGridSize()):c};var tN=function(i,t,e){return ke.call(Oq,this,i,Object.assign(Object.assign({},Tq),t),e)};var LSt={maxDirectionChange:45,directions(){let i=zu(this.step,this),t=zu(this.cost,this),e=Math.ceil(Math.sqrt(i*i<<1));return[{cost:t,offsetX:i,offsetY:0},{cost:e,offsetX:i,offsetY:i},{cost:t,offsetX:0,offsetY:i},{cost:e,offsetX:-i,offsetY:i},{cost:t,offsetX:-i,offsetY:0},{cost:e,offsetX:-i,offsetY:-i},{cost:t,offsetX:0,offsetY:-i},{cost:e,offsetX:i,offsetY:-i}]},fallbackRoute:ISt};function ISt(i,t,e){let n=i.theta(t),s=[],r={x:t.x,y:i.y},o={x:i.x,y:t.y};if(n%180>90){let M=r;r=o,o=M}let a=n%90<45?r:o,l=new Qe(i,a),c=90*Math.ceil(n/90),u=Mt.fromPolar(l.squaredLength(),bs(c+135),a),h=new Qe(t,u),d=l.intersectsWithLine(h),p=d||i,g=360/e.directions.length,y=p.theta(t),x=Ts(y+g/2),w=g*Math.floor(x/g);return e.previousDirectionAngle=w,d&&!d.equals(i)&&!d.equals(t)&&s.push(d.round()),s}var OSt=function(i,t,e){return ke.call(tN,this,i,Object.assign(Object.assign({},LSt),t),e)};var NSt=(i,t,e)=>{let n=t.offset||32,s=t.min==null?16:t.min,r=0,o=t.direction,a=e.sourceBBox,l=e.targetBBox,c=a.getCenter(),u=l.getCenter();if(typeof n=="number"&&(r=n),o==null){let w=l.left-a.right,M=l.top-a.bottom;w>=0&&M>=0?o=w>=M?"L":"T":w<=0&&M>=0?(w=a.left-l.right,w>=0?o=w>=M?"R":"T":o="T"):w>=0&&M<=0?(M=a.top-l.bottom,M>=0?o=w>=M?"L":"B":o="L"):(w=a.left-l.right,M=a.top-l.bottom,w>=0&&M>=0?o=w>=M?"R":"B":w<=0&&M>=0?o="B":w>=0&&M<=0?o="R":o=Math.abs(w)>Math.abs(M)?"R":"B")}o==="H"?o=u.x-c.x>=0?"L":"R":o==="V"&&(o=u.y-c.y>=0?"T":"B"),n==="center"&&(o==="L"?r=(l.left-a.right)/2:o==="R"?r=(a.left-l.right)/2:o==="T"?r=(l.top-a.bottom)/2:o==="B"&&(r=(a.top-l.bottom)/2));let h,d,p,g=o==="L"||o==="R";if(g){if(u.y===c.y)return[...i];p=o==="L"?1:-1,h="x",d="width"}else{if(u.x===c.x)return[...i];p=o==="T"?1:-1,h="y",d="height"}let y=c.clone(),x=u.clone();if(y[h]+=p*(a[d]/2+r),x[h]-=p*(l[d]/2+r),g){let w=y.x,M=x.x,A=a.width/2+s,C=l.width/2+s;u.x>c.x?M<=w&&(y.x=Math.max(M,c.x+A),x.x=Math.min(w,u.x-C)):M>=w&&(y.x=Math.min(M,c.x-A),x.x=Math.max(w,u.x+C))}else{let w=y.y,M=x.y,A=a.height/2+s,C=l.height/2+s;u.y>c.y?M<=w&&(y.y=Math.max(M,c.y+A),x.y=Math.min(w,u.y-C)):M>=w&&(y.y=Math.min(M,c.y-A),x.y=Math.max(w,u.y+C))}return[y.toJSON(),...i,x.toJSON()]};function y0(i,t){if(t!=null&&t!==!1){let e=typeof t=="boolean"?0:t;if(e>0){let n=Mt.create(i[1]).move(i[2],e),s=Mt.create(i[1]).move(i[0],e);return[n.toJSON(),...i,s.toJSON()]}{let n=i[1];return[Object.assign({},n),...i,Object.assign({},n)]}}return i}var BSt=(i,t,e)=>{let n=t.width||50,r=(t.height||80)/2,o=t.angle||"auto",a=e.sourceAnchor,l=e.targetAnchor,c=e.sourceBBox,u=e.targetBBox;if(a.equals(l)){let h=w=>{let M=bs(w),A=Math.sin(M),C=Math.cos(M),R=new Mt(a.x+C*n,a.y+A*n),k=new Mt(R.x-C*r,R.y-A*r),O=k.clone().rotate(-90,R),I=k.clone().rotate(90,R);return[O.toJSON(),R.toJSON(),I.toJSON()]},d=w=>{let M=a.clone().move(w,-1),A=new Qe(M,w);return!c.containsPoint(w)&&!c.intersectsWithLine(A)},p=[0,90,180,270,45,135,225,315];if(typeof o=="number")return y0(h(o),t.merge);let g=c.getCenter();if(g.equals(a))return y0(h(0),t.merge);let y=g.angleBetween(a,g.clone().translate(1,0)),x=h(y);if(d(x[1]))return y0(x,t.merge);for(let w=1,M=p.length;w<M;w+=1)if(x=h(y+p[w]),d(x[1]))return y0(x,t.merge);return y0(x,t.merge)}{let h=new Qe(a,l),d=h.parallel(-n),p=d.getCenter(),g=d.start.clone().move(d.end,r),y=d.end.clone().move(d.start,r),x=h.parallel(-1),w=new Qe(x.start,p),M=new Qe(x.end,p);if((c.containsPoint(p)||u.containsPoint(p)||c.intersectsWithLine(w)||c.intersectsWithLine(M)||u.intersectsWithLine(w)||u.intersectsWithLine(M))&&(d=h.parallel(n),p=d.getCenter(),g=d.start.clone().move(d.end,r),y=d.end.clone().move(d.start,r)),t.merge){let A=new Qe(a,l),C=new Qe(p,A.center).setLength(Number.MAX_SAFE_INTEGER),R=c.intersectsWithLine(C),k=u.intersectsWithLine(C),O=R?Array.isArray(R)?R:[R]:[];k&&(Array.isArray(k)?O.push(...k):O.push(k));let I=A.center.closest(O);I?(e.sourceAnchor=I.clone(),e.targetAnchor=I.clone()):(e.sourceAnchor=A.center.clone(),e.targetAnchor=A.center.clone())}return y0([g.toJSON(),p.toJSON(),y.toJSON()],t.merge)}};var PT=eN,Vu=ui.create({type:"router"});Vu.register(PT,!0);Sn();function FSt(i){return i!=null&&!RT(i)}function RT(i){return i!=null&&typeof i=="string"}function USt(i){return i==null||RT(i)?i:ge.cloneDeep(i)}function zSt(i){return`${i}`.trim().replace(/[\r|\n]/g," ").replace(/>\s+</g,"><")}function Nq(i,t={ns:et.ns.svg}){let e=document.createDocumentFragment(),n={},s={},r=[{markup:Array.isArray(i)?i:[i],parent:e,ns:t.ns}];for(;r.length>0;){let o=r.pop(),a=o.ns||et.ns.svg,l=o.markup,c=o.parent;l.forEach(u=>{let h=u.tagName;if(!h)throw new TypeError("Invalid tagName");u.ns&&(a=u.ns);let d=a?et.createElementNS(h,a):et.createElement(h),p=u.attrs;p&&et.attr(d,et.kebablizeAttrs(p));let g=u.style;g&&et.css(d,g);let y=u.className;y!=null&&d.setAttribute("class",Array.isArray(y)?y.join(" "):y),u.textContent&&(d.textContent=u.textContent);let x=u.selector;if(x!=null){if(s[x])throw new TypeError("Selector must be unique");s[x]=d}if(u.groupSelector){let M=u.groupSelector;Array.isArray(M)||(M=[M]),M.forEach(A=>{n[A]||(n[A]=[]),n[A].push(d)})}c.appendChild(d);let w=u.children;Array.isArray(w)&&r.push({ns:a,markup:w,parent:d})})}
4791return Object.keys(n).forEach(o=>{if(s[o])throw new Error("Ambiguous group selector");s[o]=n[o]}),{fragment:e,selectors:s,groups:n}}function nN(i){return i instanceof SVGElement?et.createSvgElement("g"):et.createElement("div")}function VSt(i){if(RT(i)){let s=_i.createVectors(i),r=s.length;if(r===1)return{elem:s[0].node};if(r>1){let o=nN(s[0].node);return s.forEach(a=>{o.appendChild(a.node)}),{elem:o}}return{}}let t=Nq(i),e=t.fragment,n=null;return e.childNodes.length>1?(n=nN(e.firstChild),n.appendChild(e)):n=e.firstChild,{elem:n,selectors:t.selectors}}function HSt(i){let t=_i.createVectors(i),e=document.createDocumentFragment();for(let n=0,s=t.length;n<s;n+=1){let r=t[n].node;e.appendChild(r)}return{fragment:e,selectors:{}}}function Bq(i,t,e){if(i!=null){let n,s=i.tagName.toLowerCase();if(i===t)return typeof e=="string"?n=`> ${s} > ${e}`:n=`> ${s}`,n;let r=i.parentNode;if(r&&r.childNodes.length>1){let o=et.index(i)+1;n=`${s}:nth-child(${o})`}else n=s;return e&&(n+=` > ${e}`),Bq(i.parentNode,t,n)}return e}function jSt(){return"g"}function WSt(){return{tagName:"circle",selector:"circle",attrs:{r:10,fill:"#FFFFFF",stroke:"#000000"}}}function $St(){return{tagName:"text",selector:"text",attrs:{fill:"#000000"}}}function GSt(){return[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}]}function qSt(i=!1){return{tagName:"foreignObject",selector:"fo",children:[{ns:et.ns.xhtml,tagName:"body",selector:"foBody",attrs:{xmlns:et.ns.xhtml},style:{width:"100%",height:"100%",background:"transparent"},children:i?[]:[{tagName:"div",selector:"foContent",style:{width:"100%",height:"100%"}}]}]}}var As={isJSONMarkup:FSt,isStringMarkup:RT,clone:USt,sanitize:zSt,parseJSONMarkup:Nq,createContainer:nN,renderMarkup:VSt,parseLabelStringMarkup:HSt,getSelector:Bq,getPortContainerMarkup:jSt,getPortMarkup:WSt,getPortLabelMarkup:$St,getEdgeMarkup:GSt,getForeignObjectMarkup:qSt};Sn();var Fq={};function Uq(i,t){Fq[i]=t}function zq(i){delete Fq[i]}function Na(i,t){return t?et.createSvgElement(i||"g"):et.createElementNS(i||"div")}function DT(i,t,e){if(!i||i===".")return{elems:[t]};if(e){let n=e[i];if(n)return{elems:Array.isArray(n)?n:[n]}}if(In.useCSSSelector){let n=i.includes(">")?`:scope ${i}`:i;return{isCSSSelector:!0,elems:Array.prototype.slice.call(t.querySelectorAll(n))}}return{elems:[]}}function Vq(i){var t;let e=i,n=i.originalEvent,s=(t=n?.changedTouches)===null||t===void 0?void 0:t[0];if(s){for(let r in i)s[r]===void 0&&(s[r]=i[r]);e=s}return e}var Wi=class extends Ii{get priority(){return 2}get disposeContainer(){return!0}constructor(){super(),this.cid=Li.uniqueId("v"),Uq(this.cid,this)}confirmUpdate(t,e){return 0}empty(t=this.container){return et.empty(t),this}unmount(t=this.container){return et.remove(t),this}remove(t=this.container){return t===this.container?(this.removeEventListeners(document),this.onRemove(),zq(this.cid),this.disposeContainer&&this.unmount(t)):this.unmount(t),this}onRemove(){}setClass(t,e=this.container){e.classList.value=Array.isArray(t)?t.join(" "):t}addClass(t,e=this.container){return et.addClass(e,Array.isArray(t)?t.join(" "):t),this}removeClass(t,e=this.container){return et.removeClass(e,Array.isArray(t)?t.join(" "):t),this}setStyle(t,e=this.container){return et.css(e,t),this}setAttrs(t,e=this.container){return t!=null&&e!=null&&et.attr(e,t),this}findAttr(t,e=this.container){let n=e;for(;n&&n.nodeType===1;){let s=n.getAttribute(t);if(s!=null)return s;if(n===this.container)return null;n=n.parentNode}return null}find(t,e=this.container,n=this.selectors){return DT(t,e,n).elems}findOne(t,e=this.container,n=this.selectors){let s=this.find(t,e,n);return s.length>0?s[0]:null}findByAttr(t,e=this.container){let n=e;for(;n?.getAttribute;){let s=n.getAttribute(t);if((s!=null||n===this.container)&&s!=="false")return n;n=n.parentNode}return null}getSelector(t,e){let n;if(t===this.container)return typeof e=="string"&&(n=`> ${e}`),n;if(t){let s=et.index(t)+1;n=`${t.tagName.toLowerCase()}:nth-child(${s})`,e&&(n+=` > ${e}`),n=this.getSelector(t.parentNode,n)}return n}prefixClassName(t){return In.prefix(t)}delegateEvents(t,e){if(t==null)return this;e||this.undelegateEvents();let n=/^(\S+)\s*(.*)$/;return Object.keys(t).forEach(s=>{let r=s.match(n);if(r==null)return;let o=this.getEventHandler(t[s]);typeof o=="function"&&this.delegateEvent(r[1],r[2],o)}),this}undelegateEvents(){return et.Event.off(this.container,this.getEventNamespace()),this}delegateDocumentEvents(t,e){return this.addEventListeners(document,t,e),this}undelegateDocumentEvents(){return this.removeEventListeners(document),this}delegateEvent(t,e,n){return et.Event.on(this.container,t+this.getEventNamespace(),e,n),this}undelegateEvent(t,e,n){let s=t+this.getEventNamespace();return e==null?et.Event.off(this.container,s):typeof e=="string"?et.Event.off(this.container,s,e,n):et.Event.off(this.container,s,e),this}addEventListeners(t,e,n){if(e==null)return this;let s=this.getEventNamespace();return Object.keys(e).forEach(r=>{let o=this.getEventHandler(e[r]);typeof o=="function"&&et.Event.on(t,r+s,n,o)}),this}removeEventListeners(t){return t!=null&&et.Event.off(t,this.getEventNamespace()),this}getEventNamespace(){return`.${In.prefixCls}-event-${this.cid}`}getEventHandler(t){let e;if(typeof t=="string"){let n=this[t];typeof n=="function"&&(e=(...s)=>n.call(this,...s))}else e=(...n)=>
4791t.call(this,...n);return e}getEventTarget(t,e={}){let{target:n,type:s,clientX:r=0,clientY:o=0}=t;return e.fromPoint||s==="touchmove"||s==="touchend"?document.elementFromPoint(r,o):n}stopPropagation(t){return this.setEventData(t,{propagationStopped:!0}),this}isPropagationStopped(t){return this.getEventData(t).propagationStopped===!0}getEventData(t){return this.eventData(t)}setEventData(t,e){return this.eventData(t,e)}eventData(t,e){if(t==null)throw new TypeError("Event object required");let n=t.data,s=`__${this.cid}__`;return e==null?n==null?{}:n[s]||{}:(n==null&&(n=t.data={}),n[s]==null?n[s]=Object.assign({},e):n[s]=Object.assign(Object.assign({},n[s]),e),n[s])}normalizeEvent(t){return Vq(t)}dispose(){this.remove()}};rn([ln()],Wi.prototype,"dispose",null);var Hq=0;function jq(i){return i?Li.pascalCase(i):(Hq+=1,`CustomTool${Hq}`)}var Ci=class i extends Wi{static isToolItem(t){if(t==null)return!1;if(t instanceof i)return!0;let e=t[Symbol.toStringTag],n=t;return(e==null||e===Wq)&&n.graph!=null&&n.cell!=null&&typeof n.config=="function"&&typeof n.update=="function"&&typeof n.focus=="function"&&typeof n.blur=="function"&&typeof n.show=="function"&&typeof n.hide=="function"&&typeof n.isVisible=="function"}static define(t){let e=this,n=ge.createClass(jq(t.name),e);return n.config(t),n}static getDefaults(){return this.defaults}static config(t){this.defaults=this.getOptions(t)}static getOptions(t){return ge.merge(ge.cloneDeep(this.getDefaults()),t)}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get name(){return this.options.name}get[Symbol.toStringTag](){return Wq}constructor(t={}){super(),this.visible=!0,this.options=this.getOptions(t),this.container=Na(this.options.tagName||"g",this.options.isSVGElement!==!1),et.addClass(this.container,this.prefixClassName("cell-tool")),typeof this.options.className=="string"&&et.addClass(this.container,this.options.className),this.init()}init(){}getOptions(t){return this.constructor.getOptions(t)}delegateEvents(){return this.options.events&&super.delegateEvents(this.options.events),this}config(t,e){return this.cellView=t,this.parent=e,this.stamp(this.container),this.cell.isEdge()?et.addClass(this.container,this.prefixClassName("edge-tool")):this.cell.isNode()&&et.addClass(this.container,this.prefixClassName("node-tool")),this.name&&this.container.setAttribute("data-tool-name",this.name),this.delegateEvents(),this}render(){this.empty();let t=this.options.markup;if(t){let e=As.parseJSONMarkup(t);this.container.appendChild(e.fragment),this.childNodes=e.selectors}return this.onRender(),this}onRender(){}update(){return this}stamp(t){t&&t.setAttribute("data-cell-id",this.cellView.cell.id)}show(){return this.container.style.display="",this.visible=!0,this}hide(){return this.container.style.display="none",this.visible=!1,this}isVisible(){return this.visible}focus(){let t=this.options.focusOpacity;return t!=null&&Number.isFinite(t)&&(this.container.style.opacity=`${t}`),this.parent.focus(this),this}blur(){return this.container.style.opacity="",this.parent.blur(this),this}guard(t){return this.graph==null||this.cellView==null?!0:this.graph.view.guard(t,this.cellView)}};Ci.toStringTag=`X6.${Ci.name}`;Ci.defaults={isSVGElement:!0,tagName:"g"};var Wq=`X6.${Ci.name}`;Sn();var LT=class{constructor(t){this.view=t}get cell(){return this.view.cell}getDefinition(t){return this.cell.getAttrDefinition(t)}processAttrs(t,e){let n,s,r,o,a=[];return Object.keys(e).forEach(l=>{let c=e[l],u=this.getDefinition(l),h=ke.call(nq,this.view,u,c,{elem:t,attrs:e,cell:this.cell,view:this.view});if(u&&h)typeof u=="string"?(n==null&&(n={}),n[u]=c):c!==null&&a.push({name:l,definition:u});else{n==null&&(n={});let d=et.CASE_SENSITIVE_ATTR.includes(l)?l:Li.kebabCase(l);n[d]=c}}),a.forEach(({name:l,definition:c})=>{let u=e[l];typeof c.set=="function"&&(s==null&&(s={}),s[l]=u),typeof c.offset=="function"&&(r==null&&(r={}),r[l]=u),typeof c.position=="function"&&(o==null&&(o={}),o[l]=u)}),{raw:e,normal:n,set:s,offset:r,position:o}}mergeProcessedAttrs(t,e){var n;t.set=Object.assign(Object.assign({},t.set),e.set),t.position=Object.assign(Object.assign({},t.position),e.position),t.offset=Object.assign(Object.assign({},t.offset),e.offset);let s=(n=t.normal)===null||n===void 0?void 0:n.transform;s!=null&&e.normal&&(e.normal.transform=s),t.normal=e.normal}findAttrs(t,e,n,s){let r=[],o=new sp;return Object.keys(t).forEach(a=>{let l=t[a];if(!ge.isPlainObject(l))return;let{isCSSSelector:c,elems:u}=DT(a,e,s);n[a]=u;for(let h=0,d=u.length;h<d;h+=1){let p=u[h],g=s&&s[a]===p,y=o.get(p);if(y){y.array||(r.push(p),y.array=!0,y.attrs=[y.attrs],y.priority=[y.priority]);let x=y.attrs,w=y.priority;if(g)x.unshift(l),w.unshift(-1);else{let M=cs.sortedIndex(w,c?-1:d);x.splice(M,0,l),w.splice(M,0,d)}}else o.set(p,{elem:p,attrs:l,priority:g?-1:d,array:!1})}}),r.forEach(a=>{let l=o.get(a),c=l.attrs;l.attrs=c.reduceRight((u,h)=>ge.merge(u,h),{})}),o}updateRelativeAttrs(t,e,n){let s=e.raw||{},r=e.normal||{},o=e.set,a=e.position,l=e.offset,c=()=>({elem:t,cell:this.cell,view:this.view,attrs:s,refBBox:n.clone()});
4791if(o!=null&&Object.keys(o).forEach(x=>{let w=o[x],M=this.getDefinition(x);if(M!=null){let A=ke.call(M.set,this.view,w,c());typeof A=="object"?r=Object.assign(Object.assign({},r),A):A!=null&&(r[x]=A)}}),t instanceof HTMLElement){this.view.setAttrs(r,t);return}let u=r.transform,h=u?`${u}`:null,d=et.transformStringToMatrix(h),p=new Mt(d.e,d.f);u&&(delete r.transform,d.e=0,d.f=0);let g=!1;a!=null&&Object.keys(a).forEach(x=>{let w=a[x],M=this.getDefinition(x);if(M!=null){let A=ke.call(M.position,this.view,w,c());A!=null&&(g=!0,p.translate(Mt.create(A)))}}),this.view.setAttrs(r,t);let y=!1;if(l!=null){let x=this.view.getBoundingRectOfElement(t);if(x.width>0&&x.height>0){let w=ei.transformRectangle(x,d);Object.keys(l).forEach(M=>{let A=l[M],C=this.getDefinition(M);if(C!=null){let R=ke.call(C.offset,this.view,A,{elem:t,cell:this.cell,view:this.view,attrs:s,refBBox:w});R!=null&&(y=!0,p.translate(Mt.create(R)))}})}}(u!=null||g||y)&&(p.round(1),d.e=p.x,d.f=p.y,t.setAttribute("transform",et.matrixToTransformString(d)))}update(t,e,n){let s={},r=this.findAttrs(n.attrs||e,t,s,n.selectors),o=n.attrs?this.findAttrs(e,t,s,n.selectors):r,a=[];r.each(u=>{let h=u.elem,d=u.attrs,p=this.processAttrs(h,d);if(p.set==null&&p.position==null&&p.offset==null)this.view.setAttrs(p.normal,h);else{let g=o.get(h),y=g?g.attrs:null,x=y&&d.ref==null?y.ref:d.ref,w;if(x){if(w=(s[x]||this.view.find(x,t,n.selectors))[0],!w)throw new Error(`"${x}" reference does not exist.`)}else w=null;let M={node:h,refNode:w,attributes:y,processedAttributes:p},A=a.findIndex(C=>C.refNode===h);A>-1?a.splice(A,0,M):a.push(M)}});let l=new sp,c;a.forEach(u=>{let h=u.node,d=u.refNode,p,g=d!=null&&n.rotatableNode!=null&&et.contains(n.rotatableNode,d);if(d&&(p=l.get(d)),!p){let w=g?n.rotatableNode:t;p=d?ei.getBBox(d,{target:w}):n.rootBBox,d&&l.set(d,p)}let y;n.attrs&&u.attributes?(y=this.processAttrs(h,u.attributes),this.mergeProcessedAttrs(y,u.processedAttributes)):y=u.processedAttributes;let x=p;g&&n.rotatableNode!=null&&!n.rotatableNode.contains(h)&&(c||(c=et.transformStringToMatrix(et.attr(n.rotatableNode,"transform"))),x=ei.transformRectangle(p,c)),this.updateRelativeAttrs(h,y,x)})}};var IT=class{constructor(t){this.view=t,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new sp,this.pathCache={}}get(t){return this.elemCache.has(t)||this.elemCache.set(t,{}),this.elemCache.get(t)}getData(t){let e=this.get(t);return e.data||(e.data={}),e.data}getMatrix(t){let e=this.get(t);if(e.matrix==null){let n=this.view.container;e.matrix=et.getTransformToParentElement(t,n)}return et.createSVGMatrix(e.matrix)}getShape(t){let e=this.get(t);return e.shape==null&&(e.shape=ei.toGeometryShape(t)),e.shape.clone()}getBoundingRect(t){let e=this.get(t);return e.boundingRect==null&&(e.boundingRect=ei.getBBoxV2(t)),e.boundingRect.clone()}};var OT=class{get cell(){return this.view.cell}constructor(t,e,n=[]){this.view=t;let s={},r={},o=0;Object.keys(e).forEach(l=>{let c=e[l];Array.isArray(c)||(c=[c]),c.forEach(u=>{let h=s[u];h||(o+=1,h=s[u]=1<<o),r[l]|=h})});let a=n;if(Array.isArray(a)||(a=[a]),a.forEach(l=>{s[l]||(o+=1,s[l]=1<<o)}),o>25)throw new Error("Maximum number of flags exceeded.");this.flags=s,this.attrs=r,this.bootstrap=n}getFlag(t){let e=this.flags;return e==null?0:Array.isArray(t)?t.reduce((n,s)=>n|e[s],0):e[t]|0}hasAction(t,e){return t&this.getFlag(e)}removeAction(t,e){return t^t&this.getFlag(e)}getBootstrapFlag(){return this.getFlag(this.bootstrap)}getChangedFlag(){let t=0;return this.attrs&&Object.keys(this.attrs).forEach(e=>{this.cell.hasChanged(e)&&(t|=this.attrs[e])}),t}};var Sr=class i extends Wi{static getDefaults(){return i.defaults}static isCellView(t){if(t==null)return!1;if(t instanceof i)return!0;let e=t[Symbol.toStringTag],n=t;return(e==null||e===$q)&&typeof n.isNodeView=="function"&&typeof n.isEdgeView=="function"&&typeof n.confirmUpdate=="function"}static config(t){i.defaults=i.getOptions(t)}static getOptions(t){let e=(c,u)=>u!=null?cs.uniq([...Array.isArray(c)?c:[c],...Array.isArray(u)?u:[u]]):Array.isArray(c)?[...c]:[c],n=ge.cloneDeep(i.getDefaults()),{bootstrap:s,actions:r,events:o,documentEvents:a}=t,l=hn(t,["bootstrap","actions","events","documentEvents"]);return s&&(n.bootstrap=e(n.bootstrap,s)),r&&Object.entries(r).forEach(([c,u])=>{let h=n.actions[c];
4791u&&h?n.actions[c]=e(h,u):u&&(n.actions[c]=e(u))}),o&&(n.events=Object.assign(Object.assign({},n.events),o)),t.documentEvents&&(n.documentEvents=Object.assign(Object.assign({},n.documentEvents),a)),ge.merge(n,l)}get[Symbol.toStringTag](){return $q}constructor(t,e={}){super(),this.cell=t,this.options=this.ensureOptions(e),this.graph=this.options.graph,this.attr=new LT(this),this.flag=new OT(this,this.options.actions,this.options.bootstrap),this.cache=new IT(this),this.setContainer(this.ensureContainer()),this.setup(),this.init()}init(){}onRemove(){this.removeTools()}get priority(){return this.options.priority}get rootSelector(){return this.options.rootSelector}getConstructor(){return this.constructor}ensureOptions(t){return this.getConstructor().getOptions(t)}getContainerTagName(){return this.options.isSvgElement?"g":"div"}getContainerStyle(){}getContainerAttrs(){return{"data-cell-id":this.cell.id,"data-shape":this.cell.shape}}getContainerClassName(){return this.prefixClassName("cell")}ensureContainer(){return Na(this.getContainerTagName(),this.options.isSvgElement)}setContainer(t){if(this.container!==t){this.undelegateEvents(),this.container=t,this.options.events!=null&&this.delegateEvents(this.options.events);let e=this.getContainerAttrs();e!=null&&this.setAttrs(e,t);let n=this.getContainerStyle();n!=null&&this.setStyle(n,t);let s=this.getContainerClassName();s!=null&&this.addClass(s,t)}return this}isNodeView(){return!1}isEdgeView(){return!1}render(){return this}confirmUpdate(t,e={}){return 0}getBootstrapFlag(){return this.flag.getBootstrapFlag()}getFlag(t){return this.flag.getFlag(t)}hasAction(t,e){return this.flag.hasAction(t,e)}removeAction(t,e){return this.flag.removeAction(t,e)}handleAction(t,e,n,s){if(this.hasAction(t,e)){n();let r=[e];return s&&(typeof s=="string"?r.push(s):r.push(...s)),this.removeAction(t,r)}return t}setup(){this.cell.on("changed",this.onCellChanged,this)}onCellChanged({options:t}){this.onAttrsChange(t)}
4791onAttrsChange(t){let e=this.flag.getChangedFlag();t.updated||!e||(t.dirty&&this.hasAction(e,"update")&&(e|=this.getFlag("render")),t.toolId&&(t.async=!1),this.graph!=null&&this.graph.renderer.requestViewUpdate(this,e,t))}parseJSONMarkup(t,e){let n=As.parseJSONMarkup(t),s=n.selectors,r=this.rootSelector;if(e&&r){if(s[r])throw new Error("Invalid root selector");s[r]=e}return n}can(t){let e=this.graph.options.interacting;if(typeof e=="function"&&(e=ke.call(e,this.graph,this)),typeof e=="object"){let n=e[t];return typeof n=="function"&&(n=ke.call(n,this.graph,this)),n!==!1}return typeof e=="boolean"?e:!1}cleanCache(){return this.cache.clean(),this}getCache(t){return this.cache.get(t)}getDataOfElement(t){return this.cache.getData(t)}getMatrixOfElement(t){return this.cache.getMatrix(t)}getShapeOfElement(t){return this.cache.getShape(t)}getBoundingRectOfElement(t){return this.cache.getBoundingRect(t)}getBBoxOfElement(t){let e=this.getBoundingRectOfElement(t),n=this.getMatrixOfElement(t),s=this.getRootRotatedMatrix(),r=this.getRootTranslatedMatrix();return ei.transformRectangle(e,r.multiply(s).multiply(n))}getUnrotatedBBoxOfElement(t){let e=this.getBoundingRectOfElement(t),n=this.getMatrixOfElement(t),s=this.getRootTranslatedMatrix();return ei.transformRectangle(e,s.multiply(n))}getBBox(t={}){let e;if(t.useCellGeometry){let n=this.cell,s=n.isNode()?n.getAngle():0;e=n.getBBox().bbox(s)}else e=this.getBBoxOfElement(this.container);return this.graph.coord.localToGraphRect(e)}getRootTranslatedMatrix(){let t=this.cell,e=t.isNode()?t.getPosition():{x:0,y:0};return et.createSVGMatrix().translate(e.x,e.y)}getRootRotatedMatrix(){let t=et.createSVGMatrix(),e=this.cell,n=e.isNode()?e.getAngle():0;if(n){let s=e.getBBox(),r=s.width/2,o=s.height/2;t=t.translate(r,o).rotate(n).translate(-r,-o)}return t}findMagnet(t=this.container){return this.findByAttr("magnet",t)}updateAttrs(t,e,n={}){n.rootBBox==null&&(n.rootBBox=new Pe),n.selectors==null&&(n.selectors=this.selectors),this.attr.update(t,e,n)}isEdgeElement(t){return this.cell.isEdge()&&(t==null||t===this.container)}prepareHighlight(t,e={}){let n=t||this.container;return e.partial=n===this.container,n}highlight(t,e={}){let n=this.prepareHighlight(t,e);return this.notify("cell:highlight",{magnet:n,options:e,view:this,cell:this.cell}),this.isEdgeView()?this.notify("edge:highlight",{magnet:n,options:e,view:this,edge:this.cell,cell:this.cell}):this.isNodeView()&&this.notify("node:highlight",{magnet:n,options:e,view:this,node:this.cell,cell:this.cell}),this}unhighlight(t,e={}){let n=this.prepareHighlight(t,e);return this.notify("cell:unhighlight",{magnet:n,options:e,view:this,cell:this.cell}),this.isNodeView()?this.notify("node:unhighlight",{magnet:n,options:e,view:this,node:this.cell,cell:this.cell}):this.isEdgeView()&&this.notify("edge:unhighlight",{magnet:n,options:e,view:this,edge:this.cell,cell:this.cell}),this}notifyUnhighlight(t,e){}getEdgeTerminal(t,e,n,s,r){let o=this.cell,a=this.findAttr("port",t),l=t.getAttribute("data-selector"),c={cell:o.id};return l!=null&&(c.magnet=l),a!=null?(c.port=a,o.isNode()&&!o.hasPort(a)&&l==null&&(c.selector=this.getSelector(t))):l==null&&this.container!==t&&(c.selector=this.getSelector(t)),c}getMagnetFromEdgeTerminal(t){let e=this.cell,n=this.container,s=t.port,r=t.magnet,o;return s!=null&&e.isNode()&&e.hasPort(s)?o=this.findPortElem(s,r)||n:(r||(r=t.selector),!r&&s!=null&&(r=`[port="${s}"]`),o=this.findOne(r,n,this.selectors)),o}hasTools(t){let e=this.tools;return e==null?!1:t==null?!0:e.name===t}addTools(t){if(this.removeTools(),t){if(!this.can("toolsAddable"))return this;let e=Xc.isToolsView(t)?t:new Xc(t);this.tools=e,e.config({view:this}),e.mount()}return this}updateTools(t={}){return this.tools&&this.tools.update(t),this}removeTools(){return this.tools&&(this.tools.remove(),this.tools=null),this}hideTools(){return this.tools&&this.tools.hide(),this}showTools(){return this.tools&&this.tools.show(),this}renderTools(){let t=this.cell.getTools();return this.addTools(t),this}notify(t,e){return this.trigger(t,e),this.graph.trigger(t,e),this}getEventArgs(t,e,n){let s=this,r=s.cell;return e==null||n==null?{e:t,view:s,cell:r}:{e:t,x:e,y:n,view:s,cell:r}}onClick(t,e,n){this.notify("cell:click",this.getEventArgs(t,e,n))}onDblClick(t,e,n){this.notify("cell:dblclick",this.getEventArgs(t,e,n))}onContextMenu(t,e,n){this.notify("cell:contextmenu",this.getEventArgs(t,e,n))}onMouseDown(t,e,n){this.cell.model&&(this.cachedModelForMouseEvent=this.cell.model,this.cachedModelForMouseEvent.startBatch("mouse")),this.notify("cell:mousedown",this.getEventArgs(t,e,n))}onMouseUp(t,e,n){this.notify("cell:mouseup",this.getEventArgs(t,e,n)),this.cachedModelForMouseEvent&&(this.cachedModelForMouseEvent.stopBatch("mouse",{cell:this.cell}),this.cachedModelForMouseEvent=null)}onMouseMove(t,e,n){this.notify("cell:mousemove",this.getEventArgs(t,e,n))}onMouseOver(t){this.notify("cell:mouseover",this.getEventArgs(t))}onMouseOut(t){this.notify("cell:mouseout",this.getEventArgs(t))}onMouseEnter(t){this.notify("cell:mouseenter",this.getEventArgs(t))}onMouseLeave(t){this.notify("cell:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,s){this.notify("cell:mousewheel",Object.assign({delta:s},this.getEventArgs(t,e,n)))}onCustomEvent(t,e,n,s){this.notify("cell:customevent",Object.assign({name:e},this.getEventArgs(t,n,s))),this.notify(e,Object.assign({},this.getEventArgs(t,n,s)))}onMagnetMouseDown(t,e,n,s){}onMagnetDblClick(t,e,n,s){}onMagnetContextMenu(t,e,n,s){}onLabelMouseDown(t,e,n){}checkMouseleave(t){let e=this.getEventTarget(t,{fromPoint:!0}),n=this.graph.findViewByElem(e);n!==this&&(this.onMouseLeave(t),n&&n.onMouseEnter(t))}dispose(){this.cell.off("changed",this.onCellChanged,this)}};Sr.defaults={isSvgElement:!0,rootSelector:"root",priority:0,bootstrap:[],actions:{}};Sr.registry=ui.create({type:"view"});rn([ln()],Sr.prototype,"dispose",null);var $q=`X6.${Sr.name}`;var Xc=class i extends Wi{static isToolsView(t){if(t==null)return!1;if(t instanceof i)return!0;let e=t[Symbol.toStringTag],n=t;return(e==null||e===Gq)&&n.graph!=null&&n.cell!=null&&typeof n.config=="function"&&typeof n.update=="function"&&typeof n.focus=="function"&&typeof n.blur=="function"&&typeof n.show=="function"&&typeof n.hide=="function"}get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return Gq}constructor(t={}){super(),this.svgContainer=this.createContainer(!0,t),this.htmlContainer=this.createContainer(!1,t),this.config(t)}createContainer(t,e){let n=t?Na("g",!0):Na("div",!1);return et.addClass(n,this.prefixClassName("cell-tools")),e.className&&et.addClass(n,e.className),n}config(t){if(this.options=Object.assign(Object.assign({},this.options),t),!Sr.isCellView(t.view)||t.view===this.cellView)return this;this.cellView=t.view,this.cell.isEdge()?(et.addClass(this.svgContainer,this.prefixClassName("edge-tools")),et.addClass(this.htmlContainer,this.prefixClassName("edge-tools"))):this.cell.isNode()&&(et.addClass(this.svgContainer,this.prefixClassName("node-tools")),et.addClass(this.htmlContainer,this.prefixClassName("node-tools"))),this.svgContainer.setAttribute("data-cell-id",this.cell.id),this.htmlContainer.setAttribute("data-cell-id",this.cell.id),this.name&&(this.svgContainer.setAttribute("data-tools-name",this.name),this.htmlContainer.setAttribute("data-tools-name",this.name));let e=this.options.items;if(!Array.isArray(e))return this;this.tools=[];let n=[];e.forEach(s=>{Ci.isToolItem(s)?s.name==="vertices"?n.unshift(s):n.push(s):(typeof s=="object"?s.name:s)==="vertices"?n.unshift(s):n.push(s)});for(let s=0;s<n.length;s+=1){let r=n[s],o;if(Ci.isToolItem(r))o=r;else{let a=typeof r=="object"?r.name:r,l=typeof r=="object"?r.args||{}:{};if(a){if(this.cell.isNode()){let c=mp.get(a);if(c)o=new c(l);else return mp.onNotFound(a)}else if(this.cell.isEdge()){let c=bp.get(a);if(c)o=new c(l);else return bp.onNotFound(a)}}}o&&(o.config(this.cellView,this),o.render(),(o.options.isSVGElement!==!1?this.svgContainer:this.htmlContainer).appendChild(o.container),this.tools.push(o))}return this}update(t={}){let e=this.tools;return e&&e.forEach(n=>{t.toolId!==n.cid&&n.isVisible()&&n.update()}),this}focus(t){let e=this.tools;return e&&e.forEach(n=>{t===n?n.show():n.hide()}),this}blur(t){let e=this.tools;return e&&e.forEach(n=>
4791{n!==t&&!n.isVisible()&&(n.show(),n.update())}),this}hide(){return this.focus(null)}show(){return this.blur(null)}remove(){let t=this.tools;return t&&(t.forEach(e=>e.remove()),this.tools=null),et.remove(this.svgContainer),et.remove(this.htmlContainer),super.remove()}mount(){let t=this.tools,e=this.cellView;if(e&&t){let n=t.some(r=>r.options.isSVGElement!==!1),s=t.some(r=>r.options.isSVGElement===!1);n&&(this.options.local?e.container:e.graph.view.decorator).appendChild(this.svgContainer),s&&this.graph.container.appendChild(this.htmlContainer)}return this}};Xc.toStringTag=`X6.${Xc.name}`;var Gq=`X6.${Xc.name}`;var iN={};Le(iN,{noop:()=>qq,pinAbsolute:()=>Jq,pinRelative:()=>Kq});var qq=i=>i;function Yq(i,t){return t===0?"0%":`${Math.round(i/t*100)}%`}function Xq(i){return(e,n,s,r)=>n.isEdgeElement(s)?XSt(i,e,n,s,r):YSt(i,e,n,s,r)}function YSt(i,t,e,n,s){let r=e.cell,o=r.getAngle(),a=e.getUnrotatedBBoxOfElement(n),l=r.getBBox().getCenter(),c=Mt.create(s).rotate(o,l),u=c.x-a.x,h=c.y-a.y;return i&&(u=Yq(u,a.width),h=Yq(h,a.height)),t.anchor={name:"topLeft",args:{dx:u,dy:h,rotate:!0}},t}function XSt(i,t,e,n,s){let r=e.getConnection();if(!r)return t;let o=r.closestPointLength(s);if(i){let a=r.length();t.anchor={name:"ratio",args:{ratio:o/a}}}else t.anchor={name:"length",args:{length:o}};return t}var Kq=Xq(!0),Jq=Xq(!1);var sN=iN,KSt=ui.create({type:"connection strategy"});KSt.register(sN,!0);function NT(i,t,e,n){return ke.call(sN.pinRelative,this.graph,{},t,e,i,this.cell,n,{}).anchor}function BT(i,t){return t?i.cell.getBBox():i.cell.isEdge()?i.getConnection().bbox():i.getUnrotatedBBoxOfElement(i.container)}var vp=class extends Ci{get type(){return this.options.type}onRender(){et.addClass(this.container,this.prefixClassName(`edge-tool-${this.type}-anchor`)),this.toggleArea(!1),this.update()}update(){let t=this.type;return this.cellView.getTerminalView(t)?(this.updateAnchor(),this.updateArea(),this.container.style.display=""):this.container.style.display="none",this}updateAnchor(){let t=this.childNodes;if(!t)return;let e=t.anchor;if(!e)return;let n=this.type,s=this.cellView,r=this.options,o=s.getTerminalAnchor(n),a=s.cell.prop([n,"anchor"]);e.setAttribute("transform",`translate(${o.x}, ${o.y})`);let l=a?r.customAnchorAttrs:r.defaultAnchorAttrs;l&&Object.keys(l).forEach(c=>{e.setAttribute(c,l[c])})}updateArea(){let t=this.childNodes;if(!t)return;let e=t.area;if(!e)return;let n=this.type,s=this.cellView,r=s.getTerminalView(n);if(r){let o=r.cell,a=s.getTerminalMagnet(n),l=this.options.areaPadding||0;Number.isFinite(l)||(l=0);let c,u,h;r.isEdgeElement(a)?(c=r.getBBox(),u=0,h=c.getCenter()):(c=r.getUnrotatedBBoxOfElement(a),u=o.getAngle(),h=c.getCenter(),u&&h.rotate(-u,o.getBBox().getCenter())),c.inflate(l),et.attr(e,{x:-c.width/2,y:-c.height/2,width:c.width,height:c.height,transform:`translate(${h.x}, ${h.y}) rotate(${u})`})}}toggleArea(t){if(this.childNodes){let e=this.childNodes.area;e&&(e.style.display=t?"":"none")}}onMouseDown(t){this.guard(t)||(t.stopPropagation(),t.preventDefault(),this.graph.view.undelegateEvents(),this.options.documentEvents&&this.delegateDocumentEvents(this.options.documentEvents),this.focus(),this.toggleArea(this.options.restrictArea),this.cell.startBatch("move-anchor",{ui:!0,toolId:this.cid}))}resetAnchor(t){let e=this.type,n=this.cell;t?n.prop([e,"anchor"],t,{rewrite:!0,ui:!0,toolId:this.cid}):n.removeProp([e,"anchor"],{ui:!0,toolId:this.cid})}onMouseMove(t){let e=this.type,n=this.cellView,s=n.getTerminalView(e);if(s==null)return;let r=this.normalizeEvent(t),o=s.cell,a=n.getTerminalMagnet(e),l=this.graph.coord.clientToLocalPoint(r.clientX,r.clientY),c=this.options.snap;if(typeof c=="function"){let d=ke.call(c,n,l,s,a,e,n,this);l=Mt.create(d)}if(this.options.restrictArea)if(s.isEdgeElement(a)){let d=s.getClosestPoint(l);d&&(l=d)}else{let d=s.getUnrotatedBBoxOfElement(a),p=o.getAngle(),g=o.getBBox().getCenter(),y=l.clone().rotate(p,g);d.containsPoint(y)||(l=d.getNearestPointToPoint(y).rotate(-p,g))}let u,h=this.options.anchor;typeof h=="function"&&(u=ke.call(h,n,l,s,a,e,n,this)),this.resetAnchor(u),this.update()}onMouseUp(t){this.graph.view.delegateEvents(),this.undelegateDocumentEvents(),this.blur(),this.toggleArea(!1);let e=this.cellView;this.options.removeRedundancies&&e.removeRedundantLinearVertices({ui:!0,toolId:this.cid}),this.cell.stopBatch("move-anchor",{ui:!0,toolId:this.cid})}onDblClick(){let t=this.options.resetAnchor;t&&this.resetAnchor(t===!0?void 0:t),this.update()}};vp.defaults=Object.assign(Object.assign({},Ci.getDefaults()),{tagName:"g",markup:[{tagName:"circle",selector:"anchor",attrs:{cursor:"pointer"}},{tagName:"rect",selector:"area",attrs:{"pointer-events":"none",fill:"none",stroke:"#33334F","stroke-dasharray":"2,4",rx:5,ry:5}}],events:{mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDblClick"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},customAnchorAttrs:{"stroke-width":4,stroke:"#33334F",fill:"#FFFFFF",r:5},defaultAnchorAttrs:{"stroke-width":2,stroke:"#FFFFFF",fill:"#33334F",r:6},areaPadding:6,snapRadius:10,resetAnchor:!0,restrictArea:!0,removeRedundancies:!0,anchor:NT,snap(i,t,e,n,s,r){let o=r.options.snapRadius||0,a=n==="source",l=a?0:-1,c=this.cell.getVertexAt(l)||this.getTerminalAnchor(a?"target":"source");return c&&(Math.abs(c.x-i.x)<o&&(i.x=c.x),Math.abs(c.y-i.y)<o&&(i.y=c.y)),i}});var fx=class extends vp{};fx.defaults=Object.assign(Object.assign({},vp.getDefaults()),{name:"source-anchor",type:"source"});var px=class extends vp{};px.defaults=Object.assign(Object.assign({},vp.getDefaults()),{name:"target-anchor",type:"target"});Sn();var yp=class extends Ci{get type(){return this.options.type}get ratio(){return this.options.ratio}init(){if(this.options.attrs){let t=this.options.attrs,{class:e}=t,n=hn(t,["class"]);this.setAttrs(n,this.container),e&&et.addClass(this.container,e)}}onRender(){et.addClass(this.container,this.prefixClassName(`edge-tool-${this.type}-arrowhead`)),this.update()}update(){let t=this.ratio,e=this.cellView,n=e.getTangentAtRatio(t),s=n?n.start:e.getPointAtRatio(t),r=n&&n.vector().vectorAngle(new Mt(1,0))||0;if(!s)return this;let o=et.createSVGMatrix().translate(s.x,s.y).rotate(r);return et.transform(this.container,o,{absolute:!0}),this}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();let e=this.cellView;if(e.can("arrowheadMovable")){e.cell.startBatch("move-arrowhead",{ui:!0,toolId:this.cid});
4791let n=this.graph.snapToGrid(t.clientX,t.clientY),s=e.prepareArrowheadDragging(this.type,{x:n.x,y:n.y,options:Object.assign(Object.assign({},this.options),{toolId:this.cid})});this.cellView.setEventData(t,s),this.delegateDocumentEvents(this.options.documentEvents,t.data),e.graph.view.undelegateEvents(),this.container.style.pointerEvents="none"}this.focus()}onMouseMove(t){let e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY);this.cellView.onMouseMove(e,n.x,n.y),this.update()}onMouseUp(t){this.undelegateDocumentEvents();let e=this.normalizeEvent(t),n=this.cellView,s=this.graph.snapToGrid(e.clientX,e.clientY);n.onMouseUp(e,s.x,s.y),this.graph.view.delegateEvents(),this.blur(),this.container.style.pointerEvents="",n.cell.stopBatch("move-arrowhead",{ui:!0,toolId:this.cid})}};yp.defaults=Object.assign(Object.assign({},Ci.getDefaults()),{tagName:"path",isSVGElement:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}});var gx=class extends yp{};gx.defaults=Object.assign(Object.assign({},yp.getDefaults()),{name:"source-arrowhead",type:"source",ratio:0,attrs:{d:"M 10 -8 -10 0 10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}});var mx=class extends yp{};mx.defaults=Object.assign(Object.assign({},yp.getDefaults()),{name:"target-arrowhead",type:"target",ratio:1,attrs:{d:"M -10 -8 10 0 -10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}});Sn();var x0=class extends Ci{onRender(){if(et.addClass(this.container,this.prefixClassName("cell-tool-boundary")),this.options.attrs){let t=this.options.attrs,{class:e}=t,n=hn(t,["class"]);et.attr(this.container,et.kebablizeAttrs(n)),e&&et.addClass(this.container,e)}this.update()}update(){let t=this.cellView,e=this.options,{useCellGeometry:n,rotate:s}=e,r=dn.normalizeSides(e.padding),o=BT(t,n);this.parent.options.local&&(o=o.translate({x:-o.x,y:-o.y})),o=o.moveAndExpand({x:-r.left,y:-r.top,width:r.left+r.right,height:r.top+r.bottom});let a=t.cell;if(a.isNode()){let l=a.getAngle();if(l!=null)if(s&&!this.parent.options.local){let c=a.getBBox().getCenter();et.rotate(this.container,l,c.x,c.y,{absolute:!0})}else s||(o=o.bbox(l))}return et.attr(this.container,o.toJSON()),this}};x0.defaults=Object.assign(Object.assign({},Ci.getDefaults()),{name:"boundary",tagName:"rect",padding:10,useCellGeometry:!0,attrs:{fill:"none",stroke:"#333","stroke-width":.5,"stroke-dasharray":"5, 5","pointer-events":"none"}});var Md=class extends Ci{onRender(){et.addClass(this.container,this.prefixClassName("cell-tool-button")),this.update()}update(){return this.updatePosition(),this}updatePosition(){let e=this.cellView.cell.isEdge()?this.getEdgeMatrix():this.getNodeMatrix();et.transform(this.container,e,{absolute:!0})}getNodeMatrix(){let t=this.cellView,e=this.options,{x:n=0,y:s=0}=e,{offset:r,useCellGeometry:o,rotate:a}=e,l=BT(t,o),c=t.cell.getAngle();a||(l=l.bbox(c));let u=0,h=0;typeof r=="number"?(u=r,h=r):typeof r=="object"&&(u=r.x,h=r.y),n=dn.normalizePercentage(n,l.width),s=dn.normalizePercentage(s,l.height);let d=et.createSVGMatrix();return this.parent.options.local?d=d.translate(l.width/2,l.height/2):d=d.translate(l.x+l.width/2,l.y+l.height/2),a&&(d=d.rotate(c)),d=d.translate(n+u-l.width/2,s+h-l.height/2),d}getEdgeMatrix(){let t=this.cellView,e=this.options,{offset:n=0,distance:s=0,rotate:r}=e,o=dn.normalizePercentage(s,1),a=o>=0&&o<=1?t.getTangentAtRatio(o):t.getTangentAtLength(o),l=a?a.start:t.getConnection().start,c=a&&a.vector().vectorAngle(new Mt(1,0))||0,u=et.createSVGMatrix().translate(l.x,l.y).rotate(c);return typeof n=="object"?u=u.translate(n.x||0,n.y||0):u=u.translate(0,n),r||(u=u.rotate(-c)),u}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();let e=this.options.onClick;typeof e=="function"&&ke.call(e,this.cellView,{e:t,view:this.cellView,cell:this.cellView.cell,btn:this})}};Md.defaults=Object.assign(Object.assign({},Ci.getDefaults()),{name:"button",useCellGeometry:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"}});var w0=class extends Md{};w0.defaults=Object.assign(Object.assign({},Md.getDefaults()),{name:"button-remove",markup:[{tagName:"circle",selector:"button",attrs:{r:7,fill:"#FF1D00",cursor:"pointer"}},{tagName:"path",selector:"icon",attrs:{d:"M -3 -3 3 3 M -3 3 3 -3",fill:"none",stroke:"#FFFFFF","stroke-width":2,"pointer-events":"none"}}],distance:60,offset:0,useCellGeometry:!0,onClick({view:i,btn:t}){t.parent.remove(),i.cell.remove({ui:!0,toolId:t.cid})}});var xp=class extends Ci{constructor(){super(...arguments),this.labelIndex=-1,this.distance=.5,this.dblClick=this.onCellDblClick.bind(this)}onRender(){let t=this.cellView;t&&t.on("cell:dblclick",this.dblClick)}createElement(){let t=[this.prefixClassName(`${this.cell.isEdge()?"edge":"node"}-tool-editor`),this.prefixClassName("cell-tool-editor")];this.editor=Na("div",!1),this.addClass(t,this.editor),this.editor.contentEditable="true",this.container.appendChild(this.editor)}removeElement(){this.undelegateDocumentEvents(),this.editor&&(this.container.removeChild(this.editor),this.editor=null)}updateEditor(){let{cell:t,editor:e}=this;if(!e)return;let{style:n}=e;
4791t.isNode()?this.updateNodeEditorTransform():t.isEdge()&&this.updateEdgeEditorTransform();let{attrs:s}=this.options;n.fontSize=`${s.fontSize}px`,n.fontFamily=s.fontFamily,n.color=s.color,n.backgroundColor=s.backgroundColor;let r=this.getCellText()||"";return e.innerText=r,this.setCellText(""),this}updateNodeEditorTransform(){let{graph:t,cell:e,editor:n}=this;if(!n)return;let s=Mt.create(),r=20,o="",{x:a,y:l}=this.options,{width:c,height:u}=this.options;if(typeof a<"u"&&typeof l<"u"){let p=e.getBBox();a=dn.normalizePercentage(a,p.width),l=dn.normalizePercentage(l,p.height),s=p.topLeft.translate(a,l),r=p.width-a*2}else{let p=e.getBBox();s=p.center,r=p.width-4,o="translate(-50%, -50%)"}let h=t.scale(),{style:d}=n;s=t.localToGraph(s),d.left=`${s.x}px`,d.top=`${s.y}px`,d.transform=`scale(${h.sx}, ${h.sy}) ${o}`,d.minWidth=`${r}px`,typeof c=="number"&&(d.width=`${c}px`),typeof u=="number"&&(d.height=`${u}px`)}updateEdgeEditorTransform(){if(!this.event)return;let{graph:t,editor:e}=this;if(!e)return;let n=Mt.create(),s=20,{style:r}=e,o=this.event.target,a=o.parentElement;if(a&&et.hasClass(a,this.prefixClassName("edge-label"))){let u=a.getAttribute("data-index")||"0";this.labelIndex=parseInt(u,10);let h=a.getAttribute("transform"),{translation:d}=et.parseTransformString(h);n=new Mt(d.tx,d.ty),s=ei.getBBox(o).width}else{if(!this.options.labelAddable)return this;n=t.clientToLocal(Mt.create(this.event.clientX,this.event.clientY));let h=this.cellView.path.closestPointLength(n);this.distance=h,this.labelIndex=-1}n=t.localToGraph(n);let c=t.scale();r.left=`${n.x}px`,r.top=`${n.y}px`,r.minWidth=`${s}px`,r.transform=`scale(${c.sx}, ${c.sy}) translate(-50%, -50%)`}updateCell(){let t=this.editor.innerText.replace(/\n$/,"")||"";this.setCellText(t!==""?t:null),this.removeElement()}onDocumentMouseUp(t){this.editor&&t.target!==this.editor&&this.updateCell()}onCellDblClick({e:t}){if(!this.editor){t.stopPropagation(),this.removeElement(),this.event=t,this.createElement(),this.updateEditor(),this.autoFocus();let e=this.options.documentEvents;e&&this.delegateDocumentEvents(e)}}onMouseDown(t){t.stopPropagation()}autoFocus(){setTimeout(()=>{this.editor&&(this.editor.focus(),this.selectText())})}selectText(){if(window.getSelection&&this.editor){let t=document.createRange();t.selectNodeContents(this.editor);let e=window.getSelection();e?.removeAllRanges(),e?.addRange(t)}
4791}getCellText(){let{getText:t}=this.options;if(typeof t=="function")return ke.call(t,this.cellView,{cell:this.cell,index:this.labelIndex});if(typeof t=="string"){if(this.cell.isNode())return this.cell.attr(t);if(this.cell.isEdge()&&this.labelIndex!==-1)return this.cell.prop(`labels/${this.labelIndex}/attrs/${t}`)}}setCellText(t){let e=this.options.setText;if(typeof e=="function"){ke.call(e,this.cellView,{cell:this.cell,value:t,index:this.labelIndex,distance:this.distance});return}if(typeof e=="string"){if(this.cell.isNode()){this.cell.attr(e,t===null?"":t);return}if(this.cell.isEdge()){let n=this.cell;if(this.labelIndex===-1){if(t){let s={position:{distance:this.distance},attrs:{}};ge.setByPath(s,`attrs/${e}`,t),n.appendLabel(s)}}else t!==null?n.prop(`labels/${this.labelIndex}/attrs/${e}`,t):n.removeLabelAt(this.labelIndex)}}}onRemove(){let t=this.cellView;t&&t.off("cell:dblclick",this.dblClick),this.removeElement()}};xp.defaults=Object.assign(Object.assign({},Ci.getDefaults()),{tagName:"div",isSVGElement:!1,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mouseup:"onDocumentMouseUp",touchend:"onDocumentMouseUp",touchcancel:"onDocumentMouseUp"}});var bx=class extends xp{};bx.defaults=ge.merge({},xp.defaults,{attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},getText:"text/text",setText:"text/text"});var vx=class extends xp{};vx.defaults=ge.merge({},xp.defaults,{attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},labelAddable:!0,getText:"label/text",setText:"label/text"});var _0=class extends Ci{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}getPoints(){let e=this.cellView.routePoints;if(e.length<=2)return e;let n=[e[0]];for(let s=1;s<e.length-1;s++){let r=n[n.length-1],o=e[s],a=e[s+1];(o.x-r.x)*(a.y-r.y)-(o.y-r.y)*(a.x-r.x)!==0&&n.push(o)}return n.push(e[e.length-1]),n}onRender(){et.addClass(this.container,this.prefixClassName("edge-tool-segments")),this.resetHandles();let t=this.cellView,e=[...this.getPoints()];e.unshift(t.sourcePoint),e.push(t.targetPoint);for(let n=0,s=e.length;n<s-1;n+=1){let r=e[n],o=e[n+1],a=this.renderHandle(r,o,n);this.stamp(a.container),this.handles.push(a)}return this}renderHandle(t,e,n){let s=this.options.createHandle({index:n,graph:this.graph,guard:r=>this.guard(r),attrs:this.options.attrs||{}});return this.options.processHandle&&this.options.processHandle(s),this.updateHandle(s,t,e),this.container.appendChild(s.container),this.startHandleListening(s),s}startHandleListening(t){t.on("change",this.onHandleChange,this),t.on("changing",this.onHandleChanging,this),t.on("changed",this.onHandleChanged,this)}stopHandleListening(t){t.off("change",this.onHandleChange,this),t.off("changing",this.onHandleChanging,this),t.off("changed",this.onHandleChanged,this)}resetHandles(){let t=this.handles;this.handles=[],t&&t.forEach(e=>{this.stopHandleListening(e),e.remove()})}shiftHandleIndexes(t){let e=this.handles;for(let n=0,s=e.length;n<s;n+=1)e[n].options.index+=t}resetAnchor(t,e){let n=this.cellView.cell,s={ui:!0,toolId:this.cid};e?n.prop([t,"anchor"],e,s):n.removeProp([t,"anchor"],s)}snapHandle(t,e,n){let s=t.options.axis,r=t.options.index,l=this.cellView.cell.getVertices(),c=l[r-2]||n.sourceAnchor,u=l[r+1]||n.targetAnchor,h=this.options.snapRadius;return Math.abs(e[s]-c[s])<h?e[s]=c[s]:Math.abs(e[s]-u[s])<h&&(e[s]=u[s]),e}onHandleChanging({handle:t,e}){let n=this.graph,s=this.options,r=this.cellView,o=s.anchor,a=t.options.axis,l=t.options.index-1,c=this.getEventData(e),u=this.normalizeEvent(e),h=n.snapToGrid(u.clientX,u.clientY),d=this.snapHandle(t,h.clone(),c),p=ge.cloneDeep(this.vertices),g=p[l],y=p[l+1],x=r.sourceView,w=r.sourceBBox,M=!1,A=!1;if(g?l===0?w.containsPoint(g)?(p.shift(),this.shiftHandleIndexes(-1),M=!0):(g[a]=d[a],A=!0):g[a]=d[a]:(g=r.sourceAnchor.toJSON(),g[a]=d[a],w.containsPoint(g)?M=!0:(p.unshift(g),this.shiftHandleIndexes(1),A=!0)),typeof o=="function"&&x){if(M){let I=c.sourceAnchor.clone();I[a]=d[a];let U=ke.call(o,r,I,x,r.sourceMagnet||x.container,"source",r,this);this.resetAnchor("source",U)}A&&this.resetAnchor("source",c.sourceAnchorDef)}let C=r.targetView,R=r.targetBBox,k=!1,O=!1;if(y?l===p.length-2?R.containsPoint(y)?(p.pop(),k=!0):(y[a]=d[a],O=!0):y[a]=d[a]:(y=r.targetAnchor.toJSON(),y[a]=d[a],R.containsPoint(y)?k=!0:(p.push(y),O=!0)),typeof o=="function"&&C){if(k){let I=c.targetAnchor.clone();I[a]=d[a];let U=ke.call(o,r,I,C,r.targetMagnet||C.container,"target",r,this);this.resetAnchor("target",U)}O&&this.resetAnchor("target",c.targetAnchorDef)}Mt.equalPoints(p,this.vertices)||this.cellView.cell.setVertices(p,{ui:!0,toolId:this.cid}),this.updateHandle(t,g,y,0),s.stopPropagation||r.notifyMouseMove(u,h.x,h.y)}onHandleChange({handle:t,e}){let n=this.options,s=this.handles,r=this.cellView,o=t.options.index;if(Array.isArray(s)){for(let a=0,l=s.length;a<l;a+=1)a!==o&&s[a].hide();if(this.focus(),this.setEventData(e,{sourceAnchor:r.sourceAnchor.clone(),targetAnchor:r.targetAnchor.clone(),sourceAnchorDef:ge.cloneDeep(this.cell.prop(["source","anchor"])),targetAnchorDef:ge.cloneDeep(this.cell.prop(["target","anchor"]))}),this.cell.startBatch("move-segment",{ui:!0,toolId:this.cid}),!n.stopPropagation){let a=this.normalizeEvent(e),l=this.graph.snapToGri
4791d(a.clientX,a.clientY);r.notifyMouseDown(a,l.x,l.y)}}}onHandleChanged({e:t}){let e=this.options,n=this.cellView;e.removeRedundancies&&n.removeRedundantLinearVertices({ui:!0,toolId:this.cid});let s=this.normalizeEvent(t),r=this.graph.snapToGrid(s.clientX,s.clientY);this.render(),this.blur(),this.cell.stopBatch("move-segment",{ui:!0,toolId:this.cid}),e.stopPropagation||n.notifyMouseUp(s,r.x,r.y),n.checkMouseleave(s),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}updateHandle(t,e,n,s=0){let r=this.options.precision||0,o=Math.abs(e.x-n.x)<r,a=Math.abs(e.y-n.y)<r;if(o||a){let l=new Qe(e,n);if(l.length()<this.options.threshold)t.hide();else{let u=l.getCenter(),h=o?"x":"y";u[h]+=s||0;let d=l.vector().vectorAngle(new Mt(1,0));t.updatePosition(u.x,u.y,d,this.cellView),t.show(),t.options.axis=h}}else t.hide()}onRemove(){this.resetHandles()}};_0.defaults=Object.assign(Object.assign({},Ci.defaults),{name:"segments",precision:.5,threshold:40,snapRadius:10,stopPropagation:!0,removeRedundancies:!0,attrs:{width:20,height:8,x:-10,y:-4,rx:4,ry:4,fill:"#333",stroke:"#fff","stroke-width":2},createHandle:i=>new oN(i),anchor:NT});var oN=class extends Wi{constructor(t){super(),this.options=t,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown"})}render(){this.container=Na("rect",!0);let t=this.options.attrs;if(typeof t=="function"){let e=_0.getDefaults();this.setAttrs(Object.assign(Object.assign({},e.attrs),t(this)))}else this.setAttrs(t);this.addClass(this.prefixClassName("edge-tool-segment"))}updatePosition(t,e,n,s){let r=s.getClosestPoint(new Mt(t,e))||new Mt(t,e),o=et.createSVGMatrix().translate(r.x,r.y);if(r.equals({x:t,y:e}))o=o.rotate(n);else{let l=new Qe(t,e,r.x,r.y).vector().vectorAngle(new Mt(1,0));l!==0&&(l+=90),o=o.rotate(l)}this.setAttrs({transform:et.matrixToTransformString(o),cursor:n%180===0?"row-resize":"col-resize"})}onMouseDown(t){this.options.guard(t)||(this.trigger("change",{e:t,handle:this}),t.stopPropagation(),t.preventDefault(),this.options.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},t.data))}onMouseMove(t){this.emit("changing",{e:t,handle:this})}onMouseUp(t){this.emit("changed",{e:t,handle:this}),this.undelegateDocumentEvents(),this.options.graph.view.delegateEvents()}show(){this.container.style.display=""}hide(){this.container.style.display="none"}};var aN=In.prefix("edge-tool-vertex-path"),S0=class extends Ci{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}onRender(){return this.addClass(this.prefixClassName("edge-tool-vertices")),this.options.addable&&this.updatePath(),this.resetHandles(),this.renderHandles(),this}update(){return this.vertices.length===this.handles.length?this.updateHandles():(this.resetHandles(),this.renderHandles()),this.options.addable&&this.updatePath(),this}resetHandles(){let t=this.handles;this.handles=[],t&&t.forEach(e=>{this.stopHandleListening(e),e.remove()})}renderHandles(){let t=this.vertices;for(let e=0,n=t.length;e<n;e+=1){let s=t[e],r=this.options.createHandle,o=this.options.processHandle,a=r({index:e,graph:this.graph,guard:l=>this.guard(l),attrs:this.options.attrs||{}});o&&o(a),a.updatePosition(s.x,s.y),this.stamp(a.container),this.container.appendChild(a.container),this.handles.push(a),this.startHandleListening(a)}}updateHandles(){let t=this.vertices;for(let e=0,n=t.length;e<n;e+=1){let s=t[e],r=this.handles[e];r&&r.updatePosition(s.x,s.y)}}updatePath(){let t=this.childNodes.connection;t&&t.setAttribute("d",this.cellView.getConnectionPathData())}startHandleListening(t){let e=this.cellView;e.can("vertexMovable")&&(t.on("change",this.onHandleChange,this),t.on("changing",this.onHandleChanging,this),t.on("changed",this.onHandleChanged,this)),e.can("vertexDeletable")&&t.on("remove",this.onHandleRemove,this)}stopHandleListening(t){let e=this.cellView;e.can("vertexMovable")&&(t.off("change",this.onHandleChange,this),t.off("changing",this.onHandleChanging,this),t.off("changed",this.onHandleChanged,this)),e.can("vertexDeletable")&&t.off("remove",this.onHandleRemove,this)}getNeighborPoints(t){let e=this.cellView,n=this.vertices,s=t>0?n[t-1]:e.sourceAnchor,r=t<n.length-1?n[t+1]:e.targetAnchor;return{prev:Mt.create(s),next:Mt.create(r)}}getMouseEventArgs(t){let e=this.normalizeEvent(t),{x:n,y:s}
4791=this.graph.snapToGrid(e.clientX,e.clientY);return{e,x:n,y:s}}onHandleChange({e:t}){this.focus();let e=this.cellView;if(e.cell.startBatch("move-vertex",{ui:!0,toolId:this.cid}),!this.options.stopPropagation){let{e:n,x:s,y:r}=this.getMouseEventArgs(t);this.eventData(n,{start:{x:s,y:r}}),e.notifyMouseDown(n,s,r)}}onHandleChanging({handle:t,e}){let n=this.cellView,s=t.options.index,{e:r,x:o,y:a}=this.getMouseEventArgs(e),l={x:o,y:a};this.snapVertex(l,s),n.cell.setVertexAt(s,l,{ui:!0,toolId:this.cid}),t.updatePosition(l.x,l.y),this.options.stopPropagation||n.notifyMouseMove(r,o,a)}stopBatch(t){this.cell.stopBatch("move-vertex",{ui:!0,toolId:this.cid}),t&&this.cell.stopBatch("add-vertex",{ui:!0,toolId:this.cid})}onHandleChanged({e:t}){let e=this.options,n=this.cellView;e.addable&&this.updatePath(),e.removeRedundancies&&n.removeRedundantLinearVertices({ui:!0,toolId:this.cid})&&this.render(),this.blur(),this.stopBatch(this.eventData(t).vertexAdded);let{e:s,x:r,y:o}=this.getMouseEventArgs(t);if(!this.options.stopPropagation){n.notifyMouseUp(s,r,o);let{start:a}=this.eventData(s);if(a){let{x:l,y:c}=a;l===r&&c===o&&n.onClick(s,r,o)}}n.checkMouseleave(s),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}snapVertex(t,e){let n=this.options.snapRadius||0;if(n>0){let s=this.getNeighborPoints(e),r=s.prev,o=s.next;Math.abs(t.x-r.x)<n?t.x=r.x:Math.abs(t.x-o.x)<n&&(t.x=o.x),Math.abs(t.y-r.y)<n?t.y=s.prev.y:Math.abs(t.y-o.y)<n&&(t.y=o.y)}}onHandleRemove({handle:t,e}){if(this.options.removable){let n=t.options.index,s=this.cellView;s.cell.removeVertexAt(n,{ui:!0}),this.options.addable&&this.updatePath(),s.checkMouseleave(this.normalizeEvent(e))}}allowAddVertex(t){let e=this.guard(t),n=this.options.addable&&this.cellView.can("vertexAddable"),s=this.options.modifiers?zo(t,this.options.modifiers):!0;return!e&&n&&s}onPathMouseDown(t){let e=this.cellView;if(!this.allowAddVertex(t))return;t.stopPropagation(),t.preventDefault();let n=this.normalizeEvent(t),s=this.graph.snapToGrid(n.clientX,n.clientY).toJSON();e.cell.startBatch("add-vertex",{ui:!0,toolId:this.cid});let r=e.getVertexIndex(s.x,s.y);this.snapVertex(s,r),e.cell.insertVertex(s,r,{ui:!0,toolId:this.cid}),this.render();let o=this.handles[r];this.eventData(n,{vertexAdded:!0}),o.onMouseDown(n)}onRemove(){this.resetHandles()}};S0.defaults=Object.assign(Object.assign({},Ci.getDefaults()),{name:"vertices",snapRadius:20,addable:!0,removable:!0,removeRedundancies:!0,stopPropagation:!0,attrs:{r:6,fill:"#333",stroke:"#fff",cursor:"move","stroke-width":2},createHandle:i=>new lN(i),markup:[{tagName:"path",selector:"connection",className:aN,attrs:{fill:"none",stroke:"transparent","stroke-width":10,cursor:"pointer"}}],events:{[`mousedown .${aN}`]:"onPathMouseDown",[`touchstart .${aN}`]:"onPathMouseDown"}});var lN=class extends Wi{get graph(){return this.options.graph}constructor(t){super(),this.options=t,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDoubleClick"})}render(){this.container=Na("circle",!0);let t=this.options.attrs;if(typeof t=="function"){let e=S0.getDefaults();this.setAttrs(Object.assign(Object.assign({},e.attrs),t(this)))}else this.setAttrs(t);this.addClass(this.prefixClassName("edge-tool-vertex"))}updatePosition(t,e){this.setAttrs({cx:t,cy:e})}onMouseDown(t){this.options.guard(t)||(t.stopPropagation(),t.preventDefault(),this.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},t.data),this.emit("change",{e:t,handle:this}))}onMouseMove(t){this.emit("changing",{e:t,handle:this})}onMouseUp(t){this.emit("changed",{e:t,handle:this}),this.undelegateDocumentEvents(),this.graph.view.delegateEvents()}onDoubleClick(t){this.emit("remove",{e:t,handle:this})}};var JSt={boundary:x0,button:Md,"button-remove":w0,"node-editor":bx},mp=ui.create({type:"node tool",process(i,t){if(typeof t=="function")return t;let e=Ci,{inherit:n}=t,s=hn(t,["inherit"]);if(n){let r=this.get(n);r==null?this.onNotFound(n,"inherited"):e=r}return s.name==null&&(s.name=i),e.define.call(e,s)}});mp.register(JSt,!0);var ZSt={boundary:x0,vertices:S0,segments:_0,button:Md,"button-remove":w0,"source-anchor":fx,"target-anchor":px,"source-arrowhead":gx,"target-arrowhead":mx,"edge-editor":vx},bp=ui.create({type:"edge tool",process(i,t){if(typeof t=="function")return t;let e=Ci,{inherit:n}=t,s=hn(t,["inherit"]);if(n){let r=this.get(n);r==null?this.onNotFound(n,"inherited"):e=r}return s.name==null&&(s.name=i),e.define.call(e,s)}});bp.register(ZSt,!0);
4791var C0=class{constructor(t,e,n,s){var r;this.target=t,this.cell=(r=this.target.effect)===null||r===void 0?void 0:r.target,this.type=e,this.bubbles=!1,this.currentTarget=t,this.defaultPrevented=!1,this.eventPhase=0,this.timeStamp=performance.now(),this.currentTime=n,this.timelineTime=s}};function yx(i){return i!=="offset"&&i!=="easing"&&i!=="composite"&&i!=="computedOffset"}function cN(i,t){return i==="reverse"||i==="alternate"&&t%2===1||i==="alternate-reverse"&&t%2===0}var xx=class{constructor(t,e){this._effect=null,this._currentTime=null,this._playbackRate=1,this._playState="idle",this._rafId=null,this._startTime=null,this._pausedTime=null,this._timeline=null,this.id="",this.onfinish=null,this.oncancel=null,this._effect=t,this._timeline=e??document.timeline}get effect(){return this._effect}get currentTime(){return this._currentTime}set currentTime(t){let e=this._timeline.currentTime;dn.isNumber(e)&&(this._startTime=e-t,this._currentTime=t)}get playbackRate(){return this._playbackRate}set playbackRate(t){let e=this._playbackRate;this._playbackRate=t;let n=this._timeline.currentTime;if(this._playState==="running"&&this._startTime!=null&&dn.isNumber(n)){let s=(n-this._startTime)*e;this._startTime=n-s/t}}get playState(){return this._playState}get timeline(){return this._timeline}play(){if(this._playState==="running"||!this._effect)return;let t=this._timeline.currentTime;dn.isNumber(t)&&(this._playState==="paused"?(this._startTime=t-this._pausedTime/this._playbackRate,this._pausedTime=null):(this._currentTime=0,this._startTime=t),this._playState="running",this._tick())}pause(){this._playState==="running"&&(this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._pausedTime=this._currentTime,this._playState="paused")}finish(){var t;if(!this._effect)return;let e=this._effect.getComputedTiming(),n=this._playbackRate<0,{duration:s,endTime:r,direction:o,fill:a,iterations:l}=e;if(a==="forwards"||a==="both"){let u=n?0:l-1,h=cN(o,u);this._effect.apply(h||n?0:s)}else(a==="none"||a==="backwards")&&this._effect.apply(null);this._currentTime=n?0:r,this._playState="finished",this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null);let c=new C0(this,"finish",this._currentTime,this._timeline.currentTime);(t=this.onfinish)===null||t===void 0||t.call(this,c),this._effect.target.notify("animation:finish",c)}cancel(){var t;if(!this._effect)return;this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._playState="idle",this._currentTime=null,this._startTime=null,this._pausedTime=null,this._effect.apply(null);let e=new C0(this,"cancel",this._currentTime,this._timeline.currentTime);(t=this.oncancel)===null||t===void 0||t.call(this,e),this._effect.target.notify("animation:cancel",e)}updatePlaybackRate(t){this.playbackRate=t}reverse(){this.playbackRate=this.playbackRate*-1}_tick(){let t=this._timeline.currentTime;if(this._playState!=="running"||!this._effect||!dn.isNumber(t))return;let e=this._effect.getComputedTiming(),{duration:n,delay:s,iterations:r,direction:o,endTime:a}=e,l=(t-this._startTime)*this._playbackRate,c=l-s,u=Math.floor(c/n);if(l>=a||l<0||n<=0){this.finish();return}if(l>=s){let h=c%n;u=Math.min(u,r-1),cN(o,u)&&(h=n-h),this._effect.apply(h)}this._currentTime=l,this._rafId=requestAnimationFrame(()=>this._tick())}};var wx=class{constructor(){this.animations=[]}addAnimation(t){this.animations.push(t)}getAnimations(){return this.animations}cancelAnimations(){this.animations.forEach(t=>{t.cancel()})}};var _x=class{constructor(t,e,n){this._originProps={},this._target=t,this._options=dn.isNumber(n)?{duration:n}:Object.assign({},n),this.setKeyframes(e)}get target(){return this._target}getKeyframes(){if(!this._keyframes||this._keyframes.length===0)return[];let t=[];if(Array.isArray(this._keyframes)&&(t=[...this._keyframes]),ge.isPlainObject(this._keyframes)){let n=Object.values(this._keyframes).map(r=>cs.castArray(r).length),s=Math.max(...n);for(let r=0;r<s;r++){let o={};Object.entries(this._keyframes).forEach(([a,l])=>{let c=cs.castArray(l)[r];yx(a)&&c!=null&&(o[a]=c)}),t.push(o)}}return t=t.map((e,n,s)=>{var r,o,a;let l=e??{},c={};return c.offset=l.offset,c.easing=(a=(r=l.easing)!==null&&r!==void 0?r:(o=s[n-1])===null||o===void 0?void 0:o.easing)!==null&&a!==void 0?a:this.getComputedTiming().easing,Object.keys(l).forEach(u=>{yx(u)&&(c[u]=l[u])}),c}),t=t.map((e,n)=>(e.offset==null?n===t.length-1?e.computedOffset=1:n===0?e.computedOffset=0:e.computedOffset=n/(t.length-1):e.computedOffset=e.offset,e)),t}setKeyframes(t){this._keyframes=t,this._computedKeyframes=this.getKeyframes(),this._computedKeyframes.forEac
4791h(e=>{Object.keys(e).forEach(n=>{yx(n)&&this._originProps[n]==null&&(this._originProps[n]=this.target.getPropByPath(n))})})}getTiming(){return ge.defaults(this._options,QSt)}getComputedTiming(){let t=this.getTiming(),e=t.duration*t.iterations;return Object.assign(Object.assign({},t),{activeDuration:e,endTime:e+t.delay})}apply(t){var e,n,s,r;if(!this._target||!this._computedKeyframes.length)return;if(t==null){Object.entries(this._originProps).forEach(([M,A])=>{this.target.setPropByPath(M,A)});return}let a=this.getComputedTiming().duration;if(a<0)return;let l=Math.min(t/a,1),c=this._computedKeyframes;if(c.length===0)return;let u={computedOffset:0},h={computedOffset:1};for(let M of c)if(l===0&&M.computedOffset===0&&(u=M),l===1&&M.computedOffset===1&&(h=M),M.computedOffset<l&&(u=M),M.computedOffset>l){h=M;break}let d=u.computedOffset,p=h.computedOffset,g=(l-d)/(p-d),y=(e=u.easing)!==null&&e!==void 0?e:h.easing,x=Li.camelCase(y),w=(n=sx[x])!==null&&n!==void 0?n:sx.linear;for(let M in Object.assign(Object.assign({},u),h))if(yx(M)&&(u[M]!=null||h[M]!=null)){let A=(s=u[M])!==null&&s!==void 0?s:this._originProps[M],C=(r=h[M])!==null&&r!==void 0?r:this._originProps[M],R;String(A).startsWith("#")?R=ip.color:M.endsWith("transform")&&!dn.isNumber(A)?R=ip.transform:np.test(String(A))||np.test(String(C))?R=ip.unit:R=ip.number;let O=R(A,C)(w(g));this.target.setPropByPath(M,O)}}},QSt={delay:0,direction:"normal",duration:0,easing:"linear",fill:"none",iterations:1};Sn();var Sx=class extends Ii{constructor(t={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(ge.cloneDeep(t)),this.changed={}}mutate(t,e={}){let n=e.unset===!0,s=e.silent===!0,r=[],o=this.changing;this.changing=!0,o||(this.previous=ge.cloneDeep(this.data),this.changed={});let a=this.data,l=this.previous,c=this.changed;if(Object.keys(t).forEach(u=>{let h=u,d=t[h];ge.isEqual(a[h],d)||r.push(h),ge.isEqual(l[h],d)?delete c[h]:c[h]=d,n?delete a[h]:a[h]=d}),!s&&r.length>0&&(this.pending=!0,this.pendingOptions=e,r.forEach(u=>{this.emit("change:*",{key:u,options:e,store:this,current:a[u],previous:l[u]})})),o)return this;if(!s)for(;this.pending;)this.pending=!1,this.emit("changed",{current:a,previous:l,store:this,options:this.pendingOptions});return this.pending=!1,this.changing=!1,this.pendingOptions=null,this}get(t,e){if(t==null)return this.data;let n=this.data[t];return n??e}getPrevious(t){if(this.previous){let e=this.previous[t];return e??void 0}}set(t,e,n){return t!=null&&(typeof t=="object"?this.mutate(t,e):this.mutate({[t]:e},n)),this}remove(t,e){let s={},r;if(typeof t=="string")s[t]=void 0,r=e;else if(Array.isArray(t))t.forEach(o=>s[o]=void 0),r=e;else{for(let o in this.data)s[o]=void 0;r=t}return this.mutate(s,Object.assign(Object.assign({},r),{unset:!0})),this}getByPath(t){return ge.getByPath(this.data,t,"/")}setByPath(t,e,n={}){let r=Array.isArray(t)?[...t]:t.split("/"),o=Array.isArray(t)?t.join("/"):t,a=r[0],l=r.length;if(n.propertyPath=o,n.propertyValue=e,n.propertyPathArray=r,l===1)this.set(a,e,n);else{let c={},u=c,h=a;for(let g=1;g<l;g+=1){let y=r[g],x=Number.isFinite(Number(y));u=u[h]=x?[]:{},h=y}ge.setByPath(c,r,e,"/");let d=ge.cloneDeep(this.data);n.rewrite&&ge.unsetByPath(d,t,"/");let p=ge.merge(d,c);this.set(a,p[a],n)}return this}removeByPath(t,e){let n=Array.isArray(t)?t:t.split("/"),s=n[0];if(n.length===1)this.remove(s,e);else{let r=n.slice(1),o=ge.cloneDeep(this.get(s));o&&ge.unsetByPath(o,r),this.set(s,o,e)}return this}hasChanged(t){return t==null?Object.keys(this.changed).length>0:t in this.changed}getChanges(t){if(t==null)return this.hasChanged()?ge.cloneDeep(this.changed):null;let e=this.changing?this.previous:this.data,n={},s;for(let r in t){let o=t[r];ge.isEqual(e[r],o)||(n[r]=o,s=!0)}return s?ge.cloneDeep(n):null}toJSON(){return ge.cloneDeep(this.data)}clone(){let t=this.constructor;return new t(this.data)}dispose(){this.off(),this.data={},this.previous={},this.changed={},this.pending=!1,this.changing=!1,this.pendingOptions=null,this.trigger("disposed",{store:this})}};rn([ln()],Sx.prototype,"dispose",null);var vi=class i extends Ii{static isCell(t){if(t==null)return!1;if(t instanceof i)return!0;let e=t[Symbol.toStringTag],n=t;return(e==null||e===i.toStringTag)&&typeof n.isNode=="function"&&typeof n.isEdge=="function"&&typeof n.prop=="function"&&typeof n.attr=="function"}static normalizeTools(t){if(typeof t=="string")return{items:[t]};if(Array.isArray(t))return{items:t};
4791if(t.items)return t;if(Reflect.has(t,"local")){let e=t,{local:n}=e,s=hn(e,["local"]);return{local:n,items:[s]}}return{items:[t]}}static getCommonAncestor(...t){let e=t.filter(s=>s!=null).map(s=>s.getAncestors()).sort((s,r)=>s.length-r.length);return e.shift().find(s=>e.every(r=>r.includes(s)))||null}static getCellsBBox(t,e={}){let n=null;for(let s=0,r=t.length;s<r;s+=1){let o=t[s],a=o.getBBox(e);if(a){if(o.isNode()){let l=o.getAngle();l!=null&&l!==0&&(a=a.bbox(l))}n=n==null?a:n.union(a)}}return n}static deepClone(t){let e=[t,...t.getDescendants({deep:!0})];return i.cloneCells(e)}static cloneCells(t){let e=cs.uniq(t),n=e.reduce((s,r)=>(s[r.id]=r.clone(),s),{});return e.forEach(s=>{let r=n[s.id];if(r.isEdge()){let l=r.getSourceCellId(),c=r.getTargetCellId();l&&n[l]&&r.setSource(Object.assign(Object.assign({},r.getSource()),{cell:n[l].id})),c&&n[c]&&r.setTarget(Object.assign(Object.assign({},r.getTarget()),{cell:n[c].id}))}let o=s.getParent();o&&n[o.id]&&r.setParent(n[o.id]);let a=s.getChildren();if(a&&a.length){let l=a.reduce((c,u)=>(n[u.id]&&c.push(n[u.id]),c),[]);l.length>0&&r.setChildren(l)}}),n}static config(t){let{markup:e,propHooks:n,attrHooks:s}=t,r=hn(t,["markup","propHooks","attrHooks"]);e!=null&&(this.markup=e),n&&(this.propHooks=this.propHooks.slice(),Array.isArray(n)?this.propHooks.push(...n):typeof n=="function"?this.propHooks.push(n):Object.values(n).forEach(o=>{typeof o=="function"&&this.propHooks.push(o)})),s&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),s)),this.defaults=ge.merge({},this.defaults,r)}static getMarkup(){return this.markup}static getDefaults(t){return t?this.defaults:ge.cloneDeep(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(t,e){return this.propHooks.reduce((n,s)=>s?ke.call(s,t,n):n,e)}static generateId(t={}){return Li.uuid()}get[Symbol.toStringTag](){return i.toStringTag}constructor(t={}){super();let n=this.constructor.getDefaults(!0),s=ge.merge({},this.preprocess(n),this.preprocess(t));this.id=s.id||i.generateId(t),this.store=new Sx(s),this.animationManager=new wx,this.setup(),this.init(),this.postprocess(t)}init(){}get model(){return this._model}set model(t){this._model!==t&&(this._model=t)}preprocess(t,e){let n=t.id,r=this.constructor.applyPropHooks(this,t);return n==null&&e!==!0&&(r.id=i.generateId(t)),r}postprocess(t){}setup(){this.store.on("change:*",t=>{let{key:e,current:n,previous:s,options:r}=t;this.notify("change:*",{key:e,options:r,current:n,previous:s,cell:this}),this.notify(`change:${e}`,{options:r,current:n,previous:s,cell:this});let o=e;(o==="source"||o==="target")&&this.notify("change:terminal",{type:o,current:n,previous:s,options:r,cell:this})}),this.store.on("changed",({options:t})=>this.notify("changed",{options:t,cell:this})),this.on("added",({cell:t})=>{let e=this.store.get("animation");ge.isEmpty(e)||e.forEach(n=>{t.animate(...n)})})}notify(t,e){this.trigger(t,e);let n=this.model;return n&&(n.notify(`cell:${t}`,e),this.isNode()?n.notify(`node:${t}`,Object.assign(Object.assign({},e),{node:this})):this.isEdge()&&n.notify(`edge:${t}`,Object.assign(Object.assign({},e),{edge:this}))),this}isNode(){return!1}isEdge(){return!1}isSameStore(t){return this.store===t.store}get view(){return this.store.get("view")}get shape(){return this.store.get("shape","")}getProp(t,e){return t==null?this.store.get():this.store.get(t,e)}setProp(t,e,n){if(typeof t=="string")this.store.set(t,e,n);else{let s=this.preprocess(t,!0);this.store.set(ge.merge({},this.getProp(),s),e),this.postprocess(t)}return this}removeProp(t,e){return typeof t=="string"||Array.isArray(t)?this.store.removeByPath(t,e):this.store.remove(e),this}hasChanged(t){return t==null?this.store.hasChanged():this.store.hasChanged(t)}getPropByPath(t){return this.store.getByPath(t)}setPropByPath(t,e,n={}){return this.model&&(t==="children"?this._children=e?e.map(s=>this.model.getCell(s)).filter(s=>s!=null):null:t==="parent"&&(this._parent=e?this.model.getCell(e):null)),this.store.setByPath(t,e,n),this}removePropByPath(t,e={}){let n=Array.isArray(t)?t:t.split("/");return n[0]==="attrs"&&(e.dirty=!0),this.store.removeByPath(n,e),this}prop(t,e,n){return t==null?this.getProp():typeof t=="string"||Array.isArray(t)?arguments.length===1?this.getPropByPath(t):e==null?this.removePropByPath(t,n||{}):this.setPropByPath(t,e,n||{}):this.setProp(t,e||{})}previous(t){return this.store.getPrevious(t)}get zIndex(){return this.getZIndex()}set zIndex(t){t==null?this.removeZIndex():this.setZIndex(t)}getZIndex(){return this.store.get("zIndex")}setZIndex(t,e={}){return this.store.set("zIndex",t,e),this}removeZIndex(t={}){return this.store.remove("zIndex",t),this}toFront(t={}){let e=this.model;if(e){let n=e.getMaxZIndex(),s;t.deep?(s=this.getDescendants({deep:!0,breadthFirst:!0}),s.unshift(this)):s=[this],n=n-s.length+1;let r=e.total(),o=e.indexOf(this)!==r-s.length;o||(o=s.some((a,l)=>a.getZIndex()!==n+l)),o&&this.batchUpdate("to-front",()=>
4791{n+=s.length,s.forEach((a,l)=>{a.setZIndex(n+l,t)})})}return this}toBack(t={}){let e=this.model;if(e){let n=e.getMinZIndex(),s;t.deep?(s=this.getDescendants({deep:!0,breadthFirst:!0}),s.unshift(this)):s=[this];let r=e.indexOf(this)!==0;r||(r=s.some((o,a)=>o.getZIndex()!==n+a)),r&&this.batchUpdate("to-back",()=>{n-=s.length,s.forEach((o,a)=>{o.setZIndex(n+a,t)})})}return this}get markup(){return this.getMarkup()}set markup(t){t==null?this.removeMarkup():this.setMarkup(t)}getMarkup(){let t=this.store.get("markup");return t==null&&(t=this.constructor.getMarkup()),t}setMarkup(t,e={}){return this.store.set("markup",t,e),this}removeMarkup(t={}){return this.store.remove("markup",t),this}get attrs(){return this.getAttrs()}set attrs(t){t==null?this.removeAttrs():this.setAttrs(t)}getAttrs(){let t=this.store.get("attrs");return t?Object.assign({},t):{}}setAttrs(t,e={}){if(t==null)this.removeAttrs(e);else{let n=s=>this.store.set("attrs",s,e);if(e.overwrite===!0)n(t);else{let s=this.getAttrs();e.deep===!1?n(Object.assign(Object.assign({},s),t)):n(ge.merge({},s,t))}}return this}replaceAttrs(t,e={}){return this.setAttrs(t,Object.assign(Object.assign({},e),{overwrite:!0}))}updateAttrs(t,e={}){return this.setAttrs(t,Object.assign(Object.assign({},e),{deep:!1}))}removeAttrs(t={}){return this.store.remove("attrs",t),this}getAttrDefinition(t){if(!t)return null;let n=this.constructor.getAttrHooks()||{},s=n[t]||op.get(t);if(!s){let r=Li.camelCase(t);s=n[r]||op.get(r)}return s||null}getAttrByPath(t){return t==null||t===""?this.getAttrs():this.getPropByPath(this.prefixAttrPath(t))}setAttrByPath(t,e,n={}){return this.setPropByPath(this.prefixAttrPath(t),e,n),this}removeAttrByPath(t,e={}){return this.removePropByPath(this.prefixAttrPath(t),e),this}prefixAttrPath(t){return Array.isArray(t)?["attrs"].concat(t):`attrs/${t}`}attr(t,e,n){return t==null?this.getAttrByPath():typeof t=="string"||Array.isArray(t)?arguments.length===1?this.getAttrByPath(t):e==null?this.removeAttrByPath(t,n||{}):this.setAttrByPath(t,e,n||{}):this.setAttrs(t,e||{})}get visible(){return this.isVisible()}set visible(t){this.setVisible(t)}setVisible(t,e={}){return this.store.set("visible",t,e),this}isVisible(){return this.store.get("visible")!==!1}show(t={}){return this.isVisible()||this.setVisible(!0,t),this}hide(t={}){return this.isVisible()&&this.setVisible(!1,t),this}toggleVisible(t,e={}){let n=typeof t=="boolean"?t:!this.isVisible(),s=typeof t=="boolean"?e:t;return n?this.show(s):this.hide(s),this}get data(){return this.getData()}set data(t){this.setData(t)}getData(){return this.store.get("data")}setData(t,e={}){if(t==null)this.removeData(e);else{let n=s=>this.store.set("data",s,e);if(e.overwrite===!0)n(t);else{let s=this.getData();e.deep===!1?n(typeof t=="object"?Object.assign(Object.assign({},s),t):t):n(ge.merge({},s,t))}}return this}replaceData(t,e={}){return this.setData(t,Object.assign(Object.assign({},e),{overwrite:!0}))}updateData(t,e={}){return this.setData(t,Object.assign(Object.assign({},e),{deep:!1}))}removeData(t={}){return this.store.remove("data",t),this}get parent(){return this.getParent()}get children(){return this.getChildren()}getParentId(){return this.store.get("parent")}getParent(){let t=this.getParentId();if(t&&this.model){let e=this.model.getCell(t);return this._parent=e,e}return null}getChildren(){let t=this.store.get("children");if(t&&t.length&&this.model){let e=t.map(n=>{var s;return(s=this.model)===null||s===void 0?void 0:s.getCell(n)}).filter(n=>n!=null);return this._children=e,[...e]}return null}hasParent(){return this.parent!=null}isParentOf(t){return t!=null&&t.getParent()===this}isChildOf(t){return t!=null&&this.getParent()===t}eachChild(t,e){return this.children&&this.children.forEach(t,e),this}filterChild(t,e){return this.children?this.children.filter(t,e):[]}getChildCount(){return this.children==null?0:this.children.length}getChildIndex(t){return this.children==null?-1:this.children.indexOf(t)}getChildAt(t){return this.children!=null&&t>=0?this.children[t]:null}getAncestors(t={}){let e=[],n=this.getParent();for(;n;)e.push(n),n=t.deep!==!1?n.getParent():null;return e}getDescendants(t={}){if(t.deep!==!1){if(t.breadthFirst){let e=[],n=this.getChildren()||[];for(;n.length>0;){let s=n.shift(),r=s.getChildren();e.push(s),r&&n.push(...r)}return e}{let e=this.getChildren()||[];return e.forEach(n=>{e.push(...n.getDescendants(t))}),e}}return this.getChildren()||[]}isDescendantOf(t,e={}){if(t==null)return!1;if(e.deep!==!1){let n=this.getParent();for(;n;){if(n===t)return!0;n=n.getParent()}return!1}return this.isChildOf(t)}isAncestorOf(t,e={}){return t==null?!1:t.isDescendantOf(this,e)}contains(t){return this.isAncestorOf(t)}getCommonAncestor(...t){return i.getCommonAncestor(this,...t)}setParent(t,e={}){return this._parent=t,t?this.store.set("parent",t.id,e):this.store.remove("parent",e),this}setChildren(t,e={}){return this._children=t,t!=null?this.store.set("children",t.map(n=>n.id),e):this.store.remove("children",e),this}unembed(t,e={}){let n=this.children;if(n!=null&&t!=null){let s=this.getChildIndex(t);s!==-1&&(n.splice(s,1),t.setParent(null,e),this.setChildren(n,e))}return this}embed(t,e={}){return t.addTo(this,e),this}addTo(t,e={}){return i.isCell(t)?t.addChild(this,e):t.addCell(this,e),this}insertTo(t,e,n={}){return t.insertChild(this,e,n),this}addChild(t,e={}){return this.insertChild(t,void 0,e)}insertChild(t,e,n={}){if(t!=null&&t!==this){let s=t.getParent(),r=this!==s,o=e;if(o==null&&(o=this.getChildCount(),r||(o-=1)),s){let l=s.getChildren();if(l){let c=l.indexOf(t);c>=0&&(t.setParent(null,n),l.splice(c,1),s.setChildren(l,n))}}let a=this.children;if(a==null?(a=[],a.push(t)):a.splice(o,0,t),t.setParent(this,n),this.setChildren(a,n),r&&this.model){let l=this.model.getIncomingEdges(this),c=this.model.getOutgoingEdges(this);l&&l.forEach(u=>{u.updateParent(n)}
4791),c&&c.forEach(u=>{u.updateParent(n)})}this.model&&this.model.addCell(t,n)}return this}removeFromParent(t={}){let e=this.getParent();if(e!=null){let n=e.getChildIndex(this);e.removeChildAt(n,t)}return this}removeChild(t,e={}){let n=this.getChildIndex(t);return this.removeChildAt(n,e)}removeChildAt(t,e={}){let n=this.getChildAt(t);return this.children!=null&&n!=null&&(this.unembed(n,e),n.remove(e)),n}remove(t={}){return this.batchUpdate("remove",()=>{let e=this.getParentId(),n=e&&this.model?this.model.getCell(e):this._parent;if(n){let s=n.store.get("children");if(s&&s.length){let r=s.filter(o=>o!==this.id);r.length!==s.length&&(r.length?n.store.set("children",r,t):n.store.remove("children",t))}}this.setParent(null,t),t.deep!==!1&&this.eachChild(s=>s.remove(t)),this.model&&this.model.removeCell(this,t),this.dispose()}),this}animate(t,e){var n;let s=dn.isNumber(e)?{duration:e}:Object.assign({},e),r=new _x(this,t,s),o=new xx(r,s.timeline);return this.animationManager.addAnimation(o),o.id=(n=s.id)!==null&&n!==void 0?n:"",o.play(),o}getAnimations(){return this.animationManager.getAnimations()}translate(t,e,n){return this}scale(t,e,n,s){return this}addTools(t,e,n){let s=Array.isArray(t)?t:[t],r=typeof e=="string"?e:null,o=typeof e=="object"?e:typeof n=="object"?n:{};if(o.reset)return this.setTools({name:r,items:s,local:o.local},o);let a=ge.cloneDeep(this.getTools());if(a==null||r==null||a.name===r)return a==null&&(a={}),a.items||(a.items=[]),a.name=r,a.items=[...a.items,...s],this.setTools(Object.assign({},a),o)}setTools(t,e={}){return t==null?this.removeTools():this.store.set("tools",i.normalizeTools(t),e),this}getTools(){return this.store.get("tools")}removeTools(t={}){return this.store.remove("tools",t),this}hasTools(t){let e=this.getTools();return e==null?!1:t==null?!0:e.name===t}hasTool(t){let e=this.getTools();return e==null?!1:e.items.some(n=>typeof n=="string"?n===t:n.name===t)}removeTool(t,e={}){let n=ge.cloneDeep(this.getTools());if(n){let s=!1,r=n.items.slice(),o=a=>{r.splice(a,1),s=!0};if(typeof t=="number")o(t);else for(let a=r.length-1;a>=0;a-=1){let l=r[a];(typeof l=="string"?l===t:l.name===t)&&o(a)}s&&(n.items=r,this.setTools(n,e))}return this}getBBox(t){return new Pe}getConnectionPoint(t,e){return new Mt}toJSON(t={}){let e=Object.assign({},this.store.get()),n=Object.prototype.toString,s=this.isNode()?"node":this.isEdge()?"edge":"cell";if(!e.shape){let g=this.constructor;throw new Error(`Unable to serialize ${s} missing "shape" prop, check the ${s} "${g.name||n.call(g)}"`)}let r=this.constructor,o=t.diff===!0,a=e.attrs||{},l=r.getDefaults(!0),c=o?this.preprocess(l,!0):l,u=c.attrs||{},h={};Object.entries(e).forEach(([g,y])=>{if(y!=null&&!Array.isArray(y)&&typeof y=="object"&&!ge.isPlainObject(y))throw new Error(`Can only serialize ${s} with plain-object props, but got a "${toString.call(y)}" type of key "${g}" on ${s} "${this.id}"`);if(g!=="attrs"&&g!=="shape"&&o){let x=c[g];ge.isEqual(y,x)&&delete e[g]}}),Object.keys(a).forEach(g=>{let y=a[g],x=u[g];Object.keys(y).forEach(w=>{let M=y[w],A=x?x[w]:null;M!=null&&typeof M=="object"&&!Array.isArray(M)?Object.keys(M).forEach(C=>{let R=M[C];if(x==null||A==null||!ge.isObject(A)||!ge.isEqual(A[C],R)){h[g]==null&&(h[g]={}),h[g][w]==null&&(h[g][w]={});let k=h[g][w];k[C]=R}}):(x==null||!ge.isEqual(A,M))&&(h[g]==null&&(h[g]={}),h[g][w]=M)})});let d=Object.assign(Object.assign({},e),{attrs:ge.isEmpty(h)?void 0:h});d.attrs==null&&delete d.attrs;let p=d;return p.angle===0&&delete p.angle,ge.cloneDeep(p)}clone(t={}){if(!t.deep){let n=Object.assign({},this.store.get());t.keepId||delete n.id,delete n.parent,delete n.children;let s=this.constructor;return new s(n)}return i.deepClone(this)[this.id]}findView(t){return t.findViewByCell(this)}startBatch(t,e={},n=this.model){return this.notify("batch:start",{name:t,data:e,cell:this}),n&&n.startBatch(t,Object.assign(Object.assign({},e),{cell:this})),this}stopBatch(t,e={},n=this.model){return n&&n.stopBatch(t,Object.assign(Object.assign({},e),{cell:this})),this.notify("batch:stop",{name:t,data:e,cell:this}),this}batchUpdate(t,e,n){let s=this.model;this.startBatch(t,n,s);let r=e();return this.stopBatch(t,n,s),r}dispose(){this.removeFromParent(),this.animationManager.cancelAnimations(),this.store.dispose()}};vi.toStringTag="X6.cell";vi.defaults={};vi.attrHooks={};vi.propHooks=[];rn([ln()],vi.prototype,"dispose",null);vi.config({propHooks(i){var{tools:t}=i,e=hn(i,["tools"]);return t&&(e.tools=vi.normalizeTools(t)),e}});Sn();var FT=class{constructor(t){this.ports=[],this.groups={},this.init(ge.cloneDeep(t))}getPorts(){return this.ports}getGroup(t){return t!=null?this.groups[t]:null}getPortsByGroup(t){return this.ports.filter(e=>e.group===t||e.group==null&&t==null)}getPortsLayoutByGroup(t,e){let n=this.getPortsByGroup(t),s=t?this.getGroup(t):null,r=s?s.position:null,o=r?r.name:null,a;if(o!=null){let h=gp.get(o);if(h==null)return gp.onNotFound(o);a=h}else a=VO.left;let l=n.map(h=>h&&h.position&&h.position.args||{}),c=r&&r.args||{};return a(l,e,c).map((h,d)=>{let p=n[d];return{portLayout:h,portId:p.id,portSize:p.size,portAttrs:p.attrs,labelSize:p.label.size,labelLayout:this.getPortLabelLayout(p,Mt.create(h.position),e)}})}init(t){let{groups:e,items:n}=t;e!=null&&Object.keys(e).forEach(s=>{this.groups[s]=this.parseGroup(e[s])}
4791),Array.isArray(n)&&n.forEach(s=>{this.ports.push(this.parsePort(s))})}parseGroup(t){return Object.assign(Object.assign({},t),{label:this.getLabel(t,!0),position:this.getPortPosition(t.position,!0)})}parsePort(t){let e=Object.assign({},t),n=this.getGroup(t.group)||{};return e.markup=e.markup||n.markup,e.attrs=ge.merge({},n.attrs,e.attrs),e.position=this.createPosition(n,e),e.label=ge.merge({},n.label,this.getLabel(e)),e.zIndex=this.getZIndex(n,e),e.size=Object.assign(Object.assign({},n.size),e.size),e}getZIndex(t,e){return typeof e.zIndex=="number"?e.zIndex:typeof t.zIndex=="number"||t.zIndex==="auto"?t.zIndex:"auto"}createPosition(t,e){return ge.merge({name:"left",args:{}},t.position,{args:e.args})}getPortPosition(t,e=!1){if(t==null){if(e)return{name:"left",args:{}}}else{if(typeof t=="string")return{name:t,args:{}};if(Array.isArray(t))return{name:"absolute",args:{x:t[0],y:t[1]}};if(typeof t=="object")return t}return{args:{}}}getPortLabelPosition(t,e=!1){if(t==null){if(e)return{name:"left",args:{}}}else{if(typeof t=="string")return{name:t,args:{}};if(typeof t=="object")return t}return{args:{}}}getLabel(t,e=!1){let n=t.label||{};return n.position=this.getPortLabelPosition(n.position,e),n}getPortLabelLayout(t,e,n){let s=t.label.position.name||"left",r=t.label.position.args||{},o=g0.get(s)||UO.left;return o?o(e,n,r):null}};var uN,hN;function UT(i,t){return t?uN!=null&&uN.exist(i):hN!=null&&hN.exist(i)}function Zq(i){uN=i}function Qq(i){hN=i}var eY="X6.node",tY=0;function tCt(i){return i?Li.pascalCase(i):(tY+=1,`CustomNode${tY}`)}var vs=class i extends vi{static isNode(t){if(t==null)return!1;if(t instanceof i)return!0;let e=t[Symbol.toStringTag],n=t;return(e==null||e===eY)&&typeof n.isNode=="function"&&typeof n.isEdge=="function"&&typeof n.prop=="function"&&typeof n.attr=="function"&&typeof n.size=="function"&&typeof n.position=="function"}static define(t){let{constructorName:e,overwrite:n}=t,s=hn(t,["constructorName","overwrite"]),r=ge.createClass(tCt(e||s.shape),this);return r.config(s),s.shape&&i.registry.register(s.shape,r,n),r}static create(t){let e=t.shape||"rect",n=i.registry.get(e);return n?new n(t):i.registry.onNotFound(e)}get[Symbol.toStringTag](){return i.toStringTag}constructor(t={}){super(t),this.initPorts()}preprocess(t,e){let{x:n,y:s,width:r,height:o}=t,a=hn(t,["x","y","width","height"]);if(n!=null||s!=null){let l=a.position;a.position=Object.assign(Object.assign({},l),{x:n??(l?l.x:0),y:s??(l?l.y:0)})}if(r!=null||o!=null){let l=a.size;a.size=Object.assign(Object.assign({},l),{width:r??(l?l.width:0),height:o??(l?l.height:0)})}return super.preprocess(a,e)}isNode(){return!0}size(t,e,n){return t===void 0?this.getSize():typeof t=="number"?this.setSize(t,e,n):this.setSize(t,e)}getSize(){let t=this.store.get("size");return t?Object.assign({},t):{width:1,height:1}}setSize(t,e,n){return typeof t=="object"?this.resize(t.width,t.height,e):this.resize(t,e,n),this}resize(t,e,n={}){this.startBatch("resize",n);let s=n.direction;if(s){let r=this.getSize();switch(s){case"left":case"right":e=r.height;break;case"top":case"bottom":t=r.width;break;default:break}let a={right:0,"top-right":0,top:1,"top-left":1,left:2,"bottom-left":2,bottom:3,"bottom-right":3}[s],l=Ts(this.getAngle()||0);n.absolute&&(a+=Math.floor((l+45)/90),a%=4);let c=this.getBBox(),u;a===0?u=c.getBottomLeft():a===1?u=c.getCorner():a===2?u=c.getTopRight():u=c.getOrigin();let h=u.clone().rotate(-l,c.getCenter()),d=Math.sqrt(t*t+e*e)/2,p=a*Math.PI/2;p+=Math.atan(a%2===0?e/t:t/e),p-=bs(l);let y=Mt.fromPolar(d,p,h).clone().translate(t/-2,e/-2);this.store.set("size",{width:t,height:e},n),this.setPosition(y.x,y.y,n)}else this.store.set("size",{width:t,height:e},n);return this.stopBatch("resize",n),this}scale(t,e,n,s={}){let r=this.getBBox().scale(t,e,n??void 0);return this.startBatch("scale",s),this.setPosition(r.x,r.y,s),this.resize(r.width,r.height,s),this.stopBatch("scale"),this}position(t,e,n){return typeof t=="number"?this.setPosition(t,e,n):this.getPosition(t)}getPosition(t={}){if(t.relative){let n=this.getParent();if(n!=null&&n.isNode()){let s=this.getPosition(),r=n.getPosition();return{x:s.x-r.x,y:s.y-r.y}}}let e=this.store.get("position");return e?Object.assign({},e):{x:0,y:0}}setPosition(t,e,n={}){let s,r,o;
4791if(typeof t=="object"?(s=t.x,r=t.y,o=e||{}):(s=t,r=e,o=n||{}),o.relative){let a=this.getParent();if(a!=null&&a.isNode()){let l=a.getPosition();s+=l.x,r+=l.y}}if(o.deep){let a=this.getPosition();this.translate(s-a.x,r-a.y,o)}else this.store.set("position",{x:s,y:r},o);return this}translate(t=0,e=0,n={}){if(t===0&&e===0)return this;n.translateBy=n.translateBy||this.id;let s=this.getPosition();if(n.restrict!=null&&n.translateBy===this.id){let o=this.getBBox({deep:!0}),a=n.restrict,l=s.x-o.x,c=s.y-o.y,u=Math.max(a.x+l,Math.min(a.x+a.width+l-o.width,s.x+t)),h=Math.max(a.y+c,Math.min(a.y+a.height+c-o.height,s.y+e));t=u-s.x,e=h-s.y}let r={x:s.x+t,y:s.y+e};if(n.tx=t,n.ty=e,n.transition){let o=typeof n.transition!="object"?{}:Object.assign({},n.transition);o=Object.assign({duration:100,fill:"forwards"},o),this.animate({"position/x":r.x,"position/y":r.y},o),this.eachChild(a=>{var l;!((l=n.exclude)===null||l===void 0)&&l.includes(a)||a.translate(t,e,n)})}else this.startBatch("translate",n),this.store.set("position",r,n),this.eachChild(o=>{var a;!((a=n.exclude)===null||a===void 0)&&a.includes(o)||o.translate(t,e,n)}),this.stopBatch("translate",n);return this}angle(t,e){return t==null?this.getAngle():this.rotate(t,e)}getAngle(){return this.store.get("angle",0)}rotate(t,e={}){let n=this.getAngle();if(e.center){let s=this.getSize(),r=this.getPosition(),o=this.getBBox().getCenter();o.rotate(n-t,e.center);let a=o.x-s.width/2-r.x,l=o.y-s.height/2-r.y;this.startBatch("rotate",{angle:t,options:e}),this.setPosition(r.x+a,r.y+l,e),this.rotate(t,Object.assign(Object.assign({},e),{center:null})),this.stopBatch("rotate")}else this.store.set("angle",e.absolute?t:(n+t)%360,e);return this}getBBox(t={}){if(t.deep){let e=this.getDescendants({deep:!0,breadthFirst:!0});return e.push(this),vi.getCellsBBox(e)}
4791return Pe.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(t,e){let n=this.getBBox(),s=n.getCenter(),r=t.getTerminal(e);if(r==null)return s;let o=r.port;if(!o||!this.hasPort(o))return s;let a=this.getPort(o);if(!a||!a.group)return s;let c=this.getPortsPosition(a.group)[o].position,u=Mt.create(c).translate(n.getOrigin()),h=this.getAngle();return h&&u.rotate(-h,s),u}fit(t={}){let n=(this.getChildren()||[]).filter(c=>c.isNode());if(n.length===0)return this;this.startBatch("fit-embeds",t),t.deep&&n.forEach(c=>{c.fit(t)});let{x:s,y:r,width:o,height:a}=vi.getCellsBBox(n),l=dn.normalizeSides(t.padding);return s-=l.left,r-=l.top,o+=l.left+l.right,a+=l.bottom+l.top,this.store.set({position:{x:s,y:r},size:{width:o,height:a}},t),this.stopBatch("fit-embeds"),this}get portContainerMarkup(){return this.getPortContainerMarkup()}set portContainerMarkup(t){this.setPortContainerMarkup(t)}getDefaultPortContainerMarkup(){return this.store.get("defaultPortContainerMarkup")||As.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get("portContainerMarkup")||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(t,e={}){return this.store.set("portContainerMarkup",As.clone(t),e),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(t){this.setPortMarkup(t)}getDefaultPortMarkup(){return this.store.get("defaultPortMarkup")||As.getPortMarkup()}getPortMarkup(){return this.store.get("portMarkup")||this.getDefaultPortMarkup()}setPortMarkup(t,e={}
4791){return this.store.set("portMarkup",As.clone(t),e),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(t){this.setPortLabelMarkup(t)}getDefaultPortLabelMarkup(){return this.store.get("defaultPortLabelMarkup")||As.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get("portLabelMarkup")||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(t,e={}){return this.store.set("portLabelMarkup",As.clone(t),e),this}get ports(){let t=this.store.get("ports",{items:[]});return t.items==null&&(t.items=[]),t}getPorts(){return ge.cloneDeep(this.ports.items)}getPortsByGroup(t){return this.getPorts().filter(e=>e.group===t)}getPort(t){return ge.cloneDeep(this.ports.items.find(e=>e.id&&e.id===t))}getPortAt(t){return this.ports.items[t]||null}hasPorts(){return this.ports.items.length>0}hasPort(t){return this.getPortIndex(t)!==-1}getPortIndex(t){let e=typeof t=="string"?t:t.id;return e!=null?this.ports.items.findIndex(n=>n.id===e):-1}getPortsPosition(t){let e=this.getSize();return this.port.getPortsLayoutByGroup(t,new Pe(0,0,e.width,e.height)).reduce((s,r)=>{let o=r.portLayout;return s[r.portId]={position:Object.assign({},o.position),angle:o.angle||0},s},{})}getPortProp(t,e){return this.getPropByPath(this.prefixPortPath(t,e))}setPortProp(t,e,n,s){if(typeof e=="string"||Array.isArray(e)){let a=this.prefixPortPath(t,e),l=n;return this.setPropByPath(a,l,s)}let r=this.prefixPortPath(t),o=e;return this.setPropByPath(r,o,n)}removePortProp(t,e,n){return typeof e=="string"||Array.isArray(e)?this.removePropByPath(this.prefixPortPath(t,e),n):this.removePropByPath(this.prefixPortPath(t),e)}portProp(t,e,n,s){return e==null?this.getPortProp(t):typeof e=="string"||Array.isArray(e)?arguments.length===2?this.getPortProp(t,e):n==null?this.removePortProp(t,e,s):this.setPortProp(t,e,n,s):this.setPortProp(t,e,n)}prefixPortPath(t,e){let n=this.getPortIndex(t);if(n===-1)throw new Error(`Unable to find port with id: "${t}"`);return e==null||e===""?["ports","items",`${n}`]:Array.isArray(e)?["ports","items",`${n}`,...e]:`ports/items/${n}/${e}`}addPort(t,e){let n=[...this.ports.items];return n.push(t),this.setPropByPath("ports/items",n,e),this}addPorts(t,e){return this.setPropByPath("ports/items",[...this.ports.items,...t],e),this}insertPort(t,e,n){let s=[...this.ports.items];return s.splice(t,0,e),this.setPropByPath("ports/items",s,n),this}removePort(t,e={}){return this.removePortAt(this.getPortIndex(t),e)}removePortAt(t,e={}){if(t>=0){let n=[...this.ports.items];n.splice(t,1),e.rewrite=!0,this.setPropByPath("ports/items",n,e)}return this}removePorts(t,e){let n;if(Array.isArray(t)){if(n=e||{},t.length){n.rewrite=!0;let r=[...this.ports.items].filter(o=>!t.some(a=>{let l=typeof a=="string"?a:a.id;return o.id===l}));this.setPropByPath("ports/items",r,n)}}else n=t||{},n.rewrite=!0,this.setPropByPath("ports/items",[],n);return this}getParsedPorts(){return this.port.getPorts()}getParsedGroups(){return this.port.groups}getPortsLayoutByGroup(t,e){return this.port.getPortsLayoutByGroup(t,e)}initPorts(){this.updatePortData(),this.on("change:ports",()=>{this.processRemovedPort(),this.updatePortData()})}processRemovedPort(){let t=this.ports,e={};t.items.forEach(o=>{o.id&&(e[o.id]=!0)});let n={};(this.store.getPrevious("ports")||{items:[]}).items.forEach(o=>{o.id&&!e[o.id]&&(n[o.id]=!0)});let r=this.model;r&&!ge.isEmpty(n)&&(r.getConnectedEdges(this,{incoming:!0}).forEach(l=>{let c=l.getTargetPortId();c&&n[c]&&l.remove()}),r.getConnectedEdges(this,{outgoing:!0}).forEach(l=>{let c=l.getSourcePortId();c&&n[c]&&l.remove()}))}validatePorts(){let t={},e=[];return this.ports.items.forEach(n=>{typeof n!="object"&&e.push(`Invalid port ${n}.`),n.id==null&&(n.id=this.generatePortId()),t[n.id]&&e.push("Duplicitied port id."),t[n.id]=!0}),e}generatePortId(){return Li.uuid()}updatePortData(){let t=this.validatePorts();if(t.length>0)throw this.store.set("ports",this.store.getPrevious("ports")),new Error(t.join(" "));let e=this.port?this.port.getPorts():null;this.port=new FT(this.ports);let n=this.port.getPorts(),s=e?n.filter(o=>e.find(a=>
4791a.id===o.id)?null:o):[...n],r=e?e.filter(o=>n.find(a=>a.id===o.id)?null:o):[];s.length>0&&this.notify("ports:added",{added:s,cell:this,node:this}),r.length>0&&this.notify("ports:removed",{removed:r,cell:this,node:this})}};vs.toStringTag=eY;vs.registry=ui.create({type:"node",process(i,t){if(UT(i,!0))throw new Error(`Node with name '${i}' was registered by anthor Edge`);if(typeof t=="function")return t.config({shape:i}),t;let e=vs,{inherit:n}=t,s=hn(t,["inherit"]);if(n)if(typeof n=="string"){let o=this.get(n);o==null?this.onNotFound(n,"inherited"):e=o}else e=n;s.constructorName==null&&(s.constructorName=i);let r=e.define.call(e,s);return r.config({shape:i}),r}});vs.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}};vs.config({markup:[{tagName:"rect",selector:"body"},{tagName:"text",selector:"label"}],propHooks(i){var{ports:t}=i,e=hn(i,["ports"]);return t&&(e.ports=Array.isArray(t)?{items:t}:t),e}});Qq(vs.registry);Sn();var iY="X6.edge",sY="basic.edge",nY=0;function eCt(i){return i?Li.pascalCase(i):(nY+=1,`CustomEdge${nY}`)}var ns=class i extends vi{static parseStringLabel(t){return{attrs:{label:{text:t}}}}static isEdge(t){if(t==null)return!1;if(t instanceof i)return!0;let e=t[Symbol.toStringTag],n=t;return(e==null||e===iY)&&typeof n.isNode=="function"&&typeof n.isEdge=="function"&&typeof n.prop=="function"&&typeof n.attr=="function"&&typeof n.disconnect=="function"&&typeof n.getSource=="function"&&typeof n.getTarget=="function"}static equalTerminals(t,e){let n=t,s=e;return n.cell===s.cell?n.port===s.port||n.port==null&&s.port==null:!1}static define(t){let{constructorName:e,overwrite:n}=t,s=hn(t,["constructorName","overwrite"]),r=ge.createClass(eCt(e||s.shape),this);return r.config(s),s.shape&&i.registry.register(s.shape,r,n),r}static create(t){let e=t.shape||"edge",n=i.registry.get(e);return n?new n(t):i.registry.onNotFound(e)}get[Symbol.toStringTag](){return i.toStringTag}constructor(t={}){super(t)}preprocess(t,e){let{source:n,sourceCell:s,sourcePort:r,sourcePoint:o,target:a,targetCell:l,targetPort:c,targetPoint:u}=t,d=hn(t,["source","sourceCell","sourcePort","sourcePoint","target","targetCell","targetPort","targetPoint"]),p=g=>typeof g=="string"||typeof g=="number";if(n!=null)if(vi.isCell(n))d.source={cell:n.id};else if(p(n))d.source={cell:n};else if(Mt.isPoint(n))d.source=n.toJSON();else if(Array.isArray(n))d.source={x:n[0],y:n[1]};else{let g=n.cell;vi.isCell(g)?d.source=Object.assign(Object.assign({},n),{cell:g.id}):d.source=n}if(s!=null||r!=null){let g=d.source;if(s!=null){let y=p(s)?s:s.id;g?g.cell=y:g=d.source={cell:y}}r!=null&&g&&(g.port=r)}else o!=null&&(d.source=Mt.create(o).toJSON());if(a!=null)if(vi.isCell(a))d.target={cell:a.id};else if(p(a))d.target={cell:a};else if(Mt.isPoint(a))d.target=a.toJSON();else if(Array.isArray(a))d.target={x:a[0],y:a[1]};
4791else{let g=a.cell;vi.isCell(g)?d.target=Object.assign(Object.assign({},a),{cell:g.id}):d.target=a}if(l!=null||c!=null){let g=d.target;if(l!=null){let y=p(l)?l:l.id;g?g.cell=y:g=d.target={cell:y}}c!=null&&g&&(g.port=c)}else u!=null&&(d.target=Mt.create(u).toJSON());return super.preprocess(d,e)}setup(){super.setup(),this.on("change:labels",t=>this.onLabelsChanged(t)),this.on("change:vertices",t=>this.onVertexsChanged(t))}isEdge(){return!0}disconnect(t={}){return this.store.set({source:{x:0,y:0},target:{x:0,y:0}},t),this}get source(){return this.getSource()}set source(t){this.setSource(t)}getSource(){return this.getTerminal("source")}getSourceCellId(){return this.source.cell}getSourcePortId(){return this.source.port}setSource(t,e,n={}){return this.setTerminal("source",t,e,n)}get target(){return this.getTarget()}set target(t){this.setTarget(t)}getTarget(){return this.getTerminal("target")}getTargetCellId(){return this.target.cell}getTargetPortId(){return this.target.port}setTarget(t,e,n={}){return this.setTerminal("target",t,e,n)}getTerminal(t){return Object.assign({},this.store.get(t))}setTerminal(t,e,n,s={}){if(vi.isCell(e))return this.store.set(t,ge.merge({},n,{cell:e.id}),s),this;let r=e;return Mt.isPoint(e)||r.x!=null&&r.y!=null?(this.store.set(t,ge.merge({},n,{x:r.x,y:r.y}),s),this):(this.store.set(t,ge.cloneDeep(e),s),this)}getSourcePoint(){return this.getTerminalPoint("source")}getTargetPoint(){return this.getTerminalPoint("target")}getTerminalPoint(t){let e=this[t];if(Mt.isPointLike(e))return Mt.create(e);let n=this.getTerminalCell(t);return n?n.getConnectionPoint(this,t):new Mt}getSourceCell(){return this.getTerminalCell("source")}getTargetCell(){return this.getTerminalCell("target")}getTerminalCell(t){if(this.model){let e=t==="source"?this.getSourceCellId():this.getTargetCellId();if(e)return this.model.getCell(e)}return null}getSourceNode(){return this.getTerminalNode("source")}getTargetNode(){return this.getTerminalNode("target")}getTerminalNode(t){let e=this,n={};for(;e&&e.isEdge();){if(n[e.id])return null;n[e.id]=!0,e=e.getTerminalCell(t)}return e&&e.isNode()?e:null}get router(){return this.getRouter()}set router(t){t==null?this.removeRouter():this.setRouter(t)}getRouter(){return this.store.get("router")}setRouter(t,e,n){return typeof t=="object"?this.store.set("router",t,e):this.store.set("router",{name:t,args:e},n),this}removeRouter(t={}){return this.store.remove("router",t),this}get connector(){return this.getConnector()}set connector(t){t==null?this.removeConnector():this.setConnector(t)}getConnector(){return this.store.get("connector")}setConnector(t,e,n){return typeof t=="object"?this.store.set("connector",t,e):this.store.set("connector",{name:t,args:e},n),this}removeConnector(t={}){return this.store.remove("connector",t)}getDefaultLabel(){let t=this.constructor,e=this.store.get("defaultLabel")||t.defaultLabel||{};return ge.cloneDeep(e)}get labels(){return this.getLabels()}set labels(t){this.setLabels(t)}
4791getLabels(){return[...this.store.get("labels",[])].map(t=>this.parseLabel(t))}setLabels(t,e={}){return this.store.set("labels",Array.isArray(t)?t:[t],e),this}insertLabel(t,e,n={}){let s=this.getLabels(),r=s.length,o=e!=null&&Number.isFinite(e)?e:r;return o<0&&(o=r+o+1),s.splice(o,0,this.parseLabel(t)),this.setLabels(s,n)}appendLabel(t,e={}){return this.insertLabel(t,-1,e)}getLabelAt(t){let e=this.getLabels();return t!=null&&Number.isFinite(t)?this.parseLabel(e[t]):null}setLabelAt(t,e,n={}){if(t!=null&&Number.isFinite(t)){let s=this.getLabels();s[t]=this.parseLabel(e),this.setLabels(s,n)}return this}removeLabelAt(t,e={}){let n=this.getLabels(),s=t!=null&&Number.isFinite(t)?t:-1,r=n.splice(s,1);return this.setLabels(n,e),r.length?r[0]:null}parseLabel(t){return typeof t=="string"?this.constructor.parseStringLabel(t):t}onLabelsChanged({previous:t,current:e}){let n=t&&e?e.filter(r=>t.find(o=>r===o||ge.isEqual(r,o))?null:r):e?[...e]:[],s=t&&e?t.filter(r=>e.find(o=>r===o||ge.isEqual(r,o))?null:r):t?[...t]:[];n.length>0&&this.notify("labels:added",{added:n,cell:this,edge:this}),s.length>0&&this.notify("labels:removed",{removed:s,cell:this,edge:this})}get vertices(){return this.getVertices()}set vertices(t){this.setVertices(t)}getVertices(){return[...this.store.get("vertices",[])]}setVertices(t,e={}){let n=Array.isArray(t)?t:[t];return this.store.set("vertices",n.map(s=>Mt.toJSON(s)),e),this}insertVertex(t,e,n={}){let s=this.getVertices(),r=s.length,o=e!=null&&Number.isFinite(e)?e:r;return o<0&&(o=r+o+1),s.splice(o,0,Mt.toJSON(t)),this.setVertices(s,n)}appendVertex(t,e={}){return this.insertVertex(t,-1,e)}getVertexAt(t){return t!=null&&Number.isFinite(t)?this.getVertices()[t]:null}setVertexAt(t,e,n={}){if(t!=null&&Number.isFinite(t)){let s=this.getVertices();s[t]=e,this.setVertices(s,n)}return this}removeVertexAt(t,e={}){let n=this.getVertices(),s=t!=null&&Number.isFinite(t)?t:-1;return n.splice(s,1),this.setVertices(n,e)}onVertexsChanged({previous:t,current:e}){let n=t&&e?e.filter(r=>t.find(o=>Mt.equals(r,o))?null:r):e?[...e]:[],s=t&&e?t.filter(r=>e.find(o=>Mt.equals(r,o))?null:r):t?[...t]:[];n.length>0&&this.notify("vertexs:added",{added:n,cell:this,edge:this}),s.length>0&&this.notify("vertexs:removed",{removed:s,cell:this,edge:this})}getDefaultMarkup(){return this.store.get("defaultMarkup")||As.getEdgeMarkup()}getMarkup(){return super.getMarkup()||this.getDefaultMarkup()}translate(t,e,n={}){return n.translateBy=n.translateBy||this.id,n.tx=t,n.ty=e,this.applyToPoints(s=>({x:(s.x||0)+t,y:(s.y||0)+e}),n)}scale(t,e,n,s={}){return this.applyToPoints(r=>
4791Mt.create(r).scale(t,e,n).toJSON(),s)}applyToPoints(t,e={}){let n={},s=this.getSource(),r=this.getTarget();Mt.isPointLike(s)&&(n.source=t(s)),Mt.isPointLike(r)&&(n.target=t(r));let o=this.getVertices();return o.length>0&&(n.vertices=o.map(t)),this.store.set(n,e),this}getBBox(){return this.getPolyline().bbox()}getConnectionPoint(){return this.getPolyline().pointAt(.5)}getPolyline(){let t=[this.getSourcePoint(),...this.getVertices().map(e=>Mt.create(e)),this.getTargetPoint()];return new Qs(t)}updateParent(t){let e=null,n=this.getSourceCell(),s=this.getTargetCell(),r=this.getParent();return n&&s&&(n===s||n.isDescendantOf(s)?e=s:s.isDescendantOf(n)?e=n:e=vi.getCommonAncestor(n,s)),r&&e&&e.id!==r.id&&r.unembed(this,t),e&&(!r||r.id!==e.id)&&e.embed(this,t),e}hasLoop(t={}){let e=this.getSource(),n=this.getTarget(),s=e.cell,r=n.cell;if(!s||!r)return!1;let o=s===r;if(!o&&t.deep&&this._model){let a=this.getSourceCell(),l=this.getTargetCell();a&&l&&(o=a.isAncestorOf(l,t)||l.isAncestorOf(a,t))}return o}getFragmentAncestor(){let t=[this,this.getSourceNode(),this.getTargetNode()].filter(e=>e!=null);return this.getCommonAncestor(...t)}isFragmentDescendantOf(t){let e=this.getFragmentAncestor();return!!e&&(e.id===t.id||e.isDescendantOf(t))}};ns.toStringTag=iY;ns.defaultLabel={markup:[{tagName:"rect",selector:"body"},{tagName:"text",selector:"label"}],attrs:{text:{fill:"#000",fontSize:14,textAnchor:"middle",textVerticalAnchor:"middle",pointerEvents:"none"},rect:{ref:"label",fill:"#fff",rx:3,ry:3,refWidth:1,refHeight:1,refX:0,refY:0}},position:{distance:.5}};ns.registry=ui.create({type:"edge",process(i,t){if(UT(i,!1))throw new Error(`Edge with name '${i}' was registered by anthor Node`);if(typeof t=="function")return t.config({shape:i}),t;let e=ns,{inherit:n="edge"}=t,s=hn(t,["inherit"]);if(typeof n=="string"){let o=this.get(n||"edge");o==null&&n?this.onNotFound(n,"inherited"):e=o}else e=n;s.constructorName==null&&(s.constructorName=i);let r=e.define.call(e,s);return r.config({shape:i}),r}});ns.defaults={};Zq(ns.registry);ns.config({shape:sY,propHooks(i){let{label:t,vertices:e}=i,n=hn(i,["label","vertices"]);if(t){n.labels==null&&(n.labels=[]);let s=typeof t=="string"?ns.parseStringLabel(t):t;n.labels.push(s)}return e&&Array.isArray(e)&&(n.vertices=e.map(s=>Mt.create(s).toJSON())),n}});ns.registry.register(sY,ns);Sn();Sn();var wp=class extends Ii{constructor(t,e={}){super(),this.length=0,this.comparator=e.comparator||"zIndex",this.clean(),t&&this.reset(t,{silent:!0})}toJSON(){return this.cells.map(t=>t.toJSON())}add(t,e,n){let s,r;typeof e=="number"?(s=e,r=Object.assign({merge:!1},n)):(s=this.length,r=Object.assign({merge:!1},e)),s>this.length&&(s=this.length),s<0&&(s+=this.length+1);let o=Array.isArray(t)?t:[t],a=this.comparator&&typeof e!="number"&&r.sort!==!1,l=this.comparator||null,c=!1,u=[],h=[];return o.forEach(d=>{let p=this.get(d);p?r.merge&&!d.isSameStore(p)&&(p.setProp(d.getProp(),n),h.push(p),a&&!c&&(l==null||typeof l=="function"?c=p.hasChanged():typeof l=="string"?c=p.hasChanged(l):c=l.some(g=>p.hasChanged(g)))):(u.push(d),this.reference(d))}),u.length&&(a&&(c=!0),this.cells.splice(s,0,...u),this.length=this.cells.length),c&&this.sort({silent:!0}),r.silent||(u.forEach((d,p)=>{let g={cell:d,index:s+p,options:r};this.trigger("added",g),r.dryrun||d.notify("added",Object.assign({},g))}),c&&this.trigger("sorted"),(u.length||h.length)&&this.trigger("updated",{added:u,merged:h,removed:[],options:r})),this}remove(t,e={}){let n=Array.isArray(t)?t:[t],s=this.removeCells(n,e);return!e.silent&&s.length>0&&this.trigger("updated",{options:e,removed:s,added:[],merged:[]}),Array.isArray(t)?s:s[0]}removeCells(t,e){let n=[];for(let s=0;s<t.length;s+=1){let r=this.get(t[s]);if(r==null)continue;let o=this.cells.indexOf(r);this.cells.splice(o,1),this.length-=1,delete this.map[r.id],n.push(r),this.unreference(r),e.silent||(this.trigger("removed",{cell:r,index:o,options:e}),e.dryrun||r.notify("removed",{cell:r,index:o,options:e})),e.dryrun||r.remove()}return n}reset(t,e={}){let n=this.cells.slice();if(e.diff||(n.forEach(s=>{this.unreference(s),s.remove()}),this.clean()),this.add(t,Object.assign({silent:!0},e)),!e.silent){let s=this.cells.slice();this.trigger("reseted",{options:e,previous:n,current:s});let r=[],o=[];
4791s.forEach(a=>{n.some(c=>c.id===a.id)||r.push(a)}),n.forEach(a=>{s.some(c=>c.id===a.id)||o.push(a)}),this.trigger("updated",{options:e,added:r,removed:o,merged:[]})}return this}push(t,e){return this.add(t,this.length,e)}pop(t){let e=this.at(this.length-1);return e?this.remove(e,t):null}unshift(t,e){return this.add(t,0,e)}shift(t){let e=this.at(0);return e?this.remove(e,t):null}get(t){if(t==null)return null;let e=typeof t=="string"||typeof t=="number"?t:t.id;return this.map[e]||null}has(t){return this.get(t)!=null}at(t){return t<0&&(t+=this.length),this.cells[t]||null}first(){return this.at(0)}last(){return this.at(-1)}indexOf(t){return this.cells.indexOf(t)}toArray(){return this.cells.slice()}sort(t={}){return this.comparator!=null&&(this.cells=cs.sortBy(this.cells,this.comparator),t.silent||this.trigger("sorted")),this}clone(){let t=this.constructor;return new t(this.cells.slice(),{comparator:this.comparator})}reference(t){this.map[t.id]=t,t.on("*",this.notifyCellEvent,this)}unreference(t){t.off("*",this.notifyCellEvent,this),delete this.map[t.id]}notifyCellEvent(t,e){let n=e.cell;this.trigger(`cell:${t}`,e),n&&(n.isNode()?this.trigger(`node:${t}`,Object.assign(Object.assign({},e),{node:n})):n.isEdge()&&this.trigger(`edge:${t}`,Object.assign(Object.assign({},e),{edge:n})))}clean(){this.length=0,this.cells=[],this.map={}}dispose(){this.reset([])}};rn([ln()],wp.prototype,"dispose",null);var nCt="X6.Model",Zr=class i extends Ii{static isModel(t){if(t==null)return!1;if(t instanceof i)return!0;let e=t[Symbol.toStringTag],n=t;return(e==null||e===nCt)&&typeof n.addNode=="function"&&typeof n.addEdge=="function"&&n.collection!=null}static toJSON(t,e={}){return{cells:t.map(n=>n.toJSON(e))}}static fromJSON(t){let e=[];return Array.isArray(t)?e.push(...t):(t.cells&&e.push(...t.cells),t.nodes&&t.nodes.forEach(n=>{n.shape==null&&(n.shape="rect"),e.push(n)}
4791),t.edges&&t.edges.forEach(n=>{n.shape==null&&(n.shape="edge"),e.push(n)})),e.map(n=>{let s=n.shape;if(s){if(vs.registry.exist(s))return vs.create(n);if(ns.registry.exist(s))return ns.create(n)}throw new Error("The `shape` should be specified when creating a node/edge instance")})}constructor(t=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new wp(t),this.setup()}notify(t,e){this.trigger(t,e);let n=this.graph;return n&&(t==="sorted"||t==="reseted"||t==="updated"?n.trigger(`model:${t}`,e):n.trigger(t,e)),this}setup(){let t=this.collection;t.on("sorted",()=>this.notify("sorted",null)),t.on("updated",e=>this.notify("updated",e)),t.on("cell:change:zIndex",()=>this.sortOnChangeZ()),t.on("added",({cell:e})=>{this.onCellAdded(e)}),t.on("removed",e=>{let n=e.cell;this.onCellRemoved(n,e.options),this.notify("cell:removed",e),n.isNode()?this.notify("node:removed",Object.assign(Object.assign({},e),{node:n})):n.isEdge()&&this.notify("edge:removed",Object.assign(Object.assign({},e),{edge:n}))}),t.on("reseted",e=>{this.onReset(e.current),this.notify("reseted",e)}),t.on("edge:change:source",({edge:e})=>this.onEdgeTerminalChanged(e,"source")),t.on("edge:change:target",({edge:e})=>{this.onEdgeTerminalChanged(e,"target")})}sortOnChangeZ(){this.collection.sort()}onCellAdded(t){let e=t.id;t.isEdge()?(t.updateParent(),this.edges[e]=!0,this.onEdgeTerminalChanged(t,"source"),this.onEdgeTerminalChanged(t,"target")):this.nodes[e]=!0}onCellRemoved(t,e){let n=t.id;if(t.isEdge()){delete this.edges[n];let s=t.getSource(),r=t.getTarget();if(s?.cell){let o=this.outgoings[s.cell],a=o?o.indexOf(n):-1;a>=0&&(o.splice(a,1),o.length===0&&delete this.outgoings[s.cell])}if(r?.cell){let o=this.incomings[r.cell],a=o?o.indexOf(n):-1;a>=0&&(o.splice(a,1),o.length===0&&delete this.incomings[r.cell])}}else delete this.nodes[n];e.clear||(e.disconnectEdges?this.disconnectConnectedEdges(t,e):this.removeConnectedEdges(t,e)),t.model===this&&(t.model=null)}onReset(t){this.nodes={},this.edges={},this.outgoings={},this.incomings={},t.forEach(e=>{this.onCellAdded(e)})}onEdgeTerminalChanged(t,e){let n=e==="source"?this.outgoings:this.incomings,s=t.previous(e);if(s?.cell){let o=vi.isCell(s.cell)?s.cell.id:s.cell,a=n[o],l=a?a.indexOf(t.id):-1;l>=0&&(a.splice(l,1),a.length===0&&delete n[o])}let r=t.getTerminal(e);if(r?.cell){let o=vi.isCell(r.cell)?r.cell.id:r.cell,a=n[o]||[];a.indexOf(t.id)===-1&&a.push(t.id),n[o]=a}}prepareCell(t,e){return!t.model&&(!e||!e.dryrun)&&(t.model=this),t.zIndex==null&&t.setZIndex(this.getMaxZIndex()+1,{silent:!0}),t}resetCells(t,e={}){return t.map(n=>this.prepareCell(n,Object.assign(Object.assign({},e),{dryrun:!0}))),this.collection.reset(t,e),t.map(n=>this.prepareCell(n,{options:e})),this}clear(t={}){let e=this.getCells();if(e.length===0)return this;let n=Object.assign(Object.assign({},t),{clear:!0});return this.batchUpdate("clear",()=>{let s=e.sort((r,o)=>{let a=r.isEdge()?1:2,l=o.isEdge()?1:2;return a-l});for(;s.length>0;){let r=s.shift();r&&r.remove(n)}},n),this}addNode(t,e={}){let n=vs.isNode(t)?t:this.createNode(t);return this.addCell(n,e),n}updateNode(t,e={}){let n=this.createNode(t),s=n.getProp();return n.dispose(),this.updateCell(s,e)}createNode(t){return vs.create(t)}addEdge(t,e={}){let n=ns.isEdge(t)?t:this.createEdge(t);return this.addCell(n,e),n}createEdge(t){return ns.create(t)}updateEdge(t,e={}){let n=this.createEdge(t),s=n.getProp();return n.dispose(),this.updateCell(s,e)}addCell(t,e={}){return Array.isArray(t)?this.addCells(t,e):(!this.collection.has(t)&&!this.addings.has(t)&&(this.addings.set(t,!0),this.collection.add(this.prepareCell(t,e),e),t.eachChild(n=>this.addCell(n,e)),this.addings.delete(t)),this)}addCells(t,e={}){let n=t.length;if(n===0)return this;let s=Object.assign(Object.assign({},e),{position:n-1,maxPosition:n-1});return this.startBatch("add",Object.assign(Object.assign({},s),{cells:t})),t.forEach(r=>
4791{this.addCell(r,s),s.position-=1}),this.stopBatch("add",Object.assign(Object.assign({},s),{cells:t})),this}updateCell(t,e={}){let n=t.id&&this.getCell(t.id);return n?this.batchUpdate("update",()=>(Object.entries(t).forEach(([s,r])=>{n.setProp(s,r,e)}),!0),t):!1}removeCell(t,e={}){let n=typeof t=="string"?this.getCell(t):t;return n&&this.has(n)?this.collection.remove(n,e):null}updateCellId(t,e){if(t.id===e)return;this.startBatch("update",{id:e}),t.prop("id",e);let n=t.clone({keepId:!0});return this.addCell(n),this.getConnectedEdges(t).forEach(r=>{let o=r.getSourceCell(),a=r.getTargetCell();o===t&&r.setSource(Object.assign(Object.assign({},r.getSource()),{cell:e})),a===t&&r.setTarget(Object.assign(Object.assign({},r.getTarget()),{cell:e}))}),this.removeCell(t),this.stopBatch("update",{id:e}),n}removeCells(t,e={}){return t.length?this.batchUpdate("remove",()=>t.map(n=>this.removeCell(n,e))):[]}removeConnectedEdges(t,e={}){let n=this.getConnectedEdges(t);return n.forEach(s=>{s.remove(e)}),n}disconnectConnectedEdges(t,e={}){let n=typeof t=="string"?t:t.id;this.getConnectedEdges(t).forEach(s=>{let r=s.getSourceCellId(),o=s.getTargetCellId();r===n&&s.setSource({x:0,y:0},e),o===n&&s.setTarget({x:0,y:0},e)})}has(t){return this.collection.has(t)}total(){return this.collection.length}indexOf(t){return this.collection.indexOf(t)}getCell(t){return this.collection.get(t)}getCells(){return this.collection.toArray()}getFirstCell(){return this.collection.first()}getLastCell(){return this.collection.last()}getMinZIndex(){let t=this.collection.first();return t&&t.getZIndex()||0}getMaxZIndex(){let t=this.collection.last();return t&&t.getZIndex()||0}getCellsFromCache(t){return t?Object.keys(t).map(e=>this.getCell(e)).filter(e=>e!=null):[]}getNodes(){return this.getCellsFromCache(this.nodes)}getEdges(){return this.getCellsFromCache(this.edges)}getOutgoingEdges(t){let e=typeof t=="string"?t:t.id,n=this.outgoings[e];return n?n.map(s=>this.getCell(s)).filter(s=>s?.isEdge()):null}getIncomingEdges(t){let e=typeof t=="string"?t:t.id,n=this.incomings[e];return n?n.map(s=>this.getCell(s)).filter(s=>s?.isEdge()):null}getConnectedEdges(t,e={}){let n=[],s=typeof t=="string"?this.getCell(t):t;if(s==null)return n;let r={},o=e.indirect,a=e.incoming,l=e.outgoing;a==null&&l==null&&(a=l=!0);let c=(u,h)=>{let d=h?this.getOutgoingEdges(u):this.getIncomingEdges(u);if(d?.forEach(p=>{r[p.id]||(n.push(p),r[p.id]=!0,o&&(a&&c(p,!1),l&&c(p,!0)))}),o&&u.isEdge()){let p=h?u.getTargetCell():u.getSourceCell();p?.isEdge()&&(r[p.id]||(n.push(p),c(p,h)))}};if(l&&c(s,!0),a&&c(s,!1),e.deep){let u=s.getDescendants({deep:!0}),h={};u.forEach(p=>{p.isNode()&&(h[p.id]=!0)});let d=(p,g)=>{let y=g?this.getOutgoingEdges(p.id):this.getIncomingEdges(p.id);y?.forEach(x=>{if(!r[x.id]){let w=x.getSourceCell(),M=x.getTargetCell();if(!e.enclosed&&w&&h[w.id]&&M&&h[M.id])return;n.push(x),r[x.id]=!0}})};u.forEach(p=>{p.isEdge()||(l&&d(p,!0),a&&d(p,!1))})}return n}isBoundary(t,e){let n=typeof t=="string"?this.getCell(t):t,s=e?this.getIncomingEdges(n):this.getOutgoingEdges(n);return s==null||s.length===0}getBoundaryNodes(t){let e=[];return Object.keys(this.nodes).forEach(n=>{if(this.isBoundary(n,t)){let s=this.getCell(n);s&&e.push(s)}}),e}getRoots(){return this.getBoundaryNodes(!0)}getLeafs(){return this.getBoundaryNodes(!1)}isRoot(t){return this.isBoundary(t,!0)}isLeaf(t){return this.isBoundary(t,!1)}getNeighbors(t,e={}){let n=e.incoming,s=e.outgoing;n==null&&s==null&&(n=s=!0);let o=this.getConnectedEdges(t,e).reduce((a,l)=>{let c=l.hasLoop(e),u=l.getSourceCell(),h=l.getTargetCell();return n&&u&&u.isNode()&&!a[u.id]&&(c||u!==t&&(!e.deep||!u.isDescendantOf(t)))&&(a[u.id]=u),s&&h&&h.isNode()&&!a[h.id]&&(c||h!==t&&(!e.deep||!h.isDescendantOf(t)))&&(a[h.id]=h),a},{});if(t.isEdge()){if(n){let a=t.getSourceCell();a?.isNode()&&!o[a.id]&&(o[a.id]=a)}if(s){let a=t.getTargetCell();a?.isNode()&&!o[a.id]&&(o[a.id]=a)}}return Object.keys(o).map(a=>o[a])}isNeighbor(t,e,n={}){let s=n.incoming,r=n.outgoing;return s==null&&r==null&&(s=r=!0),this.getConnectedEdges(t,n).some(o=>{let a=o.getSourceCell(),l=o.getTargetCell();return!!(s&&a&&a.id===e.id||r&&l&&l.id===e.id)})}getSuccessors(t,e={}){let n=[];return this.search(t,(s,r)=>{s!==t&&this.matchDistance(r,e.distance)&&n.push(s)},Object.assign(Object.assign({},e),{outgoing:!0})),n}isSuccessor(t,e,n={}){let s=!1;return this.search(t,(r,o)=>{if(r===e&&r!==t&&this.matchDistance(o,n.distance))return s=!0,!1},Object.assign(Object.assign({},n),{outgoing:!0})),s}getPredecessors(t,e={}){let n=[];return this.search(t,(s,r)=>{s!==t&&this.matchDistance(r,e.distance)&&n.push(s)},Object.assign(Object.assign({},e),{incoming:!0})),n}isPredecessor(t,e,n={}){let s=!1;return this.search(t,(r,o)=>{if(r===e&&r!==t&&this.matchDistance(o,n.distance))return s=!0,!1},Object.assign(Object.assign({},n),{incoming:!0})),s}matchDistance(t,e){return e==null?!0:typeof e=="function"?e(t):Array.isArray(e)&&e.includes(t)?!0:t===e}getCommonAncestor(...t){let e=[];return t.forEach(n=>
4791{n&&(Array.isArray(n)?e.push(...n):e.push(n))}),vi.getCommonAncestor(...e)}getSubGraph(t,e={}){let n=[],s={},r=[],o=[],a=l=>{s[l.id]||(n.push(l),s[l.id]=l,l.isEdge()&&o.push(l),l.isNode()&&r.push(l))};return t.forEach(l=>{a(l),e.deep&&l.getDescendants({deep:!0}).forEach(u=>{a(u)})}),o.forEach(l=>{let c=l.getSourceCell(),u=l.getTargetCell();c&&!s[c.id]&&(n.push(c),s[c.id]=c,c.isNode()&&r.push(c)),u&&!s[u.id]&&(n.push(u),s[u.id]=u,u.isNode()&&r.push(u))}),r.forEach(l=>{this.getConnectedEdges(l,e).forEach(u=>{let h=u.getSourceCell(),d=u.getTargetCell();!s[u.id]&&h&&s[h.id]&&d&&s[d.id]&&(n.push(u),s[u.id]=u)})}),n}cloneSubGraph(t,e={}){let n=this.getSubGraph(t,e);return this.cloneCells(n)}cloneCells(t){return vi.cloneCells(t)}getNodesFromPoint(t,e){let n=typeof t=="number"?{x:t,y:e||0}:t;return this.getNodes().filter(s=>s.getBBox().containsPoint(n))}getNodesInArea(t,e,n,s,r){let o=typeof t=="number"?new Pe(t,e,n,s):Pe.create(t),a=typeof t=="number"?r:e,l=a?.strict;return this.getNodes().filter(c=>{let u=c.angle(),h=c.getBBox().bbox(u);return l?o.containsRect(h):o.isIntersectWithRect(h)})}getEdgesInArea(t,e,n,s,r){let o=typeof t=="number"?new Pe(t,e,n,s):Pe.create(t),a=typeof t=="number"?r:e,l=a?.strict;return this.getEdges().filter(c=>{let u=c.getBBox();return u.width===0?u.inflate(1,0):u.height===0&&u.inflate(0,1),l?o.containsRect(u):o.isIntersectWithRect(u)})}getNodesUnderNode(t,e={}){let n=t.getBBox();return(e.by==null||e.by==="bbox"?this.getNodesInArea(n):this.getNodesFromPoint(n[e.by])).filter(r=>t.id!==r.id&&!r.isDescendantOf(t))}getAllCellsBBox(){return this.getCellsBBox(this.getCells())}getCellsBBox(t,e={}){return vi.getCellsBBox(t,e)}search(t,e,n={}){n.breadthFirst?this.breadthFirstSearch(t,e,n):this.depthFirstSearch(t,e,n)}breadthFirstSearch(t,e,n={}){let s=[],r={},o={};for(s.push(t),o[t.id]=0;s.length>0;){let a=s.shift();if(a==null||r[a.id]||(r[a.id]=!0,ke.call(e,this,a,o[a.id])===!1))continue;this.getNeighbors(a,n).forEach(c=>{o[c.id]=o[a.id]+1,s.push(c)})}}depthFirstSearch(t,e,n={}){let s=[],r={},o={};for(s.push(t),o[t.id]=0;s.length>0;){let a=s.pop();if(a==null||r[a.id]||(r[a.id]=!0,ke.call(e,this,a,o[a.id])===!1))continue;let l=this.getNeighbors(a,n),c=s.length;l.forEach(u=>{o[u.id]=o[a.id]+1,s.splice(c,0,u)})}}getShortestPath(t,e,n={}){let s={};
4791this.getEdges().forEach(c=>{let u=c.getSourceCellId(),h=c.getTargetCellId();u&&h&&(s[u]||(s[u]=[]),s[h]||(s[h]=[]),s[u].push(h),n.directed||s[h].push(u))});let r=typeof t=="string"?t:t.id,o=fO(s,r,n.weight),a=[],l=typeof e=="string"?e:e.id;for(o[l]&&a.push(l);o[l];){let c=o[l];a.unshift(c),l=c}return a}translate(t,e,n){return this.getCells().filter(s=>!s.hasParent()).forEach(s=>{s.translate(t,e,n)}),this}resize(t,e,n){return this.resizeCells(t,e,this.getCells(),n)}resizeCells(t,e,n,s={}){let r=this.getCellsBBox(n);if(r){let o=Math.max(t/r.width,0),a=Math.max(e/r.height,0),l=r.getOrigin();n.forEach(c=>{c.scale(o,a,l,s)})}return this}toJSON(t={}){return i.toJSON(this.getCells(),t)}parseJSON(t){return i.fromJSON(t)}fromJSON(t,e={}){let n=[];if(!e.diff)n=this.parseJSON(t);else{let s=t,{nodes:r=[],edges:o=[]}=s,a=hn(s,["nodes","edges"]),l=r.filter(u=>!this.nodes[u.id])||[],c=o.filter(u=>!this.edges[u.id])||[];n=this.parseJSON(Object.assign(Object.assign({},a),{nodes:l,edges:c}))}return this.resetCells(n,e),this}startBatch(t,e={}){return this.batches[t]=(this.batches[t]||0)+1,this.notify("batch:start",{name:t,data:e}),this}stopBatch(t,e={}){return this.batches[t]=(this.batches[t]||0)-1,this.notify("batch:stop",{name:t,data:e}),this}batchUpdate(t,e,n={}){this.startBatch(t,n);let s=e();return this.stopBatch(t,n),s}hasActiveBatch(t=Object.keys(this.batches)){return(Array.isArray(t)?t:[t]).some(n=>this.batches[n]>0)}dispose(){this.collection.dispose()}};rn([ln()],Zr.prototype,"dispose",null);var zT={fill:"#ffffff",stroke:"#333333",strokeWidth:2},iCt={fontSize:14,fill:"#000000",refX:.5,refY:.5,textAnchor:"middle",textVerticalAnchor:"middle",fontFamily:"Arial, helvetica, sans-serif"},Xl=class extends vs{get label(){return this.getLabel()}set label(t){this.setLabel(t)}getLabel(){return this.getAttrByPath("text/text")}setLabel(t,e){return t==null?this.removeLabel():this.setAttrByPath("text/text",t,e),this}removeLabel(){return this.removeAttrByPath("text/text"),this}};Xl.config({attrs:{text:Object.assign({},iCt)},propHooks(i){let{label:t}=i,e=hn(i,["label"]);return t!=null&&ge.setByPath(e,"attrs/text/text",t),e},visible:!0});function sCt(i,t="body"){return[{tagName:i,selector:t},{tagName:"text",selector:"label"}]}function rY(i="xlink:href"){return e=>{let{imageUrl:n,imageWidth:s,imageHeight:r}=e,o=hn(e,["imageUrl","imageWidth","imageHeight"]);if(n!=null||s!=null||r!=null){let a=()=>{if(o.attrs){let l=o.attrs.image;n!=null&&(l[i]=n),s!=null&&(l.width=s),r!=null&&(l.height=r),o.attrs.image=l}};o.attrs?(o.attrs.image==null&&(o.attrs.image={}),a()):(o.attrs={image:{}},a())}return o}}function fl(i,t,e={}){let n={constructorName:i,markup:sCt(i,e.selector),attrs:{[i]:Object.assign({},zT)}};return(e.parent||Xl).define(ge.merge(n,t,{shape:i}))}function dN(i){return typeof i=="string"?i:i.map(t=>Array.isArray(t)?t.join(","):Mt.isPointLike(t)?`${t.x}, ${t.y}`:"").join(" ")}var oY=fl("circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%"}}});var VT=ns.define({shape:"edge",markup:[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}],attrs:{lines:{connection:!0,strokeLinejoin:"round"},wrap:{strokeWidth:10},line:{stroke:"#333",strokeWidth:2,targetMarker:"classic"}}});var aY=fl("ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}});Sn();Sn();Sn();var hs=class extends Uo{get options(){return this.graph.options}get model(){return this.graph.model}get view(){return this.graph.view}constructor(t){super(),this.graph=t,this.init()}init(){}};Sn();var HT={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onDragEnd"},Td=1<<30,lY=1<<29;Sn();var Ba=class i extends Sr{constructor(){super(...arguments),this.portsCache={}}static isNodeView(t){if(t==null)return!1;if(t instanceof i)return!0;let e=t[Symbol.toStringTag],n=t;return(e==null||e===cY)&&typeof n.isNodeView=="function"&&typeof n.isEdgeView=="function"&&typeof n.confirmUpdate=="function"&&typeof n.update=="function"&&typeof n.findPortElem=="function"&&typeof n.resize=="function"&&typeof n.rotate=="function"&&typeof n.translate=="function"}get[Symbol.toStringTag](){return cY}getContainerClassName(){let t=[super.getContainerClassName(),this.prefixClassName("node")];return this.can("nodeMovable")||t.push(this.prefixClassName("node-immovable")),t.join(" ")}updateClassName(t){let e=t.target;if(e.hasAttribute("magnet")){let n=this.prefixClassName("port-unconnectable");this.can("magnetConnectable")?et.removeClass(e,n):et.addClass(e,n)}else{let n=this.prefixClassName("node-immovable");this.can("nodeMovable")?this.removeClass(n):this.addClass(n)}}isNodeView(){return!0}confirmUpdate(t,e={}){let n=t,s=this.hasAction(t,["resize","translate","rotate"]);return this.hasAction(n,"ports")&&(this.removePorts(),this.cleanPortsCache()),this.hasAction(n,"render")?(this.render(),n=this.removeAction(n,["render","update","resize","translate","rotate","ports","tools"])):(n=this.handleAction(n,"resize",()=>this.resize(),"update"),n=this.handleAction(n,"update",()=>this.update(),In.useCSSSelector?"ports":null),n=this.handleAction(n,"translate",()=>this.translate()),n=this.handleAction(n,"rotate",()=>this.rotate()),n=this.handleAction(n,"ports",()=>this.renderPorts()),n=this.handleAction(n,"tools",()=>{let r=this.cell.getTools()!=null;!s||this.tools==null||!r?this.renderTools():this.updateTools(e)})),n}update(t){this.cleanCache(),In.useCSSSelector&&this.removePorts();let e=this.cell,n=e.getSize(),s=e.getAttrs();this.updateAttrs(this.container,s,{attrs:t===s?null:t,rootBBox:new Pe(0,0,n.width,n.height),selectors:this.selectors}),In.useCSSSelector&&this.renderPorts()}renderMarkup(){let t=this.cell.markup;if(t){if(typeof t=="string")throw new TypeError("Not support string markup.");return this.renderJSONMarkup(t)}throw new TypeError("Invalid node markup.")}renderJSONMarkup(t){let e=this.parseJSONMarkup(t,this.container);this.selectors=e.selectors,this.container.appendChild(e.fragment)}render(){return this.empty(),this.renderMarkup(),this.resize(),this.updateTransform(),In.useCSSSelector||this.renderPorts(),this.renderTools(),this.notify("view:render",{view:this}),this}resize(){this.cell.getAngle()&&this.rotate(),this.update()}translate(){this.updateTransform()}rotate(){this.updateTransform()}getTranslationString(){let t=this.cell.getPosition();return`translate(${t.x},${t.y})`}getRotationString(){let t=this.cell.getAngle();if(t){let e=this.cell.getSize();return`rotate(${t},${e.width/2},${e.height/2})`}}updateTransform(){let t=this.getTranslationString(),e=this.getRotationString();e&&(t+=` ${e}`),this.container.setAttribute("transform",t)}findPortElem(t,e){let n=t?this.portsCache[t]:null;if(!n)return null;let s=n.portContentElement,r=n.portContentSelectors||{};return this.findOne(e,s,r)}cleanPortsCache(){this.portsCache={}}removePorts(){Object.values(this.portsCache).forEach(t=>{et.remove(t.portElement)})}renderPorts(){let t=this.container,e=[];
4791t.childNodes.forEach(o=>{e.push(o)});let n=this.cell.getParsedPorts(),s=cs.groupBy(n,"zIndex"),r="auto";s[r]&&s[r].forEach(o=>{let a=this.getPortElement(o);t.append(a),e.push(a)}),Object.keys(s).forEach(o=>{if(o!==r){let a=parseInt(o,10);this.appendPorts(s[o],a,e)}}),this.updatePorts(),this.cleanCache(),this.updateConnectedEdges()}updateConnectedEdges(){let t=this.graph,e=this.cell,n=t.model.getConnectedEdges(e);for(let s=0,r=n.length;s<r;s+=1){let o=n[s],a=o.findView(t);if(!a||!t.renderer.isViewMounted(a))continue;let l=["update"];o.getSourceCell()===e&&l.push("source"),o.getTargetCell()===e&&l.push("target"),t.renderer.requestViewUpdate(a,a.getFlag(l))}}appendPorts(t,e,n){let s=t.map(r=>this.getPortElement(r));n[e]||e<0?et.before(n[Math.max(e,0)],s):et.append(this.container,s)}getPortElement(t){let e=this.portsCache[t.id];return e?e.portElement:this.createPortElement(t)}createPortElement(t){let e=As.renderMarkup(this.cell.getPortContainerMarkup()),n=e.elem;if(n==null)throw new Error("Invalid port container markup.");e=As.renderMarkup(this.getPortMarkup(t));let s=e.elem,r=e.selectors;if(s==null)throw new Error("Invalid port markup.");this.setAttrs({port:t.id,"port-group":t.group},s);let o="x6-port";
4791t.group&&(o+=` x6-port-${t.group}`),et.addClass(n,o),et.addClass(n,"x6-port"),et.addClass(s,"x6-port-body"),n.appendChild(s);let a=r,l,c;if(this.existPortLabel(t)){if(e=As.renderMarkup(this.getPortLabelMarkup(t.label)),l=e.elem,c=e.selectors,l==null)throw new Error("Invalid port label markup.");if(r&&c){for(let h in c)if(r[h]&&h!==this.rootSelector)throw new Error("Selectors within port must be unique.");a=Object.assign(Object.assign({},r),c)}et.addClass(l,"x6-port-label"),n.appendChild(l)}return this.portsCache[t.id]={portElement:n,portSelectors:a,portLabelElement:l,portLabelSelectors:c,portContentElement:s,portContentSelectors:r},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:t,node:this.cell,container:n,selectors:a,labelContainer:l,labelSelectors:c,contentContainer:s,contentSelectors:r}),n}updatePorts(){let t=this.cell.getParsedGroups(),e=Object.keys(t);e.length===0?this.updatePortGroup():e.forEach(n=>{this.updatePortGroup(n)})}updatePortGroup(t){let e=Pe.fromSize(this.cell.getSize()),n=this.cell.getPortsLayoutByGroup(t,e);for(let s=0,r=n.length;s<r;s+=1){let o=n[s],a=o.portId,l=this.portsCache[a]||{},c=o.portLayout;if(this.applyPortTransform(l.portElement,c),o.portAttrs!=null){let h={selectors:l.portSelectors||{}};o.portSize&&(h.rootBBox=Pe.fromSize(o.portSize)),this.updateAttrs(l.portElement,o.portAttrs,h)}let u=o.labelLayout;if(u&&l.portLabelElement&&(this.applyPortTransform(l.portLabelElement,u,-(c.angle||0)),u.attrs)){let h={selectors:l.portLabelSelectors||{}};o.labelSize&&(h.rootBBox=Pe.fromSize(o.labelSize)),this.updateAttrs(l.portLabelElement,u.attrs,h)}}}applyPortTransform(t,e,n=0){let s=e.angle,r=e.position,o=et.createSVGMatrix().rotate(n).translate(r.x||0,r.y||0).rotate(s||0);et.transform(t,o,{absolute:!0})}getPortMarkup(t){return t.markup||this.cell.portMarkup}getPortLabelMarkup(t){return t.markup||this.cell.portLabelMarkup}existPortLabel(t){return t.attrs&&t.attrs.text}getEventArgs(t,e,n){let s=this,r=s.cell,o=r;return e==null||n==null?{e:t,view:s,node:r,cell:o}:{e:t,x:e,y:n,view:s,node:r,cell:o}}getPortEventArgs(t,e,n){let s=this,r=s.cell,o=r;return n?{e:t,x:n.x,y:n.y,view:s,node:r,cell:o,port:e}:{e:t,view:s,node:r,cell:o,port:e}}notifyMouseDown(t,e,n){super.onMouseDown(t,e,n),this.notify("node:mousedown",this.getEventArgs(t,e,n))}notifyMouseMove(t,e,n){super.onMouseMove(t,e,n),this.notify("node:mousemove",this.getEventArgs(t,e,n))}notifyMouseUp(t,e,n){super.onMouseUp(t,e,n),this.notify("node:mouseup",this.getEventArgs(t,e,n))}notifyPortEvent(t,e,n){let s=this.findAttr("port",e.target);if(s){let r=e.type;t==="node:port:mouseenter"?e.type="mouseenter":t==="node:port:mouseleave"&&(e.type="mouseleave"),this.notify(t,this.getPortEventArgs(e,s,n)),e.type=r}}onClick(t,e,n){super.onClick(t,e,n),this.notify("node:click",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:click",t,{x:e,y:n})}onDblClick(t,e,n){super.onDblClick(t,e,n),this.notify("node:dblclick",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:dblclick",t,{x:e,y:n})}onContextMenu(t,e,n){super.onContextMenu(t,e,n),this.notify("node:contextmenu",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:contextmenu",t,{x:e,y:n})}onMouseDown(t,e,n){this.isPropagationStopped(t)||(this.notifyMouseDown(t,e,n),this.notifyPortEvent("node:port:mousedown",t,{x:e,y:n}),this.startNodeDragging(t,e,n))}onMouseMove(t,e,n){let s=this.getEventData(t),r=s.action;if(r==="magnet")this.dragMagnet(t,e,n);else{if(r==="move"){let a=s.targetView||this;a.dragNode(t,e,n),a.notify("node:moving",{e:t,x:e,y:n,view:a,cell:a.cell,node:a.cell})}this.notifyMouseMove(t,e,n),this.notifyPortEvent("node:port:mousemove",t,{x:e,y:n})}this.setEventData(t,s)}onMouseUp(t,e,n){let s=this.getEventData(t),r=s.action;r==="magnet"?this.stopMagnetDragging(t,e,n):(this.notifyMouseUp(t,e,n),this.notifyPortEvent("node:port:mouseup",t,{x:e,y:n}),r==="move"&&(s.targetView||this).stopNodeDragging(t,e,n));let o=s.targetMagnet;o&&this.onMagnetClick(t,o,e,n),this.checkMouseleave(t)}onMouseOver(t){super.onMouseOver(t),this.notify("node:mouseover",this.getEventArgs(t)),this.notifyPortEvent("node:port:mouseenter",t),this.notifyPortEvent("node:port:mouseover",t)}onMouseOut(t){super.onMouseOut(t),this.notify("node:mouseout",this.getEventArgs(t)),this.notifyPortEvent("node:port:mouseleave",t),this.notifyPortEvent("node:port:mouseout",t)}onMouseEnter(t){this.updateClassName(t),super.onMouseEnter(t),this.notify("node:mouseenter",this.getEventArgs(t))}onMouseLeave(t){super.onMouseLeave(t),this.notify("node:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,s){super.onMouseWheel(t,e,n,s),this.notify("node:mousewheel",Object.assign({delta:s},this.getEventArgs(t,e,n)))}onMagnetClick(t,e,n,s){let r=this.graph;r.view.getMouseMovedCount(t)>r.options.clickThreshold||this.notify("node:magnet:click",Object.assign({magnet
4791:e},this.getEventArgs(t,n,s)))}onMagnetDblClick(t,e,n,s){this.notify("node:magnet:dblclick",Object.assign({magnet:e},this.getEventArgs(t,n,s)))}onMagnetContextMenu(t,e,n,s){this.notify("node:magnet:contextmenu",Object.assign({magnet:e},this.getEventArgs(t,n,s)))}onMagnetMouseDown(t,e,n,s){this.startMagnetDragging(t,n,s)}onCustomEvent(t,e,n,s){this.notify("node:customevent",Object.assign({name:e},this.getEventArgs(t,n,s))),super.onCustomEvent(t,e,n,s)}prepareEmbedding(t){let e=this.graph,s=this.getEventData(t).cell||this.cell,r=e.findViewByCell(s),o=e.snapToGrid(t.clientX,t.clientY);this.notify("node:embed",{e:t,node:s,view:r,cell:s,x:o.x,y:o.y,currentParent:s.getParent()})}processEmbedding(t,e){let n=e.cell||this.cell,s=e.graph||this.graph,r=s.options.embedding,o=r.findParent,a=typeof o=="function"?ke.call(o,s,{view:this,node:this.cell}).filter(d=>vi.isCell(d)&&this.cell.id!==d.id&&!d.isDescendantOf(this.cell)):s.model.getNodesUnderNode(n,{by:o});if(r.frontOnly&&a.length>0){let d=cs.groupBy(a,"zIndex"),p=cs.max(Object.keys(d).map(g=>parseInt(g,10)));p&&(a=d[p])}a=a.filter(d=>d.visible);let l=null,c=e.candidateEmbedView,u=r.validate;for(let d=a.length-1;d>=0;d-=1){let p=a[d];if(c&&c.cell.id===p.id){l=c;break}else{let g=p.findView(s);if(u&&ke.call(u,s,{child:this.cell,parent:g.cell,childView:this,parentView:g})){l=g;break}}}this.clearEmbedding(e),l&&l.highlight(null,{type:"embedding"}),e.candidateEmbedView=l;let h=s.snapToGrid(t.clientX,t.clientY);this.notify("node:embedding",{e:t,cell:n,node:n,view:s.findViewByCell(n),x:h.x,y:h.y,currentParent:n.getParent(),candidateParent:l?l.cell:null})}clearEmbedding(t){let e=t.candidateEmbedView;e&&(e.unhighlight(null,{type:"embedding"}),t.candidateEmbedView=null)}finalizeEmbedding(t,e){this.graph.startBatch("embedding");let n=e.cell||this.cell,s=e.graph||this.graph,r=s.findViewByCell(n),o=n.getParent(),a=e.candidateEmbedView;if(a?(a.unhighlight(null,{type:"embedding"}),e.candidateEmbedView=null,(o==null||o.id!==a.cell.id)&&a.cell.insertChild(n,void 0,{ui:!0})):o&&o.unembed(n,{ui:!0}),s.model.getConnectedEdges(n,{deep:!0}).forEach(l=>{l.updateParent({ui:!0})}
4791),r&&a){let l=s.snapToGrid(t.clientX,t.clientY);r.notify("node:embedded",{e:t,cell:n,x:l.x,y:l.y,node:n,view:s.findViewByCell(n),previousParent:o,currentParent:n.getParent()})}this.graph.stopBatch("embedding")}getDelegatedView(){let t=this.cell,e=this;for(;e&&!t.isEdge();){if(!t.hasParent()||e.can("stopDelegateOnDragging"))return e;t=t.getParent(),e=this.graph.findViewByCell(t)}return null}validateMagnet(t,e,n){if(e.getAttribute("magnet")!=="passive"){let s=this.graph.options.connecting.validateMagnet;return s?ke.call(s,this.graph,{e:n,magnet:e,view:t,cell:t.cell}):!0}return!1}startMagnetDragging(t,e,n){if(!this.can("magnetConnectable"))return;t.stopPropagation();let s=t.currentTarget,r=this.graph;this.setEventData(t,{targetMagnet:s}),this.validateMagnet(this,s,t)?(r.options.magnetThreshold<=0&&this.startConnectting(t,s,e,n),this.setEventData(t,{action:"magnet"}),this.stopPropagation(t)):this.onMouseDown(t,e,n),r.view.delegateDragEvents(t,this)}startConnectting(t,e,n,s){this.graph.model.startBatch("add-edge");let r=this.createEdgeFromMagnet(e,n,s);r.setEventData(t,r.prepareArrowheadDragging("target",{x:n,y:s,isNewEdge:!0,fallbackAction:"remove"})),this.setEventData(t,{edgeView:r}),r.notifyMouseDown(t,n,s)}getDefaultEdge(t,e){let n,s=this.graph.options.connecting.createEdge;return s&&(n=ke.call(s,this.graph,{sourceMagnet:e,sourceView:t,sourceCell:t.cell})),n}createEdgeFromMagnet(t,e,n){let s=this.graph,r=s.model,o=this.getDefaultEdge(this,t);return o.setSource(Object.assign(Object.assign({},o.getSource()),this.getEdgeTerminal(t,e,n,o,"source"))),o.setTarget(Object.assign(Object.assign({},o.getTarget()),{x:e,y:n})),o.addTo(r,{async:!1,ui:!0}),o.findView(s)}dragMagnet(t,e,n){let s=this.getEventData(t),r=s.edgeView;if(r)r.onMouseMove(t,e,n),this.autoScrollGraph(t.clientX,t.clientY);else{let o=this.graph,a=o.options.magnetThreshold,l=this.getEventTarget(t),c=s.targetMagnet;if(a==="onleave"){if(c===l||c.contains(l))return}else if(o.view.getMouseMovedCount(t)<=a)return;this.startConnectting(t,c,e,n)}}stopMagnetDragging(t,e,n){let r=this.eventData(t).edgeView;r&&(r.onMouseUp(t,e,n),this.graph.model.stopBatch("add-edge"))}notifyUnhandledMouseDown(t,e,n){this.notify("node:unhandled:mousedown",{e:t,x:e,y:n,view:this,cell:this.cell,node:this.cell})}notifyNodeMove(t,e,n,s,r){let o=[r],a=this.graph.getPlugin("selection");if(a&&a.isSelectionMovable()){let l=a.getSelectedCells();l.includes(r)&&(o=l.filter(c=>c.isNode()))}o.forEach(l=>{this.notify(t,{e,x:n,y:s,cell:l,node:l,view:l.findView(this.graph)})})}getRestrictArea(t){let e=this.graph.options.translating.restrict,n=typeof e=="function"?ke.call(e,this.graph,t):e;return typeof n=="number"?this.graph.transform.getGraphArea().inflate(n):n===!0?this.graph.transform.getGraphArea():n||null}startNodeDragging(t,e,n){let s=this.getDelegatedView();if(s==null||!s.can("nodeMovable"))return this.notifyUnhandledMouseDown(t,e,n);this.setEventData(t,{targetView:s,action:"move"});let r=Mt.create(s.cell.getPosition());s.setEventData(t,{moving:!1,offset:r.diff(e,n),restrict:this.getRestrictArea(s)})}dragNode(t,e,n){let s=this.cell,r=this.graph,o=r.getGridSize(),a=this.getEventData(t),l=a.offset,c=a.restrict;a.moving||(a.moving=!0,this.addClass("node-moving"),this.notifyNodeMove("node:move",t,e,n,this.cell)),this.autoScrollGraph(t.clientX,t.clientY);let u=fo(e+l.x,o),h=fo(n+l.y,o);s.setPosition(u,h,{restrict:c,deep:!0,ui:!0}),r.options.embedding.enabled&&(a.embedding||(this.prepareEmbedding(t),a.embedding=!0),this.processEmbedding(t,a))}autoOffsetNode(){let t=this.cell,e=this.graph,n=Object.assign({id:t.id},t.getPosition()),r=e.getNodes().map(c=>{let u=c.getPosition();return{id:c.id,x:u.x,y:u.y}}).filter(c=>c.id!==n.id),o=[[1,1],[1,-1],[-1,1],[-1,-1]],a=e.getGridSize(),l=c=>r.some(u=>u.x===c.x&&u.y===c.y);for(;l(n);){let c=!1;for(let u=0;u<o.length;u+=1){let h=o[u],d={x:n.x+h[0]*a,y:n.y+h[1]*a};if(!l(d)){t.translate(h[0]*a,h[1]*a),c=!0;break}}if(c)break;a+=e.getGridSize()}}stopNodeDragging(t,e,n){let s=this.getEventData(t),r=this.graph;s.embedding&&this.finalizeEmbedding(t,s),s.moving&&(r.options.translating.autoOffset&&this.autoOffsetNode(),this.removeClass("node-moving"),this.notifyNodeMove("node:moved",t,e,n,this.cell)),s.moving=!1,s.embedding=!1}autoScrollGraph(t,e){let n=this.graph.getPlugin("scroller");n&&n.autoScroll(t,e)}},cY=`X6.${Ba.name}`;Ba.config({isSvgElement:!0,priority:0,bootstrap:["render"],actions:{view:["render"],markup:["render"],attrs:["update"],size:["resize","ports","tools"],angle:["rotate","tools"],position:["translate","tools"],ports:["ports"],tools:["tools"]}});Ba.registry.register("node",Ba,!0);var Ad=class i extends Sr{constructor(){super(...arguments),this.POINT_ROUNDING=2,this.labelDestroyFn={}}static isEdgeView(t){if(t==null)return!1;if(t instanceof i)return!0;let e=t[Symbol.toStringTag],n=t;return(e==null||e===uY)&&typeof n.isNodeView=="function"&&typeof n.isEdgeView=="function"&&typeof n.confirmUpdate=="function"&&typeof n.update=="function"&&typeof n.getConnection=="function"}get[Symbol.toStringTag](){return uY}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName("edge")].join(" ")}get sourceBBox(){let t=this.sourceView;if(!t||!this.graph.renderer.isViewMounted(t)){let n=this.cell.getSourceCell();if(n)return n.getBBox();let s=this.cell.getSourcePoint();return new Pe(s.x,s.y)}let e=this.sourceMagnet;return t.isEdgeElement(e)?new Pe(this.sourceAnchor.x,this.sourceAnchor.y):t.getBBoxOfElement(e||t.container)}get targetBBox(){let t=this.targetView;if(!t||!this.graph.renderer.isViewMounted(t)){let n=this.cell.getTargetCell();if(n)return n.getBBox();let s=this.cell.getTargetPoint();return new Pe(s.x,s.y)}let e=this.targetMagnet;return t.isEdgeElement(e)?new Pe(this.targetAnchor.x,this.targetAnchor.y):t.getBBoxOfElement(e||t.container)}isEdgeView(){return!0}confirmUpdate(t,e={}){let n=t;if(this.hasAction(n,"source")){if(!this.updateTerminalProperties("source"))return n;n=this.removeAction(n,"source")}if(this.hasAction(n,"target")){if(!this.updateTerminalProperties("target"))return n;n=this.removeAction(n,"target")}return this.hasAction(n,"render")?(this.render(),n=this.removeAction(n,["render","update","labels","tools"]),n):(n=this.handleAction(n,"update",()=>this.update(e)),n=this.handleAction(n,"labels",()=>this.onLabelsChange(e)),n=this.handleAction(n,"tools",()=>this.renderTools()),n)}render(){return this.empty(),this.renderMarkup(),this.labelContainer=null,this.renderLabels(),this.update(),this.renderTools(),this.notify("view:render",{view:this}),this}renderMarkup(){let t=this.cell.markup;if(t){if(typeof t=="string")throw new TypeError("Not support string markup.");return this.renderJSONMarkup(t)}throw new TypeError("Invalid edge markup.")}renderJSONMarkup(t){let e=this.parseJSONMarkup(t,this.container);this.selectors=e.selectors,this.container.append(e.fragment)}customizeLabels(){if(this.labelContainer){let t=this.cell,e=t.labels;for(let n=0,s=e.length;n<s;n+=1){let r=e[n],o=this.labelCache[n],a=this.labelSelectors[n],l=this.graph.options.onEdgeLabelRendered;if(l){let c=l({edge:t,label:r,container:o,selectors:a});c&&(this.labelDestroyFn[n]=c)}}}}destroyCustomizeLabels(){let t=this.cell.labels;if(this.labelCache&&this.labelSelectors&&this.labelDestroyFn)for(let e=0,n=t.length;e<n;e+=1){let s=this.labelDestroyFn[e],r=this.labelCache[e],o=this.labelSelectors[e];s&&r&&o&&s({edge:this.cell,label:t[e],container:r,selectors:o})}this.labelDestroyFn={}}renderLabels(){let t=this.cell,e=t.getLabels(),n=e.length,s=this.labelContainer;if(this.labelCache={},this.labelSelectors={},n<=0)return s?.parentNode&&s.parentNode.removeChild(s),this;s?this.empty(s):(s=et.createSvgElement("g"),this.addClass(this.prefixClassName("edge-labels"),s),this.labelContainer=s);for(let r=0,o=e.length;r<o;r+=1){let a=e[r],l=this.normalizeLabelMarkup(this.parseLabelMarkup(a.markup)),c,u;if(l)c=l.node,u=l.selectors;else{let d=t.getDefaultLabel(),p=this.normalizeLabelMarkup(this.parseLabelMarkup(d.markup));c=p.node,u=p.selectors}c.setAttribute("data-index",`${r}`),s.appendChild(c);let h=this.rootSelector;if(u[h])throw new Error("Ambiguous label root selector.");u[h]=c,this.labelCache[r]=c,this.labelSelectors[r]=u}return s.parentNode==null&&this.container.appendChild(s),this.updateLabels(),this.customizeLabels(),this}onLabelsChange(t={}){this.destroyCustomizeLabels(),this.shouldRerenderLabels(t)?this.renderLabels():this.updateLabels(),this.updateLabelPositions()}shouldRerenderLabels(t={}){let e=this.cell.previous("labels");if(e==null)return!0;
4791if("propertyPathArray"in t&&"propertyValue"in t){let n=t.propertyPathArray||[],s=n.length;if(s>1){let r=n[1];if(e[r]){if(s===2)return typeof t.propertyValue=="object"&&ge.has(t.propertyValue,"markup");if(n[2]!=="markup")return!1}}}return!0}parseLabelMarkup(t){return t?typeof t=="string"?this.parseLabelStringMarkup(t):this.parseJSONMarkup(t):null}parseLabelStringMarkup(t){let e=_i.createVectors(t),n=document.createDocumentFragment();for(let s=0,r=e.length;s<r;s+=1){let o=e[s].node;n.appendChild(o)}return{fragment:n,selectors:{}}}normalizeLabelMarkup(t){if(t==null)return;let e=t.fragment;if(!(e instanceof DocumentFragment)||!e.hasChildNodes())throw new Error("Invalid label markup.");let n,s=e.childNodes;return s.length>1||s[0].nodeName.toUpperCase()!=="G"?n=_i.create("g").append(e):n=_i.create(s[0]),n.addClass(this.prefixClassName("edge-label")),{node:n.node,selectors:t.selectors}}updateLabels(){if(this.labelContainer){let t=this.cell,e=t.labels,n=this.can("edgeLabelMovable"),s=t.getDefaultLabel();for(let r=0,o=e.length;r<o;r+=1){let a=this.labelCache[r],l=this.labelSelectors[r];a.setAttribute("cursor",n?"move":"default");let c=e[r],u=ge.merge({},s.attrs,c.attrs);this.updateAttrs(a,u,{selectors:l,rootBBox:c.size?Pe.fromSize(c.size):void 0})}}}renderTools(){let t=this.cell.getTools();return this.addTools(t),this}update(t={}){var e;this.cleanCache(),this.updateConnection(t);let n=this.cell.getAttrs(),{text:s}=n,r=hn(n,["text"]);if(r!=null){if(((e=this.container)===null||e===void 0?void 0:e.tagName)==="g"&&this.isEdgeElement(this.container)&&D9){let o=this.container.parentNode;if(o){let a=this.container.nextSibling;o.removeChild(this.container),o.insertBefore(this.container,a)}}this.updateAttrs(this.container,r,{selectors:this.selectors})}return this.updateLabelPositions(),this.updateTools(t),this}removeRedundantLinearVertices(t={}){let e=this.cell,n=e.getVertices(),s=[this.sourceAnchor,...n,this.targetAnchor],r=s.length,o=new Qs(s);o.simplify({threshold:.01});let a=o.points.map(c=>c.toJSON()),l=a.length;return r===l?0:(e.setVertices(a.slice(1,l-1),t),r-l)}getTerminalView(t){switch(t){case"source":return this.sourceView||null;case"target":return this.targetView||null;default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalAnchor(t){switch(t){case"source":return Mt.create(this.sourceAnchor);case"target":return Mt.create(this.targetAnchor);default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalConnectionPoint(t){switch(t){case"source":return Mt.create(this.sourcePoint);case"target":return Mt.create(this.targetPoint);default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalMagnet(t,e={}){switch(t){case"source":{if(e.raw)return this.sourceMagnet;let n=this.sourceView;return n?this.sourceMagnet||n.container:null}case"target":{if(e.raw)return this.targetMagnet;let n=this.targetView;return n?this.targetMagnet||n.container:null}default:throw new Error(`Unknown terminal type '${t}'`)}}updateConnection(t={}){let e=this.cell;if(t.translateBy&&e.isFragmentDescendantOf(t.translateBy)){let n=t.tx||0,s=t.ty||0;this.routePoints=new Qs(this.routePoints).translate(n,s).points,this.translateConnectionPoints(n,s),this.path.translate(n,s)}else{let n=e.getVertices(),s=this.findAnchors(n);this.sourceAnchor=s.source,this.targetAnchor=s.target,this.routePoints=this.findRoutePoints(n);let r=this.findConnectionPoints(this.routePoints,this.sourceAnchor,this.targetAnchor);this.sourcePoint=r.source,this.targetPoint=r.target;let o=this.findMarkerPoints(this.routePoints,this.sourcePoint,this.targetPoint);this.path=this.findPath(this.routePoints,o.source||this.sourcePoint,o.target||this.targetPoint)}this.cleanCache()}findAnchors(t){let e=this.cell,n=e.source,s=e.target,r=t[0],o=t[t.length-1];return s.priority&&!n.priority?this.findAnchorsOrdered("target",o,"source",r):this.findAnchorsOrdered("source",r,"target",o)}findAnchorsOrdered(t,e,n,s){let r,o,a=this.cell,l=a[t],c=a[n],u=this.getTerminalView(t),h=this.getTerminalView(n),d=this.getTerminalMagnet(t),p=this.getTerminalMagnet(n);if(u){let g;e?g=Mt.create(e):h?g=p:g=Mt.create(c),r=this.getAnchor(l.anchor,u,d,g,t)}else r=Mt.create(l);if(h){let g=Mt.create(s||r);o=this.getAnchor(c.anchor,h,p,g,n)}else o=Mt.isPointLike(c)?Mt.create(c):new Mt;return{[t]:r,[n]:o}}getAnchor(t,e,n,s,r){let o=e.isEdgeElement(n),a=this.graph.options.connecting,l=typeof t=="string"?{name:t}:t;if(!l){let h=o?(r==="source"?a.sourceEdgeAnchor:a.targetEdgeAnchor)||a.edgeAnchor:(r==="source"?a.sourceAnchor:a.targetAnchor)||a.anchor;l=typeof h=="string"?{name:h}:h}if(!l)throw new Error("Anchor should be specified.");let c,u=l.name;if(o){let h=up.get(u);if(typeof h!="function")return up.onNotFound(u);c=ke.call(h,this,e,n,s,l.args||{},r)}else{let h=pp.get(u);if(typeof h!="function")return pp.onNotFound(u);c=ke.call(h,this,e,n,s,l.args||{},r)}
4791return c?c.round(this.POINT_ROUNDING):new Mt}findRoutePoints(t=[]){let e=this.graph.options.connecting.router||PT.normal,n=this.cell.getRouter()||e,s;if(typeof n=="function")s=ke.call(n,this,t,{},this);else{let r=typeof n=="string"?n:n.name,o=typeof n=="string"?{}:n.args||{},a=r?Vu.get(r):PT.normal;if(typeof a!="function")return Vu.onNotFound(r);s=ke.call(a,this,t,o,this)}return s==null?t.map(r=>Mt.create(r)):s.map(r=>Mt.create(r))}findConnectionPoints(t,e,n){let s=this.cell,r=this.graph.options.connecting,o=s.getSource(),a=s.getTarget(),l=this.sourceView,c=this.targetView,u=t[0],h=t[t.length-1],d;if(l&&!l.isEdgeElement(this.sourceMagnet)){let g=this.sourceMagnet||l.container,y=u||n,x=new Qe(y,e),w=o.connectionPoint||r.sourceConnectionPoint||r.connectionPoint;d=this.getConnectionPoint(w,l,g,x,"source")}else d=e;let p;if(c&&!c.isEdgeElement(this.targetMagnet)){let g=this.targetMagnet||c.container,y=a.connectionPoint||r.targetConnectionPoint||r.connectionPoint,x=h||e,w=new Qe(x,n);p=this.getConnectionPoint(y,c,g,w,"target")}else p=n;return{source:d,target:p}}getConnectionPoint(t,e,n,s,r){let o=s.end;if(t==null)return o;let a=typeof t=="string"?t:t.name,l=typeof t=="string"?{}:t.args,c=lp.get(a);if(typeof c!="function")return lp.onNotFound(a);let u=ke.call(c,this,s,e,n,l||{},r);return u?u.round(this.POINT_ROUNDING):o}findMarkerPoints(t,e,n){let s=h=>{let d=this.cell.getAttrs(),p=Object.keys(d);for(let g=0,y=p.length;g<y;g+=1){let x=d[p[g]];if(x[`${h}Marker`]||x[`${h}-marker`]){let w=x.strokeWidth||x["stroke-width"];if(w)return parseFloat(w);break}}return null},r=t[0],o=t[t.length-1],a,l,c=s("source");c&&(a=e.clone().move(r||n,-c));let u=s("target");return u&&(l=n.clone().move(o||e,-u)),this.sourceMarkerPoint=a||e.clone(),this.targetMarkerPoint=l||n.clone(),{source:a,target:l}}findPath(t,e,n){let s=this.cell.getConnector()||this.graph.options.connecting.connector,r,o,a;if(typeof s=="string"?r=s:(r=s.name,o=s.args),r){let c=cp.get(r);if(typeof c!="function")return cp.onNotFound(r);a=c}else a=kO.normal;let l=ke.call(a,this,e,n,t,Object.assign(Object.assign({},o),{raw:!0}),this);return typeof l=="string"?Pn.parse(l):l}translateConnectionPoints(t,e){this.sourcePoint.translate(t,e),this.targetPoint.translate(t,e),this.sourceAnchor.translate(t,e),this.targetAnchor.translate(t,e),this.sourceMarkerPoint.translate(t,e),this.targetMarkerPoint.translate(t,e)}updateLabelPositions(){if(this.labelContainer==null)return this;if(!this.path)return this;let e=this.cell,n=e.getLabels();if(n.length===0)return this;let s=e.getDefaultLabel(),r=this.normalizeLabelPosition(s.position);for(let o=0,a=n.length;o<a;o+=1){let l=n[o],c=this.labelCache[o];if(!c)continue;let u=this.normalizeLabelPosition(l.position),h=ge.merge({},r,u),d=this.getLabelTransformationMatrix(h);c.setAttribute("transform",et.matrixToTransformString(d))}return this}updateTerminalProperties(t){let e=this.cell,n=this.graph,s=e[t],r=s&&s.cell,o=`${t}View`;if(!r)return this[o]=null,this.updateTerminalMagnet(t),!0;let a=n.getCellById(r);if(!a)throw new Error(`Edge's ${t} node with id "${r}" not exists`);let l=a.findView(n);return l?(this[o]=l,this.updateTerminalMagnet(t),!0):!1}updateTerminalMagnet(t){let e=`${t}Magnet`,n=this.getTerminalView(t);if(n){let s=n.getMagnetFromEdgeTerminal(this.cell[t]);s===n.container&&(s=null),this[e]=s}else this[e]=null}getLabelPositionAngle(t){let e=this.cell.getLabelAt(t);return e&&e.position&&typeof e.position=="object"&&e.position.angle||0}getLabelPositionArgs(t){let e=this.cell.getLabelAt(t);if(e&&e.position&&typeof e.position=="object")return e.position.options}getDefaultLabelPositionArgs(){let t=this.cell.getDefaultLabel();if(t&&t.position&&typeof t.position=="object")return t.position.options}mergeLabelPositionArgs(t,e){return t===null?null:t===void 0?e===null?null:e:ge.merge({},e,t)}getConnection(){return this.path!=null?this.path.clone():null}getConnectionPathData(){if(this.path==null)return"";let t=this.cache.pathCache;return ge.has(t,"data")||(t.data=this.path.serialize()),t.data||""}getConnectionSubdivisions(){if(this.path==null)return null;let t=this.cache.pathCache;return ge.has(t,"segmentSubdivisions")||(t.segmentSubdivisions=this.path.getSegmentSubdivisions()),t.segmentSubdivisions}getConnectionLength(){if(this.path==null)return 0;let t=this.cache.pathCache;return ge.has(t,"length")||(t.length=this.path.length({segmentSubdivisions:this.getConnectionSubdivisions()})),t.length}getPointAtLength(t){return this.path==null?null:this.path.pointAtLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getPointAtRatio(t){return this.path==null?null:(dn.isPercentage(t)&&(t=parseFloat(t)/100),this.path.pointAt(t,{segmentSubdivisions:this.getConnectionSubdivisions()}))}getTangentAtLength(t){return this.path==null?null:this.path.tangentAtLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getTangentAtRatio(t){return this.path==null?null:this.path.tangentAt(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPoint(t){return this.path==null?null:this.path.closestPoint(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointLength(t){return this.path==null?null:this.path.closestPointLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointRatio(t){return this.path==null?null:this.path.closestPointNormalizedLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getLabelPosition(t,e,n,s){var r;let o={distance:0},a=0,l;typeof n=="number"?(a=n,l=s):l=n,l!=null&&(o.options=l);let c=l?.absoluteOffset,u=!l?.absoluteDistance,h=l?.absoluteDistance&&l.reverseDistance,d=this.path,p={segmentSubdivisions:this.getConnectionSubdivisions()},g=new Mt(t,e),y=(r=d.closestPointT(g,p))!==null&&r!==void 0?r:0,x=this.getConnectionLength()||0,w=d.lengthAtT(y,p);u&&(w=x>0?w/x:0),h&&(w=-1*(x-w)||1),o.distance=w;let M;c||(M=d.tangentAtT(y));let A;if(M)A=M.pointOffset(g);else{let C=d.pointAtT(y);if(C){let R=g.diff(C);A={x:R.x,y:R.y}}else A={x:0,y:0}}return o.offset=A,o.angle=a,o}normalizeLabelPosition(t){return typeof t=="number"?{distance:t}:t}getLabelTransformationMatrix(t){let e=this.normalizeLabelPosition(t),n=e.options||{},s=e.angle||0,r=e.distance,o=r>0&&r<=1,a=0,l={x:0,y:0},c=e.offset;
4791c&&(typeof c=="number"?a=c:(c.x!=null&&(l.x=c.x),c.y!=null&&(l.y=c.y)));let u=l.x!==0||l.y!==0||a===0,h=n.keepGradient,d=n.ensureLegibility,p=this.path,g={segmentSubdivisions:this.getConnectionSubdivisions()},y=o?r*(this.getConnectionLength()||0):r,x=p.tangentAtLength(y,g),w,M=s;if(x){if(u)w=x.start,w.translate(l);else{let A=x.clone();A.rotate(-90,x.start),A.setLength(a),w=A.end}h&&(M=x.angle()+s,d&&(M=Ts((M+90)%180-90)))}else w=p.pointAtLength(0,g)||new Mt,u&&w.translate(l);return et.createSVGMatrix().translate(w.x,w.y).rotate(M)}getVertexIndex(t,e){let s=this.cell.getVertices(),r=this.getClosestPointLength(new Mt(t,e)),o=0;if(r!=null)for(let a=s.length;o<a;o+=1){let l=s[o],c=this.getClosestPointLength(l);if(c!=null&&r<c)break}return o}getEventArgs(t,e,n){let s=this,r=s.cell,o=r;return e==null||n==null?{e:t,view:s,edge:r,cell:o}:{e:t,x:e,y:n,view:s,edge:r,cell:o}}notifyUnhandledMouseDown(t,e,n){this.notify("edge:unhandled:mousedown",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})}notifyMouseDown(t,e,n){super.onMouseDown(t,e,n),this.notify("edge:mousedown",this.getEventArgs(t,e,n))}notifyMouseMove(t,e,n){super.onMouseMove(t,e,n),this.notify("edge:mousemove",this.getEventArgs(t,e,n))}notifyMouseUp(t,e,n){super.onMouseUp(t,e,n),this.notify("edge:mouseup",this.getEventArgs(t,e,n))}onClick(t,e,n){super.onClick(t,e,n),this.notify("edge:click",this.getEventArgs(t,e,n))}onDblClick(t,e,n){super.onDblClick(t,e,n),this.notify("edge:dblclick",this.getEventArgs(t,e,n))}onContextMenu(t,e,n){super.onContextMenu(t,e,n),this.notify("edge:contextmenu",this.getEventArgs(t,e,n))}onMouseDown(t,e,n){this.notifyMouseDown(t,e,n),this.startEdgeDragging(t,e,n)}onMouseMove(t,e,n){let s=this.getEventData(t);switch(s.action){case"drag-label":{this.dragLabel(t,e,n);break}case"drag-arrowhead":{this.dragArrowhead(t,e,n);break}case"drag-edge":{this.dragEdge(t,e,n);break}default:break}return this.notifyMouseMove(t,e,n),s}onMouseUp(t,e,n){let s=this.getEventData(t);switch(s.action){case"drag-label":{this.stopLabelDragging(t,e,n);break}case"drag-arrowhead":{this.stopArrowheadDragging(t,e,n);break}case"drag-edge":{this.stopEdgeDragging(t,e,n);break}default:break}return this.notifyMouseUp(t,e,n),this.checkMouseleave(t),s}onMouseOver(t){super.onMouseOver(t),this.notify("edge:mouseover",this.getEventArgs(t))}onMouseOut(t){super.onMouseOut(t),this.notify("edge:mouseout",this.getEventArgs(t))}onMouseEnter(t){super.onMouseEnter(t),this.notify("edge:mouseenter",this.getEventArgs(t))}onMouseLeave(t){super.onMouseLeave(t),this.notify("edge:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,s){super.onMouseWheel(t,e,n,s),this.notify("edge:mousewheel",Object.assign({delta:s},this.getEventArgs(t,e,n)))}onCustomEvent(t,e,n,s){if(et.findParentByClass(t.target,"edge-tool",this.container)){if(t.stopPropagation(),this.can("useEdgeTools")){if(e==="edge:remove"){this.cell.remove({ui:!0});return}this.notify("edge:customevent",Object.assign({name:e},this.getEventArgs(t,n,s)))}this.notifyMouseDown(t,n,s)}else this.notify("edge:customevent",Object.assign({name:e},this.getEventArgs(t,n,s))),super.onCustomEvent(t,e,n,s)}onLabelMouseDown(t,e,n){this.notifyMouseDown(t,e,n),this.startLabelDragging(t,e,n),this.getEventData(t).stopPropagation&&t.stopPropagation()}startEdgeDragging(t,e,n){if(!this.can("edgeMovable")){this.notifyUnhandledMouseDown(t,e,n);return}this.setEventData(t,{x:e,y:n,moving:!1,action:"drag-edge"})}dragEdge(t,e,n){let s=this.getEventData(t);s.moving||(s.moving=!0,this.addClass("edge-moving"),this.notify("edge:move",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})),this.cell.translate(e-s.x,n-s.y,{ui:!0}),this.setEventData(t,{x:e,y:n}),this.notify("edge:moving",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})}stopEdgeDragging(t,e,n){let s=this.getEventData(t);s.moving&&(this.removeClass("edge-moving"),this.notify("edge:moved",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})),s.moving=!1}prepareArrowheadDragging(t,e){let n=this.getTerminalMagnet(t),s={action:"drag-arrowhead",x:e.x,y:e.y,isNewEdge:e.isNewEdge===!0,terminalType:t,initialMagnet:n,initialTerminal:ge.clone(this.cell[t]),fallbackAction:e.fallbackAction||"revert",getValidateConnectionArgs:this.createValidateConnectionArgs(t),options:e.options};return this.beforeArrowheadDragging(s),s}createValidateConnectionArgs(t){let e=[void 0,void 0,void 0,void 0,t,this],n,s=0,r=0;t==="source"?(s=2,n="target"):(r=2,n="source");let o=this.cell[n],a=o.cell;if(a){let l,c=this.graph.findViewByCell(a);e[s]=c,c&&(l=c.getMagnetFromEdgeTerminal(o),l===c.container&&(l=void 0)),e[s+1]=l}return(l,c)=>(e[r]=l,e[r+1]=l.container===c?void 0:c,e)}beforeArrowheadDragging(t){t.zIndex=this.cell.zIndex,this.cell.toFront();let e=this.container.style;t.pointerEvents=e.pointerEvents,e.pointerEvents="none",this.graph.options.connecting.highlight&&this.highlightAvailableMagnets(t)}afterArrowheadDragging(t){t.zIndex!=null&&(this.cell.setZIndex(t.zIndex,{ui:!0}),t.zIndex=null);let e=this.container;e.style.pointerEvents=t.pointerEvents||"",this.graph.options.connecting.highlight&&this.unhighlightAvailableMagnets(t)}validateConnection(t,e,n,s,r,o,a){let l=this.graph.options.connecting,c=l.allowLoop,u=l.allowNode,h=l.allowEdge,d=l.allowPort,p=l.allowMulti,g=l.validateConnection,y=o?o.cell:null,x=r==="target"?n:t,w=r==="target"?s:e,M=!0,A=C=>{let R=r==="source"?a?a.port:null:y?y.getSourcePortId():null,k=r==="target"?a?a.port:null:y?y.getTargetPortId():null;return ke.call(C,this.graph,{edge:y,edgeView:o,sourceView:t,targetView:n,sourcePort:R,targetPort:k,sourceMagnet:e,targetMagnet:s,sourceCell:t?t.cell:null,targetCell:n?n.cell:null,type:r})};if(c!=null&&t!=null&&t===n&&(typeof c=="boolean"?c||(M=!1):M=A(c)),M&&d!=null&&(typeof d=="boolean"?!d&&w&&(M=!1):M=A(d)),M&&h!=null&&(typeof h=="boolean"?!h&&i.isEdgeView(x)&&(M=!1):M=A(h)),M&&u!=null&&w==null&&(typeof u=="boolean"?!u&&Ba.isNodeView(x)&&(M=!1):M=A(u)),M&&p!=null&&o){let C=o.cell,R=r==="source"?a:C.getSource(),k=r==="target"?a:C.getTarget(),O=a?this.graph.getCellById(a.cell):null;if(R&&k&&R.cell&&k.cell&&O)if(typeof p=="function")M=A(p);else{let I=this.graph.model.getConnectedEdges(O,{outgoing:r==="source",incoming:r==="target"});I.length&&(p==="withPort"?I.some(V=>{let q=V.getSource(),X=V.getTarget();return q&&X&&q.cell===R.cell&&X.cell===k.cell&&q.port!=null&&q.port===R.port&&X.port!=null&&X.port===k.port})&&(M=!1):p||I.some(V=>{let q=V.getSource(),X=V.getTarget();return q&&X&&q.cell===R.cell&&X.cell===k.cell})&&(M=!1))}}return M&&g!=null&&(M=A(g)),M}allowConnectToBlank(t){let e=this.graph,s=e.options.connecting.allowBlank;if(typeof s!="function")return!!s;let r=e.findViewByCell(t),o=t.getSourceCell(),a=t.getTargetCell(),l=e.findViewByCell(o),c=e.findViewByCell(a);return ke.call(s,e,{edge:t,edgeView:r,sourceCell:o,targetCell:a,sourceView:l,targetView:c,sourcePort:t.getSourcePortId(),targetPort:t.getTargetPortId(),sourceMagnet:r.sourceMagnet,targetMagnet:r.targetMagnet})}validateEdge(t,e,n){let s=this.graph;if(!this.allowConnectToBlank(t)){let o=t.getSourceCellId(),a=t.getTargetCellId();if(!(o&&a))return!1}let r=s.options.connecting.validateEdge;return r?ke.call(r,s,{edge:t,type:e,previous:n}):!0}arrowheadDragging(t,e,n,s){s.x=e,s.y=n,s.currentTarget!==t&&(s.currentMagnet&&s.currentView&&s.currentView.unhighlight(s.currentMagnet,{type:"magnetAdsorbed"}),s.currentView=this.graph.findViewByElem(t),s.currentView?(s.currentMagnet=s.currentView.findMagnet(t),s.currentMagnet&&this.validateConnection(...s.getValidateConnectionArgs(s.currentView,s.currentMagnet),s.currentView.getEdgeTerminal(s.currentMagnet,e,n,this.cell,s.terminalType))?s.currentView.highlight(s.currentMagnet,{type:"magnetAdsorbed"}):s.currentMagnet=null):s.currentMagnet=null),s.currentTarget=t,this.cell.prop(s.terminalType,{x:e,y:n},Object.assign(Object.assign({},s.options),{ui:!0}))}arrowheadDragged(t,e,n){let s=t.currentView,r=t.currentMagnet;if(!r||!s)return;s.unhighlight(r,{type:"magnetAdsorbed"});let o=t.terminalType,a=s.getEdgeTerminal(r,e,n,this.cell,o);this.cell.setTerminal(o,a,{ui:!0})}snapArrowhead(t,e,n){let s=this.graph,{snap:r,allowEdge:o}=s.options.connecting,a=typeof r=="object"&&r.radius||50,l=typeof r=="object"&&r.anchor||"center",c=s.renderer.f
4791indViewsInArea({x:t-a,y:e-a,width:2*a,height:2*a},{nodeOnly:!0});if(o){let A=s.renderer.findEdgeViewsFromPoint({x:t,y:e},a).filter(C=>C!==this);c.push(...A)}let u=n.closestView||null,h=n.closestMagnet||null;n.closestView=null,n.closestMagnet=null;let d,p=Number.MAX_SAFE_INTEGER,g=new Mt(t,e);c.forEach(A=>{if(A.container.getAttribute("magnet")!=="false"){if(A.isNodeView())d=l==="center"?A.cell.getBBox().getCenter().distance(g):A.cell.getBBox().getNearestPointToPoint(g).distance(g);else if(A.isEdgeView()){let C=A.getClosestPoint(g);C?d=C.distance(g):d=Number.MAX_SAFE_INTEGER}d<a&&d<p&&(h===A.container||this.validateConnection(...n.getValidateConnectionArgs(A,null),A.getEdgeTerminal(A.container,t,e,this.cell,n.terminalType)))&&(p=d,n.closestView=A,n.closestMagnet=A.container)}A.container.querySelectorAll("[magnet]").forEach(C=>{if(C.getAttribute("magnet")!=="false"){let R=A.getBBoxOfElement(C);d=l==="center"?g.distance(R.getCenter()):g.distance(R.getNearestPointToPoint(g)),d<a&&d<p&&(h===C||this.validateConnection(...n.getValidateConnectionArgs(A,C),A.getEdgeTerminal(C,t,e,this.cell,n.terminalType)))&&(p=d,n.closestView=A,n.closestMagnet=C)}})});let y=n.terminalType,x=n.closestView,w=n.closestMagnet,M=h!==w;if(u&&M&&u.unhighlight(h,{type:"magnetAdsorbed"}),x){if(!M)return;x.highlight(w,{type:"magnetAdsorbed"}),this.cell.setTerminal(y,x.getEdgeTerminal(w,t,e,this.cell,y),{},Object.assign(Object.assign({},n.options),{ui:!0}))}else this.cell.setTerminal(y,{x:t,y:e},{},Object.assign(Object.assign({},n.options),{ui:!0}))}snapArrowheadEnd(t){let e=t.closestView,n=t.closestMagnet;e&&n&&(e.unhighlight(n,{type:"magnetAdsorbed"}),t.currentMagnet=e.findMagnet(n)),t.closestView=null,t.closestMagnet=null}finishEmbedding(t){this.graph.options.embedding.enabled&&this.cell.updateParent()&&(t.zIndex=null)}fallbackConnection(t){t.fallbackAction==="remove"?this.cell.remove({ui:!0}):this.cell.prop(t.terminalType,t.initialTerminal,{ui:!0})}notifyConnectionEvent(t,e){let n=t.terminalType,s=t.initialTerminal,r=this.cell[n];if(r&&!ns.equalTerminals(s,r)){let a=this.graph,l=s,c=l.cell?a.getCellById(l.cell):null,u=l.port,h=c?a.findViewByCell(c):null,d=c||t.isNewEdge?null:Mt.create(s).toJSON(),p=r,g=p.cell?a.getCellById(p.cell):null,y=p.port,x=g?a.findViewByCell(g):null,w=g?null:Mt.create(r).toJSON();this.notify("edge:connected",{e,previousCell:c,previousPort:u,previousView:h,previousPoint:d,currentCell:g,currentView:x,currentPort:y,currentPoint:w,previousMagnet:t.initialMagnet,currentMagnet:t.currentMagnet,edge:this.cell,view:this,type:n,isNew:t.isNewEdge})}}highlightAvailableMagnets(t){let e=this.graph,n=e.model.getCells();t.marked={};for(let s=0,r=n.length;s<r;s+=1){let o=e.findViewByCell(n[s]);if(!o||o.cell.id===this.cell.id)continue;let a=Array.prototype.slice.call(o.container.querySelectorAll("[magnet]"));o.container.getAttribute("magnet")!=="false"&&a.push(o.container);let l=a.filter(c=>this.validateConnection(...t.getValidateConnectionArgs(o,c),o.getEdgeTerminal(c,t.x,t.y,this.cell,t.terminalType)));if(l.length>0){for(let c=0,u=l.length;c<u;c+=1)o.highlight(l[c],{type:"magnetAvailable"});o.highlight(null,{type:"nodeAvailable"}),t.marked[o.cell.id]=l}}}unhighlightAvailableMagnets(t){let e=t.marked||{};Object.keys(e).forEach(n=>{let s=this.graph.findViewByCell(n);s&&(e[n].forEach(o=>{s.unhighlight(o,{type:"magnetAvailable"})}),s.unhighlight(null,{type:"nodeAvailable"}))}),t.marked=null}startArrowheadDragging(t,e,n){if(!this.can("arrowheadMovable")){this.notifyUnhandledMouseDown(t,e,n);return}let r=t.target.getAttribute("data-terminal"),o=this.prepareArrowheadDragging(r,{x:e,y:n});this.setEventData(t,o)}dragArrowhead(t,e,n){let s=this.getEventData(t);this.graph.options.connecting.snap?this.snapArrowhead(e,n,s):this.arrowheadDragging(this.getEventTarget(t),e,n,s)}stopArrowheadDragging(t,e,n){let s=this.graph,r=this.getEventData(t);s.options.connecting.snap?this.snapArrowheadEnd(r):this.arrowheadDragged(r,e,n),this.validateEdge(this.cell,r.terminalType,r.initialTerminal)?(this.finishEmbedding(r),this.notifyConnectionEvent(r,t)):this.fallbackConnection(r),this.afterArrowheadDragging(r)}startLabelDragging(t,e,n){if(this.can("edgeLabelMovable")){let s=t.currentTarget,r=parseInt(s.getAttribute("data-index"),10),o=this.getLabelPositionAngle(r),a=this.getLabelPositionArgs(r),l=this.getDefaultLabelPositionArgs(),c=this.mergeLabelPositionArgs(a,l);this.setEventData(t,{index:r,positionAngle:o,positionArgs:c,stopPropagation:!0,action:"drag-label"})}else this.setEventData(t,{stopPropagation:!0});this.graph.view.delegateDragEvents(t,this)}dragLabel(t,e,n){let s=this.getEventData(t),r=this.cell.getLabelAt(s.index),o=ge.merge({},r,{position:this.getLabelPosition(e,n,s.positionAngle,s.positionArgs)});this.cell.setLabelAt(s.index,o)}stopLabelDragging(t,e,n){}},uY=`X6.${Ad.name}`;Ad.config({isSvgElement:!0,priority:1,bootstrap:["render","source","target"],actions:{view:["render"],markup:["render"],attrs:["update"],source:["source","update"],target:["target","update"],router:["update"],connector:["update"],labels:["labels"],defaultLabel:["labels"],tools:["tools"],vertices:["vertices","update"]}});Ad.registry.register("edge",Ad,!0);var M0={idle:"idle",raf:"raf",timeout:"timeout"},jT=class{constructor(){this.isFlushing=!1,this.isFlushPending=!1,this.scheduleId=0,this.queue=[],this.frameInterval=16,this.initialTime=Date.now(),this.pendingJobs=new Map,this.scheduleMode=null}queueJob(t){if(t.priority&Kc.PRIOR)t.cb();else{let e=this.pendingJobs.get(t.id);if(e){if(e.cb=t.cb,t.priority!==e.priority){e.priority=t.priority;let n=this.queue.indexOf(e);if(n>=0){this.queue.splice(n,1);let s=this.findInsertionIndex(e);this.queue.splice(s,0,e)}}}else{let n=this.findInsertionIndex(t);this.queue.splice(n,0,t),this.pendingJobs.set(t.id,t)}}}queueFlush(){!this.isFlushing&&!this.isFlushPending&&(this.isFlushPending=!0,this.scheduleJob())}queueFlushSync(){!this.isFlushing&&!this.isFlushPending&&(this.isFlushPending=!0,this.flushJobsSync())}clearJobs(){this.queue.length=0,this.pendingJobs.clear(),this.isFlushing=!1,this.isFlushPending=!1,this.cancelScheduleJob()}flushJobs(t){this.isFlushPending=!1,this.isFlushing=!0;let e=this.getCurrentTime(),n=this.frameInterval;if(t&&typeof t.timeRemaining=="function"){let s=t.timeRemaining();n=Math.max(0,Math.min(n,s))}for(;this.queue.length>0;){let s=this.queue.shift();if(s.cb(),this.pendingJobs.delete(s.id),this.getCurrentTime()-e>=n)break}this.isFlushing=!1,this.queue.length&&this.queueFlush()}flushJobsSync(){for(this.isFlushPending=!1,this.isFlushing=!0;this.queue.length>0;){let t=this.queue.shift();try{t.cb()}catch(e){console.error(e)}this.pendingJobs.delete(t.id)}this.isFlushing=!1}findInsertionIndex(t){let e=0,n=this.queue.length,s=n-1,r=t.priority;for(;e<=s;){let o=(s-e>>1)+e;r<=this.queue[o].priority?e=o+1:(n=o,s=o-1)}return n}scheduleJob(){this.scheduleId&&this.cancelScheduleJob(),"requestAnimationFrame"in window?(this.scheduleMode=M0.raf,this.scheduleId=window.requestAnimationFrame(()=>this.flushJobs())):"requestIdleCallback"in window?(this.scheduleMode=M0.idle,this.scheduleId=window.requestIdleCallback(t=>this.flushJobs(t),{timeout:100})):(this.scheduleMode=M0.timeout,this.scheduleId=window.setTimeout(()=>this.flushJobs()))}cancelScheduleJob(){if(!this.scheduleId)return;let t={[M0.idle]:window?.cancelIdleCallback,[M0.raf]:window?.cancelAnimationFrame,[M0.timeout]:window?.clearTimeout},e=this.scheduleMode,n=e?t[e]:void 0;typeof n=="function"&&n(this.scheduleId),this.scheduleId=0,this.scheduleMode=null}getCurrentTime(){return typeof performance=="object"&&typeof performance.now=="function"?performance.now():Date.now()-this.initialTime}},Kc;(function(i){i[i.Update=2]="Update",i[i.RenderEdge=4]="RenderEdge",i[i.RenderNode=8]="RenderNode",i[i.PRIOR=1048576]="PRIOR"})(Kc||(Kc={}));var Jc;(function(i){i[i.CREATED=0]="CREATED",i[i.MOUNTED=1]="MOUNTED",i[i.WAITING=2]="WAITING"})(Jc||(Jc={}));var Cx=class extends Uo{get model(){return this.graph.model}get container(){return this.graph.view.stage}constructor(t){super(),this.views={},this.willRemoveViews={},this.queue=new jT,this.graph=t,this.init()}init(){this.startListening(),this.renderViews(this.model.getCells())}startListening(){this.model.on("reseted",this.onModelReseted,this),this.model.on("cell:added",this.onCellAdded,this),this.model.on("cell:removed",this.onCellRemoved,this),this.model.on("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.on("cell:change:visible",this.onCellVisibleChanged,this)}stopListening(){this.model.off("reseted",this.onModelReseted,this),this.model.off("cell:added",this.onCellAdded,this),this.model.off("cell:removed",this.onCellRemoved,this),this.model.off("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.off("cell:change:visible",this.onCellVisibleChanged,this)}onModelReseted({options:t,previous:e}){let n=this.model.getCells();if(!t?.diff)this.queue.clearJobs(),this.removeZPivots(),this.resetViews();else{let s=new Set(e);n=n.filter(r=>!s.has(r))}this.renderViews(n,Object.assign(Object.assign({},t),{queue:n.map(s=>s.id)}))}onCellAdded({cell:t,options:e}){this.renderViews([t],e)}onCellRemoved({cell:t}){this.removeViews([t])}onCellZIndexChanged({cell:t,options:e}){let n=this.views[t.id];n&&this.requestViewUpdate(n.view,Td,e,Kc.Update,!0)}onCellVisibleChanged({cell:t,current:e}){this.toggleVisible(t,!!e)}requestViewUpdate(t,e,n={},s=Kc.Update,r=!0){let o=t.cell.id,a=this.views[o];if(!a)return;let l=a.flag|e;a.flag=l;let c=a.options||{},u=n||{};c.queue&&u.queue==null&&(u.queue=c.queue),(c.async===!1||u.async===!1)&&(u.async=!1),a.options=u,(t.hasAction(e,["translate","resize","rotate"])||u.async===!1)&&(s=Kc.PRIOR,r=!1),this.queue.queueJob({id:o,priority:s,cb:()=>{let p=this.views[o];if(!p)return;let g=p.options||{};this.renderViewInArea(p.view,p.flag,g);let y=g.queue;if(y){let x=y.indexOf(p.view.cell.id);x>
4791=0&&y.splice(x,1),y.length===0&&this.graph.trigger("render:done")}}}),this.getEffectedEdges(t).forEach(p=>{this.requestViewUpdate(p.view,p.flag,n,s,!1)}),r&&this.flush()}setRenderArea(t){this.renderArea=t,Object.values(this.views).forEach(e=>{if(!e)return;let{view:n}=e;e.state===Jc.MOUNTED&&(this.isUpdatable(n)||(n.remove(),this.graph.trigger("view:unmounted",{view:n}),e.state=Jc.WAITING,e.flag|=Td|n.getBootstrapFlag()))}),this.flushWaitingViews()}isViewMounted(t){if(t==null)return!1;let e=this.views[t.cell.id];return e?e.state===Jc.MOUNTED:!1}renderViews(t,e={}){t.sort((n,s)=>n.isNode()&&s.isEdge()?-1:0),t.forEach(n=>{let s=n.id,r=this.views,o=0,a=r[s];if(a)o=Td;else{let l=this.createCellView(n);l&&(l.graph=this.graph,o=Td|l.getBootstrapFlag(),a={view:l,flag:o,options:e,state:Jc.CREATED},this.views[s]=a)}a&&this.requestViewUpdate(a.view,o,e,this.getRenderPriority(a.view),!1)}),this.flush()}renderViewInArea(t,e,n={}){let s=t.cell,r=s.id,o=this.views[r];if(!o)return;let a=0;this.isUpdatable(t)?(a=this.updateView(t,e,n),o.flag=a):(o.state===Jc.MOUNTED&&(t.remove(),this.graph.trigger("view:unmounted",{view:t}),a=0),o.state=Jc.WAITING,o.flag=e|Td|t.getBootstrapFlag()),a&&s.isEdge()&&(a&t.getFlag(["source","target"]))===0&&this.queue.queueJob({id:r,priority:Kc.RenderEdge,cb:()=>{this.updateView(t,e,n)}})}removeViews(t){t.forEach(e=>{let n=e.id,s=this.views[n];s&&(this.willRemoveViews[n]=s,delete this.views[n],this.queue.queueJob({id:n,priority:this.getRenderPriority(s.view),cb:()=>{this.removeView(s.view)}}))}),this.flush()}flush(){this.graph.options.async?this.queue.queueFlush():this.queue.queueFlushSync()}flushWaitingViews(){Object.values(this.views).forEach(t=>{if(t&&t.state===Jc.WAITING){let{view:e,flag:n,options:s}=t;this.requestViewUpdate(e,n,s,this.getRenderPriority(e),!1)}}),this.flush()}updateView(t,e,n={}){if(t==null)return 0;if(Sr.isCellView(t)){if(e&lY)return this.removeView(t),0;e&Td&&(this.insertView(t),e^=Td)}return e?t.confirmUpdate(e,n):0}insertView(t){let e=this.views[t.cell.id];if(e){let n=t.cell.getZIndex(),s=this.addZPivot(n);this.container.insertBefore(t.container,s),t.cell.isVisible()||this.toggleVisible(t.cell,!1),e.state=Jc.MOUNTED,this.graph.trigger("view:mounted",{view:t})}}resetViews(){this.willRemoveViews=Object.assign(Object.assign({},this.views),this.willRemoveViews),Object.values(this.willRemoveViews).forEach(t=>{t&&this.removeView(t.view)}),this.views={},this.willRemoveViews={}}removeView(t){let e=t.cell,n=this.willRemoveViews[e.id];n&&t&&(n.view.remove(),delete this.willRemoveViews[e.id],this.graph.trigger("view:unmounted",{view:t}))}toggleVisible(t,e){let n=this.model.getConnectedEdges(t);for(let r=0,o=n.length;r<o;r+=1){let a=n[r];if(e){let l=a.getSourceCell(),c=a.getTargetCell();if(l&&!l.isVisible()||c&&!c.isVisible())continue;this.toggleVisible(a,!0)}else this.toggleVisible(a,!1)}let s=this.views[t.id];s&&et.css(s.view.container,{display:e?"unset":"none"})}addZPivot(t=0){this.zPivots==null&&(this.zPivots={});let e=this.zPivots,n=e[t];if(n)return n;n=e[t]=document.createComment(`z-index:${t+1}`);let s=-1/0;for(let o in e){let a=+o;a<t&&a>s&&(s=a,t-1)}let r=this.container;if(s!==-1/0){let o=e[s];r.insertBefore(n,o.nextSibling)}else r.insertBefore(n,r.firstChild);return n}removeZPivots(){this.zPivots&&Object.values(this.zPivots).forEach(t=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),this.zPivots={}}createCellView(t){let e={graph:this.graph},n=this.graph.options.createCellView;if(n){let r=ke.call(n,this.graph,t);if(r)return new r(t,e);if(r===null)return null}let s=t.view;if(s!=null&&typeof s=="string"){let r=Sr.registry.get(s);return r?new r(t,e):Sr.registry.onNotFound(s)}return t.isNode()?new Ba(t,e):t.isEdge()?new Ad(t,e):null}getEffectedEdges(t){let e=[],n=t.cell,s=this.model.getConnectedEdges(n);for(let r=0,o=s.length;r<o;r+=1){let a=s[r],l=this.views[a.id];if(!l)continue;let c=l.view;if(!this.isViewMounted(c))continue;let u=["update"];a.getTargetCell()===n&&u.push("target"),a.getSourceCell()===n&&u.push("source"),e.push({id:a.id,view:c,flag:c.getFlag(u)})}return e}isUpdatable(t){if(t.isNodeView())return this.renderArea?this.renderArea.isIntersectWithRect(t.cell.getBBox()):!0;if(t.isEdgeView()){let e=t.cell,n=this.renderArea?this.renderArea.isIntersectWithRect(e.getBBox()):!0;
4791if(this.graph.virtualRender.isVirtualEnabled())return n;let s=e.getSourceCell(),r=e.getTargetCell();if(this.renderArea&&s&&r)return this.renderArea.isIntersectWithRect(s.getBBox())||this.renderArea.isIntersectWithRect(r.getBBox())}return!0}getRenderPriority(t){return t.cell.isNode()?Kc.RenderNode:Kc.RenderEdge}dispose(){this.stopListening(),Object.keys(this.views).forEach(t=>{this.views[t].view.dispose()}),this.views={}}};rn([ln()],Cx.prototype,"dispose",null);var Mx=class extends hs{constructor(){super(...arguments),this.schedule=new Cx(this.graph)}requestViewUpdate(t,e,n={}){this.schedule.requestViewUpdate(t,e,n)}isViewMounted(t){return this.schedule.isViewMounted(t)}setRenderArea(t){this.schedule.setRenderArea(t)}findViewByElem(t){if(t==null)return null;let e=this.options.container,n=typeof t=="string"?e.querySelector(t):t instanceof Element?t:t[0];if(n){let s=this.graph.view.findAttr("data-cell-id",n);if(s){let r=this.schedule.views;if(r[s])return r[s].view}}return null}findViewByCell(t){if(t==null)return null;let e=vi.isCell(t)?t.id:t,n=this.schedule.views;return n[e]?n[e].view:null}findViewsFromPoint(t){let e={x:t.x,y:t.y};return this.model.getCells().map(n=>this.findViewByCell(n)).filter(n=>n!=null?ei.getBBox(n.container,{target:this.view.stage}).containsPoint(e):!1)}findEdgeViewsFromPoint(t,e=5){return this.model.getEdges().map(n=>this.findViewByCell(n)).filter(n=>{if(n!=null){let s=n.getClosestPoint(t);if(s)return s.distance(t)<=e}return!1})}findViewsInArea(t,e={}){let n=Pe.create(t);return this.model.getCells().map(s=>this.findViewByCell(s)).filter(s=>{if(s){if(e.nodeOnly&&!s.isNodeView())return!1;let r=ei.getBBox(s.container,{target:this.view.stage});return r.width===0?r.inflate(1,0):r.height===0&&r.inflate(0,1),e.strict?n.containsRect(r):n.isIntersectWithRect(r)}return!1})}dispose(){this.schedule.dispose()}};rn([ln()],Mx.prototype,"dispose",null);Sn();var _p=class extends hs{get elem(){return this.view.background}init(){this.startListening(),this.options.background&&this.draw(this.options.background)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}
4791updateBackgroundImage(t={}){let e=t.size||"auto auto",n=t.position||"center",s=this.graph.transform.getScale(),r=this.graph.translate();if(typeof n=="object"){let o=r.tx+s.sx*(n.x||0),a=r.ty+s.sy*(n.y||0);n=`${o}px ${a}px`}typeof e=="object"&&(e=Pe.fromSize(e).scale(s.sx,s.sy),e=`${e.width}px ${e.height}px`),this.elem.style.backgroundSize=e,this.elem.style.backgroundPosition=n}drawBackgroundImage(t,e={}){if(!(t instanceof HTMLImageElement)){this.elem.style.backgroundImage="";return}let n=this.optionsCache;if(n&&n.image!==e.image)return;let s,r=e.opacity,o=e.size,a=e.repeat||"no-repeat",l=f0.get(a);if(typeof l=="function"){let u=e.quality||1;t.width*=u,t.height*=u;let h=l(t,e);if(!(h instanceof HTMLCanvasElement))throw new Error("Background pattern must return an HTML Canvas instance");s=h.toDataURL("image/png"),e.repeat&&a!==e.repeat?a=e.repeat:a="repeat",typeof o=="object"?(o.width*=h.width/t.width,o.height*=h.height/t.height):o===void 0&&(e.size={width:h.width/u,height:h.height/u})}else s=t.src,o===void 0&&(e.size={width:t.width,height:t.height});n!=null&&typeof e.size=="object"&&e.image===n.image&&e.repeat===n.repeat&&e.quality===n.quality&&(n.size=ge.clone(e.size));let c=this.elem.style;c.backgroundImage=`url(${s})`,c.backgroundRepeat=a,c.opacity=r==null||r>=1?"":`${r}
4791`,this.updateBackgroundImage(e)}updateBackgroundColor(t){this.elem.style.backgroundColor=t||""}updateBackgroundOptions(t){this.graph.options.background=t}update(){this.optionsCache&&this.updateBackgroundImage(this.optionsCache)}draw(t){let e=t||{};if(this.updateBackgroundOptions(t),this.updateBackgroundColor(e.color),e.image){this.optionsCache=ge.clone(e);let n=document.createElement("img");n.onload=()=>this.drawBackgroundImage(n,t),n.setAttribute("crossorigin","anonymous"),n.src=e.image}else this.drawBackgroundImage(null),this.optionsCache=null}clear(){this.draw()}dispose(){this.clear(),this.stopListening()}};rn([ln()],_p.prototype,"dispose",null);var WT=class extends hs{getClientMatrix(){return et.createSVGMatrix(this.view.stage.getScreenCTM())}getClientOffset(){let t=this.view.svg.getBoundingClientRect();return new Mt(t.left,t.top)}getPageOffset(){return this.getClientOffset().translate(window.scrollX,window.scrollY)}snapToGrid(t,e){return(typeof t=="number"?this.clientToLocalPoint(t,e):this.clientToLocalPoint(t.x,t.y)).snapToGrid(this.graph.getGridSize())}localToGraphPoint(t,e){let n=Mt.create(t,e);return ei.transformPoint(n,this.graph.matrix())}localToClientPoint(t,e){let n=Mt.create(t,e);return ei.transformPoint(n,this.getClientMatrix())}localToPagePoint(t,e){return(typeof t=="number"?this.localToGraphPoint(t,e):this.localToGraphPoint(t)).translate(this.getPageOffset())}localToGraphRect(t,e,n,s){let r=Pe.create(t,e,n,s);return ei.transformRectangle(r,this.graph.matrix())}localToClientRect(t,e,n,s){let r=Pe.create(t,e,n,s);return ei.transformRectangle(r,this.getClientMatrix())}localToPageRect(t,e,n,s){return(typeof t=="number"?this.localToGraphRect(t,e,n,s):this.localToGraphRect(t)).translate(this.getPageOffset())}graphToLocalPoint(t,e){let n=Mt.create(t,e);return ei.transformPoint(n,this.graph.matrix().inverse())}clientToLocalPoint(t,e){let n=Mt.create(t,e);return ei.transformPoint(n,this.getClientMatrix().inverse())}clientToGraphPoint(t,e){let n=Mt.create(t,e);return ei.transformPoint(n,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalPoint(t,e){let s=Mt.create(t,e).diff(this.getPageOffset());return this.graphToLocalPoint(s)}graphToLocalRect(t,e,n,s){let r=Pe.create(t,e,n,s);return ei.transformRectangle(r,this.graph.matrix().inverse())}clientToLocalRect(t,e,n,s){let r=Pe.create(t,e,n,s);return ei.transformRectangle(r,this.getClientMatrix().inverse())}clientToGraphRect(t,e,n,s){let r=Pe.create(t,e,n,s);return ei.transformRectangle(r,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalRect(t,e,n,s){let r=Pe.create(t,e,n,s),o=this.getPageOffset();return r.x-=o.x,r.y-=o.y,this.graphToLocalRect(r)}};Sn();var hY=`.x6-graph {
4792  position: relative;
4793  overflow: hidden;
4794  outline: none;
4795  touch-action: none;
4796}
4797.x6-graph-background,
4798.x6-graph-grid,
4799.x6-graph-svg {
4800  position: absolute;
4801  top: 0;
4802  right: 0;
4803  bottom: 0;
4804  left: 0;
4805}
4806.x6-graph-background-stage,
4807.x6-graph-grid-stage,
4808.x6-graph-svg-stage {
4809  user-select: none;
4810}
4811.x6-graph.x6-graph-pannable {
4812  cursor: grab;
4813  cursor: -moz-grab;
4814  cursor: -webkit-grab;
4815}
4816.x6-graph.x6-graph-panning {
4817  cursor: grabbing;
4818  cursor: -moz-grabbing;
4819  cursor: -webkit-grabbing;
4820  user-select: none;
4821}
4822.x6-node {
4823  cursor: move;
4824  /* stylelint-disable-next-line */
4825}
4826.x6-node.x6-node-immovable {
4827  cursor: default;
4828}
4829.x6-node * {
4830  -webkit-user-drag: none;
4831}
4832.x6-node .scalable * {
4833  vector-effect: non-scaling-stroke;
4834}
4835.x6-node [magnet='true'] {
4836  cursor: crosshair;
4837  transition: opacity 0.3s;
4838}
4839.x6-node [magnet='true']:hover {
4840  opacity: 0.7;
4841}
4842.x6-node foreignObject {
4843  display: block;
4844  overflow: visible;
4845  background-color: transparent;
4846}
4847.x6-node foreignObject > body {
4848  position: static;
4849  width: 100%;
4850  height: 100%;
4851  margin: 0;
4852  padding: 0;
4853  overflow: visible;
4854  background-color: transparent;
4855}
4856.x6-edge .source-marker,
4857.x6-edge .target-marker {
4858  vector-effect: non-scaling-stroke;
4859}
4860.x6-edge .connection {
4861  stroke-linejoin: round;
4862  fill: none;
4863}
4864.x6-edge .connection-wrap {
4865  cursor: move;
4866  opacity: 0;
4867  fill: none;
4868  stroke: #000;
4869  stroke-width: 15;
4870  stroke-linecap: round;
4871  stroke-linejoin: round;
4872}
4873.x6-edge .connection-wrap:hover {
4874  opacity: 0.4;
4875  stroke-opacity: 0.4;
4876}
4877.x6-edge .vertices {
4878  cursor: move;
4879  opacity: 0;
4880}
4881.x6-edge .vertices .vertex {
4882  fill: #1abc9c;
4883}
4884.x6-edge .vertices .vertex :hover {
4885  fill: #34495e;
4886  stroke: none;
4887}
4888.x6-edge .vertices .vertex-remove {
4889  cursor: pointer;
4890  fill: #fff;
4891}
4892.x6-edge .vertices .vertex-remove-area {
4893  cursor: pointer;
4894  opacity: 0.1;
4895}
4896.x6-edge .vertices .vertex-group:hover .vertex-remove-area {
4897  opacity: 1;
4898}
4899.x6-edge .arrowheads {
4900  cursor: move;
4901  opacity: 0;
4902}
4903.x6-edge .arrowheads .arrowhead {
4904  fill: #1abc9c;
4905}
4906.x6-edge .arrowheads .arrowhead :hover {
4907  fill: #f39c12;
4908  stroke: none;
4909}
4910.x6-edge .tools {
4911  cursor: pointer;
4912  opacity: 0;
4913}
4914.x6-edge .tools .tool-options {
4915  display: none;
4916}
4917.x6-edge .tools .tool-remove circle {
4918  fill: #f00;
4919}
4920.x6-edge .tools .tool-remove path {
4921  fill: #fff;
4922}
4923.x6-edge:hover .vertices,
4924.x6-edge:hover .arrowheads,
4925.x6-edge:hover .tools {
4926  opacity: 1;
4927}
4928.x6-highlight-opacity {
4929  opacity: 0.3;
4930}
4931.x6-cell-tool-editor {
4932  position: relative;
4933  display: inline-block;
4934  min-height: 1em;
4935  margin: 0;
4936  padding: 0;
4937  line-height: 1;
4938  white-space: normal;
4939  text-align: center;
4940  vertical-align: top;
4941  overflow-wrap: normal;
4942  outline: none;
4943  transform-origin: 0 0;
4944  -webkit-user-drag: none;
4945  cursor: text;
4946}
4947.x6-edge-tool-editor {
4948  border: 1px solid #275fc5;
4949  border-radius: 2px;
4950}
4951`;var Tx=class extends hs{init(){In.autoInsertCSS&&us.ensure("core",hY)}dispose(){us.clean("core")}};rn([ln()],Tx.prototype,"dispose",null);Sn();var $T=class extends hs{get cid(){return this.graph.view.cid}get svg(){return this.view.svg}get defs(){return this.view.defs}isDefined(t){return this.svg.getElementById(t)!=null}filter(t){let e=t.id,n=t.name;if(e||(e=`filter-${n}-${this.cid}-${Li.hashcode(JSON.stringify(t))}`),!this.isDefined(e)){let s=hp.get(n);if(s==null)return hp.onNotFound(n);let r=s(t.args||{}),o=Object.assign(Object.assign({x:-1,y:-1,width:3,height:3,filterUnits:"objectBoundingBox"},t.attrs),{id:e});_i.create(As.sanitize(r),o).appendTo(this.defs)}return e}gradient(t){let e=t.id,n=t.type;if(e||(e=`gradient-${n}-${this.cid}-${Li.hashcode(JSON.stringify(t))}`),!this.isDefined(e)){let r=t.stops.map(l=>{let c=l.opacity!=null&&Number.isFinite(l.opacity)?l.opacity:1;return`<stop offset="${l.offset}" stop-color="${l.color}" stop-opacity="${c}"/>`}),o=`<${n}>${r.join("")}</${n}>`,a=Object.assign({id:e},t.attrs);_i.create(o,a).appendTo(this.defs)}return e}marker(t){let{id:e,refX:n,refY:s,markerUnits:r,markerOrient:o,tagName:a,children:l}=t,c=hn(t,["id","refX","refY","markerUnits","markerOrient","tagName","children"]),u=e;if(u||(u=`marker-${this.cid}-${Li.hashcode(JSON.stringify(t))}`),!this.isDefined(u)){a!=="path"&&delete c.d;let h=_i.create("marker",{refX:n,refY:s,id:u,overflow:"visible",orient:o??"auto",markerUnits:r||"userSpaceOnUse"},l?l.map(d=>{var{tagName:p}=d,g=hn(d,["tagName"]);return _i.create(`${p}`||"path",et.kebablizeAttrs(Object.assign(Object.assign({},c),g)))}):[_i.create(a||"path",et.kebablizeAttrs(c))]);this.defs.appendChild(h.node)}return u}remove(t){let e=this.svg.getElementById(t);e&&e.parentNode&&e.parentNode.removeChild(e)}};Sn();var Ax=class extends hs{get elem(){return this.view.grid}get grid(){return this.options.grid}init(){this.startListening(),this.draw(this.grid)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}setVisible(t){this.grid.visible!==t&&(this.grid.visible=t,this.update())}getGridSize(){return this.grid.size}setGridSize(t){this.grid.size=Math.max(t,1),this.update()}show(){this.setVisible(!0),this.update()}hide(){this.setVisible(!1),this.update()}clear(){this.elem.style.backgroundImage=""}draw(t){this.clear(),this.instance=null,Object.assign(this.grid,t),this.patterns=this.resolveGrid(t),this.update()}update(t={}){let e=this.grid.size;if(e<=1||!this.grid.visible)return this.clear();let n=this.graph.matrix(),s=this.getInstance(),r=Array.isArray(t)?t:[t];this.patterns.forEach((l,c)=>{let u=`pattern_${c}`,h=n.a||1,d=n.d||1,{update:p,markup:g}=l,y=hn(l,["update","markup"]),x=Object.assign(Object.assign(Object.assign({},y),r[c]),{sx:h,sy:d,ox:n.e||0,oy:n.f||0,width:e*h,height:e*d});s.has(u)||s.add(u,_i.create("pattern",{id:u,patternUnits:"userSpaceOnUse"},_i.createVectors(g)).node);let w=s.get(u);typeof p=="function"&&p(w.childNodes[0],x);let M=x.ox%x.width;M<0&&(M+=x.width);let A=x.oy%x.height;A<0&&(A+=x.height),et.attr(w,{x:M,y:A,width:x.width,height:x.height})});let o=new XMLSerializer().serializeToString(s.root),a=`url(data:image/svg+xml;base64,${btoa(o)})`;this.elem.style.backgroundImage=a}getInstance(){return this.instance||(this.instance=new _T),this.instance}resolveGrid(t){if(!t)return[];let e=t.type;if(e==null)return[Object.assign(Object.assign({},OO.dot),t.args)];let n=dp.get(e);if(n){let s=t.args||[];return Array.isArray(s)||(s=[s]),Array.isArray(n)?n.map((r,o)=>Object.assign(Object.assign({},r),s[o])):[Object.assign(Object.assign({},n),s[0])]}return dp.onNotFound(e)}dispose(){this.stopListening(),this.clear()}};rn([ln()],Ax.prototype,"dispose",null);Sn();var Ex=class extends hs{constructor(){super(...arguments),this.highlights={}}init(){this.startListening()}startListening(){this.graph.on("cell:highlight",this.onCellHighlight,this),this.graph.on("cell:unhighlight",this.onCellUnhighlight,this)}stopListening(){this.graph.off("cell:highlight",this.onCellHighlight,this),this.graph.off("cell:unhighlight",this.onCellUnhighlight,this)}onCellHighlight({view:t,magnet:e,options:n={}}){let s=this.resolveHighlighter(n);if(!s)return;let r=this.getHighlighterId(e,s);if(!this.highlights[r]){let o=s.highlighter;o.highlight(t,e,Object.assign({},s.args)),this.highlights[r]={cellView:t,magnet:e,highlighter:o,args:s.args}}}onCellUnhighlight({magnet:t,options:e={}}){let n=this.resolveHighlighter(e);if(!n)return;
4951let s=this.getHighlighterId(t,n);this.unhighlight(s)}resolveHighlighter(t){let e=this.options,n=t.highlighter;if(n==null){let a=t.type;n=a&&e.highlighting[a]||e.highlighting.default}if(n==null)return null;let s=typeof n=="string"?{name:n}:n,r=s.name,o=fp.get(r);return o==null?fp.onNotFound(r):(bq(r,o),{name:r,highlighter:o,args:s.args||{}})}getHighlighterId(t,e){return et.ensureId(t),e.name+t.id+JSON.stringify(e.args)}unhighlight(t){let e=this.highlights[t];e&&(e.highlighter.unhighlight(e.cellView,e.magnet,e.args),delete this.highlights[t])}dispose(){Object.keys(this.highlights).forEach(t=>this.unhighlight(t)),this.stopListening()}};rn([ln()],Ex.prototype,"dispose",null);Sn();var kx=class extends hs{constructor(){super(...arguments),this.cumulatedFactor=1}get widgetOptions(){return this.options.mousewheel}init(){this.container=this.graph.container,this.target=this.widgetOptions.global?document:this.container,this.mousewheelHandle=new et.MouseWheelHandle(this.target,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.widgetOptions.enabled&&this.enable(!0)}get disabled(){return this.widgetOptions.enabled!==!0}enable(t){(this.disabled||t)&&(this.widgetOptions.enabled=!0,this.mousewheelHandle.enable())}disable(){this.disabled||(this.widgetOptions.enabled=!1,this.mousewheelHandle.disable())}allowMouseWheel(t){let e=this.widgetOptions.guard;return(e==null||e(t))&&zo(t,this.widgetOptions.modifiers)}onMouseWheel(t){let e=this.widgetOptions.guard;if((e==null||e(t))&&zo(t,this.widgetOptions.modifiers)){let n=this.widgetOptions.factor||1.2;this.currentScale==null&&(this.startPos={x:t.clientX,y:t.clientY},this.currentScale=this.graph.transform.getScale().sx),t.deltaY<0?(this.currentScale<.15?this.cumulatedFactor=(this.currentScale+.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*n*20)/20/this.currentScale,this.cumulatedFactor<=1&&(this.cumulatedFactor=1.05)):(this.currentScale<=.15?this.cumulatedFactor=(this.currentScale-.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*(1/n)*20)/20/this.currentScale,this.cumulatedFactor>=1&&(this.cumulatedFactor=.95)),this.cumulatedFactor=Math.max(.01,Math.min(this.currentScale*this.cumulatedFactor,160)/this.currentScale);let r=this.currentScale,o=this.graph.transform.clampScale(r*this.cumulatedFactor),a=this.widgetOptions.minScale||Number.MIN_SAFE_INTEGER,l=this.widgetOptions.maxScale||Number.MAX_SAFE_INTEGER;if(o=dn.clamp(o,a,l),o!==r)if(this.widgetOptions.zoomAtMousePosition){let u=!!this.graph.getPlugin("scroller")?this.graph.clientToLocal(this.startPos):this.graph.clientToGraph(this.startPos);this.graph.zoom(o,{absolute:!0,center:u.clone()})}else this.graph.zoom(o,{absolute:!0});this.currentScale=null,this.cumulatedFactor=1}}dispose(){this.disable()}};rn([ln()],kx.prototype,"dispose",null);Sn();function fY(i){let{container:t,grid:e,panning:n,mousewheel:s,embedding:r}=i,o=hn(i,["container","grid","panning","mousewheel","embedding"]),a=rCt(t);o.width==null&&(o.width=a.clientWidth),o.height==null&&(o.height=a.clientHeight);let l=ge.merge({},oCt,o,{container:a}),c={size:10,visible:!1};return typeof e=="number"?l.grid={size:e,visible:!1}:typeof e=="boolean"?l.grid=Object.assign(Object.assign({},c),{visible:e}):l.grid=Object.assign(Object.assign({},c),e),["panning","mousewheel","embedding"].forEach(h=>{let d=i[h];typeof d=="boolean"?l[h].enabled=d:d!=null&&(l[h]=Object.assign(Object.assign({},l[h]),d))}),l}function rCt(i){if(typeof i!="string"){if(dY(i))return i;throw new Error("Ensure the container of the graph is specified and valid")}let t=i.trim(),e=t?document.getElementById(t):null;if(!dY(e))throw new Error(`Cannot find the graph container: "${i}"`);return e}function dY(i){var t;if(i==null||typeof i!="object")return!1;let e=(t=i.ownerDocument)===null||t===void 0?void 0:t.defaultView;return e!=null&&i instanceof e.HTMLElement}var oCt={x:0,y:0,scaling:{min:.01,max:16},grid:{size:10,visible:!1},background:!1,panning:{enabled:!0,eventTypes:["leftMouseDown"]},mousewheel:{enabled:!1,factor:1.2,zoomAtMousePosition:!0},highlighting:{default:{name:"stroke",args:{padding:3}},nodeAvailable:{name:"className",args:{className:In.prefix("available-node")}},magnetAvailable:{name:"className",args:{className:In.prefix("available-magnet")}}},connecting:{snap:!1,allowLoop:!0,allowNode:!0,allowEdge:!1,allowPort:!0,allowBlank:!0,allowMulti:!0,highlight:!1,anchor:"center",edgeAnchor:"ratio",connectionPoint:"boundary",router:"normal",connector:"normal",validateConnection({type:i,sourceView:t,targetView:e}){return(i==="target"?e:t)!=null},createEdge(){return new VT}},translating:{restrict:!1},embedding:{enabled:!1,findParent:"bbox",frontOnly:!0,validate:()=>!0},moveThreshold:0,clickThreshold:0,magnetThreshold:0,preventDefaultDblClick:!0,preventDefaultMouseDown:!1,preventDefaultContextMenu:!0,preventDefaultBlankAction:!0,interacting:{edgeLabelMovable:!1},async:!0,virtual:!1,guard:()=>!1};Sn();var Px=class extends hs{get widgetOptions(){return this.options.panning}get pannable(){return this.widgetOptions&&this.widgetOptions.enabled===!0}init(){this.onRightMouseDown=this.onRightMouseDown.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.startListening(),this.updateClassName()}startListening(){this.graph.on("blank:mousedown",this.onMouseDown,this),this.graph.on("node:unhandled:mousedown",this.onMouseDown,this),this.graph.on("edge:unhandled:mousedown",this.onMouseDown,this),et.Event.on(this.graph.container,"mousedown",this.onRightMouseDown),et.Event.on(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle=new et.MouseWheelHandle(this.graph.container,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.mousewheelHandle.enable()}stopListening(){this.graph.off("blank:mousedown",this.onMouseDown,this),this.graph.off("node:unhandled:mousedown",this.onMouseDown,this),this.graph.off("edge:unhandled:mousedown",this.onMouseDown,this),et.Event.off(this.graph.container,"mousedown",this.onRightMouseDown),et.Event.off(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle&&this.mousewheelHandle.disable()}allowPanning(t,e){return t.spaceKey=this.isSpaceKeyPressed,this.pannable&&zo(t,this.widgetOptions.modifiers,e)}startPanning(t){let e=this.view.normalizeEvent(t);this.clientX=e.clientX,this.clientY=e.clientY,this.panning=!0,this.updateClassName(t),et.Event.on(document.body,{"mousemove.panning touchmove.panning":this.pan.bind(this),"mouseup.panning touchend.panning":this.stopPanning.bind(this),"mouseleave.panning":this.stopPanning.bind(this)}),et.Event.on(window,"mouseup.panning",this.stopPanning.bind(this))}pan(t){let e=this.view.normalizeEvent(t),n=e.clientX-this.clientX,s=e.clientY-this.clientY;this.clientX=e.clientX,this.clientY=e.clientY,this.graph.translateBy(n,s)}stopPanning(t){this.panning=!1,this.updateClassName(t),et.Event.off(document.body,".panning"),et.Event.off(window,".panning")}updateClassName(t){let e=this.widgetOptions.eventTypes;if(e?.length===1&&e.includes("mouseWheel"))return;let n=this.view.container,s=this.view.prefixClassName("graph-panning"),r=this.view.prefixClassName("graph-pannable"),o=this.graph.getPlugin("selection"),a=o&&o.allowRubberband(t,!0),l=e?.includes("leftMouseDown")&&!a;this.allowPanning(t??{},!0)||this.allowPanning(t??{})&&l?this.panning?(et.addClass(n,s),et.removeClass(n,r)):(et.removeClass(n,s),et.addClass(n,r)):this.panning||(et.removeClass(n,s),et.removeClass(n,r))}onMouseDown({e:t}){if(!this.allowBlankMouseDown(t))return;let e=this.graph.getPlugin("selection"),n=e&&e.allowRubberband(t,!0);(this.allowPanning(t,!0)||this.allowPanning(t)&&!n)&&this.startPanning(t)}onRightMouseDown(t){let e=this.widgetOptions.eventTypes;e?.includes("rightMouseDown")&&t.button===2&&this.allowPanning(t,!0)&&this.startPanning(t)}onMouseWheel(t,e,n){this.graph.translateBy(-e,-n)}onKeyDown(t){t.which===32&&(this.isSpaceKeyPressed=!0),this.updateClassName(t)}onKeyUp(t){t.which===32&&(this.isSpaceKeyPressed=!1),this.updateClassName(t)}allowBlankMouseDown(t){let e=this.widgetOptions.eventTypes;return typeof t.type=="string"&&t.type.startsWith("touch")||t.pointerType==="touch"?e?.includes("leftMouseDown"):e?.includes("leftMouseDown")&&t.button===0||e?.includes("mouseWheelDown")&&t.button===1}allowMouseWheel(t){var e;
4951return this.pannable&&!t.ctrlKey&&((e=this.widgetOptions.eventTypes)===null||e===void 0?void 0:e.includes("mouseWheel"))}autoPanning(t,e){let s=this.graph.getGraphArea(),r=0,o=0;t<=s.left+10&&(r=-10),e<=s.top+10&&(o=-10),t>=s.right-10&&(r=10),e>=s.bottom-10&&(o=10),(r!==0||o!==0)&&this.graph.translateBy(-r,-o)}enablePanning(){this.pannable||(this.widgetOptions.enabled=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.enabled=!1,this.updateClassName())}dispose(){this.stopListening()}};rn([ln()],Px.prototype,"dispose",null);Sn();var Rx=class extends hs{getScroller(){let t=this.graph.getPlugin("scroller");return t&&t.options.enabled?t:null}getContainer(){let t=this.getScroller();return t?t.container.parentElement:this.graph.container.parentElement}getSensorTarget(){let t=this.options.autoResize;if(t)return typeof t=="boolean"?this.getContainer()||void 0:t}init(){if(this.options.autoResize){let e=this.getSensorTarget();if(e){if(typeof ResizeObserver>"u")return;this.ro=new ResizeObserver(r=>{if(!r||r.length===0)return;let{width:o,height:a}=r[0].contentRect;this.resize(Math.round(o),Math.round(a))}),this.ro.observe(e);let n=e.offsetWidth,s=e.offsetHeight;this.resize(n,s)}}}resize(t,e){let n=this.getScroller();n?n.resize(t,e):this.graph.transform.resize(t,e)}dispose(){this.ro&&(this.ro.disconnect(),this.ro=void 0)}};rn([ln()],Rx.prototype,"dispose",null);var GT=class extends hs{get container(){return this.graph.view.container}get viewport(){return this.graph.view.viewport}get stage(){return this.graph.view.stage}init(){this.resize()}getMatrix(){let t=this.viewport.getAttribute("transform");return t!==this.viewportTransformString&&(this.viewportMatrix=this.viewport.getCTM(),this.viewportTransformString=t),et.createSVGMatrix(this.viewportMatrix)}setMatrix(t){let e=et.createSVGMatrix(t),n=et.matrixToTransformString(e);this.viewport.setAttribute("transform",n),this.viewportMatrix=e,this.viewportTransformString=n}resize(t,e){let n=t===void 0?this.options.width:t,s=e===void 0?this.options.height:e;this.options.width=n,this.options.height=s,typeof n=="number"&&(n=Math.round(n)),typeof s=="number"&&(s=Math.round(s)),this.container.style.width=n==null?"":`${n}px`,this.container.style.height=s==null?"":`${s}px`;let r=this.getComputedSize();return this.graph.trigger("resize",Object.assign({},r)),this}getComputedSize(){let t=this.options.width,e=this.options.height;return dn.isNumber(t)||(t=this.container.clientWidth),dn.isNumber(e)||(e=this.container.clientHeight),{width:t,height:e}}getScale(){return et.matrixToScale(this.getMatrix())}scale(t,e=t,n=0,s=0,r=!0){if(t=this.clampScale(t),e=this.clampScale(e),r&&(n||s)){let a=this.getTranslation(),l=this.getScale(),c=n-(n-a.tx)*(t/l.sx),u=s-(s-a.ty)*(e/l.sy);(c!==a.tx||u!==a.ty)&&this.translate(c,u)}let o=this.getMatrix();return o.a=t,o.d=e,this.setMatrix(o),this.graph.trigger("scale",{sx:t,sy:e,ox:n,oy:s}),this}clampScale(t){let e=this.graph.options.scaling;return dn.clamp(t,e.min||.01,e.max||16)}getZoom(){return this.getScale().sx}zoom(t,e){e=e||{};let n=t,s=t,r=this.getScale(),o=this.getComputedSize(),a=o.width/2,l=o.height/2;return e.absolute||(n+=r.sx,s+=r.sy),e.scaleGrid&&(n=Math.round(n/e.scaleGrid)*e.scaleGrid,s=Math.round(s/e.scaleGrid)*e.scaleGrid),e.maxScale&&(n=Math.min(e.maxScale,n),s=Math.min(e.maxScale,s)),e.minScale&&(n=Math.max(e.minScale,n),s=Math.max(e.minScale,s)),e.center&&(a=e.center.x,l=e.center.y),n=this.clampScale(n),s=this.clampScale(s),this.scale(n,s,a,l),this}getRotation(){return et.matrixToRotation(this.getMatrix())}rotate(t,e,n){if(e==null||n==null){let r=ei.getBBox(this.stage);e=r.width/2,n=r.height/2}let s=this.getMatrix().translate(e,n).rotate(t).translate(-e,-n);return this.setMatrix(s),this}getTranslation(){return et.matrixToTranslation(this.getMatrix())}translate(t,e){let n=this.getMatrix();n.e=t||0,n.f=e||0,this.setMatrix(n);let s=this.getTranslation();return this.options.x=s.tx,this.options.y=s.ty,this.graph.trigger("translate",Object.assign({},s)),this}setOrigin(t,e){return this.translate(t||0,e||0)}fitToContent(t,e,n,s){if(typeof t=="object"){let A=t;t=A.gridWidth||1,e=A.gridHeight||1,n=A.padding||0,s=A}else t=t||1,e=e||1,n=n||0,s==null&&(s={});let r=dn.normalizeSides(n),o=s.border||0,a=s.contentArea?Pe.create(s.contentArea):this.getContentArea(s);o>0&&a.inflate(o);let l=this.getScale(),c=this.getTranslation(),u=l.sx,h=l.sy;a.x*=u,a.y*=h,a.width*=u,a.height*=h;let d=Math.max(Math.ceil((a.width+a.x)/t),1)*t,p=Math.max(Math.ceil((a.height+a.y)/e),1)*e,g=0,y=0;(s.allowNewOrigin==="negative"&&a.x<0||s.allowNewOrigin==="positive"&&a.x>=0||s.allowNewOrigin==="any")&&(g=Math.ceil(-a.x/t)*t,g+=r.left,d+=g),(s.allowNewOrigin==="negative"&&a.y<0||s.allowNewOrigin==="positive"&&a.y>=0||s.allowNewOrigin==="any")&&(y=Math.ceil(-a.y/e)*e,y+=r.top,p+=y),d+=r.right,p+=r.bottom,d=Math.max(d,s.minWidth||0),p=Math.max(p,s.minHeight||0),d=Math.min(d,s.maxWidth||Number.MAX_SAFE_INTEGER),p=Math.min(p,s.maxHeight||Number.MAX_SAFE_INTEGER);let x=this.getComputedSize(),w=d!==x.width||p!==x.height;return(g!==c.tx||y!==c.ty)&&this.translate(g,y),w&&this.resize(d,p),new Pe(-g/u,-y/h,d/u,p/h)}scaleContentToFit(t={}){this.scaleContentToFitImpl(t)}scaleContentToFitImpl(t={},e=!0){let n,s;if(t.contentArea){let w=t.contentArea;n=this.graph.localToGraph(w),s=Mt.create(w)}else n=this.getContentBBox(t),s=this.graph.graphToLocal(n);if(!n.width||!n.height)return;let r=dn.normalizeSides(t.padding),o=t.minScale||0,a=t.maxScale||Number.MAX_SAFE_INTEGER,l=t.minScaleX||o,c=t.maxScaleX||a,u=t.minScaleY||o,h=t.maxScaleY||a,d;if(t.viewportArea)d=t.viewportArea;else{let w=this.getComputedSize(),M=this.getTranslation();d={x:M.tx,y:M.ty,width:w.width,height:w.height}}d=Pe.create(d).moveAndExpand({x:r.left,y:r.top,width:-r.left-r.right,height:-r.top-r.bottom});let p=this.getScale(),g=d.width/n.width*p.sx,y=d.height/n.height*p.sy;t.preserveAspectRatio!==!1&&(g=y=Math.min(g,y));let x=t.scaleGrid;if(x&&(g=x*Math.floor(g/x),y=x*Math.floor(y/x)),g=dn.clamp(g,l,c),y=dn.clamp(y,u,h),this.scale(g,y),e){let w=this.options,M=d.x-s.x*g-w.x,A=d.y-s.y*y-w.y;this.translate(M,A)}}getContentArea(t={}){return t.useCellGeometry!==!1?this.model.getAllCellsBBox()||new Pe:ei.getBBox(this.stage)}getContentBBox(t={}){return this.graph.localToGraph(this.getContentArea(t))}getGraphArea(){let t=Pe.fromSize(this.getComputedSize());return this.graph.graphToLocal(t)}zoomToRect(t,e={}){let n=Pe.create(t),s=this.graph;e.contentArea=n,e.viewportArea==null&&(e.viewportArea={x:s.options.x,y:s.options.y,width:this.options.width,height:this.options.height}),this.scaleContentToFitImpl(e,!1);let r=n.getCenter();return this.centerPoint(r.x,r.y),this}zoomToFit(t={}){return this.zoomToRect(this.getContentArea(t),t)}centerPoint(t,e){let n=this.getComputedSize(),s=this.getScale(),r=this.getTranslation(),o=n.width/2,a=n.height/2;t=typeof t=="number"?t:o,e=typeof e=="number"?e:a,t=o-t*s.sx,e=a-e*s.sy,(r.tx!==t||r.ty!==e)&&this.translate(t,e)}
4951centerContent(t){let n=this.graph.getContentArea(t).getCenter();this.centerPoint(n.x,n.y)}centerCell(t){return this.positionCell(t,"center")}positionPoint(t,e,n){let s=this.getComputedSize();e=dn.normalizePercentage(e,Math.max(0,s.width)),e<0&&(e=s.width+e),n=dn.normalizePercentage(n,Math.max(0,s.height)),n<0&&(n=s.height+n);let r=this.getTranslation(),o=this.getScale(),a=e-t.x*o.sx,l=n-t.y*o.sy;(r.tx!==a||r.ty!==l)&&this.translate(a,l)}positionRect(t,e){let n=Pe.create(t);switch(e){case"center":return this.positionPoint(n.getCenter(),"50%","50%");case"top":return this.positionPoint(n.getTopCenter(),"50%",0);case"top-right":return this.positionPoint(n.getTopRight(),"100%",0);case"right":return this.positionPoint(n.getRightMiddle(),"100%","50%");case"bottom-right":return this.positionPoint(n.getBottomRight(),"100%","100%");case"bottom":return this.positionPoint(n.getBottomCenter(),"50%","100%");case"bottom-left":return this.positionPoint(n.getBottomLeft(),0,"100%");case"left":return this.positionPoint(n.getLeftMiddle(),0,"50%");case"top-left":return this.positionPoint(n.getTopLeft(),0,0);default:return this}}positionCell(t,e){let n=t.getBBox();return this.positionRect(n,e)}positionContent(t,e){let n=this.graph.getContentArea(e);return this.positionRect(n,t)}};Sn();var Ed=`${In.prefixCls}-graph`,Zc=class i extends Wi{static snapshoot(t){let e=t.cloneNode();return t.childNodes.forEach(n=>{e.appendChild(n)}),()=>{for(et.empty(t);t.attributes.length>0;)t.removeAttribute(t.attributes[0].name);for(let n=0,s=e.attributes.length;n<s;n+=1){let r=e.attributes[n];t.setAttribute(r.name,r.value)}e.childNodes.forEach(n=>{t.appendChild(n)})}}get disposeContainer(){return!1}get options(){return this.graph.options}constructor(t){super(),this.graph=t;let{selectors:e,fragment:n}=As.parseJSONMarkup(i.markup);this.background=e.background,this.grid=e.grid,this.svg=e.svg,this.defs=e.defs,this.viewport=e.viewport,this.primer=e.primer,this.stage=e.stage,this.decorator=e.decorator,this.overlay=e.overlay,this.container=this.options.container,this.restore=i.snapshoot(this.container),et.addClass(this.container,this.prefixClassName("graph")),et.append(this.container,n),this.delegateEvents()}delegateEvents(){let t=this.constructor;return super.delegateEvents(t.events),this}guard(t,e){return t.type==="mousedown"&&t.button===2||this.options.guard&&this.options.guard(t,e)?!0:t.data&&t.data.guarded!==void 0?t.data.guarded:!(e&&e.cell&&vi.isCell(e.cell)||this.svg===t.target||this.container===t.target||this.svg.contains(t.target))}findView(t){return this.graph.findViewByElem(t)}onDblClick(t){this.options.preventDefaultDblClick&&t.preventDefault();let e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;let s=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onDblClick(e,s.x,s.y):this.graph.trigger("blank:dblclick",{e,x:s.x,y:s.y})}onClick(t){if(this.getMouseMovedCount(t)<=this.options.clickThreshold){let e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;let s=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onClick(e,s.x,s.y):this.graph.trigger("blank:click",{e,x:s.x,y:s.y})}}isPreventDefaultContextMenu(t){let e=this.options.preventDefaultContextMenu;return typeof e=="function"&&(e=ke.call(e,this.graph,{view:t})),e}onContextMenu(t){let e=this.normalizeEvent(t),n=this.findView(e.target);if(this.isPreventDefaultContextMenu(n)&&t.preventDefault(),this.guard(e,n))return;let s=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onContextMenu(e,s.x,s.y):this.graph.trigger("blank:contextmenu",{e,x:s.x,y:s.y})}delegateDragEvents(t,e){t.data==null&&(t.data={}),this.setEventData(t,{currentView:e||null,mouseMovedCount:0,startPosition:{x:t.clientX,y:t.clientY}});let n=this.constructor;this.delegateDocumentEvents(n.documentEvents,t.data),this.undelegateEvents()}getMouseMovedCount(t){return this.getEventData(t).mouseMovedCount||0}onMouseDown(t){let e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;this.options.preventDefaultMouseDown&&t.preventDefault();let s=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onMouseDown(e,s.x,s.y):(this.options.preventDefaultBlankAction&&["touchstart"].includes(e.type)&&t.preventDefault(),this.graph.trigger("blank:mousedown",{e,x:s.x,y:s.y})),this.delegateDragEvents(e,n)}onMouseMove(t){let e=this.getEventData(t),n=e.startPosition;if(n&&n.x===t.clientX&&n.y===t.clientY||(e.mouseMovedCount==null&&(e.mouseMovedCount=0),e.mouseMovedCount+=1,e.mouseMovedCount<=this.options.moveThreshold))return;
4951let r=this.normalizeEvent(t),o=this.graph.snapToGrid(r.clientX,r.clientY),a=e.currentView;a?a.onMouseMove(r,o.x,o.y):this.graph.trigger("blank:mousemove",{e:r,x:o.x,y:o.y}),this.setEventData(r,e)}onMouseUp(t){this.undelegateDocumentEvents();let e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY),r=this.getEventData(t).currentView;if(r?r.onMouseUp(e,n.x,n.y):this.graph.trigger("blank:mouseup",{e,x:n.x,y:n.y}),!t.isPropagationStopped()){let o=new et.EventObject(t,{type:"click",data:t.data});this.onClick(o)}t.stopImmediatePropagation(),this.delegateEvents()}onMouseOver(t){let e=this.normalizeEvent(t),n=this.findView(e.target);if(!this.guard(e,n))if(n)n.onMouseOver(e);else{if(this.container===e.target)return;this.graph.trigger("blank:mouseover",{e})}}onMouseOut(t){let e=this.normalizeEvent(t),n=this.findView(e.target);if(!this.guard(e,n))if(n)n.onMouseOut(e);else{if(this.container===e.target)return;this.graph.trigger("blank:mouseout",{e})}}onMouseEnter(t){let e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;let s=this.graph.findViewByElem(e.relatedTarget);if(n){if(s===n)return;n.onMouseEnter(e)}else{if(s)return;this.graph.trigger("graph:mouseenter",{e})}}onMouseLeave(t){let e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;let s=this.graph.findViewByElem(e.relatedTarget);if(n){if(s===n)return;n.onMouseLeave(e)}else{if(s)return;this.graph.trigger("graph:mouseleave",{e})}}onMouseWheel(t){let e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;let s=e.originalEvent,r=this.graph.snapToGrid(s.clientX,s.clientY),o=Math.max(-1,Math.min(1,s.wheelDelta||-s.detail));n?n.onMouseWheel(e,r.x,r.y,o):this.graph.trigger("blank:mousewheel",{e,delta:o,x:r.x,y:r.y})}onCustomEvent(t){let e=t.currentTarget,n=e.getAttribute("event")||e.getAttribute("data-event");if(n){let s=this.findView(e);if(s){let r=this.normalizeEvent(t);if(this.guard(r,s))return;let o=this.graph.snapToGrid(r.clientX,r.clientY);s.onCustomEvent(r,n,o.x,o.y)}}}handleMagnetEvent(t,e){let n=t.currentTarget,s=n.getAttribute("magnet");if(s&&s.toLowerCase()!=="false"){let r=this.findView(n);if(r){let o=this.normalizeEvent(t);if(this.guard(o,r))return;let a=this.graph.snapToGrid(o.clientX,o.clientY);ke.call(e,this.graph,r,o,n,a.x,a.y)}}}onMagnetMouseDown(t){this.handleMagnetEvent(t,(e,n,s,r,o)=>{e.onMagnetMouseDown(n,s,r,o)})}onMagnetDblClick(t){this.handleMagnetEvent(t,(e,n,s,r,o)=>{e.onMagnetDblClick(n,s,r,o)})}onMagnetContextMenu(t){let e=this.findView(t.target);this.isPreventDefaultContextMenu(e)&&t.preventDefault(),this.handleMagnetEvent(t,(n,s,r,o,a)=>{n.onMagnetContextMenu(s,r,o,a)})}onLabelMouseDown(t){let e=t.currentTarget,n=this.findView(e);if(n){let s=this.normalizeEvent(t);if(this.guard(s,n))return;let r=this.graph.snapToGrid(s.clientX,s.clientY);n.onLabelMouseDown(s,r.x,r.y)}}onImageDragStart(){return!1}dispose(){this.undelegateEvents(),this.undelegateDocumentEvents(),this.restore(),this.restore=()=>{}}};Zc.markup=[{ns:et.ns.xhtml,tagName:"div",selector:"background",className:`${Ed}-background`},{ns:et.ns.xhtml,tagName:"div",selector:"grid",className:`${Ed}-grid`},{ns:et.ns.svg,tagName:"svg",selector:"svg",className:`${Ed}-svg`,attrs:{width:"100%",height:"100%","xmlns:xlink":et.ns.xlink},children:[{tagName:"defs",selector:"defs"},{tagName:"g",selector:"viewport",className:`${Ed}-svg-viewport`,children:[{tagName:"g",selector:"primer",className:`${Ed}-svg-primer`},{tagName:"g",selector:"stage",className:`${Ed}-svg-stage`},{tagName:"g",selector:"decorator",className:`${Ed}-svg-decorator`},{tagName:"g",selector:"overlay",className:`${Ed}-svg-overlay`}]}]}];Zc.events={dblclick:"onDblClick",contextmenu:"onContextMenu",touchstart:"onMouseDown",mousedown:"onMouseDown",mouseover:"onMouseOver",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",DOMMouseScroll:"onMouseWheel",[`mouseenter  .${In.prefixCls}-cell`]:"onMouseEnter",[`mouseleave  .${In.prefixCls}-cell`]:"onMouseLeave",[`mouseenter  .${In.prefixCls}-cell-tools`]:"onMouseEnter",[`mouseleave  .${In.prefixCls}-cell-tools`]:"onMouseLeave",[`mousedown   .${In.prefixCls}-cell [event]`]:"onCustomEvent",[`touchstart  .${In.prefixCls}-cell [event]`]:"onCustomEvent",[`mousedown   .${In.prefixCls}-cell [data-event]`]:"onCustomEvent",[`touchstart  .${In.prefixCls}-cell [data-event]`]:"onCustomEvent",[`dblclick    .${In.prefixCls}-cell [magnet]`]:"onMagnetDblClick",[`contextmenu .${In.prefixCls}-cell [magnet]`]:"onMagnetContextMenu",[`mousedown   .${In.prefixCls}-cell [magnet]`]:"onMagnetMouseDown",[`touchstart  .${In.prefixCls}-cell [magnet]`]:"onMagnetMouseDown",[`dblclick    .${In.prefixCls}-cell [data-magnet]`]:"onMagnetDblClick",[`contextmenu .${In.prefixCls}-cell [data-magnet]`]:"onMagnetContextMenu",[`mousedown   .${In.prefixCls}-cell [data-magnet]`]:"onMagnetMouseDown",[`touchstart  .${In.prefixCls}-cell [data-magnet]`]:"onMagnetMouseDown",[`dragstart   .${In.prefixCls}-cell image`]:"onImageDragStart",[`mousedown   .${In.prefixCls}-edge .${In.prefixCls}-edge-label`]:"onLabelMouseDown",[`touchstart  .${In.prefixCls}-edge .${In.prefixCls}-edge-label`]:"onLabelMouseDown"};Zc.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"};rn([ln()],Zc.prototype,"dispose",null);Sn();var pY=120,Dx=class extends hs{init(){this.resetRenderArea=ke.throttle(this.resetRenderArea,200,{leading:!0}),this.resetRenderArea(),this.startListening()}bindScrollerEvents(t){this.scrollerRef=t,typeof t.on=="function"&&(t.on("pan:start",this.resetRenderArea,this),t.on("panning",this.resetRenderArea,this),t.on("pan:stop",this.resetRenderArea,this));let e=t.container;e&&(this.scrollerScrollHandler=n=>{this.resetRenderArea()},et.Event.on(e,"scroll",this.scrollerScrollHandler))}startListening(){this.graph.on("translate",this.resetRenderArea,this),this.graph.on("scale",this.resetRenderArea,this),this.graph.on("resize",this.resetRenderArea,this);let t=this.graph.getPlugin("scroller");t&&this.bindScrollerEvents(t)}stopListening(){this.graph.off("translate",this.resetRenderArea,this),this.graph.off("scale",this.resetRenderArea,this),this.graph.off("resize",this.resetRenderArea,this),this.unbindScroller()}onScrollerReady(t){this.scrollerRef!==t&&(this.unbindScroller(),this.bindScrollerEvents(t),this.resetRenderArea())}unbindScroller(){if(this.scrollerRef){typeof this.scrollerRef.off=="function"&&(this.scrollerRef.off("pan:start",this.resetRenderArea,this),this.scrollerRef.off("panning",this.resetRenderArea,this),this.scrollerRef.off("pan:stop",this.resetRenderArea,this));let t=this.scrollerRef.container;t&&this.scrollerScrollHandler&&et.Event.off(t,"scroll",this.scrollerScrollHandler),this.scrollerRef=void 0,this.scrollerScrollHandler=void 0}}setVirtualEnabled(t){let e=this.options.virtual;if(typeof e=="object"){let n=e;this.options.virtual=Object.assign(Object.assign({},n),{enabled:t})}else this.options.virtual=t}enableVirtualRender(){this.setVirtualEnabled(!0),this.resetRenderArea()}disableVirtualRender(){this.setVirtualEnabled(!1),this.graph.renderer.setRenderArea(void 0)}isVirtualEnabled(){let t=this.options.virtual;return t!=null&&typeof t=="object"?t.enabled!==!1:!!t}getVirtualMargin(){let t=this.options.virtual;if(typeof t=="object"){let e=t.margin;return typeof e=="number"?e:pY}return pY}resetRenderArea(){if(this.isVirtualEnabled()){let e=this.graph.getGraphArea();if(e){let n=this.getVirtualMargin(),s=e.clone();s.inflate(n,n),this.graph.renderer.setRenderArea(s);return}}}dispose(){this.stopListening()}};rn([ln()],Dx.prototype,"dispose",null);var oe=class i extends Ii{static isGraph(t){if(t==null)return!1;if(t instanceof i)return!0;let e=t[Symbol.toStringTag];return e==null||e===i.toStringTag}static render(t,e){let n=typeof t=="string"||t instanceof HTMLElement?new i({container:t}):new i(t);return e!=null&&n.fromJSON(e),n}get container(){return this.options.container}get[Symbol.toStringTag](){return i.toStringTag}constructor(t){super(),this.installedPlugins=new Set,this.options=fY(t),this.css=new Tx(this),this.view=new Zc(this),this.defs=new $T(this),this.coord=new WT(this),this.transform=new GT(this),this.highlight=new Ex(this),this.grid=new Ax(this),this.background=new _p(this),this.options.model?this.model=this.options.model:(this.model=new Zr,this.model.graph=this),this.renderer=new Mx(this),this.panning=new Px(this),this.mousewheel=new kx(this),this.virtualRe
4951nder=new Dx(this),this.size=new Rx(this)}isNode(t){return t.isNode()}isEdge(t){return t.isEdge()}resetCells(t,e={}){return this.model.resetCells(t,e),this}clearCells(t={}){return this.model.clear(t),this}toJSON(t={}){return this.model.toJSON(t)}parseJSON(t){return this.model.parseJSON(t)}fromJSON(t,e={}){return this.model.fromJSON(t,e),this}getCellById(t){return this.model.getCell(t)}addNode(t,e={}){return this.model.addNode(t,e)}addNodes(t,e={}){return this.addCell(t.map(n=>vs.isNode(n)?n:this.createNode(n)),e)}createNode(t){return this.model.createNode(t)}removeNode(t,e={}){return this.model.removeCell(t,e)}addEdge(t,e={}){return this.model.addEdge(t,e)}addEdges(t,e={}){return this.addCell(t.map(n=>ns.isEdge(n)?n:this.createEdge(n)),e)}removeEdge(t,e={}){return this.model.removeCell(t,e)}createEdge(t){return this.model.createEdge(t)}addCell(t,e={}){return this.model.addCell(t,e),this}removeCell(t,e={}){return this.model.removeCell(t,e)}removeCells(t,e={}){return this.model.removeCells(t,e)}removeConnectedEdges(t,e={}){return this.model.removeConnectedEdges(t,e)}disconnectConnectedEdges(t,e={}){return this.model.disconnectConnectedEdges(t,e),this}hasCell(t){return this.model.has(t)}getCells(){return this.model.getCells()}getCellCount(){return this.model.total()}getNodes(){return this.model.getNodes()}getEdges(){return this.model.getEdges()}getOutgoingEdges(t){return this.model.getOutgoingEdges(t)}getIncomingEdges(t){return this.model.getIncomingEdges(t)}getConnectedEdges(t,e={}){return this.model.getConnectedEdges(t,e)}getRootNodes(){return this.model.getRoots()}getLeafNodes(){return this.model.getLeafs()}isRootNode(t){return this.model.isRoot(t)}isLeafNode(t){return this.model.isLeaf(t)}getNeighbors(t,e={}){return this.model.getNeighbors(t,e)}isNeighbor(t,e,n={}){return this.model.isNeighbor(t,e,n)}getSuccessors(t,e={}){return this.model.getSuccessors(t,e)}isSuccessor(t,e,n={}){return this.model.isSuccessor(t,e,n)}getPredecessors(t,e={}){return this.model.getPredecessors(t,e)}isPredecessor(t,e,n={}){return this.model.isPredecessor(t,e,n)}getCommonAncestor(...t){return this.model.getCommonAncestor(...t)}getSubGraph(t,e={}){return this.model.getSubGraph(t,e)}cloneSubGraph(t,e={}){return this.model.cloneSubGraph(t,e)}cloneCells(t){return this.model.cloneCells(t)}getNodesFromPoint(t,e){return this.model.getNodesFromPoint(t,e)}getNodesInArea(t,e,n,s,r){return this.model.getNodesInArea(t,e,n,s,r)}getNodesUnderNode(t,e={}){return this.model.getNodesUnderNode(t,e)}searchCell(t,e,n={}){return this.model.search(t,e,n),this}getShortestPath(t,e,n={}){return this.model.getShortestPath(t,e,n)}getAllCellsBBox(){return this.model.getAllCellsBBox()}getCellsBBox(t,e={}){return this.model.getCellsBBox(t,e)}startBatch(t,e={}){this.model.startBatch(t,e)}stopBatch(t,e={}){this.model.stopBatch(t,e)}batchUpdate(t,e,n){let s=typeof t=="string"?t:"update",r=typeof t=="string"?e:t,o=typeof e=="function"?n:e;this.startBatch(s,o);let a=r();return this.stopBatch(s,o),a}updateCellId(t,e){return this.model.updateCellId(t,e)}findView(t){return vi.isCell(t)?this.findViewByCell(t):this.findViewByElem(t)}findViews(t){return Pe.isRectangleLike(t)?this.findViewsInArea(t):Mt.isPointLike(t)?this.findViewsFromPoint(t):[]}findViewByCell(t){return this.renderer.findViewByCell(t)}findViewByElem(t){return this.renderer.findViewByElem(t)}findViewsFromPoint(t,e){let n=typeof t=="number"?{x:t,y:e}:t;return this.renderer.findViewsFromPoint(n)}findViewsInArea(t,e,n,s,r){let o=typeof t=="number"?{x:t,y:e,width:n,height:s}:t,a=typeof t=="number"?r:e;return this.renderer.findViewsInArea(o,a)}matrix(t){return typeof t>"u"?this.transform.getMatrix():(this.transform.setMatrix(t),this)}resize(t,e){let n=this.getPlugin("scroller");return n?n.resize(t,e):this.transform.resize(t,e),this}scale(t,e=t,n=0,s=0){return typeof t>"u"?this.transform.getScale():(this.transform.scale(t,e,n,s),this)}zoom(t,e){let n=this.getPlugin("scroller");if(n){if(typeof t>"u")return n.zoom();n.zoom(t,e)}else{if(typeof t>"u")return this.transform.getZoom();this.transform.zoom(t,e)}return this}zoomTo(t,e={}){let n=this.getPlugin("scroller");return n?n.zoom(t,Object.assign(Object.assign({},e),{absolute:!0})):this.transform.zoom(t,Object.assign(Object.assign({},e),{absolute:!0})),this}zoomToRect(t,e={}){let n=this.getPlugin("scroller");return n?n.zoomToRect(t,e):this.transform.zoomToRect(t,e),this}zoomToFit(t={}){let e=this.getPlugin("scroller");return e?e.zoomToFit(t):this.transform.zoomToFit(t),this}rotate(t,e,n){return typeof t>"u"?this.transform.getRotation():(this.transform.rotate(t,e,n),this)}translate(t,e){return typeof t>"u"?this.transform.getTranslation():(this.transform.translate(t,e),this)}translateBy(t,e){let n=this.translate(),s=n.tx+t,r=n.ty+e;return this.translate(s,r)}getGraphArea(){var t;let e=this.getPlugin("scroller");if(e){let n=(t=e.getVisibleArea)===null||t===void 0?void 0:t.call(e);
4951if(n)return n}return this.transform.getGraphArea()}getContentArea(t={}){return this.transform.getContentArea(t)}getContentBBox(t={}){return this.transform.getContentBBox(t)}fitToContent(t,e,n,s){return this.transform.fitToContent(t,e,n,s)}scaleContentToFit(t={}){return this.transform.scaleContentToFit(t),this}center(t){return this.centerPoint(t)}centerPoint(t,e,n){let s=this.getPlugin("scroller");return s?s.centerPoint(t,e,n):this.transform.centerPoint(t,e),this}centerContent(t){let e=this.getPlugin("scroller");return e?e.centerContent(t):this.transform.centerContent(t),this}centerCell(t,e){let n=this.getPlugin("scroller");return n?n.centerCell(t,e):this.transform.centerCell(t),this}positionPoint(t,e,n,s={}){let r=this.getPlugin("scroller");return r?r.positionPoint(t,e,n,s):this.transform.positionPoint(t,e,n),this}positionRect(t,e,n){let s=this.getPlugin("scroller");return s?s.positionRect(t,e,n):this.transform.positionRect(t,e),this}positionCell(t,e,n){let s=this.getPlugin("scroller");return s?s.positionCell(t,e,n):this.transform.positionCell(t,e),this}positionContent(t,e){let n=this.getPlugin("scroller");return n?n.positionContent(t,e):this.transform.positionContent(t,e),this}
4951snapToGrid(t,e){return this.coord.snapToGrid(t,e)}pageToLocal(t,e,n,s){return Pe.isRectangleLike(t)?this.coord.pageToLocalRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof s=="number"?this.coord.pageToLocalRect(t,e,n,s):this.coord.pageToLocalPoint(t,e)}localToPage(t,e,n,s){return Pe.isRectangleLike(t)?this.coord.localToPageRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof s=="number"?this.coord.localToPageRect(t,e,n,s):this.coord.localToPagePoint(t,e)}clientToLocal(t,e,n,s){return Pe.isRectangleLike(t)?this.coord.clientToLocalRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof s=="number"?this.coord.clientToLocalRect(t,e,n,s):this.coord.clientToLocalPoint(t,e)}localToClient(t,e,n,s){return Pe.isRectangleLike(t)?this.coord.localToClientRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof s=="number"?this.coord.localToClientRect(t,e,n,s):this.coord.localToClientPoint(t,e)}localToGraph(t,e,n,s){return Pe.isRectangleLike(t)?this.coord.localToGraphRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof s=="number"?this.coord.localToGraphRect(t,e,n,s):this.coord.localToGraphPoint(t,e)}graphToLocal(t,e,n,s){return Pe.isRectangleLike(t)?this.coord.graphToLocalRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof s=="number"?this.coord.graphToLocalRect(t,e,n,s):this.coord.graphToLocalPoint(t,e)}clientToGraph(t,e,n,s){return Pe.isRectangleLike(t)?this.coord.clientToGraphRect(t):typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof s=="number"?this.coord.clientToGraphRect(t,e,n,s):this.coord.clientToGraphPoint(t,e)}defineFilter(t){return this.defs.filter(t)}defineGradient(t){return this.defs.gradient(t)}defineMarker(t){return this.defs.marker(t)}getGridSize(){return this.grid.getGridSize()}setGridSize(t){return this.grid.setGridSize(t),this}showGrid(){return this.grid.show(),this}hideGrid(){return this.grid.hide(),this}clearGrid(){return this.grid.clear(),this}drawGrid(t){return this.grid.draw(t),this}
4951updateBackground(){return this.background.update(),this}drawBackground(t,e){let n=this.getPlugin("scroller");return n!=null&&(this.options.background==null||!e)?n.drawBackground(t,e):this.background.draw(t),this}clearBackground(t){let e=this.getPlugin("scroller");return e!=null&&(this.options.background==null||!t)?e.clearBackground(t):this.background.clear(),this}enableVirtualRender(){return this.virtualRender.enableVirtualRender(),this}disableVirtualRender(){return this.virtualRender.disableVirtualRender(),this}isMouseWheelEnabled(){return!this.mousewheel.disabled}enableMouseWheel(){return this.mousewheel.enable(),this}disableMouseWheel(){return this.mousewheel.disable(),this}toggleMouseWheel(t){return t==null?this.isMouseWheelEnabled()?this.disableMouseWheel():this.enableMouseWheel():t?this.enableMouseWheel():this.disableMouseWheel(),this}isPannable(){let t=this.getPlugin("scroller");return t?t.isPannable():this.panning.pannable}enablePanning(){let t=this.getPlugin("scroller");return t?t.enablePanning():this.panning.enablePanning(),this}disablePanning(){let t=this.getPlugin("scroller");return t?t.disablePanning():this.panning.disablePanning(),this}togglePanning(t){return t==null?this.isPannable()?this.disablePanning():this.enablePanning():t!==this.isPannable()&&(t?this.enablePanning():this.disablePanning()),this}handleScrollerPluginStateChange(t,e){t.name==="scroller"&&(e?this.virtualRender.onScrollerReady(t):this.virtualRender.unbindScroller())}use(t,...e){return this.installedPlugins.has(t)||(this.installedPlugins.add(t),t.init(this,...e),this.handleScrollerPluginStateChange(t,!0)),this}getPlugin(t){return Array.from(this.installedPlugins).find(e=>e.name===t)}getPlugins(t){return Array.from(this.installedPlugins).filter(e=>t.includes(e.name))}enablePlugins(t){let e=t;Array.isArray(e)||(e=[e]);let n=this.getPlugins(e);return n?.forEach(s=>{var r;(r=s?.enable)===null||r===void 0||r.call(s),this.handleScrollerPluginStateChange(s,!0)}),this}disablePlugins(t){let e=t;Array.isArray(e)||(e=[e]);let n=this.getPlugins(e);return n?.forEach(s=>{var r;(r=s?.disable)===null||r===void 0||r.call(s),this.handleScrollerPluginStateChange(s,!1)}),this}isPluginEnabled(t){var e;let n=this.getPlugin(t);return(e=n?.isEnabled)===null||e===void 0?void 0:e.call(n)}disposePlugins(t){let e=t;Array.isArray(e)||(e=[e]);let n=this.getPlugins(e);return n?.forEach(s=>{s.dispose(),this.handleScrollerPluginStateChange(s,!1),this.installedPlugins.delete(s)}),this}dispose(t=!0){t&&this.model.dispose(),this.css.dispose(),this.defs.dispose(),this.grid.dispose(),this.coord.dispose(),this.transform.dispose(),this.highlight.dispose(),this.background.dispose(),this.mousewheel.dispose(),this.panning.dispose(),this.view.dispose(),this.renderer.dispose(),this.installedPlugins.forEach(e=>{e.dispose()})}};oe.toStringTag=`X6.${oe.name}`;oe.registerNode=vs.registry.register;oe.registerEdge=ns.registry.register;oe.registerView=Sr.registry.register;oe.registerAttr=op.register;oe.registerGrid=dp.register;oe.registerFilter=hp.register;oe.registerNodeTool=mp.register;oe.registerEdgeTool=bp.register;oe.registerBackground=f0.register;oe.registerHighlighter=fp.register;oe.registerPortLayout=gp.register;oe.registerPortLabelLayout=g0.register;oe.registerMarker=rp.register;oe.registerRouter=Vu.register;oe.registerConnector=cp.register;oe.registerAnchor=pp.register;oe.registerEdgeAnchor=up.register;oe.registerConnectionPoint=lp.register;oe.unregisterNode=vs.registry.unregister;oe.unregisterEdge=ns.registry.unregister;oe.unregisterView=Sr.registry.unregister;oe.unregisterAttr=op.unregister;oe.unregisterGrid=dp.unregister;oe.unregisterFilter=hp.unregister;oe.unregisterNodeTool=mp.unregister;oe.unregisterEdgeTool=bp.unregister;oe.unregisterBackground=f0.unregister;oe.unregisterHighlighter=fp.unregister;oe.unregisterPortLayout=gp.unregister;oe.unregisterPortLabelLayout=g0.unregister;oe.unregisterMarker=rp.unregister;oe.unregisterRouter=Vu.unregister;oe.unregisterConnector=cp.unregister;oe.unregisterAnchor=pp.unregister;oe.unregisterEdgeAnchor=up.unregister;oe.unregisterConnectionPoint=lp.unregister;rn([ln()],oe.prototype,"dispose",null);var fN="html",pN={},T0=class extends vs{static register(t){let{shape:e,html:n,effect:s,inherit:r}=t,o=hn(t,["shape","html","effect","inherit"]);if(!e)throw new Error("HTML.register should specify `shape` in config.");pN[e]={html:n,effect:s},oe.registerNode(e,Object.assign({inherit:r||"html"},o),!0)}};T0.config({view:"html-view",markup:[{tagName:"rect",selector:"body"},Object.assign({},As.getForeignObjectMarkup()),{tagName:"text",selector:"label"}],attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}}});vs.registry.register("html",T0,!0);
4951var Lx=class extends Ba{init(){super.init(),this.cell.on("change:*",this.onCellChangeAny,this)}onCellChangeAny({key:t}){let e=pN[this.cell.shape];if(e){let{effect:n}=e;(!n||n.includes(t))&&this.renderHTMLComponent()}}confirmUpdate(t){let e=super.confirmUpdate(t);return this.handleAction(e,fN,()=>this.renderHTMLComponent())}renderHTMLComponent(){let t=this.selectors&&this.selectors.foContent;if(t){et.empty(t);let e=pN[this.cell.shape];if(!e)return;let{html:n}=e;typeof n=="function"&&(n=n(this.cell)),n&&(typeof n=="string"?t.innerHTML=n:et.append(t,n))}}dispose(){this.cell.off("change:*",this.onCellChangeAny,this)}};rn([ln()],Lx.prototype,"dispose",null);Lx.config({bootstrap:[fN],actions:{html:fN}});Ba.registry.register("html-view",Lx,!0);var gY=fl("image",{attrs:{image:{refWidth:"100%",refHeight:"100%"}},propHooks:rY()},{selector:"image"});Sn();var mY=Xl.define({shape:"path",markup:[{tagName:"rect",selector:"bg"},{tagName:"path",selector:"body"},{tagName:"text",selector:"label"}],attrs:{bg:{refWidth:"100%",refHeight:"100%",fill:"none",stroke:"none",pointerEvents:"all"},body:{fill:"none",stroke:"#000",strokeWidth:2}},propHooks(i){let{path:t}=i,e=hn(i,["path"]);return t&&ge.setByPath(e,"attrs/body/refD",t),e}});Sn();var Sp=class extends Xl{get points(){return this.getPoints()}set points(t){this.setPoints(t)}getPoints(){return this.getAttrByPath("body/refPoints")}setPoints(t,e){return t==null?this.removePoints():this.setAttrByPath("body/refPoints",dN(t),e),this}removePoints(){return this.removeAttrByPath("body/refPoints"),this}};Sp.config({propHooks(i){let{points:t}=i,e=hn(i,["points"]);if(t){let n=dN(t);n&&ge.setByPath(e,"attrs/body/refPoints",n)}return e}});var bY=fl("polygon",{},{parent:Sp});var vY=fl("polyline",{},{parent:Sp});var yY=fl("rect",{attrs:{body:{refWidth:"100%",refHeight:"100%"}}});Sn();function aCt(i){return i?{tagName:"foreignObject",selector:"foreignObject",children:[{tagName:"div",ns:et.ns.xhtml,selector:"label",style:{width:"100%",height:"100%",position:"static",backgroundColor:"transparent",textAlign:"center",margin:0,padding:"0px 5px",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"}}]}:{tagName:"text",selector:"label",attrs:{textAnchor:"middle"}}}var lCt={shape:"text-block",markup:[{tagName:"rect",selector:"body"},aCt(L9)],attrs:{body:Object.assign(Object.assign({},zT),{refWidth:"100%",refHeight:"100%"}),foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}},propHooks(i){let{text:t}=i,e=hn(i,["text"]);return t&&ge.setByPath(e,"attrs/label/text",t),e},attrHooks:{text:{set(i,{cell:t,view:e,refBBox:n,elem:s,attrs:r}){if(s instanceof HTMLElement)s.textContent=i;else{let o=r.style||{},a={text:i,width:-5,height:"100%"},l=Object.assign({textVerticalAnchor:"middle"},o),c=xO.textWrap;return ke.call(c.set,this,a,{cell:t,view:e,elem:s,refBBox:n,attrs:l}),{fill:o.color||null}}},position(i,{refBBox:t,elem:e}){if(e instanceof SVGElement)return t.getCenter()}}}},xY=Xl.define(lCt);Sn();var gN=`${In.prefixCls}.clipboard.cells`;function wY(i){if(window.localStorage){let t=i.map(e=>e.toJSON());localStorage.setItem(gN,JSON.stringify(t))}}function _Y(){if(window.localStorage){let i=localStorage.getItem(gN),t=i?JSON.parse(i):[];if(t)return Zr.fromJSON(t)}}function SY(){window.localStorage&&localStorage.removeItem(gN)}var YT=class{constructor(){this.cells=[]}copy(t,e,n={}){this.options=Object.assign({},n);let r=(Zr.isModel(e)?e:e.model).cloneSubGraph(t,n);this.cells=cs.sortBy(Object.keys(r).map(o=>r[o]),o=>o.isEdge()?2:1),this.serialize(n)}cut(t,e,n={}){this.copy(t,e,n),(oe.isGraph(e)?e.model:e).batchUpdate("cut",()=>{t.forEach(r=>r.remove())})}paste(t,e={}){let n=Object.assign(Object.assign({},this.options),e),{offset:s,edgeProps:r,nodeProps:o}=n,a=20,l=20;s&&(a=typeof s=="number"?s:s.dx,l=typeof s=="number"?s:s.dy),this.deserialize(n);let c=this.cells;c.forEach(h=>{h.model=null,h.removeProp("zIndex"),(a||l)&&h.translate(a,l),o&&h.isNode()&&h.prop(o),r&&h.isEdge()&&h.prop(r)});let u=oe.isGraph(t)?t.model:t;return u.batchUpdate("paste",()=>{u.addCells(this.cells)}),this.copy(c,t,e),c}serialize(t){t.useLocalStorage!==!1&&wY(this.cells)}deserialize(t){if(t.useLocalStorage){let e=_Y();e&&(this.cells=e)}}isEmpty(t={}){return t.useLocalStorage&&this.deserialize(t),this.cells.length<=0}clean(){this.options={},this.cells=[],SY()}};oe.prototype.isClipboardEnabled=function(){let i=this.getPlugin("clipboard");return i?i.isEnabled():!1};oe.prototype.enableClipboard=function(){let i=this.getPlugin("clipboard");return i&&i.enable(),this};oe.prototype.disableClipboard=function(){let i=this.getPlugin("clipboard");return i&&i.disable(),this};oe.prototype.toggleClipboard=function(i){let t=this.getPlugin("clipboard");return t&&t.toggleEnabled(i),this};oe.prototype.isClipboardEmpty=function(i){let t=this.getPlugin("clipboard");return t?t.isEmpty(i):!0};oe.prototype.getCellsInClipboard=function(){let i=this.getPlugin("clipboard");return i?i.getCellsInClipboard():[]};oe.prototype.cleanClipboard=function(){let i=this.getPlugin("clipboard");return i&&i.clean(),this};oe.prototype.copy=function(i,t){let e=this.getPlugin("clipboard");return e&&e.copy(i,t),this};oe.prototype.cut=function(i,t){let e=this.getPlugin("clipboard");return e&&e.cut(i,t),this};oe.prototype.paste=function(i,t){let e=this.getPlugin("clipboard");return e?e.paste(i,t):[]};var XT=class extends Ii{get disabled(){return this.options.enabled!==!0}get cells(){return this.clipboardImpl.cells}constructor(t={}){super(),this.name="clipboard",this.options=Object.assign({enabled:!0},t)}init(t){this.graph=t,this.clipboardImpl=new YT,this.clipboardImpl.deserialize(this.options)}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return t===void 0&&(t=!this.isEnabled()),t?this.enable():this.disable(),this}isEmpty(t={}){return this.clipboardImpl.isEmpty(t)}getCellsInClipboard(){return this.cells}clean(t){return(!this.disabled||t)&&(this.clipboardImpl.clean(),this.notify("clipboard:changed",{cells:[]})),this}copy(t,e={}){return this.disabled||(this.clipboardImpl.copy(t,this.graph,Object.assign(Object.assign({},this.commonOptions),e)),this.notify("clipboard:changed",{cells:t})),this}cut(t,e={}){return this.disabled||(this.clipboardImpl.cut(t,this.graph,Object.assign(Object.assign({},this.commonOptions),e)),this.notify("clipboard:changed",{cells:t})),this}paste(t={},e=this.graph){return this.disabled?[]:this.clipboardImpl.paste(e,Object.assign(Object.assign({},this.commonOptions),t))}get commonOptions(){let t=this.options,{enabled:e}=t;return hn(t,["enabled"])}notify(t,e){this.trigger(t,e),this.graph.trigger(t,e)}dispose(){this.clean(!0),this.off()}};rn([ln()],XT.prototype,"dispose",null);Sn();function CY(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),e.push.apply(e,n)}return e}function MY(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};
vendor: 12,131 bytes, line 4951
4951t%2?CY(Object(e),!0).forEach(function(n){uCt(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):CY(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function xN(i){"@babel/helpers - typeof";return xN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xN(i)}function uCt(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}var Ix,hCt={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function tA(){if(Ix!==void 0)return Ix;Ix="";var i=document.createElement("p").style,t="Transform";for(var e in hCt)e+t in i&&(Ix=e);return Ix}function FY(){return tA()?"".concat(tA(),"TransitionProperty"):"transitionProperty"}function eA(){return tA()?"".concat(tA(),"Transform"):"transform"}function TY(i,t){var e=FY();e&&(i.style[e]=t,e!=="transitionProperty"&&(i.style.transitionProperty=t))}function mN(i,t){var e=eA();e&&(i.style[e]=t,e!=="transform"&&(i.style.transform=t))}function dCt(i){return i.style.transitionProperty||i.style[FY()]}function fCt(i){var t=window.getComputedStyle(i,null),e=t.getPropertyValue("transform")||t.getPropertyValue(eA());if(e&&e!=="none"){var n=e.replace(/[^0-9\-.,]/g,"").split(",");return{x:parseFloat(n[12]||n[4],0),y:parseFloat(n[13]||n[5],0)}}return{x:0,y:0}}var pCt=/matrix\((.*)\)/,gCt=/matrix3d\((.*)\)/;function mCt(i,t){var e=window.getComputedStyle(i,null),n=e.getPropertyValue("transform")||e.getPropertyValue(eA());if(n&&n!=="none"){var s,r=n.match(pCt);if(r)r=r[1],s=r.split(",").map(function(a){return parseFloat(a,10)}),s[4]=t.x,s[5]=t.y,mN(i,"matrix(".concat(s.join(","),")"));else{var o=n.match(gCt)[1];s=o.split(",").map(function(a){return parseFloat(a,10)}),s[12]=t.x,s[13]=t.y,mN(i,"matrix3d(".concat(s.join(","),")"))}}else mN(i,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}var bCt=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,Bx;function AY(i){var t=i.style.display;i.style.display="none",i.offsetHeight,i.style.display=t}function A0(i,t,e){var n=e;if(xN(t)==="object"){for(var s in t)t.hasOwnProperty(s)&&A0(i,s,t[s]);return}if(typeof n<"u"){typeof n=="number"&&(n="".concat(n,"px")),i.style[t]=n;return}return Bx(i,t)}function vCt(i){var t,e,n,s=i.ownerDocument,r=s.body,o=s&&s.documentElement;return t=i.getBoundingClientRect(),e=Math.floor(t.left),n=Math.floor(t.top),e-=o.clientLeft||r.clientLeft||0,n-=o.clientTop||r.clientTop||0,{left:e,top:n}}function UY(i,t){var e=i["page".concat(t?"Y":"X","Offset")],n="scroll".concat(t?"Top":"Left");if(typeof e!="number"){var s=i.document;e=s.documentElement[n],typeof e!="number"&&(e=s.body[n])}return e}function zY(i){return UY(i)}function VY(i){return UY(i,!0)}function Nx(i){var t=vCt(i),e=i.ownerDocument,n=e.defaultView||e.parentWindow;return t.left+=zY(n),t.top+=VY(n),t}function CN(i){return i!=null&&i==i.window}function HY(i){return CN(i)?i.document:i.nodeType===9?i:i.ownerDocument}function yCt(i,t,e){var n=e,s="",r=HY(i);return n=n||r.defaultView.getComputedStyle(i,null),n&&(s=n.getPropertyValue(t)||n[t]),s}var xCt=new RegExp("^(".concat(bCt,")(?!px)[a-z%]+$"),"i"),wCt=/^(top|right|bottom|left)$/,bN="currentStyle",vN="runtimeStyle",Cp="left",_Ct="px";function SCt(i,t){var e=i[bN]&&i[bN][t];if(xCt.test(e)&&!wCt.test(t)){var n=i.style,s=n[Cp],r=i[vN][Cp];i[vN][Cp]=i[bN][Cp],n[Cp]=t==="fontSize"?"1em":e||0,e=n.pixelLeft+_Ct,n[Cp]=s,i[vN][Cp]=r}return e===""?"auto":e}typeof window<"u"&&(Bx=window.getComputedStyle?yCt:SCt);function KT(i,t){return i==="left"?t.useCssRight?"right":i:t.useCssBottom?"bottom":i}function EY(i){if(i==="left")return"right";if(i==="right")return"left";if(i==="top")return"bottom";if(i==="bottom")return"top"}function kY(i,t,e){A0(i,"position")==="static"&&(i.style.position="relative");var n=-999,s=-999,r=KT("left",e),o=KT("top",e),a=EY(r),l=EY(o);r!=="left"&&(n=999),o!=="top"&&(s=999);var c="",u=Nx(i);("left"in t||"top"in t)&&(c=dCt(i)||"",TY(i,"none")),"left"in t&&(i.style[a]="",i.style[r]="".concat(n,"px")),"top"in t&&(i.style[l]="",i.style[o]="".concat(s,"px")),AY(i);var h=Nx(i),d={};for(var p in t)if(t.hasOwnProperty(p)){var g=KT(p,e),y=p==="left"?n:s,x=u[p]-h[p];g===p?d[g]=y+x:d[g]=y-x}A0(i,d),AY(i),("left"in t||"top"in t)&&TY(i,c);var w={};for(var M in t)if(t.hasOwnProperty(M)){var A=KT(M,e),C=t[M]-u[M];M===A?w[A]=d[A]+C:w[A]=d[A]-C}A0(i,w)}function CCt(i,t){var e=Nx(i),n=fCt(i),s={x:n.x,y:n.y};"left"in t&&(s.x=n.x+t.left-e.left),"top"in t&&(s.y=n.y+t.top-e.top),mCt(i,s)}function MCt(i,t,e){if(e.ignoreShake){var n=Nx(i),s=n.left.toFixed(0),r=n.top.toFixed(0),o=t.left.toFixed(0),a=t.top.toFixed(0);if(s===o&&r===a)return}e.useCssRight||e.useCssBottom?kY(i,t,e):e.useCssTransform&&eA()in document.body.style?CCt(i,t):kY(i,t,e)}function MN(i,t){for(var e=0;e<i.length;e++)t(i[e])}function jY(i){return Bx(i,"boxSizing")==="border-box"}var TCt=["margin","border","padding"],wN=-1,ACt=2,_N=1,ECt=0;function kCt(i,t,e){var n={},s=i.style,r;for(r in t)t.hasOwnProperty(r)&&(n[r]=s[r],s[r]=t[r]);e.call(i);for(r in t)t.hasOwnProperty(r)&&(s[r]=n[r])}function Ox(i,t,e){var n=0,s,r,o;for(r=0;r<t.length;r++)if(s=t[r],s)for(o=0;o<e.length;o++){var a=void 0;s==="border"?a="".concat(s).concat(e[o],"Width"):a=s+e[o],n+=parseFloat(Bx(i,a))||0}return n}var Qc={getParent:function(t){var e=t;do e.nodeType===11&&e.host?e=e.host:e=e.parentNode;while(e&&e.nodeType!==1&&e.nodeType!==9);return e}};MN(["Width","Height"],function(i){Qc["doc".concat(i)]=function(t){var e=t.document;return Math.max(e.documentElement["scroll".concat(i)],e.body["scroll".concat(i)],Qc["viewport".concat(i)](e))},Qc["viewport".concat(i)]=function(t){var e="client".concat(i),n=t.document,s=n.body,r=n.documentElement,o=r[e];return n.compatMode==="CSS1Compat"&&o||s&&s[e]||o}});function PY(i,t,e){var n=e;if(CN(i))return t==="width"?Qc.viewportWidth(i):Qc.viewportHeight(i);if(i.nodeType===9)return t==="width"?Qc.docWidth(i):Qc.docHeight(i);var s=t==="width"?["Left","Right"]:["Top","Bottom"],r=Math.floor(t==="width"?i.getBoundingClientRect().width:i.getBoundingClientRect().height),o=jY(i),a=0;(r==null||r<=0)&&(r=void 0,a=Bx(i,t),(a==null||Number(a)<0)&&(a=i.style[t]||0),a=Math.floor(parseFloat(a))||0),n===void 0&&(n=o?_N:wN);var l=r!==void 0||o,c=r||a;return n===wN?l?c-Ox(i,["border","padding"],s):a:l?n===_N?c:c+(n===ACt?-Ox(i,["border"],s):Ox(i,["margin"],s)):a+Ox(i,TCt.slice(n),s)}var PCt={position:"absolute",visibility:"hidden",display:"block"};function RY(){for(var i=arguments.length,t=new Array(i),e=0;e<i;e++)t[e]=arguments[e];var n,s=t[0];return s.offsetWidth!==0?n=PY.apply(void 0,t):kCt(s,PCt,function(){n=PY.apply(void 0,t)}),n}MN(["width","height"],function(i){var t=i.charAt(0).toUpperCase()+i.slice(1);Qc["outer".concat(t)]=function(n,s){return n&&RY(n,i,s?ECt:_N)};var e=i==="width"?["Left","Right"]:["Top","Bottom"];Qc[i]=function(n,s){var r=s;if(r!==void 0){if(n){var o=jY(n);return o&&(r+=Ox(n,["padding","border"],e)),A0(n,i,r)}return}return n&&RY(n,i,wN)}});function WY(i,t){for(var e in t)t.hasOwnProperty(e)&&(i[e]=t[e]);return i}var qn={getWindow:function(t){if(t&&t.document&&t.setTimeout)return t;var e=t.ownerDocument||t;return e.defaultView||e.parentWindow},getDocument:HY,offset:function(t,e,n){if(typeof e<"u")MCt(t,e,n||{});else return Nx(t)},isWindow:CN,each:MN,css:A0,clone:function(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);var s=t.overflow;if(s)for(e in t)t.hasOwnProperty(e)&&(n.overflow[e]=t.overflow[e]);return n},mix:WY,getWindowScrollLeft:function(t){return zY(t)},getWindowScrollTop:function(t){return VY(t)},merge:function(){for(var t={},e=0;e<arguments.length;e++)qn.mix(t,e<0||arguments.length<=e?void 0:arguments[e]);return t},viewportWidth:0,viewportHeight:0};WY(qn,Qc);var yN=qn.getParent;function SN(i){if(qn.isWindow(i)||i.nodeType===9)return null;var t=qn.getDocument(i),e=t.body,n,s=qn.css(i,"position"),r=s==="fixed"||s==="absolute";if(!r)return i.nodeName.toLowerCase()==="html"?null:yN(i);for(n=yN(i);n&&n!==e&&n.nodeType!==9;n=yN(n))if(s=qn.css(n,"position"),s!=="static")return n;return null}var DY=qn.getParent;function RCt(i){if(qn.isWindow(i)||i.nodeType===9)return!1;var t=qn.getDocument(i),e=t.body,n=null;for(n=DY(i);n&&n!==e&&n!==t;n=DY(n)){var s=qn.css(n,"position");if(s==="fixed")return!0}return!1}function TN(i,t){for(var e={left:0,right:1/0,top:0,bottom:1/0},n=SN(i),s=qn.getDocument(i),r=s.defaultView||s.parentWindow,o=s.body,a=s.documentElement;n;){if((navigator.userAgent.indexOf("MSIE")===-1||n.clientWidth!==0)&&n!==o&&n!==a&&qn.css(n,"overflow")!=="visible"){var l=qn.offset(n);l.left+=n.clientLeft,l.top+=n.clientTop,e.top=Math.max(e.top,l.top),e.right=Math.min(e.right,l.left+n.clientWidth),e.bottom=Math.min(e.bottom,l.top+n.clientHeight),e.left=Math.max(e.left,l.left)}else if(n===o||n===a)break;n=SN(n)}var c=null;if(!qn.isWindow(i)&&i.nodeType!==9){c=i.style.position;var u=qn.css(i,"position");u==="absolute"&&(i.style.position="fixed")}var h=qn.getWindowScrollLeft(r),d=qn.getWindowScrollTop(r),p=qn.viewportWidth(r),g=qn.viewportHeight(r),y=a.scrollWidth,x=a.scrollHeight,w=window.getComputedStyle(o);if(w.overflowX==="hidden"&&(y=r.innerWidth),w.overflowY==="hidden"&&(x=r.innerHeight),i.style&&(i.style.position=c),t||RCt(i))e.left=Math.max(e.left,h),e.top=Math.max(e.top,d),e.right=Math.min(e.right,h+p),e.bottom=Math.min(e.bottom,d+g);else{var M=Math.max(y,h+p);e.right=Math.min(e.right,M);var A=Math.max(x,d+g);e.bottom=Math.min(e.bottom,A)}return e.top>=0&&e.left>=0&&e.bottom>e.top&&e.right>e.left?e:null}function DCt(i,t,e,n){var s=qn.clone(i),r={width:t.width,height:t.height};return n.adjustX&&s.left<e.left&&(s.left=e.left),n.resizeWidth&&s.left>=e.left&&s.left+r.width>e.right&&(r.width-=s.left+r.width-e.right),n.adjustX&&s.left+r.width>e.right&&(s.left=Math.max(e.right-r.width,e.left)),n.adjustY&&s.top<e.top&&(s.top=e.top),n.resizeHeight&&s.top>=e.top&&s.top+r.height>e.bottom&&(r.height-=s.top+r.height-e.bottom),n.adjustY&&s.top+r.height>e.bottom&&(s.top=Math.max(e.bottom-r.height,e.top)),qn.mix(s,r)}function AN(i){var t,e,n;if(!qn.isWindow(i)&&i.nodeType!==9)t=qn.offset(i),e=qn.outerWidth(i),n=qn.outerHeight(i);else{var s=qn.getWindow(i);t={left:qn.getWindowScrollLeft(s),top:qn.getWindowScrollTop(s)},e=qn.viewportWidth(s),n=qn.viewportHeight(s)}return t.width=e,t.height=n,t}function LY(i,t){var e=t.charAt(0),n=t.charAt(1),s=i.width,r=i.height,o=i.left,a=i.top;return e==="c"?a+=r/2:e==="b"&&(a+=r),n==="c"?o+=s/2:n==="r"&&(o+=s),{left:o,top:a}}function JT(i,t,e,n,s){var r=LY(t,e[1]),o=LY(i,e[0]),a=[o.left-r.left,o.top-r.top];return{left:Math.round(i.left-a[0]+n[0]-s[0]),top:Math.round(i.top-a[1]+n[1]-s[1])}}function IY(i,t,e){return i.left<e.left||i.left+t.width>e.right}function OY(i,t,e){return i.top<e.top||i.top+t.height>e.bottom}function LCt(i,t,e){return i.left>e.right||i.left+t.width<e.left}function ICt(i,t,e){return i.top>e.bottom||i.top+t.height<e.top}function ZT(i,t,e){var n=[];return qn.each(i,function(s){n.push(s.replace(t,function(r){return e[r]}))}),n}function QT(i,t){return i[t]=-i[t],i}function NY(i,t){var e;return/%$/.test(i)?e=parseInt(i.substring(0,i.length-1),10)/100*t:e=parseInt(i,10),e||0}function BY(i,t){i[0]=NY(i[0],t.width),i[1]=NY(i[1],t.height)}function $Y(i,t,e,n){var s=e.points,r=e.offset||[0,0],o=e.targetOffset||[0,0],a=e.overflow,l=e.source||i;r=[].concat(r),o=[].concat(o),a=a||{};var c={},u=0,h=!!(a&&a.alwaysByViewport),d=TN(l,h),p=AN(l);BY(r,p),BY(o,t);var g=JT(p,t,s,r,o),y=qn.merge(p,g);if(d&&(a.adjustX||a.adjustY)&&n){if(a.adjustX&&IY(g,p,d)){var x=ZT(s,/[lr]/gi,{l:"r",r:"l"}),w=QT(r,0),M=QT(o,0),A=JT(p,t,x,w,M);LCt(A,p,d)||(u=1,s=x,r=w,o=M)}if(a.adjustY&&OY(g,p,d)){var C=ZT(s,/[tb]/gi,{t:"b",b:"t"}),R=QT(r,1),k=QT(o,1),O=JT(p,t,C,R,k);ICt(O,p,d)||(u=1,s=C,r=R,o=k)}u&&(g=JT(p,t,s,r,o),qn.mix(y,g));var I=IY(g,p,d),U=OY(g,p,d);if(I||U){var V=s;I&&(V=ZT(s,/[lr]/gi,{l:"r",r:"l"})),U&&(V=ZT(s,/[tb]/gi,{t:"b",b:"t"})),s=V,r=e.offset||[0,0],o=e.targetOffset||[0,0]}
4951c.adjustX=a.adjustX&&I,c.adjustY=a.adjustY&&U,(c.adjustX||c.adjustY)&&(y=DCt(g,p,d,c))}return y.width!==p.width&&qn.css(l,"width",qn.width(l)+y.width-p.width),y.height!==p.height&&qn.css(l,"height",qn.height(l)+y.height-p.height),qn.offset(l,{left:y.left,top:y.top},{useCssRight:e.useCssRight,useCssBottom:e.useCssBottom,useCssTransform:e.useCssTransform,ignoreShake:e.ignoreShake}),{points:s,offset:r,targetOffset:o,overflow:c}}function OCt(i,t){var e=TN(i,t),n=AN(i);return!e||n.left+n.width<=e.left||n.top+n.height<=e.top||n.left>=e.right||n.top>=e.bottom}function GY(i,t,e){var n=e.target||t,s=AN(n),r=!OCt(n,e.overflow&&e.overflow.alwaysByViewport);return $Y(i,s,e,r)}GY.__getOffsetParent=SN;GY.__getVisibleRectForElement=TN;function qY(i,t,e){var n,s,r=qn.getDocument(i),o=r.defaultView||r.parentWindow,a=qn.getWindowScrollLeft(o),l=qn.getWindowScrollTop(o),c=qn.viewportWidth(o),u=qn.viewportHeight(o);"pageX"in t?n=t.pageX:n=a+t.clientX,"pageY"in t?s=t.pageY:s=l+t.clientY;var h={left:n,top:s,width:0,height:0},d=n>=0&&n<=a+c&&s>=0&&s<=l+u,p=[e.points[0],"cc"];return $Y(i,h,MY(MY({},e),{},{points:p}),d)}var YY=`.x6-widget-dnd {
4952  position: absolute;
4953  top: -10000px;
4954  left: -10000px;
4955  z-index: 999999;
4956  display: none;
4957  cursor: move;
4958  opacity: 0.7;
4959}
4960.x6-widget-dnd.dragging {
4961  display: inline-block;
4962}
4963.x6-widget-dnd.dragging * {
4964  pointer-events: none !important;
4965}
4966.x6-widget-dnd .x6-graph {
4967  background: transparent;
4968  box-shadow: none;
4969}
4970`;var EN={getDragNode:i=>i.clone(),getDropNode:i=>i.clone()},E0=class extends Wi{get targetScroller(){return this.options.target.getPlugin("scroller")}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}get snapline(){return this.options.target.getPlugin("snapline")}constructor(t){super(),this.name="dnd",this.options=Object.assign(Object.assign({},EN),t),this.init()}init(){us.ensure(this.name,YY),this.container=document.createElement("div"),et.addClass(this.container,this.prefixClassName("widget-dnd")),this.draggingGraph=new oe(Object.assign(Object.assign({},this.options.delegateGraphOptions),{container:document.createElement("div"),width:1,height:1,async:!1})),et.append(this.container,this.draggingGraph.container)}start(t,e){var n;let s=e;s.preventDefault(),this.targetModel.startBatch("dnd"),et.addClass(this.container,"dragging"),et.appendTo(this.container,this.options.draggingContainer||document.body),this.sourceNode=t,this.prepareDragging(t,s.clientX,s.clientY);let r=this.updateNodePosition(s.clientX,s.clientY);this.isSnaplineEnabled()&&(this.snapline.captureCursorOffset({e:s,node:t,cell:t,view:this.draggingView,x:r.x,y:r.y}),(n=this.draggingNode)===null||n===void 0||n.on("change:position",this.snap,this)),this.delegateDocumentEvents(HT,s.data)}isSnaplineEnabled(){var t;return(t=this.snapline)===null||t===void 0?void 0:t.isEnabled()}prepareDragging(t,e,n){let s=this.draggingGraph,r=s.model,o=this.options.getDragNode(t,{sourceNode:t,draggingGraph:s,targetGraph:this.targetGraph});o.position(0,0);let a=5;if(this.isSnaplineEnabled()&&(a+=this.snapline.options.tolerance||0),this.isSnaplineEnabled()||this.options.scaled){let u=this.targetGraph.transform.getScale();s.scale(u.sx,u.sy),a*=Math.max(u.sx,u.sy)}else s.scale(1,1);this.clearDragging(),r.resetCells([o]);let l=s.findViewByCell(o);l.undelegateEvents(),l.cell.off("changed"),s.fitToContent({padding:a,allowNewOrigin:"any",useCellGeometry:!1});let c=l.getBBox();this.geometryBBox=l.getBBox({useCellGeometry:!0}),this.delta=this.geometryBBox.getTopLeft().diff(c.getTopLeft()),this.draggingNode=o,this.draggingView=l,this.draggingBBox=o.getBBox(),this.padding=a,this.updateGraphPosition(e,n)}updateGraphPosition(t,e){let n=this.delta,s=this.geometryBBox,r=this.padding||5,o={left:t-n.x-s.width/2-r,top:e-n.y-s.height/2-r};this.draggingGraph&&qY(this.container,{clientX:o.left,clientY:o.top},{points:["tl"]})}updateNodePosition(t,e){let n=this.targetGraph.clientToLocal(t,e),s=this.draggingBBox;return s&&(n.x-=s.width/2,n.y-=s.height/2,this.draggingNode.position(n.x,n.y)),n}snap({cell:t,current:e,options:n}){let s=t;if(n.snapped){let r=this.draggingBBox;s.position(r.x+n.tx,r.y+n.ty,{silent:!0}),this.draggingView.translate(),s.position(e.x,e.y,{silent:!0}),this.snapOffset={x:n.tx,y:n.ty}}else this.snapOffset=null}onMouseMove(t){this.onDragging(t)}onMouseUp(t){this.onDragEnd(t)}onDragging(t){let e=this.draggingView;if(e){t.preventDefault();let n=this.normalizeEvent(t),s=n.clientX,r=n.clientY;this.updateGraphPosition(s,r);let o=this.updateNodePosition(s,r),a=this.targetGraph.options.embedding.enabled,l=(a||this.isSnaplineEnabled())&&this.isInsideValidArea({x:s,y:r});
4970if(a){e.setEventData(n,{graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView});let c=e.getEventData(n);l?e.processEmbedding(n,c):e.clearEmbedding(c),this.candidateEmbedView=c.candidateEmbedView}this.isSnaplineEnabled()&&(l?this.snapline.snapOnMoving({e:n,view:e,x:o.x,y:o.y}):this.snapline.hide())}}onDragEnd(t){let e=this.draggingNode;if(e){let n=this.normalizeEvent(t),s=this.draggingView,r=this.draggingBBox,o=this.snapOffset,a=r.x,l=r.y;o&&(a+=o.x,l+=o.y),e.position(a,l,{silent:!0});let c=this.drop(e,{x:n.clientX,y:n.clientY}),u=h=>{h?(this.onDropped(e),this.targetGraph.options.embedding.enabled&&s&&(s.setEventData(n,{cell:h,graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView}),s.finalizeEmbedding(n,s.getEventData(n)))):this.onDropInvalid(),this.candidateEmbedView=null,this.targetModel.stopBatch("dnd")};ke.isAsync(c)?(this.undelegateDocumentEvents(),c.then(u)):u(c)}}clearDragging(){this.draggingNode&&(this.sourceNode=null,this.draggingNode.remove(),this.draggingNode=null,this.draggingView=null,this.delta=null,this.padding=null,this.snapOffset=null,this.undelegateDocumentEvents())}onDropped(t){this.draggingNode===t&&(this.clearDragging(),et.removeClass(this.container,"dragging"),et.remove(this.container))}onDropInvalid(){let t=this.draggingNode;t&&this.onDropped(t)}isInsideValidArea(t){let e,n=null,s=this.targetGraph,r=this.targetScroller;this.options.dndContainer&&(n=this.getDropArea(this.options.dndContainer));let o=n?.containsPoint(t);if(r)if(r.options.autoResize)e=this.getDropArea(r.container);else{let a=this.getDropArea(r.container);e=this.getDropArea(s.container).intersectsWithRect(a)}else e=this.getDropArea(s.container);return!o&&e&&e.containsPoint(t)}getDropArea(t){let e=et.offset(t),n=document.body.scrollTop||document.documentElement.scrollTop,s=document.body.scrollLeft||document.documentElement.scrollLeft;return Pe.create({x:e.left+parseInt(et.css(t,"border-left-width"),10)-s,y:e.top+parseInt(et.css(t,"border-top-width"),10)-n,width:t.clientWidth,height:t.clientHeight})}drop(t,e){if(this.isInsideValidArea(e)){let n=this.targetGraph,s=n.model,r=n.clientToLocal(e),o=this.sourceNode,a=this.options.getDropNode(t,{sourceNode:o,draggingNode:t,targetGraph:this.targetGraph,draggingGraph:this.draggingGraph}),l=a.getBBox();r.x+=l.x-l.width/2,r.y+=l.y-l.height/2;let c=this.snapOffset?1:n.getGridSize();a.position(fo(r.x,c),fo(r.y,c)),a.removeZIndex();let u=this.options.validateNode,h=u?u(a,{sourceNode:o,draggingNode:t,droppingNode:a,targetGraph:n,draggingGraph:this.draggingGraph}):!0;return typeof h=="boolean"?h?(s.addCell(a,{stencil:this.cid}),a):null:ke.toDeferredBoolean(h).then(d=>d?(s.addCell(a,{stencil:this.cid}),a):null)}return null}onRemove(){this.draggingGraph&&(this.draggingGraph.view.remove(),this.draggingGraph.dispose())}dispose(){this.remove(),us.clean(this.name)}};rn([ln()],E0.prototype,"dispose",null);Sn();Sn();oe.prototype.toSVG=function(i,t){let e=this.getPlugin("export");e&&e.toSVG(i,t)};oe.prototype.toSVGAsync=function(i){return rM(this,void 0,void 0,function*(){return new Promise(t=>{this.toSVG(t,i)})})};oe.prototype.toPNG=function(i,t){let e=this.getPlugin("export");e&&e.toPNG(i,t)};oe.prototype.toPNGAsync=function(i){return rM(this,void 0,void 0,function*(){return new Promise(t=>{this.toPNG(t,i)})})};oe.prototype.toJPEG=function(i,t){let e=this.getPlugin("export");e&&e.toJPEG(i,t)};oe.prototype.toJPEGAsync=function(i){return rM(this,void 0,void 0,function*(){return new Promise(t=>{this.toJPEG(t,i)})})};oe.prototype.exportPNG=function(i,t){let e=this.getPlugin("export");e&&e.exportPNG(i,t)};oe.prototype.exportJPEG=function(i,t){let e=this.getPlugin("export");e&&e.exportJPEG(i,t)};oe.prototype.exportSVG=function(i,t){let e=this.getPlugin("export");e&&e.exportSVG(i,t)};var k0=class extends Ii{constructor(){super(...arguments),this.name="export"}get view(){return this.graph.view}init(t){this.graph=t}exportPNG(t="chart",e={}){this.toPNG(n=>{bd.downloadDataUri(n,t)},e)}exportJPEG(t="chart",e={}){this.toJPEG(n=>{bd.downloadDataUri(n,t)},e)}exportSVG(t="chart",e={}){this.toSVG(n=>{bd.downloadDataUri(bd.svgToDataUrl(n),t)},e)}toSVG(t,e={}){this.notify("before:export",e),Object.hasOwn(e,"copyStyles")||(e.copyStyles=!0),Object.hasOwn(e,"serializeImages")||(e.serializeImages=!0);let n=this.view.svg,s=_i.create(n).clone(),r=s.node,o=s.findOne(`.${this.view.prefixClassName("graph-svg-stage")}`),a=e.viewBox||this.graph.graphToLocal(this.graph.getContentBBox()),l=e.preserveDimensions;
4970if(l){let h=typeof l=="boolean"?a:l;s.attr({width:h.width,height:h.height})}if(s.removeAttribute("style").attr("viewBox",[a.x,a.y,a.width,a.height].join(" ")),o.removeAttribute("transform"),e.copyStyles){let h=n.ownerDocument,d=Array.from(n.querySelectorAll("*")),p=Array.from(r.querySelectorAll("*")),g=h.implementation.createHTMLDocument("x6-export-defaults"),y=g.importNode(n,!0);g.body.appendChild(y);let x=Array.from(y.querySelectorAll("*")),w={};x.forEach((A,C)=>{let R=window.getComputedStyle(A,null),k={};for(let O=0;O<R.length;O+=1){let I=R[O],U=R.getPropertyValue(I);k[I]=U}w[C]=k});let M={};d.forEach((A,C)=>{let R=window.getComputedStyle(A,null),k=w[C]||{},O={};for(let I=0;I<R.length;I+=1){let U=R[I],V=R.getPropertyValue(U);V!==k[U]&&(O[U]=V)}M[C]=O}),p.forEach((A,C)=>{et.css(A,M[C])})}let c=e.stylesheet;if(typeof c=="string"){let h=n.ownerDocument.implementation.createDocument(null,"xml",null).createCDATASection(c);s.prepend(_i.create("style",{type:"text/css"},[h]))}let u=()=>{let h=e.beforeSerialize;if(typeof h=="function"){let p=ke.call(h,this.graph,r);p instanceof SVGSVGElement&&(r=p)}let d=new XMLSerializer().serializeToString(r).replace(/&nbsp;/g,"\xA0");this.notify("after:export",e),t(d)};if(e.serializeImages){let h=s.find("image").map(d=>new Promise(p=>{let g=d.attr("xlink:href")||d.attr("href");bd.imageToDataUri(g,(y,x)=>{!y&&x&&(d.attr("xlink:href",x),d.attr("href",x)),p()})}));Promise.all(h).then(u)}else u()}toDataURL(t,e){let n=e.viewBox||this.graph.getContentBBox(),s=dn.normalizeSides(e.padding);e.width&&e.height&&(s.left+s.right>=e.width&&(s.left=s.right=0),s.top+s.bottom>=e.height&&(s.top=s.bottom=0));let r=new Pe(-s.left,-s.top,s.left+s.right,s.top+s.bottom);if(e.width&&e.height){let u=n.width+s.left+s.right,h=n.height+s.top+s.bottom;r.scale(u/e.width,h/e.height)}n=Pe.create(n).moveAndExpand(r);let o=typeof e.width=="number"&&typeof e.height=="number"?{width:e.width,height:e.height}:n,a=e.ratio?e.ratio:1;(!Number.isFinite(a)||a===0)&&(a=1);let l={width:Math.max(Math.round(o.width*a),1),height:Math.max(Math.round(o.height*a),1)};{let u=document.createElement("canvas"),h=u.getContext("2d");u.width=l.width,u.height=l.height;let d=l.width-1,p=l.height-1;h.fillStyle="rgb(1,1,1)",h.fillRect(d,p,1,1);let g=h.getImageData(d,p,1,1).data;if(g[0]!==1||g[1]!==1||g[2]!==1)throw new Error("size exceeded")}let c=new Image;c.onload=()=>{let u=document.createElement("canvas");u.width=l.width,u.height=l.height;let h=u.getContext("2d");h.fillStyle=e.backgroundColor||"white",h.fillRect(0,0,l.width,l.height);try{h.drawImage(c,0,0,l.width,l.height);let d=u.toDataURL(e.type,e.quality);t(d)}catch{}},this.toSVG(u=>{c.src=`data:image/svg+xml,${encodeURIComponent(u)}`},Object.assign(Object.assign({},e),{viewBox:n,serializeImages:!0,preserveDimensions:Object.assign({},l)}))}toPNG(t,e={}){this.toDataURL(t,Object.assign(Object.assign({},e),{type:"image/png"}))}toJPEG(t,e={}){this.toDataURL(t,Object.assign(Object.assign({},e),{type:"image/jpeg"}))}notify(t,e){this.trigger(t,e),this.graph.trigger(t,e)}dispose(){this.off()}};rn([ln()],k0.prototype,"dispose",null);Sn();function Hu(i){return i==="cell:added"}function kd(i){return i==="cell:removed"}function P0(i){return i!=null&&i.startsWith("cell:change:")}function XY(i){let t=["cell:added","cell:removed","cell:change:*"],e=["batch:start","batch:stop"],n=i.eventNames?i.eventNames.filter(s=>!(P0(s)||t.includes(s)||e.includes(s))):t;return Object.assign(Object.assign({enabled:!0},i),{eventNames:n,applyOptionsList:i.applyOptionsList||["propertyPath"],revertOptionsList:i.revertOptionsList||["propertyPath"]})}function kN(i){let t=[];for(let e=0,n=i.length;e<n;e+=1){let s=i[e],r=null;if(Hu(s.event)){let o=s.data.id;for(let a=0;a<e;a+=1)if(i[a].data.id===o){r=a;break}}r!==null?t.splice(r,0,s):t.push(s)}return t}Sn();var Fx=class extends Ii{constructor(t){super(),this.map={},this.command=t.history,this.cancelInvalid=t.cancelInvalid!==!1,this.command.on("add",this.onCommandAdded,this)}onCommandAdded({cmds:t}){return Array.isArray(t)?t.every(e=>this.isValidCommand(e)):this.isValidCommand(t)}isValidCommand(t){if(t.options&&t.options.validation===!1)return!0;let e=t.event&&this.map[t.event]||[],n=null;return e.forEach(s=>{let r=0,o=a=>{let l=s[r];r+=1;try{l?l(a,t,o):n=a}catch(c){o(c)}};o(n)}
4970),n?(this.cancelInvalid&&this.command.cancel(),this.emit("invalid",{err:n}),!1):!0}validate(t,...e){let n=Array.isArray(t)?t:t.split(/\s+/);return e.forEach(s=>{if(typeof s!="function")throw new Error(`${n.join(" ")} requires callback functions.`)}),n.forEach(s=>{this.map[s]==null&&(this.map[s]=[]),this.map[s].push(e)}),this}dispose(){this.command.off("add",this.onCommandAdded,this)}};rn([ln()],Fx.prototype,"dispose",null);oe.prototype.isHistoryEnabled=function(){let i=this.getPlugin("history");return i?i.isEnabled():!1};oe.prototype.enableHistory=function(){let i=this.getPlugin("history");return i&&i.enable(),this};oe.prototype.disableHistory=function(){let i=this.getPlugin("history");return i&&i.disable(),this};oe.prototype.toggleHistory=function(i){let t=this.getPlugin("history");return t&&t.toggleEnabled(i),this};oe.prototype.undo=function(i){let t=this.getPlugin("history");return t&&t.undo(i),this};oe.prototype.redo=function(i){let t=this.getPlugin("history");return t&&t.redo(i),this};oe.prototype.undoAndCancel=function(i){let t=this.getPlugin("history");return t&&t.cancel(i),this};oe.prototype.canUndo=function(){let i=this.getPlugin("history");return i?i.canUndo():!1};oe.prototype.canRedo=function(){let i=this.getPlugin("history");return i?i.canRedo():!1};oe.prototype.cleanHistory=function(i){let t=this.getPlugin("history");return t&&t.clean(i),this};oe.prototype.getHistoryStackSize=function(){return this.getPlugin("history").getSize()};oe.prototype.getUndoStackSize=function(){return this.getPlugin("history").getUndoSize()};oe.prototype.getRedoStackSize=function(){return this.getPlugin("history").getRedoSize()};oe.prototype.getUndoRemainSize=function(){return this.getPlugin("history").getUndoRemainSize()};var nA=class extends Ii{constructor(t={}){super(),this.name="history",this.batchCommands=null,this.batchLevel=0,this.lastBatchIndex=-1,this.freezed=!1,this.stackSize=0,this.handlers=[];let{stackSize:e=0}=t;this.stackSize=e,this.options=XY(t),this.validator=new Fx({history:this,cancelInvalid:this.options.cancelInvalid})}init(t){this.graph=t,this.model=this.graph.model,this.clean(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return t!=null?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}undo(t={}){if(!this.disabled){let e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack.push(e),this.notify("undo",e,t))}return this}redo(t={}){if(!this.disabled){let e=this.redoStack.pop();e&&(this.applyCommand(e,t),this.undoStackPush(e),this.notify("redo",e,t))}return this}cancel(t={}){if(!this.disabled){let e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack=[],this.notify("cancel",e,t))}return this}getSize(){return this.stackSize}getUndoRemainSize(){let t=this.undoStack.length;return this.stackSize-t}getUndoSize(){return this.undoStack.length}getRedoSize(){return this.redoStack.length}canUndo(){return!this.disabled&&this.undoStack.length>0}canRedo(){return!this.disabled&&this.redoStack.length>0}clean(t={}){return this.undoStack=[],this.redoStack=[],this.notify("clean",null,t),this}get disabled(){return this.options.enabled!==!0}validate(t,...e){return this.validator.validate(t,...e),this}startListening(){this.model.on("batch:start",this.initBatchCommand,this),this.model.on("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&this.options.eventNames.forEach((t,e)=>{this.handlers[e]=this.addCommand.bind(this,t),this.model.on(t,this.handlers[e])}),this.validator.on("invalid",t=>this.trigger("invalid",t))}stopListening(){this.model.off("batch:start",this.initBatchCommand,this),this.model.off("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&(this.options.eventNames.forEach((t,e)=>{this.model.off(t,this.handlers[e])}),this.handlers.length=0),this.validator.off("invalid")}createCommand(t){return{batch:t?t.batch:!1,data:{}}}revertCommand(t,e){this.freezed=!0;let n=Array.isArray(t)?kN(t):[t];for(let s=n.length-1;s>=0;s-=1){let r=n[s],o=Object.assign(Object.assign({},e),ge.pick(r.options,this.options.revertOptionsList||[]));this.executeCommand(r,!0,o)}this.freezed=!1}applyCommand(t,e){this.freezed=!0;let n=Array.isArray(t)?kN(t):[t];for(let s=0;s<n.length;s+=1){let r=n[s],o=Object.assign(Object.assign({},e),ge.pick(r.options,this.options.applyOptionsList||[]));this.executeCommand(r,!1,o)}this.freezed=!1}executeCommand(t,e,n){let s=this.model,r=s.getCell(t.data.id),o=t.event;if(Hu(o)&&e||kd(o)&&!e)r&&r.remove(n);else if(Hu(o)&&!e||kd(o)&&e){let a=t.data;a.node?s.addNode(a.props,n):a.edge&&s.addEdge(a.props,n)}else if(P0(o)){let a=t.data,l=a.key;if(l&&r){let c=e?a.prev[l]:a.next[l];a.key==="attrs"&&this.ensureUndefinedAttrs(c,e?a.next[l]:a.prev[l])&&(n.dirty=!0),r.prop(l,c,n)}}else{let a=this.options.executeCommand;a&&ke.call(a,this,t,e,n)}}addCommand(t,e){if(this.freezed||this.disabled)return;let n=e,s=n.options||{};if(s.dryrun||Hu(t)&&this.options.ignoreAdd||kd(t)&&this.options.ignoreRemove||P0(t)&&this.options.ignoreChange)return;let r=this.options.beforeAddCommand;if(r!=null&&ke.call(r,this,t,e)===!1)return;t==="cell:change:*"&&(t=`cell:change:${n.key}`);let o=n.cell,a=Zr.isModel(o),l;if(this.batchCommands){l=this.batchCommands[Math.max(this.lastBatchIndex,0)];let u=a&&!l.modelChange||l.data.id!==o.id,h=l.event!==t;if(this.lastBatchIndex>=0&&(u||h)){let d=this.batchCommands.findIndex(p=>(a&&p.modelChange||p.data.id===o.id)&&p.event===t);d<0||Hu(t)||kd(t)?l=this.createCommand({batch:!0}):(l=this.batchCommands[d],this.batchCommands.splice(d,1)),this.batchCommands.push(l),this.lastBatchIndex=this.batchCommands.length-1}}else l=this.createCommand({batch:!1});if(Hu(t)||kd(t)){let u=l.data;
4970return l.event=t,l.options=s,u.id=o.id,u.props=ge.cloneDeep(o.toJSON()),o.isEdge()?u.edge=!0:o.isNode()&&(u.node=!0),this.push(l,s)}if(P0(t)){let u=e.key,h=l.data;return(!l.batch||!l.event)&&(l.event=t,l.options=s,h.key=u,h.prev==null&&(h.prev={}),h.prev[u]=ge.cloneDeep(o.previous(u)),a?l.modelChange=!0:h.id=o.id),h.next==null&&(h.next={}),h.next[u]=ge.cloneDeep(o.prop(u)),this.push(l,s)}let c=this.options.afterAddCommand;c&&ke.call(c,this,t,e,l),this.push(l,s)}initBatchCommand(t){this.freezed||(this.batchCommands?this.batchLevel+=1:(this.batchCommands=[this.createCommand({batch:!0})],this.batchLevel=0,this.lastBatchIndex=-1))}storeBatchCommand(t){if(!this.freezed)if(this.batchCommands&&this.batchLevel<=0){let e=this.filterBatchCommand(this.batchCommands);e.length>0&&(this.redoStack=[],this.undoStackPush(e),this.consolidateCommands(),this.notify("add",e,t)),this.batchCommands=null,this.lastBatchIndex=-1,this.batchLevel=0}else this.batchCommands&&this.batchLevel>0&&(this.batchLevel-=1)}filterBatchCommand(t){let e=t.slice(),n=[];for(;e.length>0;){let s=e.shift(),r=s.event,o=s.data.id;if(r!=null&&(o!=null||s.modelChange)){if(Hu(r)){let a=e.findIndex(l=>kd(l.event)&&l.data.id===o);if(a>=0){e=e.filter((l,c)=>a<c||l.data.id!==o);continue}}else if(kd(r)){let a=e.findIndex(l=>Hu(l.event)&&l.data.id===o);if(a>=0){e.splice(a,1);continue}}else if(P0(r)){let a=s.data;if(ge.isEqual(a.prev,a.next))continue}n.push(s)}}return n}notify(t,e,n){let s=e==null?null:Array.isArray(e)?e:[e];this.emit(t,{cmds:s,options:n}),this.graph.trigger(`history:${t}`,{cmds:s,options:n}),this.emit("change",{cmds:s,options:n}),this.graph.trigger("history:change",{cmds:s,options:n})}push(t,e){this.redoStack=[],t.batch?(this.lastBatchIndex=Math.max(this.lastBatchIndex,0),this.emit("batch",{cmd:t,options:e})):(this.undoStackPush(t),this.consolidateCommands(),this.notify("add",t,e))}consolidateCommands(){var t;let e=this.undoStack[this.undoStack.length-1],n=this.undoStack[this.undoStack.length-2];if(!Array.isArray(e))return;let s=new Set(e.map(o=>o.event));if(s.size!==2||!s.has("cell:change:parent")||!s.has("cell:change:children")||!e.every(o=>{var a;return o.batch&&((a=o.options)===null||a===void 0?void 0:a.ui)})||!Array.isArray(n)||n.length!==1)return;let r=n[0];r.event!=="cell:change:position"||!(!((t=r.options)===null||t===void 0)&&t.ui)||(n.push(...e),this.undoStack.pop())}undoStackPush(t){if(this.stackSize===0){this.undoStack.push(t);return}this.undoStack.length>=this.stackSize&&this.undoStack.shift(),this.undoStack.push(t)}ensureUndefinedAttrs(t,e){let n=!1;return t!==null&&e!==null&&typeof t=="object"&&typeof e=="object"&&Object.keys(e).forEach(s=>{t[s]===void 0&&e[s]!==void 0?(t[s]=void 0,n=!0):typeof t[s]=="object"&&typeof e[s]=="object"&&(n=this.ensureUndefinedAttrs(t[s],e[s]))}),n}dispose(){this.validator.dispose(),this.clean(),this.stopListening(),this.off()}};rn([ln()],nA.prototype,"dispose",null);Sn();Sn();var ZY=il(KY(),1);function PN(i,t,e){let n=i.toLocaleLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command").replace("arrowup","up").replace("arrowright","right").replace("arrowdown","down").replace("arrowleft","left");return t?ke.call(t,e,n):n}function RN(i){var t;let e=i.target,n=(t=e?.tagName)===null||t===void 0?void 0:t.toLowerCase(),s=["input","textarea"].includes(n);return et.attr(e,"contenteditable")==="true"&&(s=!0),s}function JY(i,t,e){let n=i.target,s=i.currentTarget;return n?n===t||s===t||n===document.body?!0:et.contains(e,n):!1}function NCt(i){let t=new ZY.default(i.target),e=t.stopCallback;return t.stopCallback=(n,s,r)=>
4970i.isEnabledForEvent(n)?e?e.call(t,n,s,r):!1:!0,t}var Ux=class extends Uo{get graph(){return this.options.graph}constructor(t){super(),this.options=t;let e=this.graph.getPlugin("scroller");this.container=e?e.container:this.graph.container,t.global?this.target=document:(this.target=this.container,this.disabled||this.target.setAttribute("tabindex","-1"),this.graph.on("cell:mouseup",this.focus.bind(this),this),this.graph.on("blank:mouseup",this.focus.bind(this),this)),this.mousetrap=NCt(this)}get disabled(){return this.options.enabled!==!0}enable(){this.disabled&&(this.options.enabled=!0,this.target instanceof HTMLElement&&this.target.setAttribute("tabindex","-1"))}disable(){this.disabled||(this.options.enabled=!1,this.target instanceof HTMLElement&&this.target.removeAttribute("tabindex"))}on(t,e,n){this.mousetrap.bind(this.getKeys(t),e,n)}off(t,e){this.mousetrap.unbind(this.getKeys(t),e)}clear(){this.mousetrap.reset()}trigger(t,e){this.mousetrap.trigger(PN(t,this.options.format,this.graph),e)}focus(t){if(RN(t.e))return;this.target.focus({preventScroll:!0})}getKeys(t){return(Array.isArray(t)?t:[t]).map(e=>PN(e,this.options.format,this.graph))}isEnabledForEvent(t){let e=!this.disabled&&JY(t,this.target,this.container),n=RN(t);if(e){if(n&&(t.key==="Backspace"||t.key==="Delete"))return!1;if(this.options.guard)return ke.call(this.options.guard,this.graph,t)}return e}dispose(){this.mousetrap.reset()}};rn([ln()],Ux.prototype,"dispose",null);oe.prototype.isKeyboardEnabled=function(){let i=this.getPlugin("keyboard");return i?i.isEnabled():!1};oe.prototype.enableKeyboard=function(){let i=this.getPlugin("keyboard");return i&&i.enable(),this};oe.prototype.disableKeyboard=function(){let i=this.getPlugin("keyboard");return i&&i.disable(),this};oe.prototype.toggleKeyboard=function(i){let t=this.getPlugin("keyboard");return t&&t.toggleEnabled(i),this};oe.prototype.bindKey=function(i,t,e){let n=this.getPlugin("keyboard");return n&&n.bindKey(i,t,e),this};oe.prototype.unbindKey=function(i,t){let e=this.getPlugin("keyboard");return e&&e.unbindKey(i,t),this};oe.prototype.clearKeys=function(){let i=this.getPlugin("keyboard");return i&&i.clear(),this};oe.prototype.triggerKey=function(i,t){let e=this.getPlugin("keyboard");return e&&e.trigger(i,t),this};var sA=class extends Uo{constructor(t={}){super(),this.name="keyboard",this.options=Object.assign({enabled:!0},t)}init(t){this.keyboardImpl=new Ux(Object.assign(Object.assign({},this.options),{graph:t}))}isEnabled(){return!this.keyboardImpl.disabled}enable(){this.keyboardImpl.enable()}disable(){this.keyboardImpl.disable()}toggleEnabled(t){return t===void 0&&(t=!this.isEnabled()),t?this.enable():this.disable(),this}bindKey(t,e,n){return this.keyboardImpl.on(t,e,n),this}trigger(t,e){return this.keyboardImpl.trigger(t,e),this}clear(){return this.keyboardImpl.clear(),this}unbindKey(t,e){return this.keyboardImpl.off(t,e),this}dispose(){this.keyboardImpl.dispose()}};rn([ln()],sA.prototype,"dispose",null);Sn();Sn();var Pd=class i extends Wi{get graph(){return this.options.graph}get boxClassName(){return this.prefixClassName(Kl.box)}get $boxes(){return et.children(this.container,this.boxClassName)}get handleOptions(){return this.options}constructor(t){super(),this.updateThrottleTimer=null,this.isDragging=!1,this.batchUpdating=!1,this.dragRafId=null,this.transformRafId=null,this.dragPendingOffset=null,this.containerLocalOffsetX=0,this.containerLocalOffsetY=0,this.containerOffsetX=0,this.containerOffsetY=0,this.draggingPreviewMode="translate",this.translatingCache=null,this.movingRouterRestoreCache=null,this.movingRouterRestoreTimer=null,this.lastMovingTs=null,this.movingDegradeActivatedTs=null,this.options=t,this.options.model&&(this.options.collection=this.options.model.collection),this.options.collection?this.collection=this.options.collection:(this.collection=new wp([],{comparator:BCt}),this.options.collection=this.collection),this.boxCount=0,this.boxesUpdated=!1,this.createContainer(),this.startListening()}startListening(){let t=this.graph,e=this.collection;this.delegateEvents({[`mousedown .${this.boxClassName}`]:"onSelectionBoxMouseDown",[`touchstart .${this.boxClassName}`]:"onSelectionBoxMouseDown",[`mousedown .${this.prefixClassName(Kl.inner)}`]:"onSelectionContainerMouseDown",[`touchstart .${this.prefixClassName(Kl.inner)}`]:"onSelectionContainerMouseDown"},!0),t.on("scale",this.onGraphTransformed,this),t.on("translate",this.onGraphTransformed,this),t.model.on("updated",this.onModelUpdated,this),e.on("added",this.onCellAdded,this),e.on("removed",this.onCellRemoved,this),e.on("reseted",this.onReseted,this),e.on("updated",this.onCollectionUpdated,this),e.on("node:change:position",this.onNodePositionChanged,this),e.on("cell:changed",this.onCellChanged,this)}stopListening(){let t=this.graph,e=this.collection;this.undelegateEvents(),t.off("scale",this.onGraphTransformed,this),t.off("translate",this.onGraphTransformed,this),this.transformRafId!=null&&(cancelAnimationFrame(this.transformRafId),this.transformRafId=null),this.updateThrottleTimer&&(clearTimeout(this.updateThrottleTimer),this.updateThrottleTimer=null),t.model.off("updated",this.onModelUpdated,this),e.off("added",this.onCellAdded,this),e.off("removed",this.onCellRemoved,this),e.off("reseted",this.onReseted,this),e.off("updated",this.onCollectionUpdated,this),e.off("node:change:position",this.onNodePositionChanged,this),e.off("cell:changed",this.onCellChanged,this)}onRemove(){this.stopListening()}onGraphTransformed(){this.updateThrottleTimer&&(clearTimeout(this.updateThrottleTimer),this.updateThrottleTimer=null),this.transformRafId==null&&(this.transformRafId=window.requestAnimationFrame(()=>{if(this.transformRafId=null,!(this.collection.length<=0)){if(this.isDragging){this.repositionSelectionBoxesInPlace(),this.options.following?this.resetContainerPosition():this.syncContainerPosition();return}this.refreshSelectionBoxes()}}))}onCellChanged(){this.updateSelectionBoxes()}onNodePositionChanged({node:t,options:e}){let{showNodeSelectionBox:n,pointerEvents:s}=this.options,{ui:r,selection:o,translateBy:a,snapped:l}=e,c=(n!==!0||s&&this.getPointerEventsValue(s)==="none")&&!this.translating&&!o,u=r&&a&&t.id===a;if(c&&(u||l)){this.translating=!0;let h=t.position(),d=t.previous("position");if(d){let p=h.x-d.x,g=h.y-d.y;(p!==0||g!==0)&&this.translateSelectedNodes(p,g,t,e)}this.translating=!1}}onModelUpdated({removed:t}){t?.length&&this.unselect(t)}isEmpty(){return this.length<=0}isSelected(t){return this.collection.has(t)}get length(){return this.collection.length}get cells(){return this.collection.toArray()}select(t,e={}){e.dryrun=!0;let n=this.filter(Array.isArray(t)?t:[t]);return this.collection.add(n,e),this}unselect(t,e={}){return e.dryrun=!0,this.collection.remove(Array.isArray(t)?t:[t],e),this}reset(t,e={}){if(t){this.batchUpdating=!!e.batch;let n=this.cells,s=this.filter(Array.isArray(t)?t:[t]),r={},o={};for(let c of n)r[c.id]=c;for(let c of s)o[c.id]=c;let a=[],l=[];
4970return s.forEach(c=>{r[c.id]||a.push(c)}),n.forEach(c=>{o[c.id]||l.push(c)}),l.length&&this.unselect(l,Object.assign(Object.assign({},e),{ui:!0})),a.length&&this.select(a,Object.assign(Object.assign({},e),{ui:!0})),this.updateContainer(),this.batchUpdating=!1,this}return this.clean(e)}clean(t={}){return this.length&&this.unselect(this.cells,t),this.resetContainerPosition(),this.draggingPreviewMode="translate",this}setFilter(t){this.options.filter=t}setContent(t){this.options.content=t}startSelecting(t){t=this.normalizeEvent(t),this.clean();let e,n,s=this.graph.container;if(t.offsetX!=null&&t.offsetY!=null&&s.contains(t.target))e=t.offsetX,n=t.offsetY;else{let o=et.offset(s),a=s.scrollLeft,l=s.scrollTop;e=t.clientX-o.left+window.pageXOffset+a,n=t.clientY-o.top+window.pageYOffset+l}et.css(this.container,{top:n,left:e,width:1,height:1}),this.setEventData(t,{action:"selecting",clientX:t.clientX,clientY:t.clientY,offsetX:e,offsetY:n,scrollerX:0,scrollerY:0,moving:!1});let r=this.graph.snapToGrid(t.clientX,t.clientY);this.notifyBoxEvent("box:mousedown",t,r.x,r.y,[]),this.delegateDocumentEvents(QY,t.data)}filter(t){let e=this.options.filter;return t.filter(n=>Array.isArray(e)?e.some(s=>typeof s=="string"?n.shape===s:n.id===s.id):typeof e=="function"?ke.call(e,this.graph,n):!0)}stopSelecting(t){this.isDragging=!1,this.boxesUpdated=!1,this.updateThrottleTimer&&(clearTimeout(this.updateThrottleTimer),this.updateThrottleTimer=null);let e=this.graph;switch(this.getEventData(t).action){case"selecting":{let r=e.snapToGrid(t.clientX,t.clientY),o=this.getSelectingRect(),a=this.getCellsInArea(o);this.reset(a,{batch:!0}),this.hideRubberband(),this.notifyBoxEvent("box:mouseup",t,r.x,r.y,a);break}case"translating":{let r=e.snapToGrid(t.clientX,t.clientY);if(this.dragPendingOffset){let o=this.dragPendingOffset;this.dragPendingOffset=null,this.applyDraggingPreview(o)}this.dragRafId!=null&&(cancelAnimationFrame(this.dragRafId),this.dragRafId=null),this.resetContainerPosition(),this.movingRouterRestoreTimer&&(clearTimeout(this.movingRouterRestoreTimer),this.movingRouterRestoreTimer=null),this.restoreMovingRouters(),this.graph.model.stopBatch("move-selection"),this.translatingCache=null,this.draggingPreviewMode="translate",this.notifyBoxEvent("box:mouseup",t,r.x,r.y),this.repositionSelectionBoxesInPlace();break}default:{this.clean();break}}this.undelegateDocumentEvents()}onMouseUp(t){let e=this.normalizeEvent(t);this.getEventData(e)&&this.stopSelecting(t)}onSelectionBoxMouseDown(t){this.handleSelectionMouseDown(t,!0)}onSelectionContainerMouseDown(t){this.handleSelectionMouseDown(t,!1)}handleSelectionMouseDown(t,e){var n;t.stopPropagation(),(n=t.preventDefault)===null||n===void 0||n.call(t);let s=this.normalizeEvent(t),r=this.graph.snapToGrid(s.clientX,s.clientY);if(!e&&zo(s,this.options.multipleSelectionModifiers)){let l=this.graph.findViewsFromPoint(r.x,r.y).find(c=>c.isNodeView());if(l){let c=l.cell;this.isSelected(c)?this.unselect(c,{ui:!0}):this.options.multiple===!1?this.reset(c,{ui:!0}):this.select(c,{ui:!0})}return}this.options.movable&&this.startTranslating(s);let o=e?this.getCellViewFromElem(s.target):null;if(!o&&(o=this.graph.findViewsFromPoint(r.x,r.y).filter(l=>this.isSelected(l.cell))[0]||null,!o)){let l=this.collection.first();l&&(o=this.graph.renderer.findViewByCell(l))}o&&(this.setEventData(s,{activeView:o}),e&&this.notifyBoxEvent("box:mousedown",s,r.x,r.y),this.delegateDocumentEvents(QY,s.data))}startTranslating(t){this.graph.model.startBatch("move-selection");let e=this.graph.snapToGrid(t.clientX,t.clientY);this.setEventData(t,{action:"translating",clientX:e.x,clientY:e.y,originX:e.x,originY:e.y}),this.prepareTranslatingCache(),this.draggingPreviewMode=this.getDraggingPreviewMode()}getRestrictArea(){let t=this.graph.options.translating.restrict,e=typeof t=="function"?ke.call(t,this.graph,null):t;return typeof e=="number"?this.graph.transform.getGraphArea().inflate(e):e===!0?this.graph.transform.getGraphArea():e||null}prepareTranslatingCache(){let t=this.collection.toArray().filter(o=>o.isNode()),e=new Set(t.map(o=>o.id)),n=this.collection.toArray().filter(o=>
4970o.isEdge()),s=new Set,r=o=>o.getVertices().length>0||!o.getSourceCellId()||!o.getTargetCellId();this.graph.model.getEdges().forEach(o=>{let a=o.getSourceCellId(),l=o.getTargetCellId();(a!=null&&e.has(a)||l!=null&&e.has(l))&&r(o)&&s.add(o)}),n.forEach(o=>{r(o)&&s.add(o)}),this.translatingCache={selectedNodes:t,nodeIdSet:e,edgesToTranslate:Array.from(s)}}applyMovingRouterFallback(){var t;if(this.movingRouterRestoreCache)return;let e=(t=this.translatingCache)===null||t===void 0?void 0:t.selectedNodes;if(!e||e.length<2)return;let n=this.options.movingRouterFallback;if(!n||!Vu.exist(n))return;let s={name:n},r={},o=new Set;e.forEach(a=>{this.graph.model.getConnectedEdges(a).forEach(l=>{if(o.has(l.id))return;o.add(l.id);let c=l.getRouter();r[l.id]=c,l.setRouter(s,{silent:!0})})}),this.movingRouterRestoreCache=r,this.movingDegradeActivatedTs=Date.now()}restoreMovingRouters(){let t=this.movingRouterRestoreCache;t&&(Object.keys(t).forEach(e=>{let n=this.graph.getCellById(e);if(!n||!n.isEdge())return;let s=t[e];s==null?n.removeRouter({silent:!0}):n.setRouter(s,{silent:!0});let r=this.graph.findViewByCell(n);r&&this.graph.renderer.requestViewUpdate(r,r.getFlag("update"),{async:!0})}),this.movingRouterRestoreCache=null)}scheduleMovingRouterRestoreThrottle(){this.movingRouterRestoreTimer&&(clearTimeout(this.movingRouterRestoreTimer),this.movingRouterRestoreTimer=null),this.movingRouterRestoreTimer=setTimeout(()=>{let t=Date.now(),e=this.lastMovingTs||0,n=t-e,s=this.movingDegradeActivatedTs!=null?t-this.movingDegradeActivatedTs:1/0;if(n<i.RESTORE_IDLE_TIME||s<i.RESTORE_HOLD_TIME){let r=Math.max(i.RESTORE_IDLE_TIME-n,i.RESTORE_HOLD_TIME-s,i.MIN_RESTORE_WAIT_TIME);this.movingRouterRestoreTimer=setTimeout(()=>{this.movingRouterRestoreTimer=null,this.restoreMovingRouters()},r);return}this.movingRouterRestoreTimer=null,this.restoreMovingRouters()},i.RESTORE_IDLE_TIME)}getSelectionOffset(t,e){let n=t.x-e.clientX,s=t.y-e.clientY,r=this.getRestrictArea();if(r){let o=this.collection.toArray(),a=vi.getCellsBBox(o,{deep:!0})||Pe.create(),l=r.x-a.x,c=r.y-a.y,u=r.x+r.width-(a.x+a.width),h=r.y+r.height-(a.y+a.height);if(n<l&&(n=l),s<c&&(s=c),u<n&&(n=u),h<s&&(s=h),!this.options.following){let d=t.x-e.originX,p=t.y-e.originY;n=d<=l||d>=u?0:n,s=p<=c||p>=h?0:s}}return{dx:n,dy:s}}updateSelectedNodesPosition(t){t.dx===0&&t.dy===0||(this.dragPendingOffset?(this.dragPendingOffset.dx+=t.dx,this.dragPendingOffset.dy+=t.dy):this.dragPendingOffset={dx:t.dx,dy:t.dy},this.dragRafId==null&&(this.dragRafId=requestAnimationFrame(()=>{let e=this.dragPendingOffset||{dx:0,dy:0};this.dragPendingOffset=null,this.dragRafId=null,this.applyDraggingPreview(e),this.boxesUpdated=!0,this.isDragging=!0})))}autoScrollGraph(t,e){let n=this.graph.getPlugin("scroller");return n?.autoScroll?n.autoScroll(t,e):{scrollerX:0,scrollerY:0}}adjustSelection(t){let e=this.normalizeEvent(t),n=this.getEventData(e);switch(n.action){case"selecting":{let r=n;r.moving!==!0&&(et.appendTo(this.container,this.graph.container),this.showRubberband(),r.moving=!0);let{scrollerX:o,scrollerY:a}=this.autoScrollGraph(e.clientX,e.clientY);r.scrollerX+=o,r.scrollerY+=a;let l=e.clientX-r.clientX+r.scrollerX,c=e.clientY-r.clientY+r.scrollerY;et.css(this.container,{left:l<0?r.offsetX+l:r.offsetX,top:c<0?r.offsetY+c:r.offsetY,width:Math.abs(l),height:Math.abs(c)});let u=this.graph.snapToGrid(e.clientX,e.clientY),h=this.getSelectingRect(),d=this.getCellsInArea(h);this.notifyBoxEvent("box:mousemove",t,u.x,u.y,d);break}case"translating":{this.isDragging=!0;let r=this.graph.snapToGrid(e.clientX,e.clientY),o=n,a=this.getSelectionOffset(r,o);this.options.following?this.updateSelectedNodesPosition(a):this.updateContainerPosition(a),a.dx&&(o.clientX=r.x),a.dy&&(o.clientY=r.y),(a.dx!==0||a.dy!==0)&&(this.lastMovingTs=Date.now(),this.applyMovingRouterFallback(),this.scheduleMovingRouterRestoreThrottle()),this.notifyBoxEvent("box:mousemove",t,r.x,r.y);break}default:break}this.boxesUpdated=!1}translateSelectedNodes(t,e,n,s){var r,o;let a={},l=[];if(n&&(a[n.id]=!0),this.collection.toArray().forEach(y=>{y.getDescendants({deep:!0}
4970).forEach(x=>{a[x.id]=!0})}),s?.translateBy){let y=this.graph.getCellById(s.translateBy);y&&(a[y.id]=!0,y.getDescendants({deep:!0}).forEach(x=>{a[x.id]=!0}),l.push(y))}let c=Object.assign(Object.assign({},s),{selection:this.cid,exclude:l}),u=(r=this.translatingCache)===null||r===void 0?void 0:r.selectedNodes,h=(u??this.collection.toArray().filter(y=>y.isNode())).filter(y=>!a[y.id]);h.forEach(y=>{y.translate(t,e,c)});let d=(o=this.translatingCache)===null||o===void 0?void 0:o.edgesToTranslate,p=new Set;if(d)d.forEach(y=>{p.add(y)});else{let y=new Set(h.map(x=>x.id));this.graph.model.getEdges().forEach(x=>{let w=x.getSourceCellId(),M=x.getTargetCellId(),A=w?y.has(w):!1,C=M?y.has(M):!1;(A||C)&&(x.getVertices().length>0||(!w||!M))&&p.add(x)})}this.collection.toArray().filter(y=>y.isEdge()&&!a[y.id]).forEach(y=>{let x=y.getVertices().length>0,w=!y.getSourceCellId()||!y.getTargetCellId();(x||w)&&p.add(y)}),p.forEach(y=>{y.translate(t,e,c)})}getCellViewsInArea(t){let e=this.graph,n={strict:this.options.strict},s=[];return this.options.rubberNode&&(s=s.concat(e.model.getNodesInArea(t,n).map(r=>e.renderer.findViewByCell(r)).filter(r=>r!=null))),this.options.rubberEdge&&(s=s.concat(e.model.getEdgesInArea(t,n).map(r=>e.renderer.findViewByCell(r)).filter(r=>r!=null))),s}getCellsInArea(t){return this.filter(this.getCellViewsInArea(t).map(e=>e.cell))}getSelectingRect(){let t=et.width(this.container),e=et.height(this.container),n=et.offset(this.container),s=this.graph.pageToLocal(n.left,n.top),r=this.graph.transform.getScale();return t/=r.sx,e/=r.sy,new Pe(s.x,s.y,t,e)}getBoxEventCells(t,e=null){var n;let s=[],r=[],o=e;return(t??this.cells).forEach(a=>{let l=this.graph.getCellById(a.id);l&&(o||(o=this.graph.renderer.findViewByCell(l)),l.isNode()?s.push(l):l.isEdge()&&r.push(l))}),{view:o,cell:(n=o?.cell)!==null&&n!==void 0?n:null,nodes:s,edges:r}}notifyBoxEvent(t,e,n,s,r){var o,a;let l=(a=(o=this.getEventData(e))===null||o===void 0?void 0:o.activeView)!==null&&a!==void 0?a:null,{view:c,cell:u,nodes:h,edges:d}=this.getBoxEventCells(r,l);this.trigger(t,{e,view:c,x:n,y:s,cell:u,nodes:h,edges:d})}getSelectedClassName(t){return this.prefixClassName(`${t.isNode()?"node":"edge"}-selected`)}addCellSelectedClassName(t){let e=this.graph.renderer.findViewByCell(t);e&&e.addClass(this.getSelectedClassName(t))}removeCellUnSelectedClassName(t){let e=this.graph.renderer.findViewByCell(t);e&&e.removeClass(this.getSelectedClassName(t))}destroySelectionBox(t){this.removeCellUnSelectedClassName(t),this.canShowSelectionBox(t)&&(et.remove(this.container.querySelector(`[data-cell-id="${t.id}"]`)),this.$boxes.length===0&&this.hide(),this.boxCount=Math.max(0,this.boxCount-1))}destroyAllSelectionBoxes(t){t.forEach(e=>{this.removeCellUnSelectedClassName(e)}),this.hide(),et.remove(this.$boxes),this.boxCount=0}hide(){et.removeClass(this.container,this.prefixClassName(Kl.rubberband)),et.removeClass(this.container,this.prefixClassName(Kl.selected))}showRubberband(){et.addClass(this.container,this.prefixClassName(Kl.rubberband))}hideRubberband(){et.removeClass(this.container,this.prefixClassName(Kl.rubberband))}showSelected(){et.removeAttribute(this.container,"style"),et.addClass(this.container,this.prefixClassName(Kl.selected))}createContainer(){this.container=document.createElement("div"),et.addClass(this.container,this.prefixClassName(Kl.root)),this.options.className&&et.addClass(this.container,this.options.className),et.css(this.container,{willChange:"transform"}),this.selectionContainer=document.createElement("div"),et.addClass(this.selectionContainer,this.prefixClassName(Kl.inner)),this.selectionContent=document.createElement("div"),et.addClass(this.selectionContent,this.prefixClassName(Kl.content)),et.append(this.selectionContainer,this.selectionContent),et.attr(this.selectionContainer,"data-selection-length",this.collection.length),et.prepend(this.container,this.selectionContainer)}getDraggingPreviewMode(){return this.options.following&&this.collection.toArray().some(e=>e.isEdge()&&this.canShowSelectionBox(e))?"geometry":"translate"}applyDraggingPreview(t){if(!(t.dx===0&&t.dy===0)){if(this.options.following&&(this.translateSelectedNodes(t.dx,t.dy),this.draggingPreviewMode==="geometry")){this.repositionSelectionBoxesInPlace(),this.resetContainerPosition();return}this.updateContainerPosition(t)}}resetContainerPosition(){this.containerLocalOffsetX=0,this.containerLocalOffsetY=0,this.containerOffsetX=0,this.containerOffsetY=0,et.css(this.container,"transform","")}syncContainerPosition(){let t=this.graph.coord.localToGraphPoint(0,0),e=this.graph.coord.localToGraphPoint(this.containerLocalOffsetX,this.containerLocalOffsetY);if(this.containerOffsetX=e.x-t.x,this.containerOffsetY=e.y-t.y,this.containerOffsetX===0&&this.containerOffsetY===0){et.css(this.container,"transform","");return}et.css(this.container,"transform",`translate3d(${this.containerOffsetX}px, ${this.containerOffsetY}px, 0)`)}updateContainerPosition(t){(t.dx||t.dy)&&(this.containerLocalOffsetX+=t.dx,this.containerLocalOffsetY+=t.dy,this.syncContainerPosition())}updateContainer(){let t={x:1/0,y:1/0},e={x:0,y:0};this.collection.toArray().filter(r=>
4970this.canShowSelectionBox(r)).forEach(r=>{let o=this.graph.renderer.findViewByCell(r);if(o){let a=o.getBBox({useCellGeometry:!0});t.x=Math.min(t.x,a.x),t.y=Math.min(t.y,a.y),e.x=Math.max(e.x,a.x+a.width),e.y=Math.max(e.y,a.y+a.height)}}),et.css(this.selectionContainer,{position:"absolute",pointerEvents:this.options.movable?"auto":"none",cursor:this.options.movable?"move":"default",left:t.x,top:t.y,width:e.x-t.x,height:e.y-t.y}),et.attr(this.selectionContainer,"data-selection-length",this.collection.length);let s=this.options.content;if(s)if(typeof s=="function"){let r=ke.call(s,this.graph,this,this.selectionContent);r&&(this.selectionContent.innerHTML=r)}else this.selectionContent.innerHTML=s;this.collection.length>0&&!this.container.parentNode?et.appendTo(this.container,this.graph.container):this.collection.length<=0&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}canShowSelectionBox(t){return t.isNode()&&this.options.showNodeSelectionBox===!0||t.isEdge()&&this.options.showEdgeSelectionBox===!0}getPointerEventsValue(t){return typeof t=="string"?t:t(this.cells)}createSelectionBox(t){if(this.addCellSelectedClassName(t),this.canShowSelectionBox(t)){let e=this.graph.renderer.findViewByCell(t);if(e){let n=e.getBBox({useCellGeometry:!0}),s=this.boxClassName,r=document.createElement("div"),o=this.options.pointerEvents;et.addClass(r,s),et.addClass(r,`${s}-${t.isNode()?"node":"edge"}`),et.attr(r,"data-cell-id",t.id),et.css(r,{position:"absolute",left:n.x,top:n.y,width:n.width,height:n.height,pointerEvents:o?this.getPointerEventsValue(o):"auto"}),et.appendTo(r,this.container),this.showSelected(),this.boxCount+=1}}}updateSelectionBoxes(){if(this.collection.length>0){if(this.isDragging)return;this.updateThrottleTimer&&clearTimeout(this.updateThrottleTimer),this.updateThrottleTimer=setTimeout(()=>{this.refreshSelectionBoxes(),this.updateThrottleTimer=null},16)}}refreshSelectionBoxes(){et.remove(this.$boxes),this.boxCount=0,this.collection.toArray().forEach(t=>{this.createSelectionBox(t)}),this.updateContainer(),this.boxesUpdated=!0}repositionSelectionBoxesInPlace(){let t=this.$boxes;if(t.length===0){this.refreshSelectionBoxes();return}for(let e of t){let n=e.getAttribute("data-cell-id");if(!n)continue;let s=this.collection.get(n);if(!s)continue;let r=this.graph.renderer.findViewByCell(s);if(!r)continue;let o=r.getBBox({useCellGeometry:!0});et.css(e,{left:o.x,top:o.y,width:o.width,height:o.height})}this.updateContainer(),this.boxesUpdated=!0}getCellViewFromElem(t){let e=t.getAttribute("data-cell-id");if(e){let n=this.collection.get(e);if(n)return this.graph.renderer.findViewByCell(n)}return null}onCellRemoved({cell:t}){this.destroySelectionBox(t),this.batchUpdating||this.updateContainer()}onReseted({previous:t,current:e}){this.destroyAllSelectionBoxes(t),e.forEach(n=>{this.listenCellRemoveEvent(n),this.createSelectionBox(n)}),this.updateContainer()}onCellAdded({cell:t}){this.listenCellRemoveEvent(t),this.createSelectionBox(t),this.batchUpdating||this.updateContainer()}listenCellRemoveEvent(t){t.off("removed",this.onCellRemoved,this),t.on("removed",this.onCellRemoved,this)}onCollectionUpdated({added:t,removed:e,options:n}){t.forEach(r=>{this.trigger("cell:selected",{cell:r,options:n}),r.isNode()?this.trigger("node:selected",{cell:r,options:n,node:r}):r.isEdge()&&this.trigger("edge:selected",{cell:r,options:n,edge:r})}),e.forEach(r=>{this.trigger("cell:unselected",{cell:r,options:n}),r.isNode()?this.trigger("node:unselected",{cell:r,options:n,node:r}):r.isEdge()&&this.trigger("edge:unselected",{cell:r,options:n,edge:r})});let s={added:t,removed:e,options:n,selected:this.cells.filter(r=>!!this.graph.getCellById(r.id))};this.trigger("selection:changed",s)}dispose(){this.clean(),this.remove(),this.off()}};Pd.RESTORE_IDLE_TIME=100;Pd.RESTORE_HOLD_TIME=150;Pd.MIN_RESTORE_WAIT_TIME=50;rn([ln()],Pd.prototype,"dispose",null);var R0="widget-selection",Kl={root:R0,inner:`${R0}-inner`,box:`${R0}-box`,content:`${R0}-content`,rubberband:`${R0}-rubberband`,selected:`${R0}-selected`},QY={mousemove:"adjustSelection",touchmove:"adjustSelection",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"};function BCt(i){return i.getAncestors().length}var tX=`.x6-widget-selection {
4971  position: absolute;
4972  top: 0;
4973  left: 0;
4974  display: none;
4975  width: 0;
4976  height: 0;
4977  touch-action: none;
4978}
4979.x6-widget-selection-rubberband {
4980  display: block;
4981  overflow: visible;
4982  opacity: 0.3;
4983}
4984.x6-widget-selection-selected {
4985  display: block;
4986}
4987.x6-widget-selection-box {
4988  cursor: move;
4989}
4990.x6-widget-selection-inner[data-selection-length='0'],
4991.x6-widget-selection-inner[data-selection-length='1'] {
4992  display: none;
4993}
4994.x6-widget-selection-content {
4995  position: absolute;
4996  top: 100%;
4997  right: -20px;
4998  left: -20px;
4999  margin-top: 30px;
5000  padding: 6px;
5001  line-height: 14px;
5002  text-align: center;
5003  border-radius: 6px;
5004}
5005.x6-widget-selection-content:empty {
5006  display: none;
5007}
5008.x6-widget-selection-rubberband {
5009  background-color: #3498db;
5010  border: 2px solid #2980b9;
5011}
5012.x6-widget-selection-box {
5013  box-sizing: content-box !important;
5014  margin-top: -4px;
5015  margin-left: -4px;
5016  padding-right: 4px;
5017  padding-bottom: 4px;
5018  border: 2px dashed #feb663;
5019  box-shadow: 2px 2px 5px #d3d3d3;
5020}
5021.x6-widget-selection-inner {
5022  box-sizing: content-box !important;
5023  margin-top: -8px;
5024  margin-left: -8px;
5025  padding-right: 12px;
5026  padding-bottom: 12px;
5027  border: 2px solid #feb663;
5028  box-shadow: 2px 2px 5px #d3d3d3;
5029}
5030.x6-widget-selection-content {
5031  color: #fff;
5032  font-size: 10px;
5033  background-color: #6a6b8a;
5034}
5035`;oe.prototype.isSelectionEnabled=function(){let i=this.getPlugin("selection");return i?i.isEnabled():!1};oe.prototype.enableSelection=function(){let i=this.getPlugin("selection");return i&&i.enable(),this};oe.prototype.disableSelection=function(){let i=this.getPlugin("selection");return i&&i.disable(),this};oe.prototype.toggleSelection=function(i){let t=this.getPlugin("selection");return t&&t.toggleEnabled(i),this};oe.prototype.isMultipleSelection=function(){let i=this.getPlugin("selection");return i?i.isMultipleSelection():!1};oe.prototype.enableMultipleSelection=function(){let i=this.getPlugin("selection");return i&&i.enableMultipleSelection(),this};oe.prototype.disableMultipleSelection=function(){let i=this.getPlugin("selection");return i&&i.disableMultipleSelection(),this};oe.prototype.toggleMultipleSelection=function(i){let t=this.getPlugin("selection");return t&&t.toggleMultipleSelection(i),this};oe.prototype.isSelectionMovable=function(){let i=this.getPlugin("selection");return i?i.isSelectionMovable():!1};oe.prototype.enableSelectionMovable=function(){let i=this.getPlugin("selection");return i&&i.enableSelectionMovable(),this};oe.prototype.disableSelectionMovable=function(){let i=this.getPlugin("selection");return i&&i.disableSelectionMovable(),this};oe.prototype.toggleSelectionMovable=function(i){let t=this.getPlugin("selection");return t&&t.toggleSelectionMovable(i),this};oe.prototype.isRubberbandEnabled=function(){let i=this.getPlugin("selection");return i?i.isRubberbandEnabled():!1};oe.prototype.enableRubberband=function(){let i=this.getPlugin("selection");return i&&i.enableRubberband(),this};oe.prototype.disableRubberband=function(){let i=this.getPlugin("selection");return i&&i.disableRubberband(),this};oe.prototype.toggleRubberband=function(i){let t=this.getPlugin("selection");return t&&t.toggleRubberband(i),this};oe.prototype.isStrictRubberband=function(){let i=this.getPlugin("selection");return i?i.isStrictRubberband():!1};oe.prototype.enableStrictRubberband=function(){let i=this.getPlugin("selection");return i&&i.enableStrictRubberband(),this};oe.prototype.disableStrictRubberband=function(){let i=this.getPlugin("selection");return i&&i.disableStrictRubberband(),this};oe.prototype.toggleStrictRubberband=function(i){let t=this.getPlugin("selection");return t&&t.toggleStrictRubberband(i),this};
5035oe.prototype.setRubberbandModifiers=function(i){let t=this.getPlugin("selection");return t&&t.setRubberbandModifiers(i),this};oe.prototype.setSelectionFilter=function(i){let t=this.getPlugin("selection");return t&&t.setSelectionFilter(i),this};oe.prototype.setSelectionDisplayContent=function(i){let t=this.getPlugin("selection");return t&&t.setSelectionDisplayContent(i),this};oe.prototype.isSelectionEmpty=function(){let i=this.getPlugin("selection");return i?i.isEmpty():!0};oe.prototype.cleanSelection=function(i){let t=this.getPlugin("selection");return t&&t.clean(i),this};oe.prototype.resetSelection=function(i,t){let e=this.getPlugin("selection");return e&&e.reset(i,t),this};oe.prototype.getSelectedCells=function(){let i=this.getPlugin("selection");return i?i.getSelectedCells():[]};oe.prototype.getSelectedCellCount=function(){let i=this.getPlugin("selection");return i?i.getSelectedCellCount():0};oe.prototype.isSelected=function(i){let t=this.getPlugin("selection");return t?t.isSelected(i):!1};oe.prototype.select=function(i,t){let e=this.getPlugin("selection");return e&&e.select(i,t),this};oe.prototype.unselect=function(i,t){let e=this.getPlugin("selection");return e&&e.unselect(i,t),this};var FCt={rubberband:!1,rubberNode:!0,rubberEdge:!1,pointerEvents:"auto",multiple:!0,multipleSelectionModifiers:["ctrl","meta"],movable:!0,strict:!1,selectCellOnMoved:!1,selectNodeOnMoved:!1,selectEdgeOnMoved:!1,following:!0,content:null,eventTypes:["leftMouseDown","mouseWheelDown"]},rA=class extends Ii{get rubberbandDisabled(){return this.options.enabled!==!0||this.options.rubberband!==!0}get disabled(){return this.options.enabled!==!0}get length(){return this.selectionImpl.length}get cells(){return this.selectionImpl.cells}constructor(t={}){super(),this.name="selection",this.movedMap=new WeakMap,this.unselectMap=new WeakMap,this.options=Object.assign(Object.assign({enabled:!0},FCt),t),us.ensure(this.name,tX)}init(t){this.graph=t,this.selectionImpl=new Pd(Object.assign(Object.assign({},this.options),{graph:t})),this.resolvePanningSelectionConflict(),this.setup(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return t!=null?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}isMultipleSelection(){return this.isMultiple()}enableMultipleSelection(){return this.enableMultiple(),this}disableMultipleSelection(){return this.disableMultiple(),this}toggleMultipleSelection(t){return t!=null?t!==this.isMultipleSelection()&&(t?this.enableMultipleSelection():this.disableMultipleSelection()):this.isMultipleSelection()?this.disableMultipleSelection():this.enableMultipleSelection(),this}isSelectionMovable(){return this.options.movable!==!1}enableSelectionMovable(){return this.selectionImpl.options.movable=!0,this}disableSelectionMovable(){return this.selectionImpl.options.movable=!1,this}toggleSelectionMovable(t){return t!=null?t!==this.isSelectionMovable()&&(t?this.enableSelectionMovable():this.disableSelectionMovable()):this.isSelectionMovable()?this.disableSelectionMovable():this.enableSelectionMovable(),this}isRubberbandEnabled(){return!this.rubberbandDisabled}enableRubberband(){return this.rubberbandDisabled&&(this.options.rubberband=!0),this}disableRubberband(){return this.rubberbandDisabled||(this.options.rubberband=!1),this}toggleRubberband(t){return t!=null?t!==this.isRubberbandEnabled()&&(t?this.enableRubberband():this.disableRubberband()):this.isRubberbandEnabled()?this.disableRubberband():this.enableRubberband(),this}isStrictRubberband(){return this.selectionImpl.options.strict===!0}enableStrictRubberband(){return this.selectionImpl.options.strict=!0,this}disableStrictRubberband(){return this.selectionImpl.options.strict=!1,this}toggleStrictRubberband(t){return t!=null?t!==this.isStrictRubberband()&&(t?this.enableStrictRubberband():this.disableStrictRubberband()):this.isStrictRubberband()?this.disableStrictRubberband():this.enableStrictRubberband(),this}
5035setRubberbandModifiers(t){this.setModifiers(t)}setSelectionFilter(t){return this.setFilter(t),this}setSelectionDisplayContent(t){return this.setContent(t),this}isEmpty(){return this.length<=0}clean(t={}){return this.selectionImpl.clean(t),this}reset(t,e={}){return this.selectionImpl.reset(t?this.getCells(t):[],e),this}getSelectedCells(){return this.cells}getSelectedCellCount(){return this.length}isSelected(t){return this.selectionImpl.isSelected(t)}select(t,e={}){let n=this.getCells(t);return n.length&&(this.isMultiple()?this.selectionImpl.select(n,e):this.reset(n.slice(0,1),e)),this}unselect(t,e={}){return this.selectionImpl.unselect(this.getCells(t),e),this}setup(){this.selectionImpl.on("*",(t,e)=>{this.trigger(t,e),this.graph.trigger(t,e)})}startListening(){this.graph.on("blank:mousedown",this.onBlankMouseDown,this),this.graph.on("blank:click",this.onBlankClick,this),this.graph.on("cell:mousemove",this.onCellMouseMove,this),this.graph.on("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.on("box:mousedown",this.onBoxMouseDown,this)}stopListening(){this.graph.off("blank:mousedown",this.onBlankMouseDown,this),this.graph.off("blank:click",this.onBlankClick,this),this.graph.off("cell:mousemove",this.onCellMouseMove,this),this.graph.off("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.off("box:mousedown",this.onBoxMouseDown,this)}onBlankMouseDown({e:t}){if(!this.allowBlankMouseDown(t))return;let e=this.graph.panning.allowPanning(t,!0),n=this.graph.getPlugin("scroller"),s=n&&n.allowPanning(t,!0);(this.allowRubberband(t,!0)||this.allowRubberband(t)&&!s&&!e)&&this.startRubberband(t)}allowBlankMouseDown(t){let e=this.options.eventTypes;return typeof t.type=="string"&&t.type.startsWith("touch")||t.pointerType==="touch"?e?.includes("leftMouseDown"):e?.includes("leftMouseDown")&&t.button===0||e?.includes("mouseWheelDown")&&t.button===1}onBlankClick(){this.clean()}allowRubberband(t,e){let n=t??{altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1};return!this.rubberbandDisabled&&zo(n,this.options.modifiers,e)}resolvePanningSelectionConflict(){if(this.options.enabled!==!0||this.options.rubberband!==!0)return;let t=this.graph.options.panning;if(!t||t.enabled===!1)return;(()=>{var n,s;let r=(n=this.options.eventTypes)!==null&&n!==void 0?n:[],o=(s=t.eventTypes)!==null&&s!==void 0?s:[],a=new Set(o),l=r.some(u=>a.has(u)),c=gO(t.modifiers,this.options.modifiers);return l&&c})()&&this.graph.panning.disablePanning()}allowMultipleSelection(t){return this.isMultiple()&&zo(t,this.options.multipleSelectionModifiers)}onCellMouseMove({cell:t}){this.movedMap.set(t,!0)}onCellMouseUp({e:t,cell:e}){let n=this.options,s=this.disabled;!s&&this.movedMap.has(e)&&(s=n.selectCellOnMoved===!1,s||(s=n.selectNodeOnMoved===!1&&e.isNode()),s||(s=n.selectEdgeOnMoved===!1&&e.isEdge())),s||(this.allowMultipleSelection(t)?this.unselectMap.has(e)?this.unselectMap.delete(e):this.isSelected(e)?this.unselect(e):this.select(e):this.reset(e)),this.movedMap.delete(e)}onBoxMouseDown({e:t,cell:e}){!this.disabled&&e&&this.allowMultipleSelection(t)&&(this.unselect(e),this.unselectMap.set(e,!0))}getCells(t){return(Array.isArray(t)?t:[t]).map(e=>typeof e=="string"?this.graph.getCellById(e):e).filter(e=>e!=null)}startRubberband(t){return this.rubberbandDisabled||this.selectionImpl.startSelecting(t),this}isMultiple(){return this.options.multiple!==!1}enableMultiple(){return this.options.multiple=!0,this}disableMultiple(){return this.options.multiple=!1,this}setModifiers(t){return this.options.modifiers=t,this}setContent(t){return this.selectionImpl.setContent(t),this}setFilter(t){return this.selectionImpl.setFilter(t),this}dispose(){this.stopListening(),this.off(),this.selectionImpl.dispose(),us.clean(this.name)}};rn([ln()],rA.prototype,"dispose",null);Sn();var eX=`.x6-widget-minimap {
5036  position: relative;
5037  display: table-cell;
5038  box-sizing: border-box;
5039  overflow: hidden;
5040  text-align: center;
5041  vertical-align: middle;
5042  background-color: #fff;
5043  user-select: none;
5044}
5045.x6-widget-minimap .x6-graph {
5046  display: inline-block;
5047  box-shadow: 0 0 4px 0 #eee;
5048  cursor: pointer;
5049}
5050.x6-widget-minimap .x6-graph > svg {
5051  pointer-events: none;
5052  shape-rendering: optimizespeed;
5053}
5054.x6-widget-minimap .x6-graph .x6-node * {
5055  /* stylelint-disable-next-line */
5056  vector-effect: initial;
5057}
5058.x6-widget-minimap-viewport {
5059  position: absolute;
5060  box-sizing: content-box !important;
5061  margin: -2px 0 0 -2px;
5062  border: 2px solid #31d0c6;
5063  cursor: move;
5064}
5065.x6-widget-minimap-viewport-zoom {
5066  position: absolute;
5067  right: 0;
5068  bottom: 0;
5069  box-sizing: border-box;
5070  width: 12px;
5071  height: 12px;
5072  margin: 0 -6px -6px 0;
5073  background-color: #fff;
5074  border: 2px solid #31d0c6;
5075  border-radius: 50%;
5076  cursor: nwse-resize;
5077}
5078`;var UCt={width:300,height:200,padding:10,scalable:!0,minScale:.01,maxScale:16,graphOptions:{},createGraph:i=>new oe(i)},zCt={mousemove:"doAction",touchmove:"doAction",mouseup:"stopAction",touchend:"stopAction"},nX="widget-minimap",iX=`${nX}-viewport`,VCt=`${iX}-zoom`,oA=class extends Wi{get scroller(){return this.graph.getPlugin("scroller")}get graphContainer(){return this.scroller?this.scroller.container:this.graph.container}constructor(t){super(),this.name="minimap",this.options=Object.assign(Object.assign({},UCt),t),us.ensure(this.name,eX)}init(t){this.graph=t,this.updateViewport=ke.debounce(this.updateViewport.bind(this),0),this.container=document.createElement("div"),et.addClass(this.container,this.prefixClassName(nX));let e=document.createElement("div");this.container.appendChild(e),this.viewport=document.createElement("div"),et.addClass(this.viewport,this.prefixClassName(iX)),this.options.scalable&&(this.zoomHandle=document.createElement("div"),et.addClass(this.zoomHandle,this.prefixClassName(VCt)),et.appendTo(this.zoomHandle,this.viewport)),et.append(this.container,this.viewport),et.css(this.container,{width:this.options.width,height:this.options.height,padding:this.options.padding}),this.options.container&&this.options.container.appendChild(this.container),this.sourceGraph=this.graph;let n=Object.assign(Object.assign({},this.options.graphOptions),{container:e,model:this.sourceGraph.model,interacting:!1,grid:!1,background:!1,embedding:!1,panning:!1});this.targetGraph=this.options.createGraph?this.options.createGraph(n):new oe(n),this.updatePaper(this.sourceGraph.options.width,this.sourceGraph.options.height),this.startListening()}startListening(){this.scroller?et.Event.on(this.graphContainer,`scroll${this.getEventNamespace()}`,this.updateViewport):(this.sourceGraph.on("translate",this.onTransform,this),this.sourceGraph.on("scale",this.onTransform,this),this.sourceGraph.on("model:updated",this.onModelUpdated,this)),this.sourceGraph.on("resize",this.updatePaper,this),this.delegateEvents({mousedown:"startAction",touchstart:"startAction",[`mousedown .${this.prefixClassName("graph")}`]:"scrollTo",[`touchstart .${this.prefixClassName("graph")}`]:"scrollTo"})}stopListening(){this.scroller?et.Event.off(this.graphContainer,this.getEventNamespace()):(this.sourceGraph.off("translate",this.onTransform,this),this.sourceGraph.off("scale",this.onTransform,this),this.sourceGraph.off("model:updated",this.onModelUpdated,this)),this.sourceGraph.off("resize",this.updatePaper,this),this.undelegateEvents()}onRemove(){this.stopListening(),this.targetGraph.dispose(!1)}onTransform(t){(t.ui||this.targetGraphTransforming||!this.scroller)&&this.updateViewport()}onModelUpdated(){this.targetGraph.zoomToFit()}updatePaper(t,e){let n,s;typeof t=="object"?(n=t.width,s=t.height):(n=t,s=e);let r=this.sourceGraph.options,o=this.sourceGraph.transform.getScale(),a=this.options.width-2*this.options.padding,l=this.options.height-2*this.options.padding;n/=o.sx,s/=o.sy,this.ratio=Math.min(a/n,l/s);let c=this.ratio,u=r.x*c/o.sx,h=r.y*c/o.sy;return n*=c,s*=c,this.targetGraph.resize(n,s),this.targetGraph.translate(u,h),this.scroller?this.targetGraph.scale(c,c):this.targetGraph.zoomToFit(),this.updateViewport(),this}updateViewport(){let t=this.sourceGraph.transform.getScale(),e=this.targetGraph.transform.getScale(),n=this.scroller?this.scroller.clientToLocalPoint(0,0):this.graph.graphToLocal(0,0),s=et.position(this.targetGraph.container),r=this.targetGraph.translate();r.ty=r.ty||0,this.geometry={top:s.top+n.y*e.sy+r.ty,left:s.left+n.x*e.sx+r.tx,width:this.graphContainer.clientWidth*e.sx/t.sx,height:this.graphContainer.clientHeight*e.sy/t.sy},et.css(this.viewport,this.geometry)}startAction(t){let e=this.normalizeEvent(t),n=e.target===this.zoomHandle?"zooming":"panning",{tx:s,ty:r}=this.sourceGraph.translate(),o={action:n,clientX:e.clientX,clientY:e.clientY,scrollLeft:this.graphContainer.scrollLeft,scrollTop:this.graphContainer.scrollTop,zoom:this.sourceGraph.zoom(),scale:this.sourceGraph.transform.getScale(),geometry:this.geometry,translateX:s,translateY:r};this.targetGraphTransforming=!0,this.delegateDocumentEvents(zCt,o)}doAction(t){let e=this.normalizeEvent(t),n=e.clientX,s=e.clientY,r=e.data;switch(r.action){case"panning":{let o=this.sourceGraph.transform.getScale(),a=(n-r.clientX)*o.sx,l=(s-r.clientY)*o.sy;
5078this.scroller?(this.graphContainer.scrollLeft=r.scrollLeft+a/this.ratio,this.graphContainer.scrollTop=r.scrollTop+l/this.ratio):this.sourceGraph.translate(r.translateX-a/this.ratio,r.translateY-l/this.ratio);break}case"zooming":{let o=r.scale,a=r.geometry,l=1+(r.clientX-n)/a.width/o.sx;r.frameId&&cancelAnimationFrame(r.frameId),r.frameId=requestAnimationFrame(()=>{this.sourceGraph.zoom(l*r.zoom,{absolute:!0,minScale:this.options.minScale,maxScale:this.options.maxScale})});break}default:break}}stopAction(){this.undelegateDocumentEvents(),this.targetGraphTransforming=!1}scrollTo(t){let e=this.normalizeEvent(t),n,s,r=this.targetGraph.translate();if(r.ty=r.ty||0,e.offsetX==null){let l=et.offset(this.targetGraph.container);n=e.pageX-l.left,s=e.pageY-l.top}else n=e.offsetX,s=e.offsetY;let o=(n-r.tx)/this.ratio,a=(s-r.ty)/this.ratio;this.sourceGraph.centerPoint(o,a)}dispose(){this.remove(),us.clean(this.name)}};rn([ln()],oA.prototype,"dispose",null);Sn();Sn();var D0="graph-scroller",Hue=`${D0}-panning`,jue=`${D0}-pannable`,HCt=`${D0}-paged`,jCt=`${D0}-content`,WCt=`${D0}-background`,sX="transition-in-progress",DN="transitionend.graph-scroller-transition",$Ct={padding(){let i=this.getClientSize(),t=Math.max(this.options.minVisibleWidth||0,1)||1,e=Math.max(this.options.minVisibleHeight||0,1)||1,n=Math.max(i.width-t,0),s=Math.max(i.height-e,0);return{left:n,top:s,right:n,bottom:s}},minVisibleWidth:50,minVisibleHeight:50,pageVisible:!1,pageBreak:!1,autoResize:!0};function IN(i){let t=ge.merge({},$Ct,i);t.pageWidth==null&&(t.pageWidth=i.graph.options.width),t.pageHeight==null&&(t.pageHeight=i.graph.options.height);let e=i.graph.options;return e.background&&t.enabled&&t.background==null&&(t.background=e.background,i.graph.background.clear()),t}var zx=class extends Wi{get graph(){return this.options.graph}get model(){return this.graph.model}constructor(t){super(),this.padding={left:0,top:0,right:0,bottom:0},this.options=IN(t),this.onUpdate=ke.debounce(this.onUpdate,200);let e=this.graph.transform.getScale();this.sx=e.sx,this.sy=e.sy;let n=this.options.width||this.graph.options.width,s=this.options.height||this.graph.options.height;this.container=document.createElement("div"),et.addClass(this.container,this.prefixClassName(D0)),et.css(this.container,{width:n,height:s}),this.options.pageVisible&&et.addClass(this.container,this.prefixClassName(HCt)),this.options.className&&et.addClass(this.container,this.options.className);let r=this.graph.container;r.parentNode&&et.before(r,this.container),this.content=document.createElement("div"),et.addClass(this.content,this.prefixClassName(jCt)),et.css(this.content,{width:this.graph.options.width,height:this.graph.options.height}),this.background=document.createElement("div"),et.addClass(this.background,this.prefixClassName(WCt)),et.append(this.content,this.background),this.options.pageVisible||et.append(this.content,this.graph.view.grid),et.append(this.content,r),et.appendTo(this.content,this.container),this.startListening(),this.options.pageVisible||this.graph.grid.update(),this.backgroundManager=new LN(this),this.options.autoResize||this.update()}startListening(){let t=this.graph,e=this.model;t.on("scale",this.onScale,this),t.on("resize",this.onResize,this),t.on("before:print",this.storeScrollPosition,this),t.on("before:export",this.storeScrollPosition,this),t.on("after:print",this.restoreScrollPosition,this),t.on("after:export",this.restoreScrollPosition,this),e.on("reseted",this.onUpdate,this),e.on("cell:added",this.onUpdate,this),e.on("cell:removed",this.onUpdate,this),e.on("cell:changed",this.onUpdate,this),this.delegateBackgroundEvents()}stopListening(){let t=this.graph,e=this.model;t.off("scale",this.onScale,this),t.off("resize",this.onResize,this),t.off("beforeprint",this.storeScrollPosition,this),t.off("beforeexport",this.storeScrollPosition,this),t.off("afterprint",this.restoreScrollPosition,this),t.off("afterexport",this.restoreScrollPosition,this),e.off("reseted",this.onUpdate,this),e.off("cell:added",this.onUpdate,this),e.off("cell:removed",this.onUpdate,this),e.off("cell:changed",this.onUpdate,this),this.undelegateBackgroun
5078dEvents()}enableAutoResize(){this.options.autoResize=!0}disableAutoResize(){this.options.autoResize=!1}onUpdate(){this.options.autoResize&&this.update()}delegateBackgroundEvents(t){let e=t||Zc.events;this.delegatedHandlers=Object.keys(e).reduce((n,s)=>{let r=e[s];if(s.indexOf(" ")===-1)if(typeof r=="function")n[s]=r;else{let o=this.graph.view[r];typeof o=="function"&&(o=o.bind(this.graph.view),n[s]=o)}return n},{}),this.onBackgroundEvent=this.onBackgroundEvent.bind(this),Object.keys(this.delegatedHandlers).forEach(n=>{this.delegateEvent(n,{guarded:!1},this.onBackgroundEvent)})}undelegateBackgroundEvents(){Object.keys(this.delegatedHandlers).forEach(t=>{this.undelegateEvent(t,this.onBackgroundEvent)})}onBackgroundEvent(t){let e=!1,n=t.target;if(this.options.pageVisible)this.options.background?e=this.background===n:e=this.content===n;else{let s=this.graph.view;e=s.background===n||s.grid===n}if(e){let s=this.delegatedHandlers[t.type];typeof s=="function"&&s.apply(this.graph,arguments)}}onResize(){this.cachedCenterPoint&&(this.centerPoint(this.cachedCenterPoint.x,this.cachedCenterPoint.y),this.updatePageBreak())}onScale({sx:t,sy:e,ox:n,oy:s}){this.updateScale(t,e),(n||s)&&(this.centerPoint(n,s),this.updatePageBreak()),typeof this.options.autoResizeOptions=="function"&&this.update()}storeScrollPosition(){this.cachedScrollLeft=this.container.scrollLeft,this.cachedScrollTop=this.container.scrollTop}restoreScrollPosition(){this.container.scrollLeft=this.cachedScrollLeft,this.container.scrollTop=this.cachedScrollTop,this.cachedScrollLeft=null,this.cachedScrollTop=null}storeClientSize(){this.cachedClientSize={width:this.container.clientWidth,height:this.container.clientHeight}}restoreClientSize(){this.cachedClientSize=null}beforeManipulation(){(bI||vI)&&et.css(this.container,{visibility:"hidden"})}afterManipulation(){(bI||vI)&&et.css(this.container,{visibility:"visible"})}updatePageSize(t,e){t!=null&&(this.options.pageWidth=t),e!=null&&(this.options.pageHeight=e),this.updatePageBreak()}updatePageBreak(){if(this.pageBreak&&this.pageBreak.parentNode&&this.pageBreak.parentNode.removeChild(this.pageBreak),this.pageBreak=null,this.options.pageVisible&&this.options.pageBreak){let t=this.graph.options.width,e=this.graph.options.height,n=this.options.pageWidth*this.sx,s=this.options.pageHeight*this.sy;if(n===0||s===0)return;if(t>n||e>s){let r=!1,o=document.createElement("div");for(let a=1,l=Math.floor(t/n);a<l;a+=1){let c=document.createElement("div");et.addClass(c,this.prefixClassName("graph-pagebreak-vertical")),et.css(c,{left:a*n}),et.appendTo(c,o),r=!0}for(let a=1,l=Math.floor(e/s);a<l;a+=1){let c=document.createElement("div");et.addClass(c,this.prefixClassName("graph-pagebreak-horizontal")),et.css(c,{top:a*s}),et.appendTo(c,o),r=!0}r&&(et.addClass(o,this.prefixClassName("graph-pagebreak")),et.after(this.graph.view.grid,o),this.pageBreak=o)}}}update(){let t=this.getClientSize();this.cachedCenterPoint=this.clientToLocalPoint(t.width/2,t.height/2);let e=this.options.autoResizeOptions;typeof e=="function"&&(e=ke.call(e,this,this));let n=Object.assign({gridWidth:this.options.pageWidth,gridHeight:this.options.pageHeight,allowNewOrigin:"negative"},e);this.graph.fitToContent(this.getFitToContentOptions(n))}getFitToContentOptions(t){let e=this.sx,n=this.sy;return t.gridWidth&&(t.gridWidth*=e),t.gridHeight&&(t.gridHeight*=n),t.minWidth&&(t.minWidth*=e),t.minHeight&&(t.minHeight*=n),typeof t.padding=="object"?t.padding={left:(t.padding.left||0)*e,right:(t.padding.right||0)*e,top:(t.padding.top||0)*n,bottom:(t.padding.bottom||0)*n}:typeof t.padding=="number"&&(t.padding*=e),this.options.autoResize||(t.contentArea=Pe.create()),t}updateScale(t,e){let n=this.graph.options,s=t/this.sx,r=e/this.sy;this.sx=t,this.sy=e,this.graph.translate(n.x*s,n.y*r),this.graph.transform.resize(n.width*s,n.height*r)}scrollbarPosition(t,e){if(t==null&&e==null)return{left:this.container.scrollLeft,top:this.container.scrollTop};let n={};return typeof t=="number"&&(n.scrollLeft=t),typeof e=="number"&&(n.scrollTop=e),et.prop(this.container,n),this}scrollToPoint(t,e){let n=this.getClientSize(),s=this.graph.matrix(),r={};return typeof t=="number"&&(r.scrollLeft=t-n.width/2+s.e+(this.padding.left||0)),typeof e=="number"&&(r.scrollTop=e-n.height/2+s.f+(this.padding.top||0)),et.prop(this.container,r),this}scrollToContent(){let t=this.sx,e=this.sy,n=this.graph.getContentArea().getCenter();return this.scrollToPoint(n.x*t,n.y*e)}scrollToCell(t){let e=this.sx,n=this.sy,s=t.getBBox().getCenter();return this.scrollToPoint(s.x*e,s.y*n)}center(t){return this.centerPoint(t)}centerPoint(t,e,n){let s=this.graph.matrix(),r=s.a,o=s.d,a=-s.e,l=-s.f,c=a+this.graph.options.width,u=l+this.graph.options.height,h;if(this.storeClientSize(),typeof t=="number"||typeof e=="number"){h=n;let R=this.getVisibleArea().getCenter();typeof t=="number"?t*=r:t=R.x,typeof e=="number"?e*=o:e=R.y}else h=t,t=(a+c)/2,e=(l+u)/2;if(h&&h.padding)return this.positionPoint({x:t,y:e},"50%","50%",h);let d=this.getPadding(),p=this.getClientSize(),g=p.width/2,y=p.height/2,x=g-d.left-t+a,w=g-d.right+t-c,M=y-d.top-e+l,A=y-d.bottom+e-u;this.addPadding(Math.max(x,0),Math.max(w,0),Math.max(M,0),Math.max(A,0));let C=this.scrollToPoint(t,e);return this.restoreClientSize(),C}centerContent(t){return this.positionContent("center",t)}centerCell(t,e){return this.positionCell(t,"center",e)}positionContent(t,e){let n=this.graph.getContentArea(e);return this.positionRect(n,t,e)}positionCell(t,e,n){let s=t.getBBox();return this.positionRect(s,e,n)}positionRect(t,e,n){let s=Pe.create(t);switch(e){case"center":return this.positionPoint(s.getCenter(),"50%","50%",n);case"top":return this.positionPoint(s.getTopCenter(),"50%",0,n);case"top-right":return this.positionPoint(s.getTopRight(),"100%",0,n);case"right":return this.positionPoint(s.getRightMiddle(),"100%","50%",n);case"bottom-right":return this.positionPoint(s.getBottomRight(),"100%","100%",n);case"bottom":return this.positionPoint(s.getBottomCenter(),"50%","100%",n);case"bottom-left":return this.positionPoint(s.getBottomLeft(),0,"100%",n);case"left":return this.positionPoint(s.getLeftMiddle(),0,"50%",n);case"top-left":return this.positionPoint(s.getTopLeft(),0,0,n);default:return this}}positionPoint(t,e,n,s={}){let{padding:r}=s,o=hn(s,["padding"]),a=dn.normalizeSides(r),l=Pe.fromSize(this.getClientSize()),c=l.clone().moveAndExpand({x:a.left,y:a.top,width:-a.right-a.left,height:-a.top-a.bottom});e=dn.normalizePercentage(e,Math.max(0,c.width)),e<0&&(e=c.width+e),n=dn.normalizePercentage(n,Math.max(0,c.height)),n<0&&(n=c.height+n);let u=c.getTopLeft().translate(e,n),h=l.getCenter().diff(u),d=this.zoom(),p=h.scale(1/d,1/d),g=Mt.create(t).translate(p);return this.centerPoint(g.x,g.y,o)}zoom(t,e){if(t==null)return this.sx;e=e||{};let n,s,r=this.getClientSize(),o=this.clientToLocalPoint(r.width/2,r.height/2),a=t,l=t;
5078if(e.absolute||(a+=this.sx,l+=this.sy),e.scaleGrid&&(a=Math.round(a/e.scaleGrid)*e.scaleGrid,l=Math.round(l/e.scaleGrid)*e.scaleGrid),e.maxScale&&(a=Math.min(e.maxScale,a),l=Math.min(e.maxScale,l)),e.minScale&&(a=Math.max(e.minScale,a),l=Math.max(e.minScale,l)),a=this.graph.transform.clampScale(a),l=this.graph.transform.clampScale(l),e.center){let c=a/this.sx,u=l/this.sy;n=e.center.x-(e.center.x-o.x)/c,s=e.center.y-(e.center.y-o.y)/u}else n=o.x,s=o.y;return this.beforeManipulation(),this.graph.transform.scale(a,l,n,s,!1),this.centerPoint(n,s),this.afterManipulation(),this}zoomToRect(t,e={}){let n=Pe.create(t),s=this.graph;if(e.contentArea=n,e.viewportArea==null){let o=this.container.getBoundingClientRect();e.viewportArea={x:s.options.x,y:s.options.y,width:o.width,height:o.height}}this.beforeManipulation(),s.transform.scaleContentToFitImpl(e,!1);let r=n.getCenter();return this.centerPoint(r.x,r.y),this.afterManipulation(),this}zoomToFit(t={}){return this.zoomToRect(this.graph.getContentArea(t),t)}transitionToPoint(t,e,n){typeof t=="object"?(n=e,e=t.y,t=t.x):e=e,n==null&&(n={});let s,r,o=this.sx,a=Math.max(n.scale||o,1e-6),l=this.getClientSize(),c=new Mt(t,e),u=this.clientToLocalPoint(l.width/2,l.height/2);if(o===a){let d=u.diff(c).scale(o,o).round();s=`translate(${d.x}px,${d.y}px)`}else{let d=a/(o-a)*c.distance(u),p=u.clone().move(c,d),g=this.localToBackgroundPoint(p).round();s=`scale(${a/o})`,r=`${g.x}px ${g.y}px`}let h=n.onTransitionEnd;return et.addClass(this.container,sX),et.Event.off(this.content,DN),et.Event.on(this.content,DN,d=>{this.syncTransition(a,{x:t,y:e}),typeof h=="function"&&ke.call(h,this,d.originalEvent)}),et.css(this.content,{transform:s,transformOrigin:r,transition:"transform",transitionDuration:n.duration||"1s",transitionDelay:n.delay,transitionTimingFunction:n.timing}),this}syncTransition(t,e){return this.beforeManipulation(),this.graph.scale(t),this.removeTransition(),this.centerPoint(e.x,e.y),this.afterManipulation(),this}removeTransition(){return et.removeClass(this.container,sX),et.Event.off(this.content,DN),et.css(this.content,{transform:"",transformOrigin:"",transition:"",transitionDuration:"",transitionDelay:"",transitionTimingFunction:""}),this}transitionToRect(t,e={}){let n=Pe.create(t),s=e.maxScale||1/0,r=e.minScale||Number.MIN_VALUE,o=e.scaleGrid||null,a=e.visibility||1,l=e.center?Mt.create(e.center):n.getCenter(),c=this.getClientSize(),u=c.width*a,h=c.height*a,d=new Pe(l.x-u/2,l.y-h/2,u,h).getMaxUniformScaleToFit(n,l);return d=Math.min(d,s),o&&(d=Math.floor(d/o)*o),d=Math.max(r,d),this.transitionToPoint(l,Object.assign({scale:d},e))}startPanning(t){let e=this.normalizeEvent(t);this.clientX=e.clientX,this.clientY=e.clientY,this.trigger("pan:start",{e}),et.Event.on(document.body,{"mousemove.panning touchmove.panning":this.pan.bind(this),"mouseup.panning touchend.panning":this.stopPanning.bind(this),"mouseleave.panning":this.stopPanning.bind(this)}),et.Event.on(window,"mouseup.panning",this.stopPanning.bind(this))}pan(t){let e=this.normalizeEvent(t),n=e.clientX-this.clientX,s=e.clientY-this.clientY;this.container.scrollTop-=s,this.container.scrollLeft-=n,this.clientX=e.clientX,this.clientY=e.clientY,this.trigger("panning",{e})}stopPanning(t){et.Event.off(document.body,".panning"),et.Event.off(window,".panning"),this.trigger("pan:stop",{e:t})}clientToLocalPoint(t,e){let n=typeof t=="object"?t.x:t,s=typeof t=="object"?t.y:e,r=this.graph.matrix();return n+=this.container.scrollLeft-this.padding.left-r.e,s+=this.container.scrollTop-this.padding.top-r.f,new Mt(n/r.a,s/r.d)}localToBackgroundPoint(t,e){let n=typeof t=="object"?Mt.create(t):new Mt(t,e),s=this.graph.matrix(),r=this.padding;return ei.transformPoint(n,s).translate(r.left,r.top)}resize(t,e){let n=t??this.container.offsetWidth,s=e??this.container.offsetHeight;typeof n=="number"&&(n=Math.round(n)),typeof s=="number"&&(s=Math.round(s)),this.options.width=n,this.options.height=s,et.css(this.container,{width:n,height:s}),this.update()}getClientSize(){return this.cachedClientSize?this.cachedClientSize:{width:this.container.clientWidth,height:this.container.clientHeight}}autoScroll(t,e){let s=this.container,r=s.getBoundingClientRect(),o=0,a=0;return t<=r.left+10&&(o=-10),e<=r.top+10&&(a=-10),t>=r.right-10&&(o=10),e>=r.bottom-10&&(a=10),o!==0&&(s.scrollLeft+=o),a!==0&&(s.scrollTop+=a),{scrollerX:o,scrollerY:a}}addPadding(t,e,n,s){let r=this.getPadding();this.padding={left:Math.round(r.left+(t||0)),top:Math.round(r.top+(n||0)),bottom:Math.round(r.bottom+(s||0)),right:Math.round(r.right+(e||0))},r=this.padding,et.css(this.content,{width:r.left+this.graph.options.width+r.right,height:r.top+this.graph.options.height+r.bottom});let o=this.graph.container;return o.style.left=`${this.padding.left}px`,o.style.top=`${this.padding.top}px`,this}getPadding(){let t=this.options.padding;return typeof t=="function"?dn.normalizeSides(ke.call(t,this,this)):dn.normalizeSides(t)}getVisibleArea(){let t=this.graph.matrix(),e=this.getClientSize(),n={x:this.container.scrollLeft||0,y:this.container.scrollTop||0,width:e.width,height:e.height},s=ei.transformRectangle(n,t.inverse());return s.x-=(this.padding.left||0)/this.sx,s.y-=(this.padding.top||0)/this.sy,s}isCellVisible(t,e={}){let n=t.getBBox(),s=this.getVisibleArea();return e.strict?s.containsRect(n):s.isIntersectWithRect(n)}isPointVisible(t){return this.getVisibleArea().containsPoint(t)}lock(){return et.css(this.container,{overflow:"hidden"}),this}unlock(){return et.css(this.container,{overflow:"scroll"}),this}onRemove(){this.stopListening()}dispose(){et.before(this.container,this.graph.container),this.remove()}};rn([ln()],zx.prototype,"dispose",null);var LN=class extends _p{get elem(){return this.scroller.background}constructor(t){super(t.graph),this.scroller=t,t.options.background&&this.draw(t.options.background)}init(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}
5078updateBackgroundOptions(t){this.scroller.options.background=t}};var rX=`.x6-graph-scroller {
5079  position: relative;
5080  box-sizing: border-box;
5081  overflow: scroll;
5082  outline: none;
5083}
5084.x6-graph-scroller-content {
5085  position: relative;
5086}
5087.x6-graph-scroller-background {
5088  position: absolute;
5089  top: 0;
5090  right: 0;
5091  bottom: 0;
5092  left: 0;
5093}
5094.x6-graph-scroller .x6-graph {
5095  position: absolute;
5096  display: inline-block;
5097  margin: 0;
5098  box-shadow: none;
5099}
5100.x6-graph-scroller .x6-graph > svg {
5101  display: block;
5102}
5103.x6-graph-scroller.x6-graph-scroller-paged .x6-graph {
5104  box-shadow: 0 0 4px 0 #eee;
5105}
5106.x6-graph-scroller.x6-graph-scroller-pannable[data-panning='false'] {
5107  cursor: grab;
5108}
5109.x6-graph-scroller.x6-graph-scroller-pannable[data-panning='true'] {
5110  cursor: grabbing;
5111  user-select: none;
5112}
5113.x6-graph-pagebreak {
5114  position: absolute;
5115  top: 0;
5116  right: 0;
5117  bottom: 0;
5118  left: 0;
5119}
5120.x6-graph-pagebreak-vertical {
5121  position: absolute;
5122  top: 0;
5123  bottom: 0;
5124  box-sizing: border-box;
5125  width: 1px;
5126  border-left: 1px dashed #bdbdbd;
5127}
5128.x6-graph-pagebreak-horizontal {
5129  position: absolute;
5130  right: 0;
5131  left: 0;
5132  box-sizing: border-box;
5133  height: 1px;
5134  border-top: 1px dashed #bdbdbd;
5135}
5136`;oe.prototype.lockScroller=function(){let i=this.getPlugin("scroller");return i&&i.lockScroller(),this};oe.prototype.unlockScroller=function(){let i=this.getPlugin("scroller");return i&&i.unlockScroller(),this};oe.prototype.updateScroller=function(){let i=this.getPlugin("scroller");return i&&i.updateScroller(),this};oe.prototype.getScrollbarPosition=function(){let i=this.getPlugin("scroller");return i?i.getScrollbarPosition():{left:0,top:0}};oe.prototype.setScrollbarPosition=function(i,t){let e=this.getPlugin("scroller");return e&&e.setScrollbarPosition(i,t),this};var aA=class extends Ii{get pannable(){return this.options?typeof this.options.pannable=="object"?this.options.pannable.enabled:!!this.options.pannable:!1}get container(){return this.scrollerImpl.container}constructor(t={}){super(),this.name="scroller",this.options=t,us.ensure(this.name,rX)}init(t){this.graph=t;let e=IN(Object.assign(Object.assign({enabled:!0},this.options),{graph:t}));this.options=e,this.scrollerImpl=new zx(e),this.setup(),this.autoDisableGraphPanning(),this.startListening(),this.updateClassName(),this.scrollerImpl.center()}resize(t,e){this.scrollerImpl.resize(t,e)}resizePage(t,e){this.scrollerImpl.updatePageSize(t,e)}zoom(t,e){return typeof t>"u"?this.scrollerImpl.zoom():(this.scrollerImpl.zoom(t,e),this)}zoomTo(t,e={}){return this.scrollerImpl.zoom(t,Object.assign(Object.assign({},e),{absolute:!0})),this}zoomToRect(t,e={}){return this.scrollerImpl.zoomToRect(t,e),this}zoomToFit(t={}){return this.scrollerImpl.zoomToFit(t),this}center(t){return this.centerPoint(t)}centerPoint(t,e,n){return this.scrollerImpl.centerPoint(t,e,n),this}centerContent(t){return this.scrollerImpl.centerContent(t),this}centerCell(t,e){return this.scrollerImpl.centerCell(t,e),this}positionPoint(t,e,n,s={}){return this.scrollerImpl.positionPoint(t,e,n,s),this}positionRect(t,e,n){return this.scrollerImpl.positionRect(t,e,n),this}positionCell(t,e,n){return this.scrollerImpl.positionCell(t,e,n),this}positionContent(t,e){return this.scrollerImpl.positionContent(t,e),this}drawBackground(t,e){return(this.graph.options.background==null||!e)&&this.scrollerImpl.backgroundManager.draw(t),this}clearBackground(t){return(this.graph.options.background==null||!t)&&this.scrollerImpl.backgroundManager.clear(),this}isPannable(){return this.pannable}enablePanning(){this.pannable||(this.options.pannable=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.options.pannable=!1,this.updateClassName())}togglePanning(t){return t==null?this.isPannable()?this.disablePanning():this.enablePanning():t!==this.isPannable()&&(t?this.enablePanning():this.disablePanning()),this}lockScroller(){return this.scrollerImpl.lock(),this}unlockScroller(){return this.scrollerImpl.unlock(),this}
5136updateScroller(){return this.scrollerImpl.update(),this}getScrollbarPosition(){return this.scrollerImpl.scrollbarPosition()}setScrollbarPosition(t,e){return this.scrollerImpl.scrollbarPosition(t,e),this}scrollToPoint(t,e){return this.scrollerImpl.scrollToPoint(t,e),this}scrollToContent(){return this.scrollerImpl.scrollToContent(),this}scrollToCell(t){return this.scrollerImpl.scrollToCell(t),this}transitionToPoint(t,e,n){return this.scrollerImpl.transitionToPoint(t,e,n),this}transitionToRect(t,e={}){return this.scrollerImpl.transitionToRect(t,e),this}enableAutoResize(){this.scrollerImpl.enableAutoResize()}disableAutoResize(){this.scrollerImpl.disableAutoResize()}autoScroll(t,e){return this.scrollerImpl.autoScroll(t,e)}clientToLocalPoint(t,e){return this.scrollerImpl.clientToLocalPoint(t,e)}getVisibleArea(){return this.scrollerImpl.getVisibleArea()}isCellVisible(t,e={}){return this.scrollerImpl.isCellVisible(t,e)}isPointVisible(t){return this.scrollerImpl.isPointVisible(t)}setup(){this.scrollerImpl.on("*",(t,e)=>{this.trigger(t,e)})}startListening(){let t=[],e=this.options.pannable;typeof e=="object"?t=e.eventTypes||[]:t=["leftMouseDown"],t.includes("leftMouseDown")&&(this.graph.on("blank:mousedown",this.preparePanning,this),this.graph.on("node:unhandled:mousedown",this.preparePanning,this),this.graph.on("edge:unhandled:mousedown",this.preparePanning,this)),t.includes("rightMouseDown")&&(this.onRightMouseDown=this.onRightMouseDown.bind(this),et.Event.on(this.scrollerImpl.container,"mousedown",this.onRightMouseDown))}stopListening(){let t=[],e=this.options.pannable;typeof e=="object"?t=e.eventTypes||[]:t=["leftMouseDown"],t.includes("leftMouseDown")&&(this.graph.off("blank:mousedown",this.preparePanning,this),this.graph.off("node:unhandled:mousedown",this.preparePanning,this),this.graph.off("edge:unhandled:mousedown",this.preparePanning,this)),t.includes("rightMouseDown")&&et.Event.off(this.scrollerImpl.container,"mousedown",this.onRightMouseDown)}onRightMouseDown(t){t.button===2&&this.allowPanning(t,!0)&&(this.updateClassName(!0),this.scrollerImpl.startPanning(t),this.scrollerImpl.once("pan:stop",()=>this.updateClassName(!1)))}preparePanning({e:t}){let e=this.allowPanning(t,!0),n=this.graph.getPlugin("selection"),s=n&&n.allowRubberband(t,!0);(e||this.allowPanning(t)&&!s)&&(this.updateClassName(!0),this.scrollerImpl.startPanning(t),this.scrollerImpl.once("pan:stop",()=>this.updateClassName(!1)))}allowPanning(t,e){return this.pannable&&zo(t,this.options.modifiers,e)}updateClassName(t){let e=this.scrollerImpl.container,n=In.prefix("graph-scroller-pannable");this.pannable?(et.addClass(e,n),e.dataset.panning=(!!t).toString()):et.removeClass(e,n)}autoDisableGraphPanning(){var t;let e=(t=this.graph)===null||t===void 0?void 0:t.panning;e?.pannable&&(e.disablePanning(),console.warn("Detected Scroller plugin; Graph panning has been disabled by default to avoid conflicts."))}dispose(){this.scrollerImpl.dispose(),this.stopListening(),this.off(),us.clean(this.name)}};rn([ln()],aA.prototype,"dispose",null);Sn();function lA(i,t){return i.reduce((e,n)=>Math.max(n?.getSize()[t],e),0)}function GCt(i,t,e){let n=[];for(let s=e*t,r=s+e;s<r;s+=1)i[s]&&n.push(i[s]);return n}function qCt(i,t,e){let n=[];for(let s=t,r=i.length;s<r;s+=e)i[s]&&n.push(i[s]);return n}function oX(i,t){return i.reduce((e,n,s)=>(e.push(e[s]+n),e),[t||0])}function aX(i,t={}){let e=Zr.isModel(i)?i:new Zr().resetCells(i,{sort:!1,dryrun:!0}),n=e.getNodes(),s=t.columns||1,r=Math.ceil(n.length/s),o=t.dx||0,a=t.dy||0,l=t.center!==!1,c=t.resizeToFit===!0,u=t.marginX||0,h=t.marginY||0,d=[],p=t.columnWidth;if(p==="compact")for(let M=0;M<s;M+=1){let A=qCt(n,M,s);d.push(lA(A,"width")+o)}else{(p==null||p==="auto")&&(p=lA(n,"width")+o);for(let M=0;M<s;M+=1)d.push(p)}let g=oX(d,u),y=[],x=t.rowHeight;if(x==="compact")for(let M=0;M<r;M+=1){let A=GCt(n,M,s);y.push(lA(A,"height")+a)}else{(x==null||x==="auto")&&(x=lA(n,"height")+a);for(let M=0;M<r;M+=1)y.push(x)}let w=oX(y,h);e.startBatch("layout"),n.forEach((M,A)=>{let C=A%s,R=Math.floor(A/s),k=d[C],O=y[R],I=0,U=0,V=M.getSize();if(c){let q=k-2*o,X=O-2*a,j=V.height*(V.width?q/V.width:1),W=V.width*(V.height?X/V.height:1);O<j?q=W:X=j,V={width:q,height:X},M.setSize(V,t)}l&&(I=(k-V.width)/2,U=(O-V.height)/2),M.position(g[C]+o+I,w[R]+a+U,t)}),e.stopBatch("layout")}var lX=`.x6-widget-dnd {
5137  position: absolute;
5138  top: -10000px;
5139  left: -10000px;
5140  z-index: 999999;
5141  display: none;
5142  cursor: move;
5143  opacity: 0.7;
5144  pointer-events: 'cursor';
5145}
5146.x6-widget-dnd.dragging {
5147  display: inline-block;
5148}
5149.x6-widget-dnd.dragging * {
5150  pointer-events: none !important;
5151}
5152.x6-widget-dnd .x6-graph {
5153  background: transparent;
5154  box-shadow: none;
5155}
5156.x6-widget-stencil {
5157  position: absolute;
5158  top: 0;
5159  right: 0;
5160  bottom: 0;
5161  left: 0;
5162}
5163.x6-widget-stencil::after {
5164  position: absolute;
5165  top: 0;
5166  display: block;
5167  width: 100%;
5168  height: 20px;
5169  padding: 8px 0;
5170  line-height: 20px;
5171  text-align: center;
5172  opacity: 0;
5173  transition: top 0.1s linear, opacity 0.1s linear;
5174  content: ' ';
5175  pointer-events: none;
5176}
5177.x6-widget-stencil-content {
5178  position: absolute;
5179  top: 0;
5180  right: 0;
5181  bottom: 0;
5182  left: 0;
5183  height: auto;
5184  overflow-x: hidden;
5185  overflow-y: auto;
5186}
5187.x6-widget-stencil .x6-node [magnet]:not([magnet='passive']) {
5188  pointer-events: none;
5189}
5190.x6-widget-stencil-group {
5191  padding: 0;
5192  padding-bottom: 8px;
5193  overflow: hidden;
5194  user-select: none;
5195}
5196.x6-widget-stencil-group.collapsed {
5197  height: auto;
5198  padding-bottom: 0;
5199}
5200.x6-widget-stencil-group-title {
5201  position: relative;
5202  margin-top: 0;
5203  margin-bottom: 0;
5204  padding: 4px;
5205  cursor: pointer;
5206}
5207.x6-widget-stencil-title,
5208.x6-widget-stencil-group > .x6-widget-stencil-group-title {
5209  overflow: hidden;
5210  white-space: nowrap;
5211  text-overflow: ellipsis;
5212  user-select: none;
5213}
5214.x6-widget-stencil .unmatched {
5215  opacity: 0.3;
5216}
5217.x6-widget-stencil .x6-node.unmatched {
5218  display: none;
5219}
5220.x6-widget-stencil-group.unmatched {
5221  display: none;
5222}
5223.x6-widget-stencil-search-text {
5224  position: relative;
5225  z-index: 1;
5226  box-sizing: border-box;
5227  width: 100%;
5228  height: 30px;
5229  max-height: 30px;
5230  line-height: 30px;
5231  outline: 0;
5232}
5233.x6-widget-stencil.not-found::after {
5234  opacity: 1;
5235  content: attr(data-not-found-text);
5236}
5237.x6-widget-stencil.not-found.searchable::after {
5238  top: 30px;
5239}
5240.x6-widget-stencil.not-found.searchable.collapsable::after {
5241  top: 50px;
5242}
5243.x6-widget-stencil {
5244  color: #333;
5245  background: #f5f5f5;
5246}
5247.x6-widget-stencil-content {
5248  position: absolute;
5249  top: 32px;
5250}
5251.x6-widget-stencil.searchable > .x6-widget-stencil-content {
5252  top: 80px;
5253}
5254.x6-widget-stencil.not-found::after {
5255  position: absolute;
5256}
5257.x6-widget-stencil.not-found.searchable.collapsable::after {
5258  top: 80px;
5259}
5260.x6-widget-stencil.not-found.searchable::after {
5261  top: 60px;
5262}
5263.x6-widget-stencil-group {
5264  height: auto;
5265  margin-bottom: 1px;
5266  padding: 0;
5267  transition: none;
5268}
5269  .x6-widget-stencil-group .x6-graph {
5270    background: transparent;
5271    box-shadow: none;
5272  }
5273
5274  .x6-widget-stencil .x6-node.x6-node-immovable {
5275    cursor: move;
5276  }
5277.x6-widget-stencil-group.collapsed {
5278  height: auto;
5279  max-height: 32px;
5280}
5281.x6-widget-stencil-title,
5282.x6-widget-stencil-group > .x6-widget-stencil-group-title {
5283  position: relative;
5284  left: 0;
5285  box-sizing: border-box;
5286  width: 100%;
5287  height: 32px;
5288  padding: 0 5px 0 8px;
5289  color: #666;
5290  font-weight: 700;
5291  font-size: 12px;
5292  line-height: 32px;
5293  cursor: default;
5294  transition: all 0.3;
5295}
5296.x6-widget-stencil-title:hover,
5297.x6-widget-stencil-group > .x6-widget-stencil-group-title:hover {
5298  color: #444;
5299}
5300.x6-widget-stencil-title {
5301  background: #e9e9e9;
5302}
5303.x6-widget-stencil-group > .x6-widget-stencil-group-title {
5304  background: #ededed;
5305}
5306.x6-widget-stencil.collapsable > .x6-widget-stencil-title,
5307.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title {
5308  padding-left: 32px;
5309  cursor: pointer;
5310}
5311.x6-widget-stencil.collapsable > .x6-widget-stencil-title::before,
5312.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title::before {
5313  position: absolute;
5314  top: 6px;
5315  left: 8px;
5316  display: block;
5317  width: 18px;
5318  height: 18px;
5319  margin: 0;
5320  padding: 0;
5321  background-color: transparent;
5322  background-repeat: no-repeat;
5323  background-position: 0 0;
5324  border: none;
5325  content: ' ';
5326}
5327.x6-widget-stencil.collapsable > .x6-widget-stencil-title::before,
5328.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title::before {
5329  background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJub256ZXJvIj48cGF0aCBkPSJNOS4zNzUuNUM0LjY4Ny41Ljg3NSA0LjMxMy44NzUgOWMwIDQuNjg4IDMuODEyIDguNSA4LjUgOC41IDQuNjg3IDAgOC41LTMuODEyIDguNS04LjUgMC00LjY4Ny0zLjgxMy04LjUtOC41LTguNXptMCAxNS44ODZDNS4zMDMgMTYuMzg2IDEuOTkgMTMuMDcyIDEuOTkgOXMzLjMxMi03LjM4NSA3LjM4NS03LjM4NVMxNi43NiA0LjkyOCAxNi43NiA5YzAgNC4wNzItMy4zMTMgNy4zODYtNy4zODUgNy4zODZ6Ii8+PHBhdGggZD0iTTEyLjc1MyA4LjQ0M0g1Ljk5N2EuNTU4LjU1OCAwIDAwMCAxLjExNmg2Ljc1NmEuNTU4LjU1OCAwIDAwMC0xLjExNnoiLz48L2c+PC9zdmc+');
5330  opacity: 0.4;
5331  transition: all 0.3s;
5332}
5333.x6-widget-stencil.collapsable > .x6-widget-stencil-title:hover::before,
5334.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title:hover::before {
5335  opacity: 0.6;
5336}
5337.x6-widget-stencil.collapsable.collapsed > .x6-widget-stencil-title::before,
5338.x6-widget-stencil-group.collapsable.collapsed > .x6-widget-stencil-group-title::before {
5339  background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJub256ZXJvIj48cGF0aCBkPSJNOS4zNzUuNUM0LjY4Ny41Ljg3NSA0LjMxMy44NzUgOWMwIDQuNjg4IDMuODEyIDguNSA4LjUgOC41IDQuNjg3IDAgOC41LTMuODEyIDguNS04LjUgMC00LjY4Ny0zLjgxMy04LjUtOC41LTguNXptMCAxNS44ODZDNS4zMDMgMTYuMzg2IDEuOTkgMTMuMDcyIDEuOTkgOXMzLjMxMi03LjM4NSA3LjM4NS03LjM4NVMxNi43NiA0LjkyOCAxNi43NiA5YzAgNC4wNzItMy4zMTMgNy4zODYtNy4zODUgNy4zODZ6Ii8+PHBhdGggZD0iTTEyLjc1MyA4LjQ0M0g1Ljk5N2EuNTU4LjU1OCAwIDAwMCAxLjExNmg2Ljc1NmEuNTU4LjU1OCAwIDAwMC0xLjExNnoiLz48cGF0aCBkPSJNOC44MTcgNS42MjN2Ni43NTZhLjU1OC41NTggMCAwMDEuMTE2IDBWNS42MjNhLjU1OC41NTggMCAxMC0xLjExNiAweiIvPjwvZz48L3N2Zz4=');
5340  opacity: 0.4;
5341}
5342.x6-widget-stencil.collapsable.collapsed > .x6-widget-stencil-title:hover::before,
5343.x6-widget-stencil-group.collapsable.collapsed > .x6-widget-stencil-group-title:hover::before {
5344  opacity: 0.6;
5345}
5346.x6-widget-stencil input[type='search'] {
5347  appearance: textfield;
5348}
5349.x6-widget-stencil input[type='search']::-webkit-search-cancel-button,
5350.x6-widget-stencil input[type='search']::-webkit-search-decoration {
5351  appearance: none;
5352}
5353.x6-widget-stencil-search-text {
5354  display: block;
5355  width: 90%;
5356  margin: 8px 5%;
5357  padding-left: 8px;
5358  color: #333;
5359  background: #fff;
5360  border: 1px solid #e9e9e9;
5361  border-radius: 12px;
5362  outline: 0;
5363}
5364.x6-widget-stencil-search-text:focus {
5365  outline: 0;
5366}
5367.x6-widget-stencil::after {
5368  color: #808080;
5369  font-weight: 600;
5370  font-size: 12px;
5371  background: 0 0;
5372}
5373`;var pl={base:"widget-stencil",title:"widget-stencil-title",search:"widget-stencil-search",searchText:"widget-stencil-search-text",content:"widget-stencil-content",group:"widget-stencil-group",groupTitle:"widget-stencil-group-title",groupContent:"widget-stencil-group-content"},ON="__default__",YCt=Object.assign({stencilGraphWidth:200,stencilGraphHeight:800,title:"Stencil",collapsable:!1,placeholder:"Search",notFoundText:"No matches found",layout(i,t){let e={columnWidth:this.options.stencilGraphWidth/2-10,columns:2,rowHeight:80,resizeToFit:!1,dx:10,dy:10};aX(i,Object.assign(Object.assign(Object.assign({},e),this.options.layoutOptions),t?t.layoutOptions:{}))}},EN),cA=class extends Wi{get targetScroller(){return this.options.target.getPlugin("scroller")}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}constructor(t={}){super(),this.name="stencil",us.ensure(this.name,lX),this.graphs={},this.groups={},this.options=Object.assign(Object.assign({},YCt),t),this.init()}init(){this.dnd=new E0(this.options),this.onSearch=ke.debounce(this.onSearch,200),this.initContainer(),this.initSearch(),this.initContent(),this.initGroups(),this.setTitle(),this.startListening()}load(t,e){return Array.isArray(t)?this.loadGroup(t,e):this.options.groups&&Object.keys(this.options.groups).forEac
5373h(n=>{t[n]&&this.loadGroup(t[n],n)}),this}unload(t,e){return Array.isArray(t)?this.loadGroup(t,e,!0):this.options.groups&&Object.keys(this.options.groups).forEach(n=>{t[n]&&this.loadGroup(t[n],n,!0)}),this}toggleGroup(t){return this.isGroupCollapsed(t)?this.expandGroup(t):this.collapseGroup(t),this}collapseGroup(t){if(this.isGroupCollapsable(t)){let e=this.groups[t];e&&!this.isGroupCollapsed(t)&&(this.trigger("group:collapse",{name:t}),et.addClass(e,"collapsed"))}return this}expandGroup(t){if(this.isGroupCollapsable(t)){let e=this.groups[t];e&&this.isGroupCollapsed(t)&&(this.trigger("group:expand",{name:t}),et.removeClass(e,"collapsed"))}return this}isGroupCollapsable(t){let e=this.groups[t];return et.hasClass(e,"collapsable")}isGroupCollapsed(t){let e=this.groups[t];return e&&et.hasClass(e,"collapsed")}collapseGroups(){return Object.keys(this.groups).forEach(t=>{this.collapseGroup(t)}),this}expandGroups(){return Object.keys(this.groups).forEach(t=>{this.expandGroup(t)}),this}resizeGroup(t,e){let n=this.graphs[t];return n&&n.resize(e.width,e.height),this}addGroup(t){let e=Array.isArray(t)?t:[t];this.options.groups?this.options.groups.push(...e):this.options.groups=e,e.forEach(n=>{this.initGroup(n)})}removeGroup(t){let e=Array.isArray(t)?t:[t];this.options.groups&&(this.options.groups=this.options.groups.filter(n=>!e.includes(n.name)),e.forEach(n=>{let s=this.graphs[n];this.unregisterGraphEvents(s),s.dispose(),delete this.graphs[n];let r=this.groups[n];et.remove(r),delete this.groups[n]}))}initContainer(){this.container=document.createElement("div"),et.addClass(this.container,this.prefixClassName(pl.base)),et.attr(this.container,"data-not-found-text",this.options.notFoundText||"No matches found")}initContent(){this.content=document.createElement("div"),et.addClass(this.content,this.prefixClassName(pl.content)),et.appendTo(this.content,this.container)}buildGraphConfig(t){let e=this.options.stencilGraphOptions||{},n=t?.graphOptions,s=Object.assign(Object.assign({},e),n);s.panning==null&&(s.panning=!1);let r=t&&t.graphWidth||this.options.stencilGraphWidth,o=t&&t.graphHeight||this.options.stencilGraphHeight,a=s.model||new Zr;return{mergedGraphOptions:s,width:r,height:o,model:a}}createStencilGraph(t,e,n,s){let r=new oe(Object.assign(Object.assign({},t),{container:document.createElement("div"),model:s,width:e,height:n,interacting:!1,preventDefaultBlankAction:!1}));return this.registerGraphEvents(r),r}initSearch(){this.options.search&&(et.addClass(this.container,"searchable"),et.append(this.container,this.renderSearch()))}initGroup(t){let e=document.createElement("div");et.addClass(e,this.prefixClassName(pl.group)),et.attr(e,"data-name",t.name),(t.collapsable==null&&this.options.collapsable||t.collapsable!==!1)&&et.addClass(e,"collapsable"),et.toggleClass(e,"collapsed",t.collapsed===!0);let n=document.createElement("h3");et.addClass(n,this.prefixClassName(pl.groupTitle)),n.innerHTML=t.title||t.name;let s=document.createElement("div");et.addClass(s,this.prefixClassName(pl.groupContent));let{mergedGraphOptions:r,width:o,height:a,model:l}=this.buildGraphConfig(t),c=this.createStencilGraph(r,o,a,l);et.append(s,c.container),et.append(e,[n,s]),et.appendTo(e,this.content),this.groups[t.name]=e,this.graphs[t.name]=c}initGroups(){if(this.clearGroups(),this.setCollapsableState(),this.options.groups&&this.options.groups.length)this.options.groups.forEach(t=>{this.initGroup(t)});else{let{mergedGraphOptions:t,width:e,height:n,model:s}=this.buildGraphConfig(),r=this.createStencilGraph(t,e,n,s);et.append(this.content,r.container),this.graphs[ON]=r}}setCollapsableState(){this.options.collapsable=this.options.collapsable&&this.options.groups&&this.options.groups.some(t=>t.collapsable!==!1),this.options.collapsable?(et.addClass(this.container,"collapsable"),this.options.groups&&this.options.groups.every(e=>e.collapsed||e.collapsable===!1)?et.addClass(this.container,"collapsed"):et.removeClass(this.container,"collapsed")):et.removeClass(this.container,"collapsable")}setTitle(){let t=document.createElement("div");et.addClass(t,this.prefixClassName(pl.title)),t.innerHTML=this.options.title,et.appendTo(t,this.container)}renderSearch(){let t=document.createElement("div");et.addClass(t,this.prefixClassName(pl.search));let e=document.createElement("input");return et.attr(e,{type:"search",placeholder:this.options.placeholder||"Search"}),et.addClass(e,this.prefixClassName(pl.searchText)),et.append(t,e),t}startListening(){let t=this.prefixClassName(pl.title),e=this.prefixClassName(pl.searchText),n=this.prefixClassName(pl.groupTitle);this.delegateEvents({[`click .${t}`]:"onTitleClick",[`touchstart .${t}`]:"onTitleClick",[`click .${n}`]:"onGroupTitleClick",[`touchstart .${n}`]:"onGroupTitleClick",[`input .${e}`]:"onSearch",[`focusin .${e}`]:"onSearchFocusIn",[`focusout .${e}`]:"onSearchFocusOut"})}stopListening(){this.undelegateEvents()}registerGraphEvents(t){t.on("cell:mousedown",this.onDragStart,this)}unregisterGraphEvents(t){t.off("cell:mousedown",this.onDragStart,this)}getGraphHeight(t){let e=this.getGroup(t);return e&&e.graphHeight!=null?e.graphHeight:this.options.stencilGraphHeight}loadGroup(t,e,n){let s=this.getModel(e);
5373if(s){let l=t.map(c=>vs.isNode(c)?c:vs.create(c));n===!0?s.removeCells(l):s.resetCells(l)}let r=this.getGroup(e),o=this.getGraphHeight(e),a=r&&r.layout||this.options.layout;if(a&&s&&ke.call(a,this,s,r),!o){let l=this.getGraph(e);l.fitToContent({minWidth:l.options.width,gridHeight:1,padding:r&&r.graphPadding||this.options.stencilGraphPadding||10})}return this}onDragStart(t){let{e,node:n}=t,s=this.getGroupByNode(n);if(s&&s.nodeMovable===!1)return;let r=this.getGraph(s?s.name:void 0),o=r&&typeof r.isPannable=="function"?r.isPannable():!1;o&&r.disablePanning();let a=()=>{o&&r.enablePanning(),this.undelegateDocumentEvents()};this.delegateDocumentEvents({mouseup:a,touchend:a,touchcancel:a}),this.dnd.start(n,e)}filter(t,e){let n=Object.keys(this.graphs).reduce((s,r)=>{let o=this.graphs[r],a=r===ON?null:r,l=o.model.getNodes().filter(p=>{let g=!1;typeof e=="function"?g=ke.call(e,this,p,t,a,this):typeof e=="boolean"?g=e:g=this.isCellMatched(p,t,e,t.toLowerCase()!==t);let y=o.renderer.findViewByCell(p);return y&&et.toggleClass(y.container,"unmatched",!g),g}),c=l.length>0,u=this.options,h=new Zr;return h.resetCells(l),u.layout&&ke.call(u.layout,this,h,this.getGroup(r)),this.groups[r]&&et.toggleClass(this.groups[r],"unmatched",!c),this.getGraphHeight(r)||o.fitToContent({gridWidth:1,gridHeight:1,padding:u.stencilGraphPadding||10,contentArea:h.getAllCellsBBox()||{x:0,y:0,width:0,height:0}}),s||c},!1);et.toggleClass(this.container,"not-found",!n)}isCellMatched(t,e,n,s){return e&&n?Object.keys(n).some(r=>{if(r==="*"||t.shape===r){let o=n[r];return typeof o=="boolean"?o:(Array.isArray(o)?o:[o]).some(l=>{let c=t.getPropByPath(l);return c!=null?(c=`${c}`,s||(c=c.toLowerCase()),c.indexOf(e)>=0):!1})}return!1}):!0}onSearch(t){this.filter(t.target.value,this.options.search)}onSearchFocusIn(){et.addClass(this.container,"is-focused")}onSearchFocusOut(){et.removeClass(this.container,"is-focused")}onTitleClick(){this.options.collapsable&&(et.toggleClass(this.container,"collapsed"),et.hasClass(this.container,"collapsed")?this.collapseGroups():this.expandGroups())}onGroupTitleClick(t){let e=t.target.closest(`.${this.prefixClassName(pl.group)}`);e&&this.toggleGroup(et.attr(e,"data-name")||"");let n=Object.keys(this.groups).every(s=>{let r=this.getGroup(s),o=this.groups[s];return r&&r.collapsable===!1||et.hasClass(o,"collapsed")});et.toggleClass(this.container,"collapsed",n)}getModel(t){let e=this.getGraph(t);return e?e.model:null}getGraph(t){return this.graphs[t||ON]}getGroup(t){let e=this.options.groups;return t!=null&&e&&e.length?e.find(n=>n.name===t):null}getGroupByNode(t){let e=this.options.groups;return e?e.find(n=>{let s=this.getModel(n.name);return s?s.has(t.id):!1}):null}clearGroups(){Object.keys(this.graphs).forEach(t=>{let e=this.graphs[t];this.unregisterGraphEvents(e),e.dispose()}),Object.keys(this.groups).forEach(t=>{let e=this.groups[t];et.remove(e)}),this.graphs={},this.groups={}}onRemove(){this.clearGroups(),this.dnd.remove(),this.stopListening(),this.undelegateDocumentEvents()}dispose(){this.remove(),us.clean(this.name)}};rn([ln()],cA.prototype,"dispose",null);Sn();Sn();var Vx=class extends Wi{get model(){return this.graph.model}get containerClassName(){return this.prefixClassName("widget-snapline")}get verticalClassName(){return`${this.containerClassName}-vertical`}get horizontalClassName(){return`${this.containerClassName}-horizontal`}constructor(t){super();let{graph:e}=t,n=hn(t,["graph"]);this.graph=e,this.options=Object.assign({},n),this.offset={x:0,y:0},this.render(),this.disabled||this.startListening()}get disabled(){return this.options.enabled!==!0}enable(){this.disabled&&(this.options.enabled=!0,this.startListening())}disable(){this.disabled||(this.options.enabled=!1,this.stopListening())}setFilter(t){this.options.filter=t}render(){let t=this.containerWrapper=new _i("svg"),e=this.horizontal=new _i("line"),n=this.vertical=new _i("line");t.addClass(this.containerClassName),e.addClass(this.horizontalClassName),n.addClass(this.verticalClassName),t.setAttribute("width","100%"),t.setAttribute("height","100%"),e.setAttribute("display","none"),n.setAttribute("display","none"),t.append([e,n]),this.options.className&&t.addClass(this.options.className),this.container=this.containerWrapper.node}startListening(){this.stopListening(),this.graph.on("node:mousedown",this.captureCursorOffset,this),this.graph.on("node:mousemove",this.snapOnMoving,this),this.model.on("batch:stop",this.onBatchStop,this),this.delegateDocumentEvents({mouseup:"hide",touchend:"hide"})}stopListening(){this.graph.off("node:mousedown",this.captureCursorOffset,this),this.graph.off("node:mousemove",this.snapOnMoving,this),this.model.off("batch:stop",this.onBatchStop,this),this.undelegateDocumentEvents()}onBatchStop({name:t,data:e}){t==="resize"&&this.snapOnResizing(e.cell,e)}captureCursorOffset({view:t,x:e,y:n}){let s=t.getDelegatedView();if(s&&this.isNodeMovable(s)){let r=t.cell.getPosition();this.offset={x:e-r.x,y:n-r.y}}}isNodeMovable(t){return t&&t.cell.isNode()&&t.can("nodeMovable")}getRestrictArea(t){let e=this.graph.options.translating.restrict,n=typeof e=="function"?ke.call(e,this.graph,t):e;return typeof n=="number"?this.graph.transform.getGraphArea().inflate(n):n===!0?this.graph.transform.getGraphArea():n||null}snapOnResizing(t,e){if(this.options.resizing&&!e.snapped&&e.ui&&e.direction&&e.trueDirection){let n=this.graph.renderer.f
5373indViewByCell(t);if(n&&n.cell.isNode()){let s=t.getBBox(),r=s.bbox(t.getAngle()),o=r.getTopLeft(),a=r.getBottomRight(),l=Ts(t.getAngle()),c=this.options.tolerance||0,u,h,d,p,g,y,x={vertical:0,horizontal:0},w=e.direction,M=e.trueDirection,A=e.relativeDirection;M.indexOf("right")!==-1?x.vertical=a.x:x.vertical=o.x,M.indexOf("bottom")!==-1?x.horizontal=a.y:x.horizontal=o.y,this.model.getNodes().some(X=>{if(this.isIgnored(t,X))return!1;let j=X.getBBox().bbox(X.getAngle()),W=j.getTopLeft(),_=j.getBottomRight(),at={vertical:[W.x,_.x],horizontal:[W.y,_.y]},ct={};return Object.keys(at).forEach(pt=>{let Et=pt,vt=at[Et].map(yt=>({position:yt,distance:Math.abs(yt-x[Et])})).filter(yt=>yt.distance<=c);ct[Et]=cs.sortBy(vt,yt=>yt.distance)}),u==null&&ct.vertical.length>0&&(u=ct.vertical[0].position,h=Math.min(r.y,j.y),d=Math.max(a.y,_.y)-h),p==null&&ct.horizontal.length>0&&(p=ct.horizontal[0].position,g=Math.min(r.x,j.x),y=Math.max(a.x,_.x)-g),u!=null&&p!=null}),this.hide();let C=0,R=0;(p!=null||u!=null)&&(u!=null&&(C=M.indexOf("right")!==-1?u-a.x:o.x-u),p!=null&&(R=M.indexOf("bottom")!==-1?p-a.y:o.y-p));let k=0,O=0;if(l%90===0)l===90||l===270?(k=R,O=C):(k=C,O=R);else{let X=l>=0&&l<90?1:l>=90&&l<180?4:l>=180&&l<270?3:2;p!=null&&u!=null&&(C<R?(R=0,p=void 0):(C=0,u=void 0));let j=bs(l%90);C&&(k=X===3?C/Math.cos(j):C/Math.sin(j)),R&&(O=X===3?R/Math.cos(j):R/Math.sin(j));let W=X===1||X===3;switch(A){case"top":case"bottom":O=R?R/(W?Math.cos(j):Math.sin(j)):C/(W?Math.sin(j):Math.cos(j));break;case"left":case"right":k=C?C/(W?Math.cos(j):Math.sin(j)):R/(W?Math.sin(j):Math.cos(j));break;default:break}}switch(A){case"top":case"bottom":k=0;break;case"left":case"right":O=0;break;default:break}let I=this.graph.getGridSize(),U=Math.max(s.width+k,I),V=Math.max(s.height+O,I);e.minWidth&&e.minWidth>I&&(U=Math.max(U,e.minWidth)),e.minHeight&&e.minHeight>I&&(V=Math.max(V,e.minHeight)),e.maxWidth&&(U=Math.min(U,e.maxWidth)),e.maxHeight&&(V=Math.min(V,e.maxHeight)),e.preserveAspectRatio&&(O<k?V=U*(s.height/s.width):U=V*(s.width/s.height)),(U!==s.width||V!==s.height)&&(t.resize(U,V,{direction:w,relativeDirection:A,trueDirection:M,snapped:!0,snaplines:this.cid,restrict:this.getRestrictArea(n)}),d&&(d+=V-s.height),y&&(y+=U-s.width));let q=t.getBBox().bbox(l);u&&Math.abs(q.x-u)>1&&Math.abs(q.width+q.x-u)>1&&(u=void 0),p&&Math.abs(q.y-p)>1&&Math.abs(q.height+q.y-p)>1&&(p=void 0),this.update({verticalLeft:u,verticalTop:h,verticalHeight:d,horizontalTop:p,horizontalLeft:g,horizontalWidth:y})}}}snapOnMoving({view:t,e,x:n,y:s}){let r=t.getEventData(e).delegatedView||t;if(!this.isNodeMovable(r))return;let o=r.cell,a=o.getSize(),l=o.getPosition(),c=new Pe(n-this.offset.x,s-this.offset.y,a.width,a.height),u=o.getAngle(),h=c.getCenter(),d=c.bbox(u),p=d.getTopLeft(),g=d.getBottomRight(),y=this.options.tolerance||0,x,w,M,A,C,R,k=0,O=0;if(this.model.getNodes().some(I=>{if(this.isIgnored(o,I))return!1;let U=I.getBBox().bbox(I.getAngle()),V=U.getCenter(),q=U.getTopLeft(),X=U.getBottomRight();return x==null&&(Math.abs(V.x-h.x)<y?(x=V.x,k=.5):Math.abs(q.x-p.x)<y?(x=q.x,k=0):Math.abs(q.x-g.x)<y?(x=q.x,k=1):Math.abs(X.x-g.x)<y?(x=X.x,k=1):Math.abs(X.x-p.x)<y&&(x=X.x),x!=null&&(w=Math.min(d.y,U.y),M=Math.max(g.y,X.y)-w)),A==null&&(Math.abs(V.y-h.y)<y?(A=V.y,O=.5):Math.abs(q.y-p.y)<y?A=q.y:Math.abs(q.y-g.y)<y?(A=q.y,O=1):Math.abs(X.y-g.y)<y?(A=X.y,O=1):Math.abs(X.y-p.y)<y&&(A=X.y),A!=null&&(C=Math.min(d.x,U.x),R=Math.max(g.x,X.x)-C)),x!=null&&A!=null}),this.hide(),A!=null||x!=null){A!=null&&(d.y=A-O*d.height),x!=null&&(d.x=x-k*d.width);let I=d.getCenter(),U=I.x-c.width/2,V=I.y-c.height/2,q=U-l.x,X=V-l.y;(q!==0||X!==0)&&(o.translate(q,X,{snapped:!0,restrict:this.getRestrictArea(r)}),R&&(R+=q),M&&(M+=X)),this.update({verticalLeft:x,verticalTop:w,verticalHeight:M,horizontalTop:A,horizontalLeft:C,horizontalWidth:R})}}isIgnored(t,e){return e.id===t.id||e.isDescendantOf(t)||!this.filter(e)}filter(t){let e=this.options.filter;return Array.isArray(e)?e.some(n=>typeof n=="string"?t.shape===n:t.id===n.id):typeof e=="function"?ke.call(e,this.graph,t):!0}update(t){if(t.horizontalTop){let e=this.graph.localToGraph(new Mt(t.horizontalLeft,t.horizontalTop)),n=this.graph.localToGraph(new Mt(t.horizontalLeft+t.horizontalWidth,t.horizontalTop));this.horizontal.setAttributes({x1:this.options.sharp?`${e.x}`:"0",y1:`${e.y}`,x2:this.options.sharp?`${n.x}`:"100%",y2:`${n.y}`,display:"inherit"})}else this.horizontal.setAttribute("display","none");if(t.verticalLeft){let e=this.graph.localToGraph(new Mt(t.verticalLeft,t.verticalTop)),n=this.graph.localToGraph(new Mt(t.verticalLeft,t.verticalTop+t.verticalHeight));this.vertical.setAttributes({x1:`${e.x}`,y1:this.options.sharp?`${e.y}`:"0",x2:`${n.x}`,y2:this.options.sharp?`${n.y}`:"100%",display:"inherit"})}else this.vertical.setAttribute("display","none");this.show()}resetTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}show(){return this.resetTimer(),this.container.parentNode==null&&this.graph.container.appendChild(this.container),this}hide(){this.resetTimer(),this.vertical.setAttribute("display","none"),this.horizontal.setAttribute("display","none");let t=this.options.clean,e=typeof t=="number"?t:t!==!1?3e3:0;return e>0&&(this.timer=window.setTimeout(()=>{this.container.parentNode!==null&&this.unmount()},e)),this}onRemove(){this.stopListening(),this.hide()}dispose(){this.remove()}};rn([ln()],Vx.prototype,"dispose",null);var cX=`.x6-widget-snapline {
5374  position: absolute;
5375  top: 0;
5376  right: 0;
5377  bottom: 0;
5378  left: 0;
5379  pointer-events: none;
5380}
5381.x6-widget-snapline-vertical,
5382.x6-widget-snapline-horizontal {
5383  stroke: #2ecc71;
5384  stroke-width: 1px;
5385}
5386`;oe.prototype.isSnaplineEnabled=function(){let i=this.getPlugin("snapline");return i?i.isEnabled():!1};oe.prototype.enableSnapline=function(){let i=this.getPlugin("snapline");return i&&i.enable(),this};oe.prototype.disableSnapline=function(){let i=this.getPlugin("snapline");return i&&i.disable(),this};oe.prototype.toggleSnapline=function(){let i=this.getPlugin("snapline");return i&&i.toggleEnabled(),this};oe.prototype.hideSnapline=function(){let i=this.getPlugin("snapline");return i&&i.hide(),this};oe.prototype.setSnaplineFilter=function(i){let t=this.getPlugin("snapline");return t&&t.setFilter(i),this};oe.prototype.isSnaplineOnResizingEnabled=function(){let i=this.getPlugin("snapline");return i?i.isOnResizingEnabled():!1};oe.prototype.enableSnaplineOnResizing=function(){let i=this.getPlugin("snapline");return i&&i.enableOnResizing(),this};oe.prototype.disableSnaplineOnResizing=function(){let i=this.getPlugin("snapline");return i&&i.disableOnResizing(),this};oe.prototype.toggleSnaplineOnResizing=function(i){let t=this.getPlugin("snapline");return t&&t.toggleOnResizing(i),this};oe.prototype.isSharpSnapline=function(){let i=this.getPlugin("snapline");return i?i.isSharp():!1};oe.prototype.enableSharpSnapline=function(){let i=this.getPlugin("snapline");return i&&i.enableSharp(),this};oe.prototype.disableSharpSnapline=function(){let i=this.getPlugin("snapline");return i&&i.disableSharp(),this};oe.prototype.toggleSharpSnapline=function(i){let t=this.getPlugin("snapline");return t&&t.toggleSharp(i),this};oe.prototype.getSnaplineTolerance=function(){let i=this.getPlugin("snapline");if(i)return i.getTolerance()};oe.prototype.setSnaplineTolerance=function(i){let t=this.getPlugin("snapline");return t&&t.setTolerance(i),this};var uA=class extends Uo{constructor(t={}){super(),this.name="snapline",this.options=Object.assign({enabled:!0,tolerance:10},t),us.ensure(this.name,cX)}init(t){this.snaplineImpl=new Vx(Object.assign(Object.assign({},this.options),{graph:t}))}isEnabled(){return!this.snaplineImpl.disabled}enable(){this.snaplineImpl.enable()}disable(){this.snaplineImpl.disable()}toggleEnabled(t){if(t!=null)t!==this.isEnabled()&&(t?this.enable():this.disable());else return this.isEnabled()?this.disable():this.enable(),this}hide(){return this.snaplineImpl.hide(),this}setFilter(t){return this.snaplineImpl.setFilter(t),this}isOnResizingEnabled(){return this.snaplineImpl.options.resizing===!0}enableOnResizing(){return this.snaplineImpl.options.resizing=!0,this}disableOnResizing(){return this.snaplineImpl.options.resizing=!1,this}toggleOnResizing(t){return t!=null?t!==this.isOnResizingEnabled()&&(t?this.enableOnResizing():this.disableOnResizing()):this.isOnResizingEnabled()?this.disableOnResizing():this.enableOnResizing(),this}isSharp(){return this.snaplineImpl.options.sharp===!0}enableSharp(){return this.snaplineImpl.options.sharp=!0,this}disableSharp(){return this.snaplineImpl.options.sharp=!1,this}toggleSharp(t){return t!=null?t!==this.isSharp()&&(t?this.enableSharp():this.disableSharp()):this.isSharp()?this.disableSharp():this.enableSharp(),this}getTolerance(){return this.snaplineImpl.options.tolerance}setTolerance(t){return this.snaplineImpl.options.tolerance=t,this}captureCursorOffset(t){this.snaplineImpl.captureCursorOffset(t)}snapOnMoving(t){this.snaplineImpl.snapOnMoving(t)}dispose(){this.snaplineImpl.dispose(),us.clean(this.name)}};rn([ln()],uA.prototype,"dispose",null);Sn();var uX=`.x6-widget-transform {
5387  position: absolute;
5388  box-sizing: content-box !important;
5389  margin: -5px 0 0 -5px;
5390  padding: 4px;
5391  border: 1px dashed #000;
5392  border-radius: 5px;
5393  user-select: none;
5394  pointer-events: none;
5395}
5396.x6-widget-transform > div {
5397  position: absolute;
5398  box-sizing: border-box;
5399  background-color: #fff;
5400  border: 1px solid #000;
5401  transition: background-color 0.2s;
5402  pointer-events: auto;
5403  -webkit-user-drag: none;
5404  user-drag: none;
5405  /* stylelint-disable-line */
5406}
5407.x6-widget-transform > div:hover {
5408  background-color: #d3d3d3;
5409}
5410.x6-widget-transform-cursor-n {
5411  cursor: n-resize;
5412}
5413.x6-widget-transform-cursor-s {
5414  cursor: s-resize;
5415}
5416.x6-widget-transform-cursor-e {
5417  cursor: e-resize;
5418}
5419.x6-widget-transform-cursor-w {
5420  cursor: w-resize;
5421}
5422.x6-widget-transform-cursor-ne {
5423  cursor: ne-resize;
5424}
5425.x6-widget-transform-cursor-nw {
5426  cursor: nw-resize;
5427}
5428.x6-widget-transform-cursor-se {
5429  cursor: se-resize;
5430}
5431.x6-widget-transform-cursor-sw {
5432  cursor: sw-resize;
5433}
5434.x6-widget-transform-resize {
5435  width: 10px;
5436  height: 10px;
5437  border-radius: 6px;
5438}
5439.x6-widget-transform-resize[data-position='top-left'] {
5440  top: -5px;
5441  left: -5px;
5442}
5443.x6-widget-transform-resize[data-position='top-right'] {
5444  top: -5px;
5445  right: -5px;
5446}
5447.x6-widget-transform-resize[data-position='bottom-left'] {
5448  bottom: -5px;
5449  left: -5px;
5450}
5451.x6-widget-transform-resize[data-position='bottom-right'] {
5452  right: -5px;
5453  bottom: -5px;
5454}
5455.x6-widget-transform-resize[data-position='top'] {
5456  top: -5px;
5457  left: 50%;
5458  margin-left: -5px;
5459}
5460.x6-widget-transform-resize[data-position='bottom'] {
5461  bottom: -5px;
5462  left: 50%;
5463  margin-left: -5px;
5464}
5465.x6-widget-transform-resize[data-position='left'] {
5466  top: 50%;
5467  left: -5px;
5468  margin-top: -5px;
5469}
5470.x6-widget-transform-resize[data-position='right'] {
5471  top: 50%;
5472  right: -5px;
5473  margin-top: -5px;
5474}
5475.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='top'],
5476.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='bottom'],
5477.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='left'],
5478.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='right'] {
5479  display: none;
5480}
5481.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='bottom'],
5482.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='left'],
5483.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='right'],
5484.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='top'] {
5485  display: none;
5486}
5487.x6-widget-transform.no-resize .x6-widget-transform-resize {
5488  display: none;
5489}
5490.x6-widget-transform-rotate {
5491  top: -20px;
5492  left: -20px;
5493  width: 12px;
5494  height: 12px;
5495  border-radius: 6px;
5496  cursor: crosshair;
5497}
5498.x6-widget-transform.no-rotate .x6-widget-transform-rotate {
5499  display: none;
5500}
5501.x6-widget-transform-active {
5502  border-color: transparent;
5503  pointer-events: all;
5504}
5505.x6-widget-transform-active > div {
5506  display: none;
5507}
5508.x6-widget-transform-active > .x6-widget-transform-active-handle {
5509  display: block;
5510  background-color: #808080;
5511}
5512`;Sn();var hX="has-widget-transform",L0=["nw","n","ne","e","se","s","sw","w"],Mp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],XCt={minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,rotateGrid:15,rotatable:!0,preserveAspectRatio:!1,orthogonalResizing:!0,restrictedResizing:!1,autoScrollOnResizing:!0,allowReverse:!0},Hx=class extends Wi{get model(){return this.graph.model}get view(){return this.graph.renderer.findViewByCell(this.node)}get containerClassName(){return this.prefixClassName("widget-transform")}get resizeClassName(){return`${this.containerClassName}-resize`}get rotateClassName(){return`${this.containerClassName}-rotate`}constructor(t,e,n){super(),this.node=e,this.graph=n,this.options=Object.assign(Object.assign({},XCt),t),this.render(),this.startListening()}startListening(){this.delegateEvents({[`mousedown .${this.resizeClassName}`]:"startResizing",[`touchstart .${this.resizeClassName}`]:"startResizing",[`mousedown .${this.rotateClassName}`]:"startRotating",[`touchstart .${this.rotateClassName}`]:"startRotating"}),this.model.on("*",this.update,this),this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this),this.node.on("removed",this.remove,this),this.model.on("reseted",this.remove,this),this.view.on("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.on("cell:knob:mouseup",this.onKnobMouseUp,this)}stopListening(){this.undelegateEvents(),this.model.off("*",this.update,this),this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this),this.node.off("removed",this.remove,this),this.model.off("reseted",this.remove,this),this.view.off("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.off("cell:knob:mouseup",this.onKnobMouseUp,this)}renderHandles(){this.container=document.createElement("div");let t=document.createElement("div");et.attr(t,"draggable","false");let e=t.cloneNode(!0);et.addClass(e,this.rotateClassName);let n=Mp.map(s=>{let r=t.cloneNode(!0);
5512return et.addClass(r,this.resizeClassName),et.attr(r,"data-position",s),r});this.empty(),et.append(this.container,[...n,e])}render(){return this.renderHandles(),this.view&&this.view.addClass(hX),et.addClass(this.container,this.containerClassName),et.toggleClass(this.container,"no-orth-resize",this.options.preserveAspectRatio||!this.options.orthogonalResizing),et.toggleClass(this.container,"no-resize",!this.options.resizable),et.toggleClass(this.container,"no-rotate",!this.options.rotatable),this.options.className&&et.addClass(this.container,this.options.className),this.graph.container.appendChild(this.container),this.update()}update(){let t=this.graph.matrix(),e=this.node.getBBox();e.x*=t.a,e.x+=t.e,e.y*=t.d,e.y+=t.f,e.width*=t.a,e.height*=t.d;let n=Ts(this.node.getAngle()),s=n!==0?`rotate(${n}deg)`:"";return et.css(this.container,{transform:s,width:e.width,height:e.height,left:e.x,top:e.y}),this.updateResizerDirections(),this}remove(){return this.view&&this.view.removeClass(hX),super.remove()}onKnobMouseDown(){this.startHandle()}onKnobMouseUp(){this.stopHandle()}updateResizerDirections(){let t=Ts(this.node.getAngle()),e=Math.floor(t*(L0.length/360));if(e!==this.prevShift){let n=L0.slice(e).concat(L0.slice(0,e)),s=o=>`${this.containerClassName}-cursor-${o}`;this.container.querySelectorAll(`.${this.resizeClassName}`).forEach((o,a)=>{et.removeClass(o,L0.map(l=>s(l)).join(" ")),et.addClass(o,s(n[a]))}),this.prevShift=e}}getTrueDirection(t){let e=Ts(this.node.getAngle()),n=Mp.indexOf(t);return n+=Math.floor(e*(Mp.length/360)),n%=Mp.length,Mp[n]}toValidResizeDirection(t){return{top:"top-left",bottom:"bottom-right",left:"bottom-left",right:"top-right"}[t]||t}startResizing(t){t.stopPropagation(),this.model.startBatch("resize",{cid:this.cid});let e=et.attr(t.target,"data-position");this.prepareResizing(t,e),this.startAction(t)}prepareResizing(t,e){let n=this.getTrueDirection(e),s=0,r=0;e.split("-").forEach(c=>{s={left:-1,right:1}[c]||s,r={top:-1,bottom:1}[c]||r});let o=this.toValidResizeDirection(e),a={"top-right":"bottomLeft","top-left":"bottomRight","bottom-left":"topRight","bottom-right":"topLeft"}[o],l=Ts(this.node.getAngle());this.setEventData(t,{selector:a,direction:o,trueDirection:n,relativeDirection:e,angle:l,resizeX:s,resizeY:r,action:"resizing"})}startRotating(t){t.stopPropagation(),this.model.startBatch("rotate",{cid:this.cid});let e=this.node.getBBox().getCenter(),n=this.normalizeEvent(t),s=this.graph.snapToGrid(n.clientX,n.clientY);this.setEventData(t,{center:e,action:"rotating",angle:Ts(this.node.getAngle()),start:Mt.create(s).theta(e)}),this.startAction(t)}onMouseMove(t){let e=this.graph.findViewByCell(this.node),n=this.getEventData(t);if(n.action){let s=this.normalizeEvent(t),r=s.clientX,o=s.clientY,a=this.graph.getPlugin("scroller"),l=this.options.restrictedResizing;if(l===!0||typeof l=="number"){let p=l===!0?0:l,g=a?Math.max(p,8):p,y=this.graph.container.getBoundingClientRect();r=dn.clamp(r,y.left+g,y.right-g),o=dn.clamp(o,y.top+g,y.bottom-g)}else this.options.autoScrollOnResizing&&a&&a.autoScroll(r,o);let c=this.graph.snapToGrid(r,o),u=this.graph.getGridSize(),h=this.node,d=this.options;if(n.action==="resizing"){n=n,n.resized||(e&&(e.addClass("node-resizing"),this.notify("node:resize",t,e)),n.resized=!0);let p=h.getBBox(),g=Mt.create(c).rotate(n.angle,p.getCenter()).diff(p[n.selector]),y=n.resizeX?g.x*n.resizeX:p.width,x=n.resizeY?g.y*n.resizeY:p.height,w=y,M=x;if(y=fo(y,u),x=fo(x,u),y=Math.max(y,d.minWidth||u),x=Math.max(x,d.minHeight||u),y=Math.min(y,d.maxWidth||1/0),x=Math.min(x,d.maxHeight||1/0),d.preserveAspectRatio){let C=p.width*x/p.height,R=p.height*y/p.width;y<C?x=R:y=C}let A=n.relativeDirection;if(d.allowReverse&&(w<=-y||M<=-x)){let C;A==="left"?w<=-y&&(C="right"):A==="right"?w<=-y&&(C="left"):A==="top"?M<=-x&&(C="bottom"):A==="bottom"?M<=-x&&(C="top"):A==="top-left"?w<=-y&&M<=-x?C="bottom-right":w<=-y?C="top-right":M<=-x&&(C="bottom-left"):A==="top-right"?w<=-y&&M<=-x?C="bottom-left":w<=-y?C="top-left":M<=-x&&(C="bottom-right"):A==="bottom-left"?w<=-y&&M<=-x?C="top-right":w<=-y?C="bottom-right":M<=-x&&(C="top-left"):A==="bottom-right"&&(w<=-y&&M<=-x?C="top-left":w<=-y?C="bottom-left":M<=-x&&(C="top-right"));let R=C;this.stopHandle();let k=this.container.querySelector(`.${this.resizeClassName}[data-position="${R}"]`);this.startHandle(k),this.prepareResizing(t,R),this.onMouseMove(t)}if(p.width!==y||p.height!==x){let C={ui:!0,direction:n.direction,relativeDirection:n.relativeDirection,trueDirection:n.trueDirection,minWidth:d.minWidth,minHeight:d.minHeight,maxWidth:d.maxWidth,maxHeight:d.maxHeight,preserveAspectRatio:d.preserveAspectRatio===!0};h.resize(y,x,C),this.notify("node:resizing",t,e)}}else if(n.action==="rotating"){n=n,n.rotated||(e&&(e.addClass("node-rotating"),this.notify("node:rotate",t,e)),n.rotated=!0);let p=h.getAngle(),g=n.start-Mt.create(c).theta(n.center),y=n.angle+g;d.rotateGrid&&(y=fo(y,d.rotateGrid)),y=Ts(y),p!==y&&(h.rotate(y,{absolute:!0}),this.notify("node:rotating",t,e))}}}onMouseUp(t){let e=this.getEventData(t);e.action&&(this.stopAction(t),this.model.stopBatch(e.action==="resizing"?"resize":"rotate",{cid:this.cid}))}startHandle(t){if(this.handle=t||null,et.addClass(this.container,`${this.containerClassName}-active`),t){et.addClass(t,`${this.containerClassName}-active-handle`);let e=t.getAttribute("data-position");if(e){let n=L0[Mp.indexOf(e)];et.addClass(this.container,`${this.containerClassName}-cursor-${n}`)}}}stopHandle(){if(et.removeClass(this.container,`${this.containerClassName}-active`),this.handle){et.removeClass(this.handle,`${this.containerClassName}-active-handle`);let t=this.handle.getAttribute("data-position");if(t){let e=L0[Mp.indexOf(t)];et.removeClass(this.container,`${this.containerClassName}-cursor-${e}`)}this.handle=null}}startAction(t){this.startHandle(t.target),this.graph.view.undelegateEvents(),this.delegateDocumentEvents(HT,t.data)}stopAction(t){this.stopHandle(),this.undelegateDocumentEvents(),this.graph.view.delegateEvents();let e=this.graph.findViewByCell(this.node),n=this.getEventData(t);e&&(e.removeClass(`node-${n.action}`),n.action==="resizing"&&n.resized?this.notify("node:resized",t,e):n.action==="rotating"&&n.rotated&&this.notify("node:rotated",t,e))}notify(t,e,n,s={}
5512){if(n){let r=n.graph,o=r.view.normalizeEvent(e),a=r.snapToGrid(o.clientX,o.clientY);this.trigger(t,Object.assign({e:o,view:n,node:n.cell,cell:n.cell,x:a.x,y:a.y},s))}}dispose(){this.stopListening(),this.remove(),this.off()}};rn([ln()],Hx.prototype,"dispose",null);oe.prototype.createTransformWidget=function(i){let t=this.getPlugin("transform");return t&&t.createWidget(i),this};oe.prototype.clearTransformWidgets=function(){let i=this.getPlugin("transform");return i&&i.clearWidgets(),this};var hA=class extends Ii{constructor(t={}){super(),this.name="transform",this.widgets=new Map,this.disabled=!1,this.options=t,us.ensure(this.name,uX)}init(t){this.graph=t,!this.disabled&&this.startListening()}startListening(){this.graph.on("node:click",this.onNodeClick,this),this.graph.on("blank:mousedown",this.onBlankMouseDown,this)}stopListening(){this.graph.off("node:click",this.onNodeClick,this),this.graph.off("blank:mousedown",this.onBlankMouseDown,this)}enable(){this.disabled&&(this.disabled=!1,this.startListening())}disable(){this.disabled||(this.disabled=!0,this.stopListening())}isEnabled(){return!this.disabled}createWidget(t){this.clearWidgets();let e=this.createTransform(t);e&&(this.widgets.set(t,e),e.on("*",(n,s)=>{this.trigger(n,s),this.graph.trigger(n,s)}))}onNodeClick({node:t}){this.createWidget(t)}onBlankMouseDown(){this.clearWidgets()}createTransform(t){let e=this.getTransformOptions(t);return e.resizable||e.rotatable?new Hx(e,t,this.graph):null}parseOptionGroup(t,e,n){let s={};return Object.keys(n||{}).forEach(r=>{let o=n[r];s[r]=typeof o=="function"?o.call(t,e):o}),s}getTransformOptions(t){this.options.resizing||(this.options.resizing={enabled:!1}),this.options.rotating||(this.options.rotating={enabled:!1}),typeof this.options.resizing=="boolean"&&(this.options.resizing={enabled:this.options.resizing}),typeof this.options.rotating=="boolean"&&(this.options.rotating={enabled:this.options.rotating});let e=this.parseOptionGroup(this.graph,t,this.options.resizing),n=this.parseOptionGroup(this.graph,t,this.options.rotating);return{resizable:!!e.enabled,minWidth:e.minWidth||0,maxWidth:e.maxWidth||Number.MAX_SAFE_INTEGER,minHeight:e.minHeight||0,maxHeight:e.maxHeight||Number.MAX_SAFE_INTEGER,orthogonalResizing:typeof e.orthogonal=="boolean"?e.orthogonal:!0,restrictedResizing:!!e.restrict,autoScrollOnResizing:typeof e.autoScroll=="boolean"?e.autoScroll:!0,preserveAspectRatio:!!e.preserveAspectRatio,allowReverse:typeof e.allowReverse=="boolean"?e.allowReverse:!0,rotatable:!!n.enabled,rotateGrid:n.grid||15}}clearWidgets(){this.widgets.forEach((t,e)=>{this.graph.getCellById(e.id)&&t.dispose()}),this.widgets.clear()}dispose(){this.clearWidgets(),this.stopListening(),this.off(),us.clean(this.name)}};rn([ln()],hA.prototype,"dispose",null);var dX=220,fX=52,pX=220,gX=20,KCt=-44,mX=250,JCt=96,bX=64,ZCt=["Asset","Change","Build","Review","Deploy"],QCt=900,tMt=8e3,vX=!1;function eMt(){vX||(vX=!0,qT.HTML.register({shape:"lineage-card",html:rMt,effect:["data"]}),oe.registerConnector("lineage-curve",(i,t)=>{let e=Math.abs(t.x-i.x),n=new Pn;return n.appendSegment(Pn.createSegment("M",i.x-4,i.y)),n.appendSegment(Pn.createSegment("L",i.x+12,i.y)),n.appendSegment(Pn.createSegment("C",i.x<t.x?i.x+e/2:i.x-e/2,i.y,i.x<t.x?t.x-e/2:t.x+e/2,t.y,t.x-6,t.y)),n.appendSegment(Pn.createSegment("L",t.x+2,t.y)),n.serialize()},!0),ns.define({shape:"lineage-edge",markup:[{tagName:"path",selector:"wrap",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",attrs:{fill:"none",pointerEvents:"none"}}],connector:{name:"lineage-curve"},attrs:{wrap:{connection:!0,strokeWidth:10,strokeLinejoin:"round"},line:{connection:!0,strokeWidth:1.25,targetMarker:{name:"classic",size:6},style:{stroke:"var(--bs-fg-faint)"}}},zIndex:-1}))}var yX={asset:'<path d="M4 4h9l3 3v13H4z"/><path d="M13 4v3h3"/>',commit:'<line x1="3" y1="12" x2="9" y2="12"/><circle cx="12" cy="12" r="3"/><line x1="15" y1="12" x2="21" y2="12"/>',approval:'<circle cx="12" cy="12" r="9"/><path d="M8 12l3 3 5-6"/>',build:'<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M7 9l3 3-3 3M13 15h4"/>',lifecycle:'<path d="M12 3v12"/><path d="M7 10l5-5 5 5"/><path d="M5 21h14"/>',deployment:'<path d="M12 3v12"/><path d="M7 10l5-5 5 5"/><path d="M5 21h14"/>'},nMt={ok:'<circle cx="12" cy="12" r="10"/><path d="M8 12l2.5 2.5L16 9"/>',err:'<circle cx="12" cy="12" r="10"/><path d="M9 9l6 6M15 9l-6 6"/>',warn:'<circle cx="12" cy="12" r="10"/><path d="M12 7v5l3 3"/>',info:'<circle cx="12" cy="12" r="9" stroke-dasharray="4 3"/>'};function iMt(i){return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">${yX[i]||yX.commit}</svg>`}function sMt(i){let t=nMt[i];return t?`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`:""}function rMt(i){let t=i.getData()||{};if(t.kind==="header")return`<div class="lg-header">${dA(t.title)}</div>`;let e=t.subtitle?`${t.title} \xB7 ${t.subtitle}`:t.title;return`
5513    <div class="lg-card lg-card--${t.type} is-${t.spotlightState}" title="${dA(e)}">
5514      <span class="lg-card__icon lg-icon--${t.iconTint}">${iMt(t.type)}</span>
5515      <span class="lg-card__body">
5516        <span class="lg-card__title">${dA(t.title)}</span>
5517        <span class="lg-card__subtitle">${dA(t.subtitle||"")}</span>
5518      </span>
5519      ${t.glyphKind?`<span class="lg-card__status lg-status--${t.glyphKind}">${sMt(t.glyphKind)}</span>`:""}
5520    </div>
5521  `}function BN(i){let t=i.data||{},e=String(t.status||"").toLowerCase();switch(i.type){case"approval":return t.approved_at||t.status==="approved"?"ok":"warn";case"build":return["failed","error"].includes(e)?"err":["success","completed","passed"].includes(e)?"ok":["running","building"].includes(e)?"info":"warn";case"lifecycle":case"deployment":return"ok";default:return null}}function oMt(i){return i.type==="asset"?"accent":i.type==="commit"?"info":BN(i)||"neutral"}function aMt(i){let t=i.data||{};switch(i.type){case"asset":return[t.name||"Asset",I0(t.asset_type)||""];case"commit":{let n=String(t.message||"").split(`
5522`)[0].trim()||`Commit ${NN(t.commit_hash)}`,s=[NN(t.commit_hash),t.author].filter(Boolean).join(" \xB7 ");return[n,s]}case"approval":return[I0(t.stage)||"Review",[t.approver,I0(t.status)].filter(Boolean).join(" \xB7 ")];case"build":return[`Build #${t.jenkins_build_number||NN(String(i.id).replace(/^build_/,""))}`,I0(t.status)];case"lifecycle":case"deployment":return[I0(t.current_stage)||"Deployment",t.deployed_at?lMt(t.deployed_at):""];default:return[i.label||I0(i.type),""]}}function NN(i){let t=String(i||"");return t.length>10?t.slice(0,7):t}function I0(i){return i?String(i).replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()):""}function lMt(i){if(!i)return"";let t=new Date(i);return Number.isNaN(t.getTime())?"":t.toLocaleDateString()}function dA(i){return i==null?"":String(i).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function cMt(i){let t=i.filter(u=>u.type!=="asset"),e=u=>u.data&&u.data.row||0,n=u=>u.data&&u.data.col||0,s=new Map;t.forEach(u=>{let h=`${e(u)}:${n(u)}`;s.set(h,(s.get(h)||0)+1)});let r=Math.max(1,...t.map(u=>e(u)+1)),o=[],a=0;for(let u=0;u<r;u++){let h=1;s.forEach((p,g)=>{g.startsWith(`${u}:`)&&(h=Math.max(h,p))});let d=JCt+(h-1)*bX;o.push(a+d/2),a+=d}let l=new Map,c={rowY:o,colX:mX};return i.forEach(u=>{if(u.type==="asset"){c[u.id]={x:0,y:(o[0]+o[r-1])/2};return}let h=`${e(u)}:${n(u)}`,d=l.get(h)||0;l.set(h,d+1);let p=s.get(h)||1;c[u.id]={x:n(u)*mX,y:o[e(u)]+(d-(p-1)/2)*bX}}),c}var uMt={"--bs-bg-panel":"#1a1c22","--bs-bg-panel-2":"#16181d","--bs-line":"#333f55","--bs-line-strong":"#3d4a63","--bs-fg":"#f4f4f4","--bs-fg-mute":"#9aa1ab","--bs-fg-faint":"#5c6470","--bs-accent":"#2dd4bf","--bs-ok":"#22c55e","--bs-warn":"#f59e0b","--bs-err":"#ef4444","--bs-info":"#3b82f6"};function xX(i){let t=document.createElement("span");t.style.cssText="position:absolute;left:-9999px;visibility:hidden;",document.body.appendChild(t);let e=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),n=new Map;return i.forEach(s=>{let r=uMt[s]||"#808080";t.style.color=`var(${s}, ${r})`;let o=getComputedStyle(t).color||r;e.fillStyle=o,e.fillRect(0,0,1,1);let[a,l,c]=e.getImageData(0,0,1,1).data;n.set(s,`rgb(${a}, ${l}, ${c})`)}),document.body.removeChild(t),n}var wX=["--bs-bg-panel","--bs-bg-panel-2","--bs-line","--bs-line-strong","--bs-fg","--bs-fg-mute","--bs-fg-faint","--bs-accent","--bs-ok","--bs-warn","--bs-err","--bs-info"],fA=class{constructor(t,e={}){eMt(),this.container=t,this.onNavigate=e.onNavigate||(n=>window.location.assign(n)),this._nodesById=new Map,this._edgesById=new Map,this._outgoing=new Map,this._incoming=new Map,this._settleTimer=null,this.graph=new oe({container:t,background:!1,autoResize:!0,grid:{visible:!0,size:20,type:"dot",args:{color:this._gridColor(),thickness:1.2}},panning:{enabled:!0,eventTypes:["leftMouseDown","mouseWheel"]},mousewheel:{enabled:!0,modifiers:["ctrl","meta"],factor:1.1,minScale:.2,maxScale:2.5},interacting:{nodeMovable:!1,edgeMovable:!1,edgeLabelMovable:!1,arrowheadMovable:!1,magnetConnectable:!1,vertexMovable:!1}}),this.graph.use(new k0),this._bindInteractions(),this._bindResize()}
5522render(t,e){clearTimeout(this._settleTimer),this.graph.drawGrid({args:{color:this._gridColor(),thickness:1.2}}),this._nodesById=new Map(t.map(c=>[c.id,c])),this._edgesById=new Map(e.map(c=>[c.id,c])),this._outgoing=new Map,this._incoming=new Map;let n=new Set(t.map(c=>c.id)),s=cMt(t),r=t.map(c=>{let u=s[c.id],[h,d]=aMt(c),p=BN(c);return{id:c.id,shape:"lineage-card",x:u.x-dX/2,y:u.y-fX/2,width:dX,height:fX,zIndex:10,data:{kind:"card",type:c.type,title:h,subtitle:d,iconTint:oMt(c),glyphKind:c.type==="asset"||c.type==="commit"?null:p,url:c.data&&c.data.url||null,spotlightState:"resting"}}}),a=[...new Set(t.map(c=>c.data&&c.data.col||0))].sort((c,u)=>c-u).map(c=>({id:`column_header_${c}`,shape:"lineage-card",x:c*s.colX-pX/2,y:KCt-gX/2,width:pX,height:gX,zIndex:1,data:{kind:"header",title:ZCt[c]||""}})),l=e.filter(c=>n.has(c.source)&&n.has(c.target)).map(c=>(this._outgoing.has(c.source)||this._outgoing.set(c.source,[]),this._outgoing.get(c.source).push(c),this._incoming.has(c.target)||this._incoming.set(c.target,[]),this._incoming.get(c.target).push(c),{id:c.id,shape:"lineage-edge",source:{cell:c.source,anchor:{name:"right"}},target:{cell:c.target,anchor:{name:"left"}},zIndex:-1}));this.graph.fromJSON({nodes:[...r,...a],edges:l}),this._applyResting(),this.fit()}spotlight(t){if(!this.graph.getCellById(t))return;clearTimeout(this._settleTimer);let{storyNodes:e,storyEdges:n}=this._computeStory(t);this.graph.getNodes().forEach(s=>{let r=s.id===t?"focus":e.has(s.id)?"story":"dim";this._setSpotlightState(s,r)}
5522),this.graph.getEdges().forEach(s=>{n.has(s.id)?this._animateEdge(s):this._styleEdgeDim(s)}),this._settleTimer=setTimeout(()=>{n.forEach(s=>{let r=this.graph.getCellById(s);r&&this._settleEdge(r)})},QCt)}clearSpotlight(){clearTimeout(this._settleTimer),this._applyResting()}clear(){clearTimeout(this._settleTimer),this.graph.clearCells()}zoomIn(){this.graph.zoom(.2,{minScale:.2,maxScale:2.5})}zoomOut(){this.graph.zoom(-.2,{minScale:.2,maxScale:2.5})}fit(){this.graph.zoomToFit({padding:32,maxScale:1.25})}exportPng(t){return this._exportImage("exportPNG",t)}exportSvg(t){return this._exportImage("exportSVG",t)}_exportImage(t,e){try{this.graph[t](e||"asset-lineage",this._exportOptions(2))}catch(n){if(this._isSizeExceeded(n))try{this.graph[t](e||"asset-lineage",this._exportOptions(1));return}catch(s){throw console.warn(`[LineageGraph] ${t} failed even at ratio 1`,s),s}throw console.warn(`[LineageGraph] ${t} failed`,n),n}}_isSizeExceeded(t){return!!t&&typeof t.message=="string"&&t.message.includes("size exceeded")}copyPng(t){if(typeof ClipboardItem>"u")return console.warn("[LineageGraph] copyPng: ClipboardItem unsupported, falling back to download"),this.exportPng(t),Promise.reject(new Error("ClipboardItem unsupported"));let e=new Promise((s,r)=>{let o=!1,a=(c,u)=>{o||(o=!0,clearTimeout(l),c(u))},l=setTimeout(()=>{a(r,new Error("copyPng: rasterization timed out"))},tMt);try{this.graph.toPNG(c=>{fetch(c).then(u=>u.blob()).then(u=>a(s,u)).catch(u=>a(r,u))},this._exportOptions(2))}catch(c){a(r,c)}}),n=new ClipboardItem({"image/png":e});return navigator.clipboard.write([n]).catch(s=>{throw console.warn("[LineageGraph] copyPng: clipboard write failed, falling back to download",s),this.exportPng(t),s})}_exportOptions(t){let e=xX(wX),n=`:root { ${wX.map(s=>`${s}: ${e.get(s)};`).join(" ")} }`;return{backgroundColor:e.get("--bs-bg-panel-2"),padding:24,ratio:t||2,quality:1,copyStyles:!0,stylesheet:n}}_gridColor(){return xX(["--bs-fg-faint"]).get("--bs-fg-faint")}destroy(){clearTimeout(this._settleTimer),this._onResize&&window.removeEventListener("resize",this._onResize),this.graph&&(this.graph.dispose(),this.graph=null)}_bindInteractions(){this.graph.on("node:click",({node:t})=>{(t.getData()||{}).kind!=="header"&&this.spotlight(t.id)}),this.graph.on("node:dblclick",({node:t})=>{let e=t.getData()||{};e.kind!=="header"&&e.url&&this.onNavigate(e.url)}),this.graph.on("blank:click",()=>this.clearSpotlight())}_bindResize(){let t=!1;this._onResize=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1,this.graph&&this.fit()}))},window.addEventListener("resize",this._onResize)}_computeStory(t){let e=new Set([t]),n=new Set,s=[t];for(;s.length;){let r=s.shift();(this._incoming.get(r)||[]).forEach(o=>{n.add(o.id),e.has(o.source)||(e.add(o.source),s.push(o.source))})}for(s=[t];s.length;){let r=s.shift();(this._outgoing.get(r)||[]).forEach(o=>{n.add(o.id),e.has(o.target)||(e.add(o.target),s.push(o.target))})}return{storyNodes:e,storyEdges:n}}_applyResting(){this.graph.getNodes().forEach(t=>this._setSpotlightState(t,"resting")),this.graph.getEdges().forEac
5522h(t=>this._styleEdgeResting(t))}_setSpotlightState(t,e){let n=t.getData()||{};n.kind!=="header"&&n.spotlightState!==e&&t.setData({spotlightState:e})}_styleEdgeResting(t){t.attr("line/style/stroke","var(--bs-fg-faint)"),t.attr("line/style/strokeDasharray",""),t.attr("line/style/animation",""),t.attr("line/style/opacity",1)}_styleEdgeDim(t){t.attr("line/style/stroke","var(--bs-fg-faint)"),t.attr("line/style/strokeDasharray",""),t.attr("line/style/animation",""),t.attr("line/style/opacity",.6)}_animateEdge(t){t.attr("line/style/opacity",1),t.attr("line/style/stroke","var(--bs-info)"),t.attr("line/style/strokeDasharray","5 4"),t.attr("line/style/animation","lg-running-line 0.9s linear infinite")}_settleEdge(t){let e=this._edgesById.get(t.id),n=e?this._nodesById.get(e.target):null,s=e?this._nodesById.get(e.source):null,r=a=>!!a&&a.type==="build"&&BN(a)==="err",o="var(--bs-ok)";r(n)?o="var(--bs-err)":r(s)&&(o="var(--bs-warn)"),t.attr("line/style/stroke",o),t.attr("line/style/strokeDasharray",""),t.attr("line/style/animation","")}};var hMt="Copied!",dMt="Copy failed, downloaded PNG instead",_X="Export failed",SX=1500,Tp=class extends le{static targets=["assetSearch","searchResults","commitContainer","commitSelector","emptyState","loadingState","pipelineStages","assetDetails","assetDetailsContent","assetMetadata","assetMetadataContent","container","copyPngIcon","copyPngOkIcon","copyPngLabel","exportPngLabel","exportSvgLabel"];static values={projectId:String,autoLoadAsset:String,assetId:String,mode:String};connect(){this.selectedAsset=null,this.searchTimeout=null,this.lineageRequestToken=0,this.hasContainerTarget?this.initLineageGraph():this.hasAutoLoadAssetValue&&this.autoLoadAsset()}disconnect(){this.lineageRequestToken++,clearTimeout(this.copyFeedbackTimer),clearTimeout(this.exportPngFeedbackTimer),clearTimeout(this.exportSvgFeedbackTimer),this.graph&&(this.graph.destroy(),this.graph=null),this.hasContainerTarget&&(this.containerTarget.innerHTML="")}async autoLoadAsset(){this.loadPipeline(this.autoLoadAssetValue)}async initLineageGraph(){let i=++this.lineageRequestToken;try{let t=await this.fetchLineageData();if(i!==this.lineageRequestToken)return;this.lineageData=t.lineage||{nodes:[],edges:[]},this.renderLineageGraph(this.lineageData)}catch(t){if(i!==this.lineageRequestToken)return;console.error("Failed to load asset lineage graph:",t),this.renderGraphMessage("Failed to load the lineage graph. Please refresh.")}}async fetchLineageData(){let i=this.hasAssetIdValue?this.assetIdValue:this.autoLoadAssetValue,t=`/projects/${this.projectIdValue}/asset-lineage/detail/${i}`,e=await fetch(t,{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.json()}renderLineageGraph(i){let t=i&&i.nodes||[],e=i&&i.edges||[];if(t.length===0){this.renderGraphMessage("No lineage data yet for this asset.");return}this.graph&&(this.graph.destroy(),this.graph=null),this.containerTarget.innerHTML="",this.graph=new fA(this.containerTarget,{onNavigate:n=>window.location.assign(n)}),this.graph.render(t,e),this.containerTarget.dataset.renderedNodes=String(t.length)}renderGraphMessage(i){this.hasContainerTarget&&(this.graph&&(this.graph.destroy(),this.graph=null),this.containerTarget.dataset.renderedNodes="0",this.containerTarget.innerHTML=`
5523      <div style="height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center;">
5524        <p style="color: var(--bs-fg-mute); font-size: 13px; margin: 0;">${this.escapeHtml(i)}</p>
5525      </div>
5526    `)}zoomIn(){this.graph&&this.graph.zoomIn()}zoomOut(){this.graph&&this.graph.zoomOut()}centerView(){this.graph&&this.graph.fit()}refreshLineage(){this.initLineageGraph()}
5526exportPng(){if(this.graph)try{this.graph.exportPng(this.exportFileName()),this.closeExportMenu()}catch(i){console.warn("[asset-lineage] exportPng failed",i),this.hasExportPngLabelTarget&&this.flashLabel(this.exportPngLabelTarget,"exportPngFeedbackTimer",_X)}}exportSvg(){if(this.graph)try{this.graph.exportSvg(this.exportFileName()),this.closeExportMenu()}catch(i){console.warn("[asset-lineage] exportSvg failed",i),this.hasExportSvgLabelTarget&&this.flashLabel(this.exportSvgLabelTarget,"exportSvgFeedbackTimer",_X)}}async copyPng(){if(this.graph)try{await this.graph.copyPng(this.exportFileName()),this.showCopyFeedback(!0)}catch{this.showCopyFeedback(!1)}}exportFileName(){return`asset-lineage-${this.hasAssetIdValue?this.assetIdValue:"graph"}`}closeExportMenu(){let i=this.element.querySelector('[data-controller~="dropdown"]');if(!i)return;let t=this.application.getControllerForElementAndIdentifier(i,"dropdown");t&&t.close()}showCopyFeedback(i){!this.hasCopyPngIconTarget||!this.hasCopyPngOkIconTarget||!this.hasCopyPngLabelTarget||(clearTimeout(this.copyFeedbackTimer),this.copyPngIconTarget.hidden=i,this.copyPngOkIconTarget.hidden=!i,this.copyPngLabelTarget.textContent=i?hMt:dMt,this.copyFeedbackTimer=setTimeout(()=>this.resetCopyFeedback(),SX))}resetCopyFeedback(){if(clearTimeout(this.copyFeedbackTimer),!this.hasCopyPngIconTarget||!this.hasCopyPngOkIconTarget||!this.hasCopyPngLabelTarget)return;let i=this.copyPngLabelTarget.closest("button"),t=i&&i.dataset.copyLabel||"Copy PNG to Clipboard";this.copyPngIconTarget.hidden=!1,this.copyPngOkIconTarget.hidden=!0,this.copyPngLabelTarget.textContent=t}flashLabel(i,t,e){clearTimeout(this[t]),i.textContent=e,this[t]=setTimeout(()=>this.resetLabel(i,t),SX)}resetLabel(i,t){if(clearTimeout(this[t]),!i)return;let e=i.closest("button"),n=e&&e.dataset.exportLabel||i.textContent;i.textContent=n}escapeHtml(i){return i==null?"":String(i).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}onSearchInput(i){let t=i.target.value.trim();if(this.searchTimeout&&clearTimeout(this.searchTimeout),t.length<2){this.hideSearchResults();return}this.searchTimeout=setTimeout(()=>{this.searchAssets(t)},300)}onSearchFocus(){this.assetSearchTarget.value.trim().length>=2&&this.showSearchResults()}onSearchBlur(){setTimeout(()=>{this.hideSearchResults()},200)}showSearchResults(){this.hasSearchResultsTarget&&this.searchResultsTarget.classList.remove("hidden")}hideSearchResults(){this.hasSearchResultsTarget&&this.searchResultsTarget.classList.add("hidden")}onCommitChange(i){let t=i.target.value;this.selectedAsset&&this.loadPipeline(this.selectedAsset.id,t)}async searchAssets(i){try{let t=`/projects/${this.projectIdValue}/asset-lineage/search?q=${encodeURIComponent(i)}`,e=await fetch(t,{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);let n=await e.json();this.displaySearchResults(n.assets),this.showSearchResults()}catch(t){console.error("Asset search failed:",t),this.hideSearchResults()}}displaySearchResults(i){if(i.length===0)this.searchResultsTarget.innerHTML=`
5527        <div class="px-4 py-2 text-sm" style="color: var(--bs-fg-mute);">
5528          No assets found
5529        </div>
5530      `;else{let t=this;this.searchResultsTarget.innerHTML=i.map(e=>`
5531        <div class="cursor-pointer select-none relative py-2 pl-3 pr-9 bs-search-result"
5532             style="color: var(--bs-fg);"
5533             data-asset-id="${e.id}"
5534             data-asset-name="${e.name}"
5535             data-asset-type="${e.asset_type}">
5536          <div class="flex items-center justify-between mb-1">
5537            <span class="font-medium block truncate">${e.name}</span>
5538            <span class="ml-2 text-xs" style="color: var(--bs-fg-mute);">${e.asset_type}</span>
5539          </div>
5540          <div class="text-xs block truncate mb-1" style="color: var(--bs-fg-mute);">
5541            ${e.depot_path||e.path||"No path specified"}
5542          </div>
5543          <span class="text-xs block" style="color: var(--bs-fg-mute);">
5544            ${e.commits_count} commits${e.last_commit?" \u2022 "+this.formatDate(e.last_commit):""}
5545          </span>
5546        </div>
5547      `).join(""),this.searchResultsTarget.querySelectorAll("[data-asset-id]").forEach(e
5547=>{e.addEventListener("click",n=>{n.preventDefault();let s=e.dataset.assetId,r=i.find(o=>o.id.toString()===s);r&&this.selectAsset(r.id,r.name,r.asset_type)})})}this.showSearchResults()}selectAsset(i,t,e){this.selectedAsset={id:i,name:t,type:e},this.hasAssetSearchTarget&&(this.assetSearchTarget.value=t),this.hideSearchResults(),this.loadPipeline(i)}async loadPipeline(i,t=null){try{this.showLoading();let e=`/projects/${this.projectIdValue}/asset-lineage/pipeline?asset_id=${i}`;t&&(e+=`&commit_hash=${t}`);let n=await fetch(e,{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}});if(!n.ok){let r=await n.text();throw new Error(`HTTP error! status: ${n.status}`)}let s=await n.json();this.displayPipeline(s)}catch(e){console.error("Failed to load pipeline:",e),this.showError("Failed to load asset pipeline. Please try again.")}}displayPipeline(i){let{asset:t,stages:e,has_multiple_commits:n,available_commits:s,missing_stages:r,completeness_score:o,completion_suggestions:a}=i;this.updateCommitSelector(n,s),this.renderPipelineStages(e,o,a),this.updateAssetDetails(t,e,o,r),this.showPipeline()}updateCommitSelector(i,t){i&&t.length>1?(this.hasCommitSelectorTarget&&(this.commitSelectorTarget.innerHTML=`
5548          <option value="">Latest commit</option>
5549          ${t.map(e=>`
5550            <option value="${e.hash}">
5551              ${e.short_hash} - ${e.message} (${e.author})
5552            </option>
5553          `).join("")}
5554        `),this.hasCommitContainerTarget&&this.commitContainerTarget.classList.remove("hidden")):this.hasCommitContainerTarget&&this.commitContainerTarget.classList.add("hidden")}renderPipelineStages(i,t=0,e=[]){if(!this.hasPipelineStagesTarget)return;let n=i.map(o=>this.createStageElement(o)),s=i.length>1?this.createArrows(i.length-1):[],r=[];n.forEach((o,a)=>{r.push(o),s[a]&&r.push(s[a])}),this.pipelineStagesTarget.innerHTML=`
5555      <div class="max-w-4xl mx-auto">
5556        <!-- Pipeline Completeness Header -->
5557        ${this.createCompletenessHeader(t,e)}
5558        
5559        <!-- Pipeline Stages -->
5560        <div class="space-y-6 mt-8">
5561          ${r.join("")}
5562        </div>
5563        
5564        <!-- Completion Suggestions -->
5565        ${e.length>0?this.createCompletionSuggestions(e):""}
5566      </div>
5567    `}createStageElement(i){let t=this.getStatusColor(i.status),e=this.formatTimestamp(i.timestamp),n=this.getStageLink(i),s=i.is_placeholder,o=n&&(n.startsWith("http://")||n.startsWith("https://"))?"_blank":"_self";return`
5568      <div class="pipeline-stage ${s?"opacity-60":""}" data-stage-type="${i.type}">
5569        <div class="bs-card p-6 transition-all duration-200 hover:shadow-md" ${s?'style="border-style: dashed;"':""}>
5570          <!-- Stage Header -->
5571          <div class="flex items-start justify-between mb-4">
5572            <div class="flex-1">
5573              ${n&&!s?`<a href="${n}" class="block rounded-lg p-3 -m-3 transition-all duration-200 group bs-lineage-link" target="${o}">`:'<div class="p-3 -m-3">'}
5574              <div class="flex items-center space-x-3">
5575                <div class="flex-shrink-0">
5576                  <div class="w-10 h-10 rounded-lg flex items-center justify-center font-medium text-lg ${n&&!s?"group-hover:scale-105 transition-transform":""}" style="background: ${t.bg}; color: ${t.text};">
5577                    ${i.icon}
5578                  </div>
5579                </div>
5580                <div class="flex-1">
5581                  <div class="flex items-center space-x-2">
5582                    <h3 class="text-lg font-semibold" style="color: var(--bs-fg);">${i.title}</h3>
5583                    ${i.task_id?`
5584                      <a href="/projects/${this.projectIdValue}/tasks/${i.task_id}" target="_self" class="text-xs font-mono" style="color: var(--bs-fg-mute);">#${i.task_id}</a>
5585                    `:""}
5586                  </div>
5587                  <p class="text-sm" style="color: ${s?"var(--bs-warn)":"var(--bs-fg-mute)"};">
5588                    ${i.description}${s?this.getIntegrationLink(i.type):""}
5589                  </p>
5590                </div>
5591              </div>
5592              ${n&&!s?"</a>":"</div>"}
5593            </div>
5594            <div class="text-right ml-3">
5595              ${s?"":`
5596                <div class="bs-pill ${t.pillClass}">
5597                  ${this.humanizeStatus(i.status)}
5598                </div>
5599              `}
5600              ${!s&&e!=="Unknown"?`
5601                <div class="text-xs mt-1" style="color: var(--bs-fg-mute);">
5602                  ${e}
5603                </div>
5604              `:""}
5605            </div>
5606          </div>
5607
5608          <!-- User Attribution -->
5609          ${s?"":`
5610            <div class="flex items-center space-x-3 p-3 rounded-lg" style="background: var(--bs-bg-panel-2);">
5611              <div class="flex-shrink-0">
5612                <div class="w-8 h-8 rounded-full flex items-center justify-center" style="background: var(--bs-bg-panel);">
5613                  <span class="text-sm font-medium" style="color: var(--bs-fg-soft);">
5614                    ${i.user.name?i.user.name.charAt(0).toUpperCase():"?"}
5615                  </span>
5616                </div>
5617              </div>
5618              <div class="flex-1 min-w-0">
5619                <p class="text-sm font-medium" style="color: var(--bs-fg);">
5620                  ${i.user.name||"Unknown User"}
5621                </p>
5622                ${i.user.email?`<p class="text-xs" style="color: var(--bs-fg-mute);">${i.user.email}</p>`:""}
5623              </div>
5624              <div class="text-xs" style="color: var(--bs-fg-mute);">
5625                ${this.getRelativeTime(i.timestamp)}
5626              </div>
5627            </div>
5628          `}
5629
5630          <!-- Assignee (for tasks) -->
5631          ${!s&&i.assignee?`
5632            <div class="flex items-center space-x-3 p-3 rounded-lg mt-2" style="background: var(--bs-bg-panel-2);">
5633              <div class="flex-shrink-0">
5634                <div class="w-8 h-8 rounded-full flex items-center justify-center" style="background: var(--bs-info-soft);">
5635                  <span class="text-sm font-medium" style="color: var(--bs-info);">
5636                    ${i.assignee.name?i.assignee.name.charAt(0).toUpperCase():"?"}
5637                  </span>
5638                </div>
5639              </div>
5640              <div class="flex-1 min-w-0">
5641                <p class="text-xs" style="color: var(--bs-fg-mute);">Assigned to:</p>
5642                <p class="text-sm font-medium" style="color: var(--bs-fg);">
5643                  ${i.assignee.name||"Unknown User"}
5644                </p>
5645                ${i.assignee.email?`<p class="text-xs" style="color: var(--bs-fg-mute);">${i.assignee.email}</p>`:""}
5646              </div>
5647            </div>
5648          `:""}
5649
5650          <!-- Details (collapsible) -->
5651          ${s?"":this.createStageDetails(i)}
5652        </div>
5653      </div>
5654    `}createArrows(i){let t=[];for(let e=0;e<i;e++)t.push(`
5655        <div class="flex justify-center py-2">
5656          <svg class="w-6 h-6" style="color: var(--bs-fg-mute);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
5657            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 14l-7 7m0 0l-7-7m7 7V3"></path>
5658          </svg>
5659        </div>
5660      `);return t}createStageDetails(i){if(!i.details||Object.keys(i.details).length===0)return"";if(i.type==="game_engine_build"||i.type==="unreal_build")return this.createGameEngineDetails(i);let t=Object.entries(i.details).filter(([e,n])=>{let s=["short_hash","depot_path","commit_id","revision"];return n!=null&&n!==""&&!s.includes(e)}).map(([e,n])=>{if(e==="action"){let s=i.details.revision,r=s?`Rev ${s} \u2022 ${n}`:n;return`
5661            <div class="flex justify-between">
5662              <span class="text-sm" style="color: var(--bs-fg-mute);">${this.formatDetailKey(e)}:</span>
5663              <span class="text-sm font-medium" style="color: var(--bs-fg);">${r}</span>
5664            </div>
5665          `}return`
5666          <div class="flex justify-between">
5667            <span class="text-sm" style="color: var(--bs-fg-mute);">${this.formatDetailKey(e)}:</span>
5668            <span class="text-sm font-medium" style="color: var(--bs-fg);">${this.formatDetailValue(n)}</span>
5669          </div>
5670        `}).filter(e=>e!=="");return t.length===0?"":`
5671      <div class="mt-4 pt-4" style="border-top: 1px solid var(--bs-line);">
5672        <div class="grid grid-cols-2 gap-x-4 gap-y-2">
5673          ${t.join("")}
5674        </div>
5675      </div>
5676    `}createGameEngineDetails(i){let t=i.details;if(!(t.engine_type||t.cooked_asset_count||t.total_cook_time_seconds))return"";let n=[];if(t.engine_type){let c=t.engine_type==="unreal"?"\u{1F3AE}":"\u{1F3AF}",u=t.engine_type==="unreal"?"Unreal Engine":"Unity";n.push(`
5677        <div class="flex items-center space-x-2">
5678          <span class="text-lg">${c}</span>
5679          <span class="text-sm font-medium" style="color: var(--bs-fg);">${u}</span>
5680          ${t.engine_version?`<span class="text-sm" style="color: var(--bs-fg-mute);">${t.engine_version}</span>`:""}
5681        </div>
5682      `)}(t.platform||t.configuration)&&n.push(`
5683        <div class="flex items-center space-x-2 text-sm" style="color: var(--bs-fg-mute);">
5684          ${t.platform?`<span class="px-2 py-0.5 rounded" style="background: var(--bs-bg-panel-2);">${t.platform}</span>`:""}
5685          ${t.configuration?`<span class="px-2 py-0.5 rounded" style="background: var(--bs-bg-panel-2);">${t.configuration}</span>`:""}
5686        </div>
5687      `);let s=[];if(t.total_cook_time_seconds&&s.push(`
5688        <div class="flex flex-col items-center p-3 rounded-lg" style="background: var(--bs-bg-panel-2);">
5689          <span class="text-2xl font-bold" style="color: var(--bs-fg);">${this.formatDuration(t.total_cook_time_seconds)}</span>
5690          <span class="text-xs" style="color: var(--bs-fg-mute);">Cook Time</span>
5691        </div>
5692      `),t.ddc_hit_rate!=null){let c=t.ddc_hit_rate>=80?"var(--bs-ok)":t.ddc_hit_rate>=50?"var(--bs-warn)":"var(--bs-err)";s.push(`
5693        <div class="flex flex-col items-center p-3 rounded-lg" style="background: var(--bs-bg-panel-2);">
5694          <span class="text-2xl font-bold" style="color: ${c};">${t.ddc_hit_rate}%</span>
5695          <span class="text-xs" style="color: var(--bs-fg-mute);">DDC Hit Rate</span>
5696        </div>
5697      `)}t.cooked_asset_count&&s.push(`
5698        <div class="flex flex-col items-center p-3 rounded-lg" style="background: var(--bs-bg-panel-2);">
5699          <span class="text-2xl font-bold" style="color: var(--bs-fg);">${t.cooked_asset_count.toLocaleString()}</span>
5700          <span class="text-xs" style="color: var(--bs-fg-mute);">Assets Cooked</span>
5701        </div>
5702      `),t.shader_permutation_count&&s.push(`
5703        <div class="flex flex-col items-center p-3 rounded-lg" style="background: var(--bs-bg-panel-2);">
5704          <span class="text-2xl font-bold" style="color: var(--bs-fg);">${t.shader_permutation_count.toLocaleString()}</span>
5705          <span class="text-xs" style="color: var(--bs-fg-mute);">Shader Permutations</span>
5706        </div>
5707      `),t.pak_file_size_bytes&&s.push(`
5708        <div class="flex flex-col items-center p-3 rounded-lg" style="background: var(--bs-bg-panel-2);">
5709          <span class="text-2xl font-bold" style="color: var(--bs-fg);">${this.formatBytes(t.pak_file_size_bytes)}</span>
5710          <span class="text-xs" style="color: var(--bs-fg-mute);">PAK Size</span>
5711        </div>
5712      `);let r="";if(t.asset_cook_time_ms||t.asset_cooked_size||t.compression_ratio){let c=[];if(t.asset_cook_time_ms){let u=t.asset_cook_time_ms>=1e3?`${(t.asset_cook_time_ms/1e3).toFixed(1)}s`:`${t.asset_cook_time_ms}ms`;c.push(`
5713          <div class="flex justify-between">
5714            <span class="text-sm" style="color: var(--bs-fg-mute);">Asset Cook Time:</span>
5715            <span class="text-sm font-medium" style="color: var(--bs-fg);">${u}</span>
5716          </div>
5717        `)}if(t.asset_cooked_size&&c.push(`
5718          <div class="flex justify-between">
5719            <span class="text-sm" style="color: var(--bs-fg-mute);">Cooked Size:</span>
5720            <span class="text-sm font-medium" style="color: var(--bs-fg);">${this.formatBytes(t.asset_cooked_size)}</span>
5721          </div>
5722        `),t.compression_ratio){let u=t.compression_ratio<.5?"var(--bs-ok)":t.compression_ratio<.8?"var(--bs-warn)":"var(--bs-fg)";c.push(`
5723          <div class="flex justify-between">
5724            <span class="text-sm" style="color: var(--bs-fg-mute);">Compression:</span>
5725            <span class="text-sm font-medium" style="color: ${u};">${(t.compression_ratio*100).toFixed(0)}%</span>
5726          </div>
5727        `)}t.cooked_path&&c.push(`
5728          <div class="col-span-2">
5729            <span class="text-sm" style="color: var(--bs-fg-mute);">Cooked Path:</span>
5730            <code class="block mt-1 px-2 py-1 text-xs rounded font-mono break-all" style="background: var(--bs-bg-panel-2); color: var(--bs-fg-soft);">${t.cooked_path}</code>
5731          </div>
5732        `),c.length>0&&(r=`
5733          <div class="mt-4 pt-4" style="border-top: 1px solid var(--bs-line);">
5734            <h5 class="text-sm font-medium mb-3" style="color: var(--bs-fg);">This Asset's Cooking Details</h5>
5735            <div class="grid grid-cols-2 gap-x-4 gap-y-2">
5736              ${c.join("")}
5737            </div>
5738          </div>
5739        `)}let o="";if(t.build_phase&&t.build_phase!=="completed"){let c=t.build_phase==="failed"?"bs-pill-err":"bs-pill-info",u=t.build_phase.replace(/_/g," ").replace(/\b\w/g,h=>h.toUpperCase());o=`
5740        <div class="mb-4">
5741          <span class="bs-pill ${c}">
5742            ${u}
5743          </span>
5744        </div>
5745      `}let a="";t.build_log_url&&(a=`
5746        <div class="mt-4 pt-4" style="border-top: 1px solid var(--bs-line);">
5747          <a href="${t.build_log_url}" target="_blank" rel="noopener noreferrer"
5748             class="inline-flex items-center text-sm hover:underline" style="color: var(--bs-accent);">
5749            <svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
5750              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
5751            </svg>
5752            View Build Log
5753          </a>
5754        </div>
5755      `);let l="";if(t.webhook_events&&t.webhook_events.length>0){let c=t.webhook_events.filter(p=>p.status==="processed").length,u=t.webhook_events.filter(p=>p.status==="failed").length,h=u>0?`${c} processed, ${u} failed`:`${c} processed`,d=t.webhook_events.map(p=>{let g=p.status==="processed"?'<svg class="w-5 h-5" style="color: var(--bs-ok);" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg>':'<svg class="w-5 h-5" style="color: var(--bs-err);" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path></svg>',y=p.status==="processed"?`<span class="bs-pill bs-pill-ok">${p.response_code||"OK"}</span>
5755`:'<span class="bs-pill bs-pill-err">Failed</span>',x=p.event_type.replace(/_/g," ").replace(/\b\w/g,w=>w.toUpperCase());return`
5756          <tr>
5757            <td class="px-4 py-3 whitespace-nowrap">
5758              <div class="flex items-center">
5759                ${g}
5760                <span class="ml-2 text-sm font-medium" style="color: var(--bs-fg);">${x}</span>
5761              </div>
5762            </td>
5763            <td class="px-4 py-3 whitespace-nowrap">
5764              ${y}
5765            </td>
5766            <td class="px-4 py-3 whitespace-nowrap text-sm" style="color: var(--bs-fg-mute);">
5767              ${this.getRelativeTime(p.created_at)}
5768            </td>
5769          </tr>
5770        `}).join("");l=`
5771        <div class="mt-4 pt-4" style="border-top: 1px solid var(--bs-line);">
5772          <div class="mb-3">
5773            <h5 class="text-sm font-semibold" style="color: var(--bs-fg);">Build Webhook Events</h5>
5774            <p class="text-xs" style="color: var(--bs-fg-mute);">${h}</p>
5775          </div>
5776          <div class="overflow-hidden rounded-lg" style="border: 1px solid var(--bs-line);">
5777            <table class="min-w-full">
5778              <thead style="background: var(--bs-bg-panel-2);">
5779                <tr>
5780                  <th scope="col" class="px-4 py-2 text-left text-xs font-medium uppercase tracking-wider" style="color: var(--bs-fg-mute);">Event</th>
5781                  <th scope="col" class="px-4 py-2 text-left text-xs font-medium uppercase tracking-wider" style="color: var(--bs-fg-mute);">Status</th>
5782                  <th scope="col" class="px-4 py-2 text-left text-xs font-medium uppercase tracking-wider" style="color: var(--bs-fg-mute);">Time</th>
5783                </tr>
5784              </thead>
5785              <tbody style="background: var(--bs-bg-panel);">
5786                ${d}
5787              </tbody>
5788            </table>
5789          </div>
5790        </div>
5791      `}return`
5792      <div class="mt-4 pt-4" style="border-top: 1px solid var(--bs-line);">
5793        ${o}
5794
5795        <!-- Engine Info -->
5796        ${n.length>0?`
5797          <div class="mb-4 space-y-2">
5798            ${n.join("")}
5799          </div>
5800        `:""}
5801
5802        <!-- Build Metrics Grid -->
5803        ${s.length>0?`
5804          <div class="grid grid-cols-${Math.min(s.length,4)} gap-3 mb-4">
5805            ${s.join("")}
5806          </div>
5807        `:""}
5808
5809        ${l}
5810        ${r}
5811        ${a}
5812      </div>
5813    `}createCompletenessHeader(i,t){let e=i===100?"var(--bs-ok)":i>=40?"var(--bs-warn)":"var(--bs-err)",n=i===100?"var(--bs-ok-soft)":i>=40?"var(--bs-warn-soft)":"var(--bs-err-soft)",s=i===100?"var(--bs-ok)":i>=40?"var(--bs-warn)":"var(--bs-err)";return`
5814      <div class="bs-card p-6 mb-6">
5815        <div class="flex items-center justify-between mb-4">
5816          <div class="flex items-center space-x-4">
5817            <div class="flex-shrink-0">
5818              <div class="w-16 h-16 rounded-full flex items-center justify-center" style="background: ${n};">
5819                <span class="font-bold leading-none" style="color: ${e};">
5820                  <span class="text-xl">${i}</span><span class="text-sm">%</span>
5821                </span>
5822              </div>
5823            </div>
5824            <div>
5825              <h3 class="text-lg font-medium" style="color: var(--bs-fg);">Pipeline Completeness</h3>
5826              <p class="text-sm" style="color: var(--bs-fg-soft);">
5827                ${i===100?"Perfect! All pipeline stages connected":i>=40?"Good progress - keep adding integrations":"Limited coverage - add more pipeline stages"}
5828              </p>
5829            </div>
5830          </div>
5831          ${t.length>0?`
5832            <div class="flex-shrink-0">
5833              <span class="bs-pill bs-pill-info" style="padding: 0.5rem 0.75rem;">
5834                ${t.length} improvement${t.length>1?"s":""} available
5835              </span>
5836            </div>
5837          `:""}
5838        </div>
5839
5840        <!-- Progress Bar -->
5841        <div class="w-full rounded-full h-2" style="background: var(--bs-bg-panel-2);">
5842          <div class="h-2 rounded-full transition-all duration-500" style="background: ${s}; width: ${i}%"></div>
5843        </div>
5844      </div>
5845    `}createCompletionSuggestions(i){if(!i||i.length===0)return"";let t=e=>{switch(e){case"high":return"background: var(--bs-err-soft); color: var(--bs-err); border-color: var(--bs-err-soft);";case"medium":return"background: var(--bs-warn-soft); color: var(--bs-warn); border-color: var(--bs-warn-soft);";case"low":return"background: var(--bs-ok-soft); color: var(--bs-ok); border-color: var(--bs-ok-soft);";default:return"background: var(--bs-bg-panel-2); color: var(--bs-fg-soft); border-color: var(--bs-line);"}};return`
5846      <div class="mt-8 bs-card p-6" style="background: var(--bs-info-soft);">
5847        <div class="flex items-center space-x-2 mb-4">
5848          <svg class="w-5 h-5" style="color: var(--bs-info);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
5849            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
5850          </svg>
5851          <h4 class="text-lg font-medium" style="color: var(--bs-fg);">Complete Your Pipeline</h4>
5852        </div>
5853        <p class="text-sm mb-4" style="color: var(--bs-fg-soft);">
5854          Enhance your asset visibility and control by adding these components:
5855        </p>
5856
5857        <div class="space-y-3">
5858          ${i.map(e=>`
5859            <div class="flex items-start space-x-4 p-4 rounded-lg" style="border: 1px solid; ${t(e.priority)}">
5860              <div class="flex-shrink-0 mt-1">
5861                <span class="inline-flex items-center justify-center w-16 px-2 py-1 rounded text-xs font-medium" style="${t(e.priority)}">
5862                  ${e.priority.toUpperCase()}
5863                </span>
5864              </div>
5865              <div class="flex-1 min-w-0">
5866                <h5 class="font-medium mb-1" style="color: var(--bs-fg);">${e.title}</h5>
5867                <p class="text-sm" style="color: var(--bs-fg-soft);">${e.description}</p>
5868              </div>
5869            </div>
5870          `).join("")}
5871        </div>
5872      </div>
5873    `}getStatusColor(i){switch(i){case"completed":case"success":return{bg:"var(--bs-ok-soft)",text:"var(--bs-ok)",pillClass:"bs-pill-ok",badge:"bs-pill bs-pill-ok"};case"pending":return{bg:"var(--bs-warn-soft)",text:"var(--bs-warn)",pillClass:"bs-pill-warn",badge:"bs-pill bs-pill-warn"};case"failed":return{bg:"var(--bs-err-soft)",text:"var(--bs-err)",pillClass:"bs-pill-err",badge:"bs-pill bs-pill-err"};case"missing":return{bg:"var(--bs-warn-soft)",text:"var(--bs-warn)",pillClass:"bs-pill-warn",badge:"bs-pill bs-pill-warn"};default:return{bg:"var(--bs-bg-panel-2)",text:"var(--bs-fg-soft)",pillClass:"bs-pill-neutral",badge:"bs-pill bs-pill-neutral"}}}formatDetailKey(i){return i.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}formatDetailValue(i){return i==null?"-":Array.isArray(i)?i.length===0?"-":typeof i[0]=="object"?i.map(e=>e.platform||e.name||e.title||"Unknown").filter(Boolean).join(", ")||`${i.length} items`:i.join(", "):typeof i=="object"?i.name?i.name:i.title?i.title:i.platform?i.platform:i.commit_sha?i.commit_sha.substring(0,8):i.total_assets!=null?`${i.total_assets} assets`:"-":typeof i=="string"&&i.length>50?i.substring(0,47)+"...":i}humanizeStatus(i){return i?i.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()):"Unknown"}formatDepotPath(i){return i?`<code class="px-2 py-1 rounded text-xs font-mono break-all" style="background: var(--bs-bg-panel-2); color: var(--bs-fg-soft);">${i}</code>`:""}formatTimestamp(i){if(!i)return"Unknown";let t=new Date(i);return t.toLocaleDateString()+" "+t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}formatDate(i){return i?new Date(i).toLocaleDateString():"Never"}formatDuration(i){if(!i||i<=0)return"0s";let t=Math.floor(i/3600),e=Math.floor(i%3600/60),n=Math.floor(i%60);return t>0?`${t}h ${e}m`:e>0?`${e}m ${n}s`:`${n}s`}formatBytes(i){if(!i||i<=0)return"0 B";let t=["B","KB","MB","GB","TB"],e=0,n=i;for(;n>=1024&&e<t.length-1;)n/=1024,e++;return`${n.toFixed(e===0?0:1)} ${t[e]}`}getRelativeTime(i){if(!i)return"";let t=new Date,e=new Date(i),n=t-e,s=Math.floor(n/6e4),r=Math.floor(n/36e5),o=Math.floor(n/864e5);return s<60?`${s}m ago`:r<24?`${r}h ago`:`${o}
5873d ago`}showLoading(){this.hasEmptyStateTarget&&this.emptyStateTarget.classList.add("hidden"),this.hasPipelineStagesTarget&&this.pipelineStagesTarget.classList.add("hidden"),this.hasLoadingStateTarget&&this.loadingStateTarget.classList.remove("hidden")}showPipeline(){this.hasEmptyStateTarget&&this.emptyStateTarget.classList.add("hidden"),this.hasLoadingStateTarget&&this.loadingStateTarget.classList.add("hidden"),this.hasPipelineStagesTarget&&this.pipelineStagesTarget.classList.remove("hidden")}updateAssetDetails(i,t,e=0,n=[]){if(!this.hasAssetDetailsContentTarget)return;let s=t&&t.length>0?t[t.length-1]:null,r=t?t.filter(c=>!c.is_placeholder).length:0,o=t?t.length:0,a=e===100?"var(--bs-ok)":e>=40?"var(--bs-warn)":"var(--bs-err)",l=`
5874      <div class="space-y-4">
5875        <div>
5876          <div class="flex items-center space-x-3 mb-3">
5877            <div class="flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center" style="background: var(--bs-accent-soft);">
5878              <span class="text-sm font-medium" style="color: var(--bs-accent);">
5879                ${i.type?i.type.charAt(0).toUpperCase():"A"}
5880              </span>
5881            </div>
5882            <div>
5883              <h4 class="text-lg font-medium" style="color: var(--bs-fg);">${i.name||"Unknown Asset"}</h4>
5884              <p class="text-sm" style="color: var(--bs-fg-mute);">${i.type||"Unknown Type"}</p>
5885            </div>
5886          </div>
5887        </div>
5888
5889        <div class="pt-4" style="border-top: 1px solid var(--bs-line);">
5890          <dl class="space-y-3">
5891            ${i.depot_path?`
5892            <div>
5893              <dt class="text-sm font-medium" style="color: var(--bs-fg-mute);">Source Control Path</dt>
5894              <dd class="mt-1 text-sm font-mono break-words" style="color: var(--bs-fg); overflow-wrap: anywhere;">${i.depot_path}</dd>
5895            </div>
5896            `:""}
5897
5898            <div>
5899              <dt class="text-sm font-medium" style="color: var(--bs-fg-mute);">Pipeline Completeness</dt>
5900              <dd class="mt-1 flex items-center space-x-2">
5901                <span class="text-sm font-medium" style="color: var(--bs-fg);">${e}%</span>
5902                <div class="flex-1 rounded-full h-2" style="background: var(--bs-bg-panel-2);">
5903                  <div class="h-2 rounded-full transition-all duration-500" style="background: ${a}; width: ${e}%"></div>
5904                </div>
5905              </dd>
5906            </div>
5907
5908            <div>
5909              <dt class="text-sm font-medium" style="color: var(--bs-fg-mute);">Pipeline Coverage</dt>
5910              <dd class="mt-1 text-sm" style="color: var(--bs-fg);">
5911                ${r} of ${o} stages connected
5912                ${n.length>0?`<span style="color: var(--bs-warn);"> (${n.length} missing)</span>`:""}
5913              </dd>
5914            </div>
5915
5916            ${s&&!s.is_placeholder?`
5917            <div>
5918              <dt class="text-sm font-medium" style="color: var(--bs-fg-mute);">Last Activity</dt>
5919              <dd class="mt-1 text-sm" style="color: var(--bs-fg);">
5920                ${this.formatTimestamp(s.timestamp)}
5921              </dd>
5922            </div>
5923
5924            <div>
5925              <dt class="text-sm font-medium" style="color: var(--bs-fg-mute);">Last Updated By</dt>
5926              <dd class="mt-1 text-sm" style="color: var(--bs-fg);">
5927                ${s.user?s.user.name:"Unknown"}
5928              </dd>
5929            </div>
5930
5931            <div>
5932              <dt class="text-sm font-medium" style="color: var(--bs-fg-mute);">Current Stage</dt>
5933              <dd class="mt-1">
5934                <span class="${this.getStatusColor(s.status).badge}">
5935                  ${s.title} - ${s.status.charAt(0).toUpperCase()+s.status.slice(1)}
5936                </span>
5937              </dd>
5938            </div>
5939            `:`
5940            <div>
5941              <dt class="text-sm font-medium" style="color: var(--bs-fg-mute);">Status</dt>
5942              <dd class="mt-1">
5943                <span class="bs-pill bs-pill-warn">
5944                  Pipeline Incomplete
5945                </span>
5946              </dd>
5947            </div>
5948            `}
5949          </dl>
5950        </div>
5951      </div>
5952    `;this.assetDetailsContentTarget.innerHTML=l,this.hasAssetMetadataTarget&&i&&(this.assetMetadataTarget.classList.remove("hidden"),this.updateAssetMetadata(i,t))}updateAssetMetadata(i,t){if(!this.hasAssetMetadataContentTarget)return;let e=`
5953      <div class="space-y-3">
5954        <div>
5955          <dt class="text-sm font-medium" style="color: var(--bs-fg-mute);">Total Stages</dt>
5956          <dd class="mt-1 text-sm" style="color: var(--bs-fg);">${t?t.length:0}</dd>
5957        </div>
5958
5959        ${t&&t.length>0?`
5960        <div>
5961          <dt class="text-sm font-medium" style="color: var(--bs-fg-mute);">Stage Breakdown</dt>
5962          <dd class="mt-1 space-y-1">
5963            ${t.map(n=>`
5964              <div class="flex justify-between items-center">
5965                <span class="text-sm" style="color: var(--bs-fg-soft);">${n.title}</span>
5966                <span class="${this.getStatusColor(n.status).badge}">
5967                  ${n.status}
5968                </span>
5969              </div>
5970            `).join("")}
5971          </dd>
5972        </div>
5973        `:""}
5974
5975        <div>
5976          <dt class="text-sm font-medium" style="color: var(--bs-fg-mute);">Asset Type</dt>
5977          <dd class="mt-1 text-sm" style="color: var(--bs-fg);">${i.type||"Unknown"}</dd>
5978        </div>
5979      </div>
5980    `;this.assetMetadataContentTarget.innerHTML=e}showError(i){this.hasLoadingStateTarget&&this.loadingStateTarget.classList.add("hidden"),this.hasPipelineStagesTarget&&(this.pipelineStagesTarget.innerHTML=`
5981        <div class="text-center py-16">
5982          <svg class="mx-auto h-12 w-12" style="color: var(--bs-err);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
5983            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
5984          </svg>
5985          <h3 class="mt-4 text-sm font-medium" style="color: var(--bs-fg);">Error</h3>
5986          <p class="mt-2 text-sm" style="color: var(--bs-fg-mute);">${i}</p>
5987        </div>
5988      `,this.pipelineStagesTarget.classList.remove("hidden"))}getStageLink(i){if(!i.details)return null;switch(i.type){case"task":return i.details.url?i.details.url:null;case"build":if(i.details.jenkins_url)return i.details.jenkins_url;if(i.details.build_id)return`/projects/${this.projectIdValue}/build_runs/${i.details.build_id}`;break;case"game_engine_build":case"unreal_build":return i.details.build_log_url?i.details.build_log_url:i.details.build_run_id?`/projects/${this.projectIdValue}/build_runs/${i.details.build_run_id}`:null;case"approval":if(i.details.approval_id)return`/projects/${this.projectIdValue}/approvals/${i.details.approval_id}`;break;case"commit":return i.details.change_id?`/projects/${this.projectIdValue}/changes/${i.details.change_id}`:null;case"deployment":return i.details.deployment_id?`/projects/${this.projectIdValue}/deployments/${i.details.deployment_id}`:i.details.platforms&&i.details.platforms.length>0&&i.details.platforms[0].deployment_id?`/projects/${this.projectIdValue}/deployments/${i.details.platforms[0].deployment_id}`:`/projects/${this.projectIdValue}/deployments`;default:return null}return null}getIntegrationLink(i){let t=this.projectIdValue;switch(i){case"task":return` <a href="/projects/${t}/integrations/new?type=task_management" class="hover:underline" style="color: var(--bs-accent);">Connect task management</a>`;case"build":return` <a href="/projects/${t}/integrations/new?type=jenkins" class="hover:underline" style="color: var(--bs-accent);">Set up Jenkins integration</a>`;case"game_engine_build":case"unreal_build":return` <a href="/projects/${t}/integrations/new?type=jenkins" class="hover:underline" style="color: var(--bs-accent);">Configure game engine build observability</a>`;case"deployment":return` <a href="/projects/${t}/integrations" class="hover:underline" style="color: var(--bs-accent);">Set up deployment tracking</a>`;default:return""}}debounce(i,t){return function(...n){let s=()=>{clearTimeout(this.searchTimeout),i(...n)};clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout(s,t)}.bind(this)}};var zN={};Le(zN,{default:()=>UN});var UN=class extends Tp{static targets=[...Tp.targets,"overlay","assetName"];static values={...Tp.values};connect(){this.selectedAsset=null,this.searchTimeout=null,this.lineageRequestToken=0,this.boundKeyHandler=this.handleModalKeydown.bind(this)}disconnect(){document.removeEventListener("keydown",this.boundKeyHandler),super.disconnect()}async open(i){let{assetId:t,assetName:e}=i.currentTarget.dataset;t&&(this.assetIdValue=t,this.hasAssetNameTarget&&(this.assetNameTarget.textContent=e||""),delete this.containerTarget.dataset.renderedNodes,this.overlayTarget.style.display="flex",document.body.style.overflow="hidden",document.addEventListener("keydown",this.boundKeyHandler),await new Promise(requestAnimationFrame),await this.initLineageGraph())}close(){this.overlayTarget.style.display="none",document.body.style.overflow="",document.removeEventListener("keydown",this.boundKeyHandler),this.lineageRequestToken++,this.resetCopyFeedback(),this.hasExportPngLabelTarget&&this.resetLabel(this.exportPngLabelTarget,"exportPngFeedbackTimer"),this.hasExportSvgLabelTarget&&this.resetLabel(this.exportSvgLabelTarget,"exportSvgFeedbackTimer"),this.closeExportMenu(),this.graph&&(this.graph.destroy(),this.graph=null),this.containerTarget.innerHTML="",delete this.containerTarget.dataset.renderedNodes}
5988closeBackground(i){i.target===this.overlayTarget&&this.close()}handleModalKeydown(i){i.key==="Escape"&&this.close()}};var HN={};Le(HN,{default:()=>VN});var VN=class extends le{static targets=["container"];static values={previewUrl:String,sizeBytes:Number,maxSizeBytes:Number,autoLoadThreshold:{type:Number,default:1048576},assetName:String,cacheTtl:{type:Number,default:3}};connect(){this.isLoading=!1,this.objectUrl=null,this.render()}disconnect(){this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null)}render(){let i=this.sizeBytesValue,t=this.maxSizeBytesValue;i>t?this.renderTooLarge(i,t):i<=this.autoLoadThresholdValue?this.loadPreview():this.renderLoadButton(i)}renderTooLarge(i,t){this.containerTarget.innerHTML=`
5989      <div style="text-align: center; padding: 32px 0; color: var(--bs-fg-mute);">
5990        <svg style="width: 48px; height: 48px; margin: 0 auto 12px; color: var(--bs-warn); display: block;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
5991          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4.5c-.77-.833-2.694-.833-3.464 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"/>
5992        </svg>
5993        <p style="font-size: 13px; font-weight: 500; color: var(--bs-fg); margin: 0;">File too large for preview</p>
5994        <p style="font-size: 12px; margin: 4px 0 0;">${this.formatSize(i)} exceeds the ${this.formatSize(t)} limit</p>
5995      </div>
5996    `}renderLoadButton(i){this.containerTarget.innerHTML=`
5997      <div style="text-align: center; padding: 32px 0;">
5998        <button type="button" data-action="click->asset-preview#loadPreview" class="bs-btn bs-btn-ghost">
5999          <svg style="width: 18px; height: 18px; margin-right: 6px; color: var(--bs-fg-mute);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6000            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
6001          </svg>
6002          Load Preview (${this.formatSize(i)})
6003        </button>
6004      </div>
6005    `}async loadPreview(){if(!this.isLoading){this.isLoading=!0,this.containerTarget.innerHTML=`
6006      <div style="text-align: center; padding: 32px 0;">
6007        <svg class="animate-spin" style="width: 32px; height: 32px; margin: 0 auto 8px; color: var(--bs-accent); display: block;" fill="none" viewBox="0 0 24 24">
6008          <circle style="opacity: 0.25;" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
6009          <path style="opacity: 0.75;" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
6010        </svg>
6011        <p style="font-size: 13px; color: var(--bs-fg-mute); margin: 0;">Loading preview...</p>
6012      </div>
6013    `;try{let i=await fetch(this.previewUrlValue);if(!i.ok){let s=`HTTP ${i.status}`;try{let r=await i.json();if(r.too_large){this.renderTooLarge(r.size,r.max_bytes);return}r.error&&(s=r.error)}catch{}throw new Error(s)}let t=i.headers.get("Content-Type")||"";if(!t.startsWith("image/")&&t!=="application/octet-stream")throw new Error(`Unexpected content type: ${t}`);let e=await i.blob();this.objectUrl=URL.createObjectURL(e),this.containerTarget.innerHTML=`
6014        <div style="text-align: center;">
6015          <a href="${this.objectUrl}" target="_blank" rel="noopener">
6016            <img src="${this.objectUrl}"
6017                 style="max-width: 100%; max-height: 256px; margin: 0 auto; border-radius: var(--bs-r-md); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); cursor: pointer; object-fit: contain;"
6018                 alt="${this.escapeHtml(this.assetNameValue)}" />
6019          </a>
6020          <p style="font-size: 12px; color: var(--bs-fg-mute); margin: 8px 0 0;">
6021            Click image to view full size
6022          </p>
6023          <p style="font-size: 12px; color: var(--bs-fg-faint); margin: 4px 0 0;">
6024            Cached for ${this.cacheTtlValue} days
6025          </p>
6026        </div>
6027      `;let n=this.containerTarget.querySelector("img");n&&(n.onerror=()=>{this.containerTarget.innerHTML=`
6028            <div style="text-align: center; padding: 32px 0; color: var(--bs-fg-mute);">
6029              <svg style="width: 48px; height: 48px; margin: 0 auto 12px; color: var(--bs-err); display: block;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6030                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
6031              </svg>
6032              <p style="font-size: 13px; font-weight: 500; color: var(--bs-fg); margin: 0;">Image failed to render</p>
6033              <p style="font-size: 12px; margin: 4px 0 0;">The file may be corrupted or in an unsupported format</p>
6034              <button type="button" data-action="click->
6034asset-preview#retryLoad" style="margin-top: 12px; background: transparent; border: 0; color: var(--bs-accent); font-size: 12px; cursor: pointer; text-decoration: underline;">
6035                Retry
6036              </button>
6037            </div>
6038          `})}catch(i){this.containerTarget.innerHTML=`
6039        <div style="text-align: center; padding: 32px 0; color: var(--bs-fg-mute);">
6040          <svg style="width: 48px; height: 48px; margin: 0 auto 12px; color: var(--bs-err); display: block;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6041            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
6042          </svg>
6043          <p style="font-size: 13px; font-weight: 500; color: var(--bs-fg); margin: 0;">Failed to load preview</p>
6044          <p style="font-size: 12px; margin: 4px 0 0;">${this.escapeHtml(i.message)}</p>
6045          <button type="button" data-action="click->asset-preview#retryLoad" style="margin-top: 12px; background: transparent; border: 0; color: var(--bs-accent); font-size: 12px; cursor: pointer; text-decoration: underline;">
6046            Retry
6047          </button>
6048        </div>
6049      `}finally{this.isLoading=!1}}}retryLoad(){this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null),this.loadPreview()}formatSize(i){if(i===0)return"0 B";let t=["B","KB","MB","GB"],e=1024,n=Math.min(Math.floor(Math.log(i)/Math.log(e)),t.length-1);return`${(i/Math.pow(e,n)).toFixed(1)} ${t[n]}`}escapeHtml(i){let t=document.createElement("div");return t.textContent=i,t.innerHTML}};var WN={};Le(WN,{default:()=>jN});var jN=class extends le{static targets=["container"];static values={audioUrl:String,sizeBytes:Number,maxSizeBytes:Number,assetName:String,fileExtension:String,cacheTtl:{type:Number,default:3}};connect(){this.isLoading=!1,this.objectUrl=null,this.render()}disconnect(){this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null)}render(){let i=this.sizeBytesValue,t=this.maxSizeBytesValue;i>t?this.renderTooLarge(i,t):this.renderLoadButton(i)}renderTooLarge(i,t){this.containerTarget.innerHTML=`
6050      <div class="text-center py-8">
6051        <svg class="w-16 h-16 mx-auto text-brand-purple mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6052          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"/>
6053        </svg>
6054        <svg class="w-12 h-12 mx-auto mb-3 text-warn" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6055          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4.5c-.77-.833-2.694-.833-3.464 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"/>
6056        </svg>
6057        <p style="font-size: 13px; font-weight: 500; color: var(--bs-fg); margin: 0;">Audio file too large for preview</p>
6058        <p style="font-size: 12px; margin: 4px 0 0; color: var(--bs-fg-mute);">${this.formatSize(i)} exceeds the ${this.formatSize(t)} limit</p>
6059      </div>
6060    `}renderLoadButton(i){this.containerTarget.innerHTML=`
6061      <div style="text-align: center; padding: 32px 0;">
6062        <svg style="width: 64px; height: 64px; margin: 0 auto 16px; color: var(--bs-accent); display: block;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6063          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"/>
6064        </svg>
6065        <button type="button" data-action="click->audio-player#loadAudio" class="bs-btn bs-btn-ghost">
6066          <svg style="width: 18px; height: 18px; margin-right: 6px; color: var(--bs-accent);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6067            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"/>
6068            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
6069          </svg>
6070          Load Audio Player (${this.formatSize(i)})
6071        </button>
6072      </div>
6073    `}async loadAudio(){if(!this.isLoading){this.isLoading=!0,this.containerTarget.innerHTML=`
6074      <div style="text-align: center; padding: 32px 0;">
6075        <svg class="animate-spin" style="width: 32px; height: 32px; margin: 0 auto 8px; color: var(--bs-accent); display: block;" fill="none" viewBox="0 0 24 24">
6076          <circle style="opacity: 0.25;" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
6077          <path style="opacity: 0.75;" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
6078        </svg>
6079        <p style="font-size: 13px; color: var(--bs-fg-mute); margin: 0;">Loading audio...</p>
6080      </div>
6081    `;try{let i=await fetch(this.audioUrlValue);if(!i.ok){let s=`HTTP ${i.status}`;try{let r=await i.json();r.error&&(s=r.error)}catch{}throw new Error(s)}let t=await i.blob();this.objectUrl=URL.createObjectURL(t);let e=this.fileExtensionValue||"",n=this.detectMimeType(e);this.containerTarget.innerHTML=`
6082        <div style="text-align: center;">
6083          <svg style="width: 64px; height: 64px; margin: 0 auto 16px; color: var(--bs-accent); display: block;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6084            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"/>
6085          </svg>
6086          <div style="background: var(--bs-bg-panel-2); border-radius: var(--bs-r-md); padding: 16px; max-width: 28rem; margin: 0 auto;">
6087            <audio controls style="width: 100%;" preload="metadata">
6088              <source src="${this.objectUrl}" type="${n}">
6089              Your browser does not support the audio element.
6090            </audio>
6091            <div style="margin-top: 12px; font-size: 12px; color: var(--bs-fg-soft);">
6092              <div style="display: flex; justify-content: space-between; align-items: center;">
6093                <span>Format: ${this.escapeHtml(e.toUpperCase())}</span>
6094                <span>Size: ${this.formatSize(this.sizeBytesValue)}</span>
6095              </div>
6096              <div style="margin-top: 4px; text-align: center;">
6097                <span class="bs-pill bs-pill-info">
6098                  Game Audio Asset
6099                </span>
6100              </div>
6101            </div>
6102          </div>
6103          <p style="font-size: 12px; color: var(--bs-fg-faint); margin: 8px 0 0;">
6104            Cached for ${this.cacheTtlValue} days
6105          </p>
6106        </div>
6107      `}catch(i){this.containerTarget.innerHTML=`
6108        <div style="text-align: center; color: var(--bs-fg-mute); padding: 32px 0;">
6109          <svg style="width: 64px; height: 64px; margin: 0 auto 16px; color: var(--bs-accent); display: block;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6110            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"/>
6111          </svg>
6112          <svg style="width: 48px; height: 48px; margin: 0 auto 12px; color: var(--bs-err); display: block;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6113            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
6114          </svg>
6115          <p style="font-size: 13px; font-weight: 500; color: var(--bs-fg); margin: 0;">Failed to load audio</p>
6116          <p style="font-size: 12px; margin: 4px 0 0;">${this.escapeHtml(i.message)}</p>
6117          <button type="button" data-action="click->audio-player#retryLoad" style="margin-top: 12px; background: transparent; border: 0; color: var(--bs-accent); font-size: 12px; cursor: pointer; text-decoration: underline;">
6118            Retry
6119          </button>
6120        </div>
6121      `}finally{this.isLoading=!1}}}retryLoad(){this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null),this.loadAudio()}detectMimeType(i){return{".wav":"audio/wav",".mp3":"audio/mpeg",".ogg":"audio/ogg",".flac":"audio/flac",".m4a":"audio/mp4",".aiff":"audio/aiff",".wma":"audio/x-ms-wma"}[i.toLowerCase()]||"audio/mpeg"}formatSize(i){if(i===0)return"0 B";let t=["B","KB","MB","GB"],e=1024,n=Math.min(Math.floor(Math.log(i)/Math.log(e)),t.length-1);return`${(i/Math.pow(e,n)).toFixed(1)} ${t[n]}`}escapeHtml(i){let t=document.createElement("div");return t.textContent=i,t.innerHTML}};var GN={};Le(GN,{default:()=>$N});var $N=class extends le{static targets=["usernameField","tokenField"];connect(){setTimeout(()=>{this.initializeFields()},100)}initializeFields(){if(this.hasUsernameFieldTarget){let i=this.usernameFieldTarget.dataset.storedValue;this.usernameFieldTarget.value=i,this.usernameFieldTarget.removeAttribute("readonly"),this.usernameFieldTarget.addEventListener("focus",()=>{this.usernameFieldTarget.value&&!i&&(this.usernameFieldTarget.value="")})}if(this.hasTokenFieldTarget){let i=this.tokenFieldTarget.dataset.storedValue;this.tokenFieldTarget.value=i,this.tokenFieldTarget.removeAttribute("readonly"),this.tokenFieldTarget.addEventListener("focus",()=>{this.tokenFieldTarget.value&&!i&&(this.tokenFieldTarget.value="")})}this.protectAgainstAutofill()}protectAgainstAutofill(){let i=0,t=10,e=setInterval(()=>{if(i++,this.hasUsernameFieldTarget){let n=this.usernameFieldTarget.value,s=this.usernameFieldTarget.dataset.storedValue;n&&n.includes("@")&&n!==s&&(this.usernameFieldTarget.value=s)}i>=t&&clearInterval(e)},500)}};var YN={};Le(YN,{default:()=>qN});var qN=class extends le{connect(){this.autogrow()}autogrow(){this.element.style.height="auto",this.element.style.height=`${this.element.scrollHeight}px`}};var KN={};Le(KN,{default:()=>XN});var XN=class extends le{static targets=["selectAll","assetCheckbox","analyzeButton","progressModal","progressBar","progressText","resultsContainer"];static values={assetsUrl:String};connect(){this.selectedAssets=new Set,this.hasAnalyzeButtonTarget&&this.updateAnalyzeButton(),this.pollingInterval=null}disconnect(){this.stopPolling()}toggleSelectAll(){let i=this.selectAllTarget.checked;
6121this.assetCheckboxTargets.forEach(t=>{t.checked=i,i?this.selectedAssets.add(t.value):this.selectedAssets.delete(t.value)}),this.updateAnalyzeButton()}toggleAsset(i){let t=i.target,e=t.value;t.checked?this.selectedAssets.add(e):(this.selectedAssets.delete(e),this.selectAllTarget.checked=!1),this.updateAnalyzeButton()}updateAnalyzeButton(){if(!this.hasAnalyzeButtonTarget)return;let i=this.selectedAssets.size;i===0?(this.analyzeButtonTarget.disabled=!0,this.analyzeButtonTarget.textContent="Analyze Selected"):(this.analyzeButtonTarget.disabled=!1,this.analyzeButtonTarget.textContent=`Analyze ${i} Asset${i>1?"s":""}`)}async startBatchAnalysis(){if(this.selectedAssets.size===0)return;let i=Array.from(this.selectedAssets);try{this.showProgressModal();let t=await fetch("/game-assets/batch_analyze",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content},body:JSON.stringify({asset_ids:i})});if(t.ok)this.startPolling(i);else{let e=await t.text();this.showError(e)}}catch(t){console.error("Batch analysis failed:",t),this.showError("Failed to start batch analysis")}}showProgressModal(){this.progressModalTarget.classList.remove("hidden"),this.progressBarTarget.style.width="0%",this.progressTextTarget.textContent="Starting analysis...",this.resultsContainerTarget.innerHTML=""}hideProgressModal(){this.progressModalTarget.classList.add("hidden"),this.stopPolling()}startPolling(i){this.pollingInterval=setInterval(async()=>{try{let t=await fetch(`/game-assets/batch_analysis_status?asset_ids=${i.join(",")}`);if(t.ok){let e=await t.json();this.updateProgress(e),e.status==="completed"&&(this.stopPolling(),setTimeout(()=>{this.hideProgressModal(),window.location.reload()},2e3))}}catch(t){console.error("Failed to fetch progress:",t)}},2e3)}stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null)}updateProgress(i){let t=Math.round(i.progress);this.progressBarTarget.style.width=`${t}%`,i.status==="completed"?this.progressTextTarget.textContent=`Analysis complete! ${i.completed}/${i.total} assets processed`:this.progressTextTarget.textContent=`Processing... ${i.completed}/${i.total} assets complete (${t}%)`,i.assets&&i.assets.length>0&&this.updateResultsList(i.assets)}updateResultsList(i){let t=i.map(e=>{let n="",s="",r="var(--bs-fg-mute)";switch(e.status){case"completed":case"optimized":n="\u2705",r="var(--bs-ok)";break;case"needs_optimization":n="\u26A0\uFE0F",r="var(--bs-warn)";break;case"failed":n="\u274C",r="var(--bs-err)";break;case"processing":n="\u23F3",r="var(--bs-info)";break;default:n="\u23F1\uFE0F"}return`
6122        <div class="flex items-center justify-between py-2 px-3 rounded-lg" style="background: var(--bs-bg-panel-2);">
6123          <div class="flex items-center space-x-2">
6124            <span class="text-lg">${n}</span>
6125            <span class="text-sm font-medium" style="color: var(--bs-fg);">${e.name}</span>
6126          </div>
6127          <div class="text-right">
6128            <span class="text-xs" style="color: ${r};">${e.status.replace("_"," ")}</span>
6129            ${e.score?`<div class="text-xs" style="color: var(--bs-fg-mute);">Score: ${e.score.toFixed(1)}</div>`:""}
6130          </div>
6131        </div>
6132      `}).join("");this.resultsContainerTarget.innerHTML=t}showError(i){this.progressTextTarget.textContent=`Error: ${i}`,this.progressTextTarget.style.color="var(--bs-err)"}};var t3={};Le(t3,{default:()=>QN});var fMt=Object.defineProperty,pMt=(i,t,e)=>t in i?fMt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,gMt=(i,t,e)=>(pMt(i,typeof t!="symbol"?t+"":t,e),e),mMt=class{#t;#e;#n;#i;constructor(){this.#t=null,this.#e=0,this.#n=[],this.#i=new Map}start(){this.notifyApplicationAfterStart()}notifyApplicationAfterStart(){document.dispatchEvent(new Event("web-bridge:ready"))}supportsComponent(i){return this.#t?this.#t.supportsComponent(i):!1}send({component:i,event:t,data:e,callback:n}){if(!this.#t)return this.#r({component:i,event:t,data:e,callback:n}),null;if(!this.supportsComponent(i))return null;let s=this.generateMessageId(),r={id:s,component:i,event:t,data:e||{}};return this.#t.receive(r),n&&this.#i.set(s,n),s}receive(i){this.executeCallbackFor(i)}executeCallbackFor(i){let t=this.#i.get(i.id);t&&t(i)}removeCallbackFor(i){this.#i.has(i)&&this.#i.delete(i)}removePendingMessagesFor(i){this.#n=this.#n.filter(t=>t.component!=i)}generateMessageId(){return(++this.#e).toString()}setAdapter(i){this.#t=i,document.documentElement.dataset.bridgePlatform=this.#t.platform,this.adapterDidUpdateSupportedComponents(),this.#s()}adapterDidUpdateSupportedComponents(){this.#t&&(document.documentElement.dataset.bridgeComponents=this.#t.supportedComponents.join(" "))}#r(i){this.#n.push(i)}
6132#s(){this.#n.forEach(i=>this.send(i)),this.#n=[]}},JN=class{constructor(i){this.element=i}get title(){return(this.bridgeAttribute("title")||this.attribute("aria-label")||this.element.textContent||this.element.value).trim()}get enabled(){return!this.disabled}get disabled(){let i=this.bridgeAttribute("disabled");return i==="true"||i===this.platform}enableForComponent(i){i.enabled&&this.removeBridgeAttribute("disabled")}hasClass(i){return this.element.classList.contains(i)}attribute(i){return this.element.getAttribute(i)}bridgeAttribute(i){return this.attribute(`data-bridge-${i}`)}setBridgeAttribute(i,t){this.element.setAttribute(`data-bridge-${i}`,t)}removeBridgeAttribute(i){this.element.removeAttribute(`data-bridge-${i}`)}click(){this.platform=="android"&&this.element.removeAttribute("target"),this.element.click()}get platform(){return document.documentElement.dataset.bridgePlatform}},{userAgent:bMt}=window.navigator,vMt=/bridge-components: \[.+\]/.test(bMt),ZN=class extends le{static get shouldLoad(){return vMt}pendingMessageCallbacks=[];initialize(){this.pendingMessageCallbacks=[]}connect(){}disconnect(){this.removePendingCallbacks(),this.removePendingMessages()}get component(){return this.constructor.component}get platformOptingOut(){let{bridgePlatform:i}=document.documentElement.dataset;return this.identifier==this.element.getAttribute(`data-controller-optout-${i}`)}get enabled(){return!this.platformOptingOut&&this.bridge.supportsComponent(this.component)}send(i,t={},e){t.metadata={url:window.location.href};let n={component:this.component,event:i,data:t,callback:e},s=this.bridge.send(n);e&&this.pendingMessageCallbacks.push(s)}removePendingCallbacks(){this.pendingMessageCallbacks.forEach(i=>this.bridge.removeCallbackFor(i))}removePendingMessages(){this.bridge.removePendingMessagesFor(this.component)}get bridgeElement(){return new JN(this.element)}get bridge(){return window.Strada.web}};gMt(ZN,"component","");if(!window.Strada){let i=new mMt;window.Strada={web:i},i.start()}var QN=class extends ZN{static component="form";static targets=["submit"];connect(){super.connect(),this.notifyBridgeOfConnect()}notifyBridgeOfConnect(){let t=new JN(this.submitTarget).title;this.send("connect",{submitTitle:t},()=>{this.submitTarget.click()})}submitStart(i){this.submitTarget.disabled=!0,this.send("submitDisabled")}submitEnd(i){this.submitTarget.disabled=!1,this.send("submitEnabled")}};var n3={};Le(n3,{default:()=>e3});var e3=class extends le{static targets=["checkbox","selectAll"];toggleSelectAll(i){this.allCheckboxesSelected?this.unselectAll():this.selectAll()}selectAll(){this.selectAllTarget.checked=!0,this.selectAllTarget.indeterminate=!1,this.unselected.forEach(i=>i.checked=!0)}unselectAll(){this.selectAllTarget.checked=!1,this.selectAllTarget.indeterminate=!1,this.selected.forEach(i=>i.checked=!1)}change(i){this.noCheckboxesSelected?(this.selectAllTarget.checked=!1,this.selectAllTarget.indeterminate=!1):this.allCheckboxesSelected?(this.selectAllTarget.checked=!0,this.selectAllTarget.indeterminate=!1):this.selectAllTarget.indeterminate=!0}get selectedAll(){return this.selectAllTarget.checked}get selected(){return this.checkboxTargets.filter(i=>i.checked)}get unselected(){return this.checkboxTargets.filter(i=>!i.checked)}get selectedIds(){return this.selected.map(i=>i.dataset.id)}get allCheckboxesSelected(){return this.checkboxTargets.every(i=>i.checked)}get noCheckboxesSelected(){return this.checkboxTargets.every(i=>!i.checked)}};var s3={};Le(s3,{default:()=>i3});var i3=class extends le{static values={type:{type:String,default:"line"},data:{type:Array,default:[]},options:{type:Object,default:{}}};connect(){if(typeof Chart>"u"){console.warn("[chart_controller] Chart.js not loaded \u2014 skipping render");return}!Array.isArray(this.dataValue)||this.dataValue.length===0||this.renderChart()}disconnect(){this.chart?.destroy()}renderChart(){let i=this.element.querySelector("canvas");if(!i)return;let t=this.dataValue,e=t.map(u=>u.date??u.label??""),n=["success_rate","value","score","count","total"].find(u=>t[0]&&Object.prototype.hasOwnProperty.call(t[0],u))||"success_rate",s=t.map(u=>u[n]??0),r=getComputedStyle(document.documentElement).getPropertyValue("--bs-accent").trim()||"#3aa6c7",o=getComputedStyle(document.documentElement).getPropertyValue("--bs-accent-soft").trim()||"rgba(58, 166, 199, 0.14)",a=getComputedStyle(document.documentElement).getPropertyValue("--bs-fg-mute").trim()||"#888",l=getComputedStyle(document.documentElement).getPropertyValue("--bs-line").trim()||"rgba(255,255,255,0.06)",c={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{dis
vendor: 5,142 bytes, line 6132
6132play:!1}},scales:{y:{beginAtZero:!0,max:n==="success_rate"?100:void 0,ticks:{color:a,font:{size:11}},grid:{color:l}},x:{ticks:{color:a,font:{size:11}},grid:{display:!1}}}};this.chart=new Chart(i.getContext("2d"),{type:this.typeValue,data:{labels:e,datasets:[{label:n,data:s,borderColor:r,backgroundColor:o,tension:.3,fill:!0,pointBackgroundColor:r,pointRadius:3,pointHoverRadius:5,borderWidth:2}]},options:{...c,...this.optionsValue}})}};var E3={};Le(E3,{default:()=>A3});var lK=il(CX());var Vs="top",Cr="bottom",hr="right",tr="left",pA="auto",Rd=[Vs,Cr,hr,tr],ju="start",Ap="end",MX="clippingParents",gA="viewport",O0="popper",TX="reference",o3=Rd.reduce(function(i,t){return i.concat([t+"-"+ju,t+"-"+Ap])},[]),mA=[].concat(Rd,[pA]).reduce(function(i,t){return i.concat([t,t+"-"+ju,t+"-"+Ap])},[]),yMt="beforeRead",xMt="read",wMt="afterRead",_Mt="beforeMain",SMt="main",CMt="afterMain",MMt="beforeWrite",TMt="write",AMt="afterWrite",AX=[yMt,xMt,wMt,_Mt,SMt,CMt,MMt,TMt,AMt];function Fr(i){return i?(i.nodeName||"").toLowerCase():null}function Es(i){if(i==null)return window;if(i.toString()!=="[object Window]"){var t=i.ownerDocument;return t&&t.defaultView||window}return i}function gl(i){var t=Es(i).Element;return i instanceof t||i instanceof Element}function Mr(i){var t=Es(i).HTMLElement;return i instanceof t||i instanceof HTMLElement}function N0(i){if(typeof ShadowRoot>"u")return!1;var t=Es(i).ShadowRoot;return i instanceof t||i instanceof ShadowRoot}function EMt(i){var t=i.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},s=t.attributes[e]||{},r=t.elements[e];!Mr(r)||!Fr(r)||(Object.assign(r.style,n),Object.keys(s).forEach(function(o){var a=s[o];a===!1?r.removeAttribute(o):r.setAttribute(o,a===!0?"":a)}))})}function kMt(i){var t=i.state,e={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,e.popper),t.styles=e,t.elements.arrow&&Object.assign(t.elements.arrow.style,e.arrow),function(){Object.keys(t.elements).forEach(function(n){var s=t.elements[n],r=t.attributes[n]||{},o=Object.keys(t.styles.hasOwnProperty(n)?t.styles[n]:e[n]),a=o.reduce(function(l,c){return l[c]="",l},{});!Mr(s)||!Fr(s)||(Object.assign(s.style,a),Object.keys(r).forEach(function(l){s.removeAttribute(l)}))})}}var Wx={name:"applyStyles",enabled:!0,phase:"write",fn:EMt,effect:kMt,requires:["computeStyles"]};function Ur(i){return i.split("-")[0]}var Jl=Math.max,Ep=Math.min,Wu=Math.round;function B0(){var i=navigator.userAgentData;return i!=null&&i.brands&&Array.isArray(i.brands)?i.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function $x(){return!/^((?!chrome|android).)*safari/i.test(B0())}function ml(i,t,e){t===void 0&&(t=!1),e===void 0&&(e=!1);var n=i.getBoundingClientRect(),s=1,r=1;t&&Mr(i)&&(s=i.offsetWidth>0&&Wu(n.width)/i.offsetWidth||1,r=i.offsetHeight>0&&Wu(n.height)/i.offsetHeight||1);var o=gl(i)?Es(i):window,a=o.visualViewport,l=!$x()&&e,c=(n.left+(l&&a?a.offsetLeft:0))/s,u=(n.top+(l&&a?a.offsetTop:0))/r,h=n.width/s,d=n.height/r;return{width:h,height:d,top:u,right:c+h,bottom:u+d,left:c,x:c,y:u}}function kp(i){var t=ml(i),e=i.offsetWidth,n=i.offsetHeight;return Math.abs(t.width-e)<=1&&(e=t.width),Math.abs(t.height-n)<=1&&(n=t.height),{x:i.offsetLeft,y:i.offsetTop,width:e,height:n}}function Gx(i,t){var e=t.getRootNode&&t.getRootNode();if(i.contains(t))return!0;if(e&&N0(e)){var n=t;do{if(n&&i.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Ho(i){return Es(i).getComputedStyle(i)}function a3(i){return["table","td","th"].indexOf(Fr(i))>=0}function Qr(i){return((gl(i)?i.ownerDocument:i.document)||window.document).documentElement}function $u(i){return Fr(i)==="html"?i:i.assignedSlot||i.parentNode||(N0(i)?i.host:null)||Qr(i)}function EX(i){return!Mr(i)||Ho(i).position==="fixed"?null:i.offsetParent}function PMt(i){var t=/firefox/i.test(B0()),e=/Trident/i.test(B0());if(e&&Mr(i)){var n=Ho(i);if(n.position==="fixed")return null}var s=$u(i);for(N0(s)&&(s=s.host);Mr(s)&&["html","body"].indexOf(Fr(s))<0;){var r=Ho(s);if(r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].indexOf(r.willChange)!==-1||t&&r.willChange==="filter"||t&&r.filter&&r.filter!=="none")return s;s=s.parentNode}return null}function Zl(i){for(var t=Es(i),e=EX(i);e&&a3(e)&&Ho(e).position==="static";)e=EX(e);return e&&(Fr(e)==="html"||Fr(e)==="body"&&Ho(e).position==="static")?t:e||PMt(i)||t}function Pp(i){return["top","bottom"].indexOf(i)>=0?"x":"y"}function Rp(i,t,e){return Jl(i,Ep(t,e))}function kX(i,t,e){var n=Rp(i,t,e);return n>e?e:n}function qx(){return{top:0,right:0,bottom:0,left:0}}function Yx(i){return Object.assign({},qx(),i)}function Xx(i,t){return t.reduce(function(e,n){return e[n]=i,e},{})}var RMt=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,Yx(typeof t!="number"?t:Xx(t,Rd))};function DMt(i){var t,e=i.state,n=i.name,s=i.options,r=e.elements.arrow,o=e.modifiersData.popperOffsets,a=Ur(e.placement),l=Pp(a),c=[tr,hr].indexOf(a)>=0,u=c?"height":"width";
vendor: 3,803 bytes, line 6132
6132if(!(!r||!o)){var h=RMt(s.padding,e),d=kp(r),p=l==="y"?Vs:tr,g=l==="y"?Cr:hr,y=e.rects.reference[u]+e.rects.reference[l]-o[l]-e.rects.popper[u],x=o[l]-e.rects.reference[l],w=Zl(r),M=w?l==="y"?w.clientHeight||0:w.clientWidth||0:0,A=y/2-x/2,C=h[p],R=M-d[u]-h[g],k=M/2-d[u]/2+A,O=Rp(C,k,R),I=l;e.modifiersData[n]=(t={},t[I]=O,t.centerOffset=O-k,t)}}function LMt(i){var t=i.state,e=i.options,n=e.element,s=n===void 0?"[data-popper-arrow]":n;s!=null&&(typeof s=="string"&&(s=t.elements.popper.querySelector(s),!s)||Gx(t.elements.popper,s)&&(t.elements.arrow=s))}var PX={name:"arrow",enabled:!0,phase:"main",fn:DMt,effect:LMt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function bl(i){return i.split("-")[1]}var IMt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function OMt(i,t){var e=i.x,n=i.y,s=t.devicePixelRatio||1;return{x:Wu(e*s)/s||0,y:Wu(n*s)/s||0}}function RX(i){var t,e=i.popper,n=i.popperRect,s=i.placement,r=i.variation,o=i.offsets,a=i.position,l=i.gpuAcceleration,c=i.adaptive,u=i.roundOffsets,h=i.isFixed,d=o.x,p=d===void 0?0:d,g=o.y,y=g===void 0?0:g,x=typeof u=="function"?u({x:p,y}):{x:p,y};p=x.x,y=x.y;var w=o.hasOwnProperty("x"),M=o.hasOwnProperty("y"),A=tr,C=Vs,R=window;if(c){var k=Zl(e),O="clientHeight",I="clientWidth";if(k===Es(e)&&(k=Qr(e),Ho(k).position!=="static"&&a==="absolute"&&(O="scrollHeight",I="scrollWidth")),k=k,s===Vs||(s===tr||s===hr)&&r===Ap){C=Cr;var U=h&&k===R&&R.visualViewport?R.visualViewport.height:k[O];y-=U-n.height,y*=l?1:-1}if(s===tr||(s===Vs||s===Cr)&&r===Ap){A=hr;var V=h&&k===R&&R.visualViewport?R.visualViewport.width:k[I];p-=V-n.width,p*=l?1:-1}}var q=Object.assign({position:a},c&&IMt),X=u===!0?OMt({x:p,y},Es(e)):{x:p,y};if(p=X.x,y=X.y,l){var j;return Object.assign({},q,(j={},j[C]=M?"0":"",j[A]=w?"0":"",j.transform=(R.devicePixelRatio||1)<=1?"translate("+p+"px, "+y+"px)":"translate3d("+p+"px, "+y+"px, 0)",j))}return Object.assign({},q,(t={},t[C]=M?y+"px":"",t[A]=w?p+"px":"",t.transform="",t))}function NMt(i){var t=i.state,e=i.options,n=e.gpuAcceleration,s=n===void 0?!0:n,r=e.adaptive,o=r===void 0?!0:r,a=e.roundOffsets,l=a===void 0?!0:a,c={placement:Ur(t.placement),variation:bl(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:s,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,RX(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,RX(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var DX={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:NMt,data:{}};var bA={passive:!0};function BMt(i){var t=i.state,e=i.instance,n=i.options,s=n.scroll,r=s===void 0?!0:s,o=n.resize,a=o===void 0?!0:o,l=Es(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return r&&c.forEach(function(u){u.addEventListener("scroll",e.update,bA)}),a&&l.addEventListener("resize",e.update,bA),function(){r&&c.forEach(function(u){u.removeEventListener("scroll",e.update,bA)}),a&&l.removeEventListener("resize",e.update,bA)}}var LX={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:BMt,data:{}};var FMt={left:"right",right:"left",bottom:"top",top:"bottom"};function F0(i){return i.replace(/left|right|bottom|top/g,function(t){return FMt[t]})}var UMt={start:"end",end:"start"};function vA(i){return i.replace(/start|end/g,function(t){return UMt[t]})}function Dp(i){var t=Es(i),e=t.pageXOffset,n=t.pageYOffset;return{scrollLeft:e,scrollTop:n}}function Lp(i){return ml(Qr(i)).left+Dp(i).scrollLeft}
vendor: 4,194 bytes, line 6132
6132function l3(i,t){var e=Es(i),n=Qr(i),s=e.visualViewport,r=n.clientWidth,o=n.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;var c=$x();(c||!c&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a+Lp(i),y:l}}function c3(i){var t,e=Qr(i),n=Dp(i),s=(t=i.ownerDocument)==null?void 0:t.body,r=Jl(e.scrollWidth,e.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Jl(e.scrollHeight,e.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-n.scrollLeft+Lp(i),l=-n.scrollTop;return Ho(s||e).direction==="rtl"&&(a+=Jl(e.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}function Ip(i){var t=Ho(i),e=t.overflow,n=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(e+s+n)}function yA(i){return["html","body","#document"].indexOf(Fr(i))>=0?i.ownerDocument.body:Mr(i)&&Ip(i)?i:yA($u(i))}function Dd(i,t){var e;t===void 0&&(t=[]);var n=yA(i),s=n===((e=i.ownerDocument)==null?void 0:e.body),r=Es(n),o=s?[r].concat(r.visualViewport||[],Ip(n)?n:[]):n,a=t.concat(o);return s?a:a.concat(Dd($u(o)))}function U0(i){return Object.assign({},i,{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height})}function zMt(i,t){var e=ml(i,!1,t==="fixed");return e.top=e.top+i.clientTop,e.left=e.left+i.clientLeft,e.bottom=e.top+i.clientHeight,e.right=e.left+i.clientWidth,e.width=i.clientWidth,e.height=i.clientHeight,e.x=e.left,e.y=e.top,e}function IX(i,t,e){return t===gA?U0(l3(i,e)):gl(t)?zMt(t,e):U0(c3(Qr(i)))}function VMt(i){var t=Dd($u(i)),e=["absolute","fixed"].indexOf(Ho(i).position)>=0,n=e&&Mr(i)?Zl(i):i;return gl(n)?t.filter(function(s){return gl(s)&&Gx(s,n)&&Fr(s)!=="body"}):[]}function u3(i,t,e,n){var s=t==="clippingParents"?VMt(i):[].concat(t),r=[].concat(s,[e]),o=r[0],a=r.reduce(function(l,c){var u=IX(i,c,n);return l.top=Jl(u.top,l.top),l.right=Ep(u.right,l.right),l.bottom=Ep(u.bottom,l.bottom),l.left=Jl(u.left,l.left),l},IX(i,o,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Kx(i){var t=i.reference,e=i.element,n=i.placement,s=n?Ur(n):null,r=n?bl(n):null,o=t.x+t.width/2-e.width/2,a=t.y+t.height/2-e.height/2,l;switch(s){case Vs:l={x:o,y:t.y-e.height};break;case Cr:l={x:o,y:t.y+t.height};break;case hr:l={x:t.x+t.width,y:a};break;case tr:l={x:t.x-e.width,y:a};break;default:l={x:t.x,y:t.y}}var c=s?Pp(s):null;if(c!=null){var u=c==="y"?"height":"width";switch(r){case ju:l[c]=l[c]-(t[u]/2-e[u]/2);break;case Ap:l[c]=l[c]+(t[u]/2-e[u]/2);break;default:}}return l}function Ql(i,t){t===void 0&&(t={});var e=t,n=e.placement,s=n===void 0?i.placement:n,r=e.strategy,o=r===void 0?i.strategy:r,a=e.boundary,l=a===void 0?MX:a,c=e.rootBoundary,u=c===void 0?gA:c,h=e.elementContext,d=h===void 0?O0:h,p=e.altBoundary,g=p===void 0?!1:p,y=e.padding,x=y===void 0?0:y,w=Yx(typeof x!="number"?x:Xx(x,Rd)),M=d===O0?TX:O0,A=i.rects.popper,C=i.elements[g?M:d],R=u3(gl(C)?C:C.contextElement||Qr(i.elements.popper),l,u,o),k=ml(i.elements.reference),O=Kx({reference:k,element:A,strategy:"absolute",placement:s}),I=U0(Object.assign({},A,O)),U=d===O0?I:k,V={top:R.top-U.top+w.top,bottom:U.bottom-R.bottom+w.bottom,left:R.left-U.left+w.left,right:U.right-R.right+w.right},q=i.modifiersData.offset;if(d===O0&&q){var X=q[s];Object.keys(V).forEach(function(j){var W=[hr,Cr].indexOf(j)>=0?1:-1,_=[Vs,Cr].indexOf(j)>=0?"y":"x";V[j]+=X[_]*W})}return V}function h3(i,t){t===void 0&&(t={});var e=t,n=e.placement,s=e.boundary,r=e.rootBoundary,o=e.padding,a=e.flipVariations,l=e.allowedAutoPlacements,c=l===void 0?mA:l,u=bl(n),h=u?a?o3:o3.filter(function(g){return bl(g)===u}):Rd,d=h.filter(function(g){return c.indexOf(g)>=0});d.length===0&&(d=h);var p=d.reduce(function(g,y){return g[y]=Ql(i,{placement:y,boundary:s,rootBoundary:r,padding:o})[Ur(y)],g},{});return Object.keys(p).sort(function(g,y){return p[g]-p[y]})}function HMt(i){if(Ur(i)===pA)return[];var t=F0(i);return[vA(i),t,vA(t)]}function jMt(i){var t=i.state,e=i.options,n=i.name;if(!t.modifiersData[n]._skip){for(var s=e.mainAxis,r=s===void 0?!0:s,o=e.altAxis,a=o===void 0?!0:o,l=e.fallbackPlacements,c=e.padding,u=e.boundary,h=e.rootBoundary,d=e.altBoundary,p=e.flipVariations,g=p===void 0?!0:p,y=e.allowedAutoPlacements,x=t.options.placement,w=Ur(x),M=w===x,A=l||(M||!g?[F0(x)]:HMt(x
vendor: 4,944 bytes, line 6132
6132)),C=[x].concat(A).reduce(function(jt,ae){return jt.concat(Ur(ae)===pA?h3(t,{placement:ae,boundary:u,rootBoundary:h,padding:c,flipVariations:g,allowedAutoPlacements:y}):ae)},[]),R=t.rects.reference,k=t.rects.popper,O=new Map,I=!0,U=C[0],V=0;V<C.length;V++){var q=C[V],X=Ur(q),j=bl(q)===ju,W=[Vs,Cr].indexOf(X)>=0,_=W?"width":"height",at=Ql(t,{placement:q,boundary:u,rootBoundary:h,altBoundary:d,padding:c}),ct=W?j?hr:tr:j?Cr:Vs;R[_]>k[_]&&(ct=F0(ct));var pt=F0(ct),Et=[];if(r&&Et.push(at[X]<=0),a&&Et.push(at[ct]<=0,at[pt]<=0),Et.every(function(jt){return jt})){U=q,I=!1;break}O.set(q,Et)}if(I)for(var vt=g?3:1,yt=function(ae){var ee=C.find(function(Bt){var Gt=O.get(Bt);if(Gt)return Gt.slice(0,ae).every(function(Qt){return Qt})});if(ee)return U=ee,"break"},kt=vt;kt>0;kt--){var Wt=yt(kt);if(Wt==="break")break}t.placement!==U&&(t.modifiersData[n]._skip=!0,t.placement=U,t.reset=!0)}}var OX={name:"flip",enabled:!0,phase:"main",fn:jMt,requiresIfExists:["offset"],data:{_skip:!1}};function NX(i,t,e){return e===void 0&&(e={x:0,y:0}),{top:i.top-t.height-e.y,right:i.right-t.width+e.x,bottom:i.bottom-t.height+e.y,left:i.left-t.width-e.x}}function BX(i){return[Vs,hr,Cr,tr].some(function(t){return i[t]>=0})}function WMt(i){var t=i.state,e=i.name,n=t.rects.reference,s=t.rects.popper,r=t.modifiersData.preventOverflow,o=Ql(t,{elementContext:"reference"}),a=Ql(t,{altBoundary:!0}),l=NX(o,n),c=NX(a,s,r),u=BX(l),h=BX(c);t.modifiersData[e]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":h})}var FX={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:WMt};function $Mt(i,t,e){var n=Ur(i),s=[tr,Vs].indexOf(n)>=0?-1:1,r=typeof e=="function"?e(Object.assign({},t,{placement:i})):e,o=r[0],a=r[1];return o=o||0,a=(a||0)*s,[tr,hr].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}function GMt(i){var t=i.state,e=i.options,n=i.name,s=e.offset,r=s===void 0?[0,0]:s,o=mA.reduce(function(u,h){return u[h]=$Mt(h,t.rects,r),u},{}),a=o[t.placement],l=a.x,c=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[n]=o}var UX={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:GMt};function qMt(i){var t=i.state,e=i.name;t.modifiersData[e]=Kx({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}var zX={name:"popperOffsets",enabled:!0,phase:"read",fn:qMt,data:{}};function d3(i){return i==="x"?"y":"x"}function YMt(i){var t=i.state,e=i.options,n=i.name,s=e.mainAxis,r=s===void 0?!0:s,o=e.altAxis,a=o===void 0?!1:o,l=e.boundary,c=e.rootBoundary,u=e.altBoundary,h=e.padding,d=e.tether,p=d===void 0?!0:d,g=e.tetherOffset,y=g===void 0?0:g,x=Ql(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:u}),w=Ur(t.placement),M=bl(t.placement),A=!M,C=Pp(w),R=d3(C),k=t.modifiersData.popperOffsets,O=t.rects.reference,I=t.rects.popper,U=typeof y=="function"?y(Object.assign({},t.rects,{placement:t.placement})):y,V=typeof U=="number"?{mainAxis:U,altAxis:U}:Object.assign({mainAxis:0,altAxis:0},U),q=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,X={x:0,y:0};if(k){if(r){var j,W=C==="y"?Vs:tr,_=C==="y"?Cr:hr,at=C==="y"?"height":"width",ct=k[C],pt=ct+x[W],Et=ct-x[_],vt=p?-I[at]/2:0,yt=M===ju?O[at]:I[at],kt=M===ju?-I[at]:-O[at],Wt=t.elements.arrow,jt=p&&Wt?kp(Wt):{width:0,height:0},ae=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:qx(),ee=ae[W],Bt=ae[_],Gt=Rp(0,O[at],jt[at]),Qt=A?O[at]/2-vt-Gt-ee-V.mainAxis:yt-Gt-ee-V.mainAxis,xe=A?-O[at]/2+vt+Gt+Bt+V.mainAxis:kt+Gt+Bt+V.mainAxis,Ut=t.elements.arrow&&Zl(t.elements.arrow),zt=Ut?C==="y"?Ut.clientTop||0:Ut.clientLeft||0:0,St=(j=q?.[C])!=null?j:0,it=ct+Qt-St-zt,gt=ct+xe-St,ft=Rp(p?Ep(pt,it):pt,ct,p?Jl(Et,gt):Et);k[C]=ft,X[C]=ft-ct}if(a){var de,ve=C==="x"?Vs:tr,we=C==="x"?Cr:hr,Ae=k[R],Ue=R==="y"?"height":"width",en=Ae+x[ve],It=Ae-x[we],Cn=[Vs,tr].indexOf(w)!==-1,mn=(de=q?.[R])!=null?de:0,mt=Cn?en:Ae-O[Ue]-I[Ue]-mn+V.altAxis,K=Cn?Ae+O[Ue]+I[Ue]-mn-V.altAxis:It,Vt=p&&Cn?kX(mt,Ae,K):Rp(p?mt:en,Ae,p?K:It);k[R]=Vt,X[R]=Vt-Ae}t.modifiersData[n]=X}}var VX={name:"preventOverflow",enabled:!0,phase:"main",fn:YMt,requiresIfExists:["offset"]};function f3(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function p3(i){return i===Es(i)||!Mr(i)?Dp(i):f3(i)}function XMt(i){var t=i.getBoundingClientRect(),e=Wu(t.width)/i.offsetWidth||1,n=Wu(t.height)/i.offsetHeight||1;return e!==1||n!==1}function g3(i,t,e){e===void 0&&(e=!1);var n=Mr(t),s=Mr(t)&&XMt(t),r=Qr(t),o=ml(i,s,e),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(n||!n&&!e)&&((Fr(t)!=="body"||Ip(r))&&(a=p3(t)),Mr(t)?(l=ml(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):r&&(l.x=Lp(r))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function KMt(i){var t=new Map,e=new Set,n=[];
vendor: 4,083 bytes, line 6132
6132i.forEach(function(r){t.set(r.name,r)});function s(r){e.add(r.name);var o=[].concat(r.requires||[],r.requiresIfExists||[]);o.forEach(function(a){if(!e.has(a)){var l=t.get(a);l&&s(l)}}),n.push(r)}return i.forEach(function(r){e.has(r.name)||s(r)}),n}function m3(i){var t=KMt(i);return AX.reduce(function(e,n){return e.concat(t.filter(function(s){return s.phase===n}))},[])}function b3(i){var t;return function(){return t||(t=new Promise(function(e){Promise.resolve().then(function(){t=void 0,e(i())})})),t}}function v3(i){var t=i.reduce(function(e,n){var s=e[n.name];return e[n.name]=s?Object.assign({},s,n,{options:Object.assign({},s.options,n.options),data:Object.assign({},s.data,n.data)}):n,e},{});return Object.keys(t).map(function(e){return t[e]})}var HX={placement:"bottom",modifiers:[],strategy:"absolute"};function jX(){for(var i=arguments.length,t=new Array(i),e=0;e<i;e++)t[e]=arguments[e];return!t.some(function(n){return!(n&&typeof n.getBoundingClientRect=="function")})}function WX(i){i===void 0&&(i={});var t=i,e=t.defaultModifiers,n=e===void 0?[]:e,s=t.defaultOptions,r=s===void 0?HX:s;return function(a,l,c){c===void 0&&(c=r);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},HX,r),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},h=[],d=!1,p={state:u,setOptions:function(w){var M=typeof w=="function"?w(u.options):w;y(),u.options=Object.assign({},r,u.options,M),u.scrollParents={reference:gl(a)?Dd(a):a.contextElement?Dd(a.contextElement):[],popper:Dd(l)};var A=m3(v3([].concat(n,u.options.modifiers)));return u.orderedModifiers=A.filter(function(C){return C.enabled}),g(),p.update()},forceUpdate:function(){if(!d){var w=u.elements,M=w.reference,A=w.popper;if(jX(M,A)){u.rects={reference:g3(M,Zl(A),u.options.strategy==="fixed"),popper:kp(A)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(V){return u.modifiersData[V.name]=Object.assign({},V.data)});for(var C=0;C<u.orderedModifiers.length;C++){if(u.reset===!0){u.reset=!1,C=-1;continue}var R=u.orderedModifiers[C],k=R.fn,O=R.options,I=O===void 0?{}:O,U=R.name;typeof k=="function"&&(u=k({state:u,options:I,name:U,instance:p})||u)}}}},update:b3(function(){return new Promise(function(x){p.forceUpdate(),x(u)})}),destroy:function(){y(),d=!0}};if(!jX(a,l))return p;p.setOptions(c).then(function(x){!d&&c.onFirstUpdate&&c.onFirstUpdate(x)});function g(){u.orderedModifiers.forEach(function(x){var w=x.name,M=x.options,A=M===void 0?{}:M,C=x.effect;if(typeof C=="function"){var R=C({state:u,name:w,instance:p,options:A}),k=function(){};h.push(R||k)}})}function y(){h.forEach(function(x){return x()}),h=[]}return p}}var JMt=[LX,zX,DX,Wx,UX,OX,VX,PX,FX],y3=WX({defaultModifiers:JMt});var ZMt="tippy-box",tK="tippy-content",QMt="tippy-backdrop",eK="tippy-arrow",nK="tippy-svg-arrow",Op={passive:!0,capture:!0},iK=function(){return document.body};function x3(i,t,e){if(Array.isArray(i)){var n=i[t];return n??(Array.isArray(e)?e[t]:e)}return i}function T3(i,t){var e={}.toString.call(i);return e.indexOf("[object")===0&&e.indexOf(t+"]")>-1}function sK(i,t){return typeof i=="function"?i.apply(void 0,t):i}function $X(i,t){if(t===0)return i;var e;return function(n){clearTimeout(e),e=setTimeout(function(){i(n)},t)}}function tTt(i){return i.split(/\s+/).filter(Boolean)}function z0(i){return[].concat(i)}function GX(i,t){i.indexOf(t)===-1&&i.push(t)}function eTt(i){return i.filter(function(t,e){return i.indexOf(t)===e})}function nTt(i){return i.split("-")[0]}function wA(i){return[].slice.call(i)}function qX(i){return Object.keys(i).reduce(function(t,e){return i[e]!==void 0&&(t[e]=i[e]),t},{})}function Jx(){return document.createElement("div")}function _A(i){return["Element","Fragment"].some(function(t){return T3(i,t)})}function iTt(i){return T3(i,"NodeList")}function sTt(i){return T3(i,"MouseEvent")}function rTt(i){return!!(i&&i._tippy&&i._tippy.reference===i)}function oTt(i){return _A(i)?[i]:iTt(i)?wA(i):Array.isArray(i)?i:wA(document.querySelectorAll(i))}function w3(i,t){i.forEach(function(e){e&&(e.style.transitionDuration=t+"ms")})}
vendor: 8,469 bytes, line 6132
6132function YX(i,t){i.forEach(function(e){e&&e.setAttribute("data-state",t)})}function aTt(i){var t,e=z0(i),n=e[0];return n!=null&&(t=n.ownerDocument)!=null&&t.body?n.ownerDocument:document}function lTt(i,t){var e=t.clientX,n=t.clientY;return i.every(function(s){var r=s.popperRect,o=s.popperState,a=s.props,l=a.interactiveBorder,c=nTt(o.placement),u=o.modifiersData.offset;if(!u)return!0;var h=c==="bottom"?u.top.y:0,d=c==="top"?u.bottom.y:0,p=c==="right"?u.left.x:0,g=c==="left"?u.right.x:0,y=r.top-n+h>l,x=n-r.bottom-d>l,w=r.left-e+p>l,M=e-r.right-g>l;return y||x||w||M})}function _3(i,t,e){var n=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(s){i[n](s,e)})}function XX(i,t){for(var e=t;e;){var n;if(i.contains(e))return!0;e=e.getRootNode==null||(n=e.getRootNode())==null?void 0:n.host}return!1}var tu={isTouch:!1},KX=0;function cTt(){tu.isTouch||(tu.isTouch=!0,window.performance&&document.addEventListener("mousemove",rK))}function rK(){var i=performance.now();i-KX<20&&(tu.isTouch=!1,document.removeEventListener("mousemove",rK)),KX=i}function uTt(){var i=document.activeElement;if(rTt(i)){var t=i._tippy;i.blur&&!t.state.isVisible&&i.blur()}}function hTt(){document.addEventListener("touchstart",cTt,Op),window.addEventListener("blur",uTt)}var dTt=typeof window<"u"&&typeof document<"u",fTt=dTt?!!window.msCrypto:!1;var pTt={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},gTt={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},tc=Object.assign({appendTo:iK,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},pTt,gTt),mTt=Object.keys(tc),bTt=function(t){var e=Object.keys(t);e.forEach(function(n){tc[n]=t[n]})};function oK(i){var t=i.plugins||[],e=t.reduce(function(n,s){var r=s.name,o=s.defaultValue;if(r){var a;n[r]=i[r]!==void 0?i[r]:(a=tc[r])!=null?a:o}return n},{});return Object.assign({},i,e)}function vTt(i,t){var e=t?Object.keys(oK(Object.assign({},tc,{plugins:t}))):mTt,n=e.reduce(function(s,r){var o=(i.getAttribute("data-tippy-"+r)||"").trim();if(!o)return s;if(r==="content")s[r]=o;else try{s[r]=JSON.parse(o)}catch{s[r]=o}return s},{});return n}function JX(i,t){var e=Object.assign({},t,{content:sK(t.content,[i])},t.ignoreAttributes?{}:vTt(i,t.plugins));return e.aria=Object.assign({},tc.aria,e.aria),e.aria={expanded:e.aria.expanded==="auto"?t.interactive:e.aria.expanded,content:e.aria.content==="auto"?t.interactive?null:"describedby":e.aria.content},e}var yTt=function(){return"innerHTML"};function C3(i,t){i[yTt()]=t}function ZX(i){var t=Jx();return i===!0?t.className=eK:(t.className=nK,_A(i)?t.appendChild(i):C3(t,i)),t}function QX(i,t){_A(t.content)?(C3(i,""),i.appendChild(t.content)):typeof t.content!="function"&&(t.allowHTML?C3(i,t.content):i.textContent=t.content)}function M3(i){var t=i.firstElementChild,e=wA(t.children);return{box:t,content:e.find(function(n){return n.classList.contains(tK)}),arrow:e.find(function(n){return n.classList.contains(eK)||n.classList.contains(nK)}),backdrop:e.find(function(n){return n.classList.contains(QMt)})}}function aK(i){var t=Jx(),e=Jx();e.className=ZMt,e.setAttribute("data-state","hidden"),e.setAttribute("tabindex","-1");var n=Jx();n.className=tK,n.setAttribute("data-state","hidden"),QX(n,i.props),t.appendChild(e),e.appendChild(n),s(i.props,i.props);function s(r,o){var a=M3(t),l=a.box,c=a.content,u=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(r.content!==o.content||r.allowHTML!==o.allowHTML)&&QX(c,i.props),o.arrow?u?r.arrow!==o.arrow&&(l.removeChild(u),l.appendChild(ZX(o.arrow))):l.appendChild(ZX(o.arrow)):u&&l.removeChild(u)}return{popper:t,onUpdate:s}}aK.$$tippy=!0;var xTt=1,xA=[],S3=[];function wTt(i,t){var e=JX(i,Object.assign({},tc,oK(qX(t)))),n,s,r,o=!1,a=!1,l=!1,c=!1,u,h,d,p=[],g=$X(it,e.interactiveDebounce),y,x=xTt++,w=null,M=eTt(e.plugins),A={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},C={id:x,reference:i,popper:Jx(),popperInstance:w,props:e,state:A,plugins:M,clearDelayTimeouts:mt,setProps:K,setContent:Vt,show:te,hide:Nt,hideWithInteractivity:Se,enable:Cn,disable:mn,unmount:Me,destroy:ie};if(!e.render)return C;var R=e.render(C),k=R.popper,O=R.onUpdate;k.setAttribute("data-tippy-root",""),k.id="tippy-"+C.id,C.popper=k,i._tippy=C,k._tippy=C;var I=M.map(function(_t){return _t.fn(C)}),U=i.hasAttribute("aria-expanded");return Ut(),vt(),ct(),pt("onCreate",[C]),e.showOnCreate&&en(),k.addEventListener("mouseenter",function(){C.props.interactive&&C.state.isVisible&&C.clearDelayTimeouts()}),k.addEventListener("mouseleave",function(){C.props.interactive&&C.props.trigger.indexOf("mouseenter")>=0&&W().addEventListener("mousemove",g)}),C;function V(){var _t=C.props.touch;return Array.isArray(_t)?_t:[_t,0]}function q(){return V()[0]==="hold"}function X(){var _t;return!!((_t=C.props.render)!=null&&_t.$$tippy)}function j(){return y||i}function W(){var _t=j().parentNode;return _t?aTt(_t):document}function _(){return M3(k)}function at(_t){return C.state.isMounted&&!C.state.isVisible||tu.isTouch||u&&u.type==="focus"?0:x3(C.props.delay,_t?0:1,tc.delay)}function ct(_t){_t===void 0&&(_t=!1),k.style.pointerEvents=C.props.interactive&&!_t?"":"none",k.style.zIndex=""+C.props.zIndex}function pt(_t,Zt,fe){if(fe===void 0&&(fe=!0),I.forEach(function(pe){pe[_t]&&pe[_t].apply(pe,Zt)}),fe){var ce;(ce=C.props)[_t].apply(ce,Zt)}}function Et(){var _t=C.props.aria;if(_t.content){var Zt="aria-"+_t.content,fe=k.id,ce=z0(C.props.triggerTarget||i);ce.forEach(function(pe){var Fe=pe.getAttribute(Zt);if(C.state.isVisible)pe.setAttribute(Zt,Fe?Fe+" "+fe:fe);else{var je=Fe&&Fe.replace(fe,"").trim();je?pe.setAttribute(Zt,je):pe.removeAttribute(Zt)}})}}function vt(){if(!(U||!C.props.aria.expanded)){var _t=z0(C.props.triggerTarget||i);_t.forEach(function(Zt){C.props.interactive?Zt.setAttribute("aria-expanded",C.state.isVisible&&Zt===j()?"true":"false"):Zt.removeAttribute("aria-expanded")})}}function yt(){W().removeEventListener("mousemove",g),xA=xA.filter(function(_t){return _t!==g})}function kt(_t){if(!(tu.isTouch&&(l||_t.type==="mousedown"))){var Zt=_t.composedPath&&_t.composedPath()[0]||_t.target;if(!(C.props.interactive&&XX(k,Zt))){if(z0(C.props.triggerTarget||i).some(function(fe){return XX(fe,Zt)})){if(tu.isTouch||C.state.isVisible&&C.props.trigger.indexOf("click")>=0)return}else pt("onClickOutside",[C,_t]);C.props.hideOnClick===!0&&(C.clearDelayTimeouts(),C.hide(),a=!0,setTimeout(function(){a=!1}),C.state.isMounted||ee())}}}function Wt(){l=!0}function jt(){l=!1}function ae(){var _t=W();_t.addEventListener("mousedown",kt,!0),_t.addEventListener("touchend",kt,Op),_t.addEventListener("touchstart",jt,Op),_t.addEventListener("touchmove",Wt,Op)}function ee(){var _t=W();_t.removeEventListener("mousedown",kt,!0),_t.removeEventListener("touchend",kt,Op),_t.removeEventListener("touchstart",jt,Op),_t.removeEventListener("touchmove",Wt,Op)}function Bt(_t,Zt){Qt(_t,function(){!C.state.isVisible&&k.parentNode&&k.parentNode.contains(k)&&Zt()})}function Gt(_t,Zt){Qt(_t,Zt)}function Qt(_t,Zt){var fe=_().box;function ce(pe){pe.target===fe&&(_3(fe,"remove",ce),Zt())}if(_t===0)return Zt();_3(fe,"remove",h),_3(fe,"add",ce),h=ce}function xe(_t,Zt,fe){fe===void 0&&(fe=!1);var ce=z0(C.props.triggerTarget||i);ce.forEach(function(pe){pe.addEventListener(_t,Zt,fe),p.push({node:pe,eventType:_t,handler:Zt,options:fe})})}function Ut(){q()&&(xe("touchstart",St,{passive:!0}),xe("touchend",gt,{passive:!0})),tTt(C.props.trigger).forEach(function(_t){if(_t!=="manual")switch(xe(_t,St),_t){case"mouseenter":xe("mou
6132seleave",gt);break;case"focus":xe(fTt?"focusout":"blur",ft);break;case"focusin":xe("focusout",ft);break}})}function zt(){p.forEach(function(_t){var Zt=_t.node,fe=_t.eventType,ce=_t.handler,pe=_t.options;Zt.removeEventListener(fe,ce,pe)}),p=[]}function St(_t){var Zt,fe=!1;if(!(!C.state.isEnabled||de(_t)||a)){var ce=((Zt=u)==null?void 0:Zt.type)==="focus";u=_t,y=_t.currentTarget,vt(),!C.state.isVisible&&sTt(_t)&&xA.forEach(function(pe){return pe(_t)}),_t.type==="click"&&(C.props.trigger.indexOf("mouseenter")<0||o)&&C.props.hideOnClick!==!1&&C.state.isVisible?fe=!0:en(_t),_t.type==="click"&&(o=!fe),fe&&!ce&&It(_t)}}function it(_t){var Zt=_t.target,fe=j().contains(Zt)||k.contains(Zt);if(!(_t.type==="mousemove"&&fe)){var ce=Ue().concat(k).map(function(pe){var Fe,je=pe._tippy,Re=(Fe=je.popperInstance)==null?void 0:Fe.state;return Re?{popperRect:pe.getBoundingClientRect(),popperState:Re,props:e}:null}).filter(Boolean);lTt(ce,_t)&&(yt(),It(_t))}}function gt(_t){var Zt=de(_t)||C.props.trigger.indexOf("click")>=0&&o;if(!Zt){if(C.props.interactive){C.hideWithInteractivity(_t);return}It(_t)}}function ft(_t){C.props.trigger.indexOf("focusin")<0&&_t.target!==j()||C.props.interactive&&_t.relatedTarget&&k.contains(_t.relatedTarget)||It(_t)}function de(_t){return tu.isTouch?q()!==_t.type.indexOf("touch")>=0:!1}function ve(){we();var _t=C.props,Zt=_t.popperOptions,fe=_t.placement,ce=_t.offset,pe=_t.getReferenceClientRect,Fe=_t.moveTransition,je=X()?M3(k).arrow:null,Re=pe?{getBoundingClientRect:pe,contextElement:pe.contextElement||j()}:i,Ft={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(lt){var xt=lt.state;if(X()){var At=_(),st=At.box;["placement","reference-hidden","escaped"].forEach(function(rt){rt==="placement"?st.setAttribute("data-placement",xt.placement):xt.attributes.popper["data-popper-"+rt]?st.setAttribute("data-"+rt,""):st.removeAttribute("data-"+rt)}),xt.attributes.popper={}}}},Ee=[{name:"offset",options:{offset:ce}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Fe}},Ft];X()&&je&&Ee.push({name:"arrow",options:{element:je,padding:3}}),Ee.push.apply(Ee,Zt?.modifiers||[]),C.popperInstance=y3(Re,k,Object.assign({},Zt,{placement:fe,onFirstUpdate:d,modifiers:Ee}))}function we(){C.popperInstance&&(C.popperInstance.destroy(),C.popperInstance=null)}function Ae(){var _t=C.props.appendTo,Zt,fe=j();C.props.interactive&&_t===iK||_t==="parent"?Zt=fe.parentNode:Zt=sK(_t,[fe]),Zt.contains(k)||Zt.appendChild(k),C.state.isMounted=!0,ve()}function Ue(){return wA(k.querySelectorAll("[data-tippy-root]"))}function en(_t){C.clearDelayTimeouts(),_t&&pt("onTrigger",[C,_t]),ae();var Zt=at(!0),fe=V(),ce=fe[0],pe=fe[1];tu.isTouch&&ce==="hold"&&pe&&(Zt=pe),Zt?n=setTimeout(function(){C.show()},Zt):C.show()}function It(_t){if(C.clearDelayTimeouts(),pt("onUntrigger",[C,_t]),!C.state.isVisible){ee();return}if(!(C.props.trigger.indexOf("mouseenter")>=0&&C.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(_t.type)>=0&&o)){var Zt=at(!1);Zt?s=setTimeout(function(){C.state.isVisible&&C.hide()},Zt):r=requestAnimationFrame(function(){C.hide()})}}function Cn(){C.state.isEnabled=!0}function mn(){C.hide(),C.state.isEnabled=!1}function mt(){clearTimeout(n),clearTimeout(s),cancelAnimationFrame(r)}function K(_t){if(!C.state.isDestroyed){pt("onBeforeUpdate",[C,_t]),zt();var Zt=C.props,fe=JX(i,Object.assign({},Zt,qX(_t),{ignoreAttributes:!0}));C.props=fe,Ut(),Zt.interactiveDebounce!==fe.interactiveDebounce&&(yt(),g=$X(it,fe.interactiveDebounce)),Zt.triggerTarget&&!fe.triggerTarget?z0(Zt.triggerTarget).forEach(function(ce){ce.removeAttribute("aria-expanded")}):fe.triggerTarget&&i.removeAttribute("aria-expanded"),vt(),ct(),O&&O(Zt,fe),C.popperInstance&&(ve(),Ue().forEach(function(ce){requestAnimationFrame(ce._tippy.popperInstance.forceUpdate)})),pt("onAfterUpdate",[C,_t])}}function Vt(_t){C.setProps({content:_t})}function te(){var _t=C.state.isVisible,Zt=C.state.isDestroyed,fe=!C.state.isEnabled,ce=tu.isTouch&&!C.props.touch,pe=x3(C.props.duration,0,tc.duration);if(!(_t||Zt||fe||ce)&&!j().hasAttribute("disabled")&&(pt("onShow",[C],!1),C.props.onShow(C)!==!1)){if
6132(C.state.isVisible=!0,X()&&(k.style.visibility="visible"),ct(),ae(),C.state.isMounted||(k.style.transition="none"),X()){var Fe=_(),je=Fe.box,Re=Fe.content;w3([je,Re],0)}d=function(){var Ee;if(!(!C.state.isVisible||c)){if(c=!0,k.offsetHeight,k.style.transition=C.props.moveTransition,X()&&C.props.animation){var J=_(),lt=J.box,xt=J.content;w3([lt,xt],pe),YX([lt,xt],"visible")}Et(),vt(),GX(S3,C),(Ee=C.popperInstance)==null||Ee.forceUpdate(),pt("onMount",[C]),C.props.animation&&X()&&Gt(pe,function(){C.state.isShown=!0,pt("onShown",[C])})}},Ae()}}function Nt(){var _t=!C.state.isVisible,Zt=C.state.isDestroyed,fe=!C.state.isEnabled,ce=x3(C.props.duration,1,tc.duration);if(!(_t||Zt||fe)&&(pt("onHide",[C],!1),C.props.onHide(C)!==!1)){if(C.state.isVisible=!1,C.state.isShown=!1,c=!1,o=!1,X()&&(k.style.visibility="hidden"),yt(),ee(),ct(!0),X()){var pe=_(),Fe=pe.box,je=pe.content;C.props.animation&&(w3([Fe,je],ce),YX([Fe,je],"hidden"))}Et(),vt(),C.props.animation?X()&&Bt(ce,C.unmount):C.unmount()}}function Se(_t){W().addEventListener("mousemove",g),GX(xA,g),g(_t)}function Me(){C.state.isVisible&&C.hide(),C.state.isMounted&&(we(),Ue().forEach(function(_t){_t._tippy.unmount()}),k.parentNode&&k.parentNode.removeChild(k),S3=S3.filter(function(_t){return _t!==C}),C.state.isMounted=!1,pt("onHidden",[C]))}function ie(){C.state.isDestroyed||(C.clearDelayTimeouts(),C.unmount(),zt(),delete i._tippy,C.state.isDestroyed=!0,pt("onDestroy",[C]))}}function Zx(i,t){t===void 0&&(t={});var e=tc.plugins.concat(t.plugins||[]);hTt();var n=Object.assign({},t,{plugins:e}),s=oTt(i);if(0)var r,o;var a=s.reduce(function(l,c){var u=c&&wTt(c,n);return u&&l.push(u),l},[]);return _A(i)?a[0]:a}Zx.defaultProps=tc;Zx.setDefaultProps=bTt;Zx.currentInput=tu;var Rme=Object.assign({},Wx,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}});Zx.setDefaultProps({render:aK});var V0=Zx;var A3=class extends le{static values={successMessage:{type:String,default:"Copied!"},errorMessage:{type:String,default:"Failed!"}};connect(){this.clipboard=new lK.default(this.element),this.clipboard.on("success",i=>this.tooltip(this.successMessageValue)),this.clipboard.on("error",i=>this.tooltip(this.errorMessageValue))}tooltip(i){V0(this.element,{content:i,showOnCreate:!0,onHidden:t=>{t.destroy()}})}};var aB={};Le(aB,{default:()=>oB});customElements.get("ninja-keys")||Promise.resolve().then(()=>(mJ(),gJ));var oB=class extends le{connect(){this.element.data=[{id:"Home",title:"Home",hotkey:"ctrl+H",icon:'<svg xmlns="http://www.w3.org/2000/svg" class="ninja-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" /></svg>',handler:()=>{Turbo.visit("/")}},{id:"Accounts",title:"Accounts",hotkey:"ctrl+A",icon:'<svg xmlns="http://www.w3.org/2000/svg" class="ninja-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" /></svg>',handler:()=>{Turbo.visit("/accounts")}},{id:"Profile",title:"Profile",hotkey:"ctrl+P",icon:'<svg xmlns="http://www.w3.org/2000/svg" class="ninja-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>',handler:()=>{Turbo.visit("/users/edit")}},{id:"Notifications",title:"Notifications",hotkey:"ctrl+N",icon:'<svg xmlns="http://www.w3.org/2000/svg" class="ninja-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" /></svg>',handler:()=>{Turbo.visit("/notifications")}}]}};var cB={};Le(cB,{default:()=>lB});
6132var zTt=["#f5922e","#edbe32","#96d44e","#4ed469","#4ed4cd","#3296ed","#3261ed","#8932ed","#ed32c8","#ed3251"],VTt=["star","circle","square","ribbon","streamer"],q0=class{constructor(t=null){typeof t=="string"?this.canvas=document.getElementById(t):t instanceof HTMLCanvasElement?this.canvas=t:(this.canvas=document.createElement("canvas"),this.canvas.id="butterstack-confetti-canvas",this.canvas.style.position="fixed",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.pointerEvents="none",this.canvas.style.zIndex="9999",document.body.appendChild(this.canvas),this._createdCanvas=!0),this.ctx=this.canvas.getContext("2d"),this.particles=[],this.animationFrame=null,this.resizeHandler=()=>this.resize(),this.resize(),window.addEventListener("resize",this.resizeHandler)}resize(){if(!this.canvas)return;let t=window.devicePixelRatio||1;this.width=window.innerWidth,this.height=window.innerHeight,this.canvas.width=this.width*t,this.canvas.height=this.height*t,this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(t,t)}burst(t={}){let e=t.particleCount||150,n=t.colors||zTt,s=t.shapes||VTt,r=(t.originY!==void 0?t.originY:.88)*this.height;(t.type||"dual-cannon")==="dual-cannon"?(this.spawnCannon(this.width*.18,r,45,Math.ceil(e/2),n,s),this.spawnCannon(this.width*.82,r,135,Math.floor(e/2),n,s)):this.spawnCenter(this.width*.5,r,e,n,s),this.animationFrame||this.animate()}spawnCannon(t,e,n,s,r,o){for(let a=0;a<s;a++){let l=r[Math.floor(Math.random()*r.length)],c=o[Math.floor(Math.random()*o.length)],u=65,d=(n===45?-90+(Math.random()*u-u/3)+20:-90-(Math.random()*u-u/3)-20)*Math.PI/180,p=18+Math.random()*26;this.particles.push({x:t+(Math.random()*40-20),y:e+(Math.random()*40-20),vx:Math.cos(d)*p,vy:Math.sin(d)*p,size:c==="streamer"?14+Math.random()*12:8+Math.random()*8,color:l,shape:c,opacity:Math.random()>.3?1:.6,rotationX:Math.random()*360,rotationY:Math.random()*360,rotationZ:Math.random()*360,rSpeedX:(Math.random()-.5)*14,rSpeedY:(Math.random()-.5)*14,rSpeedZ:(Math.random()-.5)*8,gravity:.42+Math.random()*.15,drag:.945+Math.random()*.02,wobble:Math.random()*10,wobbleSpeed:.06+Math.random()*.08,decay:.005+Math.random()*.004,life:1})}}spawnCenter(t,e,n,s,r){for(let o=0;o<n;o++){let a=s[Math.floor(Math.random()*s.length)],l=r[Math.floor(Math.random()*r.length)],c=Math.random()*Math.PI*2,u=10+Math.random()*22;this.particles.push({x:t,y:e,vx:Math.cos(c)*u,vy:Math.sin(c)*u-6,size:l==="streamer"?14+Math.random()*12:8+Math.random()*8,color:a,shape:l,opacity:Math.random()>.3?1:.6,rotationX:Math.random()*360,rotationY:Math.random()*360,rotationZ:Math.random()*360,rSpeedX:(Math.random()-.5)*14,rSpeedY:(Math.random()-.5)*14,rSpeedZ:(Math.random()-.5)*8,gravity:.42+Math.random()*.15,drag:.95,wobble:Math.random()*10,wobbleSpeed:.06+Math.random()*.08,decay:.005+Math.random()*.004,life:1})}}drawStar(t,e){t.beginPath();for(let n=0;n<5;n++){let s=(n*72-90)*Math.PI/180,r=(n*72+36-90)*Math.PI/180,o=Math.cos(s)*e,a=Math.sin(s)*e,l=Math.cos(r)*(e*.42),c=Math.sin(r)*(e*.42);n===0?t.moveTo(o,a):t.lineTo(o,a),t.lineTo(l,c)}t.closePath(),t.fill()}drawStreamer(t,e){t.beginPath(),t.moveTo(-e/2,0),t.bezierCurveTo(-e/4,-e/3,e/4,e/3,e/2,0),t.lineWidth=3.5,t.strokeStyle=t.fillStyle,t.stroke()}animate(){if(this.ctx){this.ctx.clearRect(0,0,this.width,this.height);for(let t=this.particles.length-1;t>=0;t--){let e=this.particles[t];if(e.x+=e.vx,e.y+=e.vy,e.vy+=e.gravity,e.vx*=e.drag,e.vy*=e.drag,e.wobble+=e.wobbleSpeed,e.x+=Math.sin(e.wobble)*1.1,e.rotationX+=e.rSpeedX,e.rotationY+=e.rSpeedY,e.rotationZ+=e.rSpeedZ,e.life-=e.decay,e.life<=0||e.y>this.height+60){this.particles.splice(t,1);continue}this.ctx.save(),this.ctx.translate(e.x,e.y),this.ctx.rotate(e.rotationZ*Math.PI/180);let n=Math.cos(e.rotationX*Math.PI/180),s=Math.cos(e.rotationY*Math.PI/180);this.ctx.scale(n,s),this.ctx.globalAlpha=Math.max(0,e.life*e.opacity),this.ctx.fillStyle=e.color;let r=e.size;e.shape==="star"?this.drawStar(this.ctx,r):e.shape==="circle"?(this.ctx.beginPath(),this.ctx.arc(0,0,r*.65,0,Math.PI*2),this.ctx.fill()):e.shape==="square"?this.ctx.fillRect(-r/2,-r/2,r,r):e.shape==="ribbon"?this.ctx.fillRect(-r*.8,-r*.4,r*1.6,r*.8):e.shape==="streamer"&&this.drawStreamer(this.ctx,r*1.8),this.ctx.restore(
6132)}this.particles.length>0?this.animationFrame=requestAnimationFrame(()=>this.animate()):this.animationFrame=null}}destroy(){this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null),this.particles=[],window.removeEventListener("resize",this.resizeHandler),this._createdCanvas&&this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};function HTt(i={}){let t=new q0;return t.burst(i),t}typeof window<"u"&&(window.Confetti=q0,window.fireConfetti=HTt);var lB=class extends le{static targets=["canvas"];static values={autoBurst:{type:Boolean,default:!0},particleCount:{type:Number,default:160},originY:{type:Number,default:.88},delay:{type:Number,default:150}};connect(){let i=this.hasCanvasTarget?this.canvasTarget:null;this.confetti=new q0(i),this.autoBurstValue&&setTimeout(()=>{this.burst()},this.delayValue)}burst(i){i&&i.preventDefault?.(),this.confetti&&this.confetti.burst({particleCount:this.particleCountValue,originY:this.originYValue})}disconnect(){this.confetti&&(this.confetti.destroy(),this.confetti=null)}};var hB={};Le(hB,{default:()=>uB});var uB=class extends le{static targets=["value"];static values={message:String};check(i){let t=this.messageValue;this.hasValueTarget&&(t=t.replace("%s",this.valueTarget.value.trim())),window.confirm(t)||(i.preventDefault(),i.stopPropagation())}};var fB={};Le(fB,{default:()=>dB});var Wp=!1,dB=class extends le{static targets=["button","buttonText","spinner"];static values={projectId:String,integrationId:String,testUrl:String};connect(){this.testStartTime=null,this.delayTimeout=null,document.addEventListener("turbo:before-stream-render",this.handleBroadcast.bind(this))}disconnect(){this.delayTimeout&&clearTimeout(this.delayTimeout),document.removeEventListener("turbo:before-stream-render",this.handleBroadcast.bind(this))}async testConnection(i){if(i.preventDefault(),!Wp){Wp=!0,this.testStartTime=Date.now(),this.showLoadingState(),this.delayTimeout=setTimeout(()=>{Wp&&this.showTestingMessage()},5e3);try{console.log("[ConnectionTest] Starting test to:",this.testUrlValue);let t=document.querySelector('[name="csrf-token"]')?.content;if(!t){console.error("[ConnectionTest] CSRF token not found"),this.handleError("CSRF token not found - please refresh the page");return}let e=await fetch(this.testUrlValue,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":t,Accept:"application/json"}});if(console.log("[ConnectionTest] Response status:",e.status),!e.ok){let s=await e.text();console.error("[ConnectionTest] Request failed:",e.status,s),this.handleError(`Request failed: ${e.status}`);return}let n=await e.json();console.log("[ConnectionTest] Result:",n),this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),this.handleQuickResponse(n)}catch(t){console.error("[ConnectionTest] Connection test failed:",t),this.handleError(t.message||"Connection test failed")}}}showLoadingState(){this.buttonTarget.disabled=!0,this.hasButtonTextTarget&&this.buttonTextTarget.classList.add("hidden"),this.hasSpinnerTarget&&this.spinnerTarget.classList.remove("hidden"),this.renderStatusPanel(`
6133      <div class="text-center" data-testid="connection-status-testing">
6134        <div style="width: 64px; height: 64px; background: var(--bs-info-soft); border-radius: 999px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;">
6135          <svg class="animate-spin" style="width: 32px; height: 32px; color: var(--bs-info);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6136            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
6137          </svg>
6138        </div>
6139        <h4 class="bs-fg-text" style="font-size: 16px; font-weight: 500; margin: 0 0 8px;">Testing Connection</h4>
6140        <p class="bs-fg-mute-text">Please wait while we verify the connection...</p>
6141      </div>
6142    `)}showTestingMessage(){this.renderStatusPanel(`
6143      <div class="text-center" data-testid="connection-status-testing">
6144        <div style="width: 64px; height: 64px; background: var(--bs-info-soft); border-radius: 999px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;">
6145          <svg class="animate-spin" style="width: 32px; height: 32px; color: var(--bs-info);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6146            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
6147          </svg>
6148        </div>
6149        <h4 class="bs-fg-text" style="font-size: 16px; font-weight: 500; margin: 0 0 8px;">Testing Connection</h4>
6150        <p class="bs-fg-mute-text">Still testing the connection. This may take 2-3 minutes due to system TCP timeout limitations. This page will refresh automatically when the test finishes.</p>
6151      </div>
6152    `)}renderStatusPanel(i){let t=document.getElementById("connection-status-body");t&&(t.innerHTML=i)}handleQuickResponse(i){if(this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),Wp=!1,this.resetButtonState(),i)if(i.success){this.renderStatusPanel(`
6153          <div class="text-center" data-testid="connection-status-test-success">
6154            <div style="width: 64px; height: 64px; background: var(--bs-ok-soft); border-radius: 999px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;">
6155              <svg style="width: 32px; height: 32px; color: var(--bs-ok);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6156                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
6157              </svg>
6158            </div>
6159            <h4 class="bs-fg-text" style="font-size: 16px; font-weight: 500; margin: 0 0 8px;">Connection Successful</h4>
6160            <p class="bs-fg-mute-text">${i.message}</p>
6161            <p class="bs-fg-faint-text" style="font-size: 12px; margin-top: 8px;">Refreshing page...</p>
6162          </div>
6163        `),setTimeout(()=>{window.location.reload()},1500);return}
6163else{let t=[i.cause,i.suggestion].filter(Boolean).join(" "),e=t?`<p class="bs-fg-soft-text" style="font-size: 13px; margin-top: 8px;">${this.escapeHtml(t)}</p>`:"",n=i.details_url?`<p style="margin-top: 8px;"><a href="${this.escapeHtml(i.details_url)}" style="color: var(--bs-info); font-size: 12px; text-decoration: underline;">View this test in the monitoring log</a></p>`:"",s=!t&&!i.details_url;this.renderStatusPanel(`
6164          <div class="text-center" data-testid="connection-status-test-failure">
6165            <div style="width: 64px; height: 64px; background: var(--bs-err-soft); border-radius: 999px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;">
6166              <svg style="width: 32px; height: 32px; color: var(--bs-err);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6167                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L4.232 16.5c-.77.833.192 2.5 1.732 2.5z"/>
6168              </svg>
6169            </div>
6170            <h4 class="bs-fg-text" style="font-size: 16px; font-weight: 500; margin: 0 0 8px;">Connection Failed</h4>
6171            <p class="bs-fg-mute-text">${i.message}</p>
6172            ${e}
6173            ${n}
6174            ${s?'<p class="bs-fg-faint-text" style="font-size: 12px; margin-top: 8px;">Refreshing page...</p>':""}
6175          </div>
6176        `),s&&setTimeout(()=>{window.location.reload()},2e3);return}}escapeHtml(i){return String(i).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}handleError(i){Wp=!1,this.resetButtonState(),this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),this.renderStatusPanel(`
6177      <div class="text-center" data-testid="connection-status-test-error">
6178        <div style="width: 64px; height: 64px; background: var(--bs-err-soft); border-radius: 999px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;">
6179          <svg style="width: 32px; height: 32px; color: var(--bs-err);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6180            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L4.232 16.5c-.77.833.192 2.5 1.732 2.5z"/>
6181          </svg>
6182        </div>
6183        <h4 class="bs-fg-text" style="font-size: 16px; font-weight: 500; margin: 0 0 8px;">Connection Test Error</h4>
6184        <p class="bs-fg-mute-text">${i}</p>
6185      </div>
6186    `)}handleBroadcast(i){i.detail?.newStream?.action==="update"&&Wp&&(Wp=!1,this.resetButtonState(),this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null))}resetButtonState(){this.buttonTarget.disabled=!1,this.hasButtonTextTarget&&this.buttonTextTarget.classList.remove("hidden"),this.hasSpinnerTarget&&this.spinnerTarget.classList.add("hidden")}};var gB={};Le(gB,{default:()=>pB});var pB=class extends le{static targets=["modal","primaryButton"];connect(){this.boundKeyHandler=this.handleKeydown.bind(this),document.addEventListener("keydown",this.boundKeyHandler),this.open()}disconnect(){document.removeEventListener("keydown",this.boundKeyHandler)}open(){this.hasModalTarget&&this.modalTarget.classList.remove("hidden"),document.body.classList.add("overflow-hidden"),this.hasPrimaryButtonTarget&&this.primaryButtonTarget.focus()}close(){this.hasModalTarget&&this.modalTarget.classList.add("hidden"),document.body.classList.remove("overflow-hidden")}confirmCopied(){this.close()}closeWithoutCopying(){window.confirm("You are about to close this dialog. The token will not be shown again after this reload.")&&this.close()}handleKeydown(i){i.key==="Escape"&&this.closeWithoutCopying()}clickOutside(i){i.target===i.currentTarget&&this.closeWithoutCopying()}};var bB={};Le(bB,{default:()=>mB});var WTt=2e3,mB=class extends le{static targets=["source","button"];static values={text:String,successLabel:{type:String,default:"Copied!"},errorLabel:{type:String,default:"Press Cmd+C"}};connect(){this.defaultLabel=this.labelElement?this.labelElement.textContent.trim():"Copy"}disconnect(){clearTimeout(this.resetTimer)}async copy(i){i&&i.preventDefault();let t=this.textToCopy;if(t)try{if(!navigator.clipboard||!navigator.clipboard.writeText)throw new Error("clipboard API unavailable");await navigator.clipboard.writeText(t),this.flash(this.successLabelValue)}catch{this.flash(this.selectSource()?this.successLabelValue:this.errorLabelValue)}}
6186selectSource(){if(!this.hasSourceTarget)return!1;try{let i=document.createRange();i.selectNodeContents(this.sourceTarget);let t=window.getSelection();return t.removeAllRanges(),t.addRange(i),document.execCommand&&document.execCommand("copy")}catch{return!1}}flash(i){this.labelElement&&(clearTimeout(this.resetTimer),this.labelElement.textContent=i,this.resetTimer=setTimeout(()=>{this.labelElement&&(this.labelElement.textContent=this.defaultLabel)},WTt))}get labelElement(){return this.hasButtonTarget?this.buttonTarget:null}get textToCopy(){return this.hasTextValue&&this.textValue.length>0?this.textValue:this.hasSourceTarget?this.sourceTarget.textContent.trim():""}};var yB={};Le(yB,{default:()=>vB});var vB=class extends le{static targets=["checkbox","role"];connect(){this.checkboxTargets.forEach(i=>this.sync(i))}toggle(i){this.sync(i.target)}sync(i){let t=this.roleTargets.find(e=>e.dataset.projectRole===i.dataset.projectId);t&&(t.disabled=!i.checked,t.style.opacity=i.checked?"1":"0.5")}};var wB={};Le(wB,{default:()=>xB});var xB=class extends le{static targets=["email"];static values={event:String};fire(){if(!window.posthog)return;let i=this.hasEmailTarget?this.emailTarget.value.trim():void 0;posthog.capture(this.eventValue,{email:i})}};var SB={};Le(SB,{default:()=>_B});var _B=class extends le{static values={message:{type:String,default:"Read-only demo \u2014 sign up to enable"}};connect(){this.tippy=V0(this.element,{content:this.messageValue,placement:"top",trigger:"mouseenter focus click",allowHTML:!1,arrow:!0})}disconnect(){this.tippy&&this.tippy.destroy()}};var MB={};Le(MB,{default:()=>CB});var CB=class extends le{static targets=["loading","error","errorMessage","interface","placeholder","availableList","selectedList","availableEmpty","selectedEmpty","availableCount","selectedCount","searchInput","hiddenInput","selectAllBtn","clearAllBtn"];static values={integrationId:String,projectId:String,selectedDepots:Array,availableDepots:Array};connect(){this.allDepots=[],this.selectedDepotNames=new Set(this.selectedDepotsValue||[]),this.filteredDepots=[],this.loadDepots()}async loadDepots(){if(console.log("loadDepots called"),!this.integrationIdValue){console.log("No integration ID, showing placeholder"),this.showPlaceholder();return}console.log("Raw availableDepotsValue:",this.data.get("availableDepots")),console.log("Parsed availableDepotsValue:",this.availableDepotsValue);try{if(this.availableDepotsValue&&this.availableDepotsValue.length>0){console.log("Using preloaded depot data:",this.availableDepotsValue.length,"depots"),this.allDepots=this.availableDepotsValue,this.filteredDepots=[...this.allDepots],this.showInterface(),this.updateUI();return}}catch(i){console.error("Error parsing depot data:",i),console.log("Raw depot data was:",this.data.get("availableDepots"))}console.log("No preloaded data, falling back to AJAX call"),this.showLoading();try{let i=await fetch(`/projects/${this.projectIdValue}/integrations/${this.integrationIdValue}/available_depots`,{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}});if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);let t=await i.json();if(t.success)this.allDepots=t.depots||[],this.filteredDepots=[...this.allDepots],this.showInterface(),this.updateUI();else throw new Error(t.error||"Failed to load depots")}catch(i){console.error("Failed to load depots:",i),this.showError(i.message)}}filterDepots(){if(!this.hasSearchInputTarget)return;let i=this.searchInputTarget.value.toLowerCase().trim();i===""?this.filteredDepots=[...this.allDepots]:this.filteredDepots=this.allDepots.filter(t=>t.name.toLowerCase().includes(i)||t.description.toLowerCase().includes(i)),this.updateAvailableList(
6186)}selectDepot(i){let t=i.currentTarget.dataset.depotName;t&&!this.selectedDepotNames.has(t)&&(this.selectedDepotNames.add(t),this.updateUI(),this.updateHiddenInput())}deselectDepot(i){let t=i.currentTarget.dataset.depotName;t&&this.selectedDepotNames.has(t)&&(this.selectedDepotNames.delete(t),this.updateUI(),this.updateHiddenInput())}selectAll(){this.filteredDepots.forEach(i=>{this.selectedDepotNames.add(i.name)}),this.updateUI(),this.updateHiddenInput()}clearAll(){this.selectedDepotNames.clear(),this.updateUI(),this.updateHiddenInput()}updateUI(){this.updateAvailableList(),this.updateSelectedList(),this.updateCounts()}updateAvailableList(){if(!this.hasAvailableListTarget)return;let i=this.filteredDepots.filter(t=>!this.selectedDepotNames.has(t.name));i.length===0?(this.hasAvailableListTarget&&this.availableListTarget.classList.add("hidden"),this.hasAvailableEmptyTarget&&this.availableEmptyTarget.classList.remove("hidden")):(this.hasAvailableListTarget&&(this.availableListTarget.classList.remove("hidden"),this.availableListTarget.innerHTML=i.map(t=>this.createDepotItem(t,"available")).join("")),this.hasAvailableEmptyTarget&&this.availableEmptyTarget.classList.add("hidden"))}updateSelectedList(){if(!this.hasSelectedListTarget||!this.hasSelectedEmptyTarget)return;let i=this.allDepots.filter(t=>this.selectedDepotNames.has(t.name));i.length===0?(this.selectedListTarget.classList.add("hidden"),this.selectedEmptyTarget.classList.remove("hidden")):(this.selectedListTarget.classList.remove("hidden"),this.selectedEmptyTarget.classList.add("hidden"),this.selectedListTarget.innerHTML=i.map(t=>this.createDepotItem(t,"selected")).join(""))}createDepotItem(i,t){let e=t==="selected",n=e?"deselect":"select",s=e?"Remove":"Add",r=e?"color: var(--bs-err);":"color: var(--bs-accent);",o=e?"M6 18L18 6M6 6l12 12":"M12 6v6m0 0v6m0-6h6m-6 0H6";return`
6187      <div class="flex items-center justify-between p-2 rounded-lg transition-colors group" style="--hover-bg: var(--bs-bg-panel-2);" onmouseover="this.style.background='var(--bs-bg-panel-2)'" onmouseout="this.style.background=''">
6188        <div class="flex-1 min-w-0">
6189          <div class="flex items-center space-x-2">
6190            <svg class="w-4 h-4 flex-shrink-0" style="color: var(--bs-info);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6191              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z"/>
6192            </svg>
6193            <div class="min-w-0">
6194              <p class="text-sm font-medium truncate" style="color: var(--bs-fg);">${i.name}</p>
6195              ${i.description?`<p class="text-xs truncate" style="color: var(--bs-fg-mute);">${i.description}</p>`:""}
6196            </div>
6197          </div>
6198        </div>
6199        <button type="button"
6200                class="ml-2 p-1 rounded transition-colors"
6201                style="${r} background: transparent; border: 0; cursor: pointer;"
6202                data-depot-name="${i.name}"
6203                data-testid="depot-${n}-${i.name}"
6204                data-action="click->depot-selector#${n}Depot"
6205                title="${s} depot">
6206          <svg class="w-4 h-4" stroke="currentColor" fill="none" viewBox="0 0 24 24">
6207            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${o}"/>
6208          </svg>
6209        </button>
6210      </div>
6211    `}updateCounts(){let i=this.filteredDepots.filter(e=>!this.selectedDepotNames.has(e.name)).length,t=this.selectedDepotNames.size;this.hasAvailableCountTarget&&(this.availableCountTarget.textContent=`${i} depot${i!==1?"s":""}`),this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent=`${t} selected`),this.hasSelectAllBtnTarget&&(this.selectAllBtnTarget.disabled=i===0,i===0?this.selectAllBtnTarget.classList.add("opacity-50","cursor-not-allowed"):this.selectAllBtnTarget.classList.remove("opacity-50","cursor-not-allowed")),this.hasClearAllBtnTarget&&(this.clearAllBtnTarget.disabled=t===0,t===0?this.clearAllBtnTarget.classList.add("opacity-50","cursor-not-allowed"):this.clearAllBtnTarget.classList.remove("opacity-50","cursor-not-allowed"))}updateHiddenInput(){if(!this.hasHiddenInputTarget)return;let i=Array.from(this.selectedDepotNames);this.hiddenInputTarget.value=JSON.stringify(i)}showLoading(){this.hasLoadingTarget&&this.loadingTarget.classList.remove("hidden"),this.hasErrorTarget&&this.errorTarget.classList.add("hidden"),this.hasInterfaceTarget&&this.interfaceTarget.classList.add("hidden"),this.hasPlaceholderTarget&&this.placeholderTarget.classList.add("hidden")}showError(i){this.hasErrorMessageTarget&&(this.errorMessageTarget.textContent=i),this.hasLoadingTarget&&this.loadingTarget.classList.add("hidden"),this.hasErrorTarget&&this.errorTarget.classList.remove("hidden"),this.hasInterfaceTarget&&this.interfaceTarget.classList.add("hidden"),this.hasPlaceholderTarget&&this.placeholderTarget.classList.add("hidden")}showInterface(){this.hasLoadingTarget&&this.loadingTarget.classList.add("hidden"),this.hasErrorTarget&&this.errorTarget.classList.add("hidden"),this.hasPlaceholderTarget&&this.placeholderTarget.classList.add("hidden"),this.hasInterfaceTarget&&this.interfaceTarget.classList.remove("hidden")}showPlaceholder(){this.hasLoadingTarget&&this.loadingTarget.classList.add("hidden"),this.hasErrorTarget&&this.errorTarget.classList.add("hidden"),this.hasInterfaceTarget&&this.interfaceTarget.classList.add("hidden"),this.hasPlaceholderTarget&&this.placeholderTarget.classList.remove("hidden")}};var AB={};Le(AB,{default:()=>TB});var TB=class extends le{static targets=["treeItem"];static values={integrationId:String,projectId:String};connect(){this.loadedPaths=new Set}async toggleDirectory(i){let t=i.currentTarget,e=t.dataset.path;t.classList.contains("expanded")?this.collapseDirectory(t):await this.expandDirectory(t,e)}
6211collapseDirectory(i){i.classList.remove("expanded");let t=i.parentElement.querySelector(".tree-children");t&&(t.style.display="none");let e=i.querySelector(".tree-arrow");e&&(e.style.transform="rotate(0deg)")}async expandDirectory(i,t){i.classList.add("expanded");let e=i.querySelector(".tree-arrow");if(e&&(e.style.transform="rotate(90deg)"),!this.loadedPaths.has(t))await this.loadDirectoryContents(i,t),this.loadedPaths.add(t);else{let n=i.parentElement.querySelector(".tree-children");n&&(n.style.display="block")}}async loadDirectoryContents(i,t){try{this.showLoading(i);let e=this.projectIdValue?`/projects/${this.projectIdValue}/integrations/${this.integrationIdValue}/depot_dirs?path=${encodeURIComponent(t)}`:`/integrations/${this.integrationIdValue}/depot_dirs?path=${encodeURIComponent(t)}`,n=await fetch(e);if(n.ok){let s=await n.json();this.renderDirectoryContents(i,s.dirs,s.total_files)}else{let s=await n.text();console.error("Server response:",n.status,s),this.showError(i,`Failed to load directory contents (${n.status})`)}}catch(e){console.error("Error loading directory:",e),this.showError(i,"Error loading directory")}finally{this.hideLoading(i)}}renderDirectoryContents(i,t,e=0){let n=i.parentElement,s=n.querySelector(".tree-children");s||(s=document.createElement("div"),s.className="tree-children ml-4",n.appendChild(s)),s.innerHTML="";let r=t.filter(a=>a.type==="directory"),o=t.filter(a=>a.type==="file");if(r.forEach(a=>{let l=this.createDirectoryElement(a);s.appendChild(l)}),o.forEach(a=>{let l=this.createFileElement(a);s.appendChild(l)}),e>o.length){let a=document.createElement("div");a.className="py-1 text-xs italic ml-5",a.style.color="var(--bs-fg-faint)",a.textContent=`and ${e-o.length} more files`,s.appendChild(a)}if(t.length===0&&e===0){let a=document.createElement("div");a.className="py-2 text-sm italic ml-5",a.style.color="var(--bs-fg-faint)",a.textContent="No files",s.appendChild(a)}s.style.display="block"}createDirectoryElement(i){let t=document.createElement("div");t.className="tree-node";let e=document.createElement("div");return e.className="tree-item flex items-center py-1 px-2 rounded cursor-pointer",e.style.cssText="transition: background 120ms ease;",e.onmouseover=()=>{e.style.background="var(--bs-bg-panel-2)"},e.onmouseout=()=>{e.style.background=""},e.dataset.path=i.path,e.dataset.action="click->depot-tree#toggleDirectory",e.innerHTML=`
6212      <svg class="tree-arrow w-3 h-3 mr-1 transition-transform duration-200" style="color: var(--bs-fg-mute);"
6213           fill="none" stroke="currentColor" viewBox="0 0 24 24">
6214        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
6215      </svg>
6216      <svg class="w-4 h-4 mr-2" style="color: var(--bs-info);" fill="currentColor" viewBox="0 0 20 20">
6217        <path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"/>
6218      </svg>
6219      <span class="text-sm" style="color: var(--bs-fg);">${i.name}</span>
6220    `,t.appendChild(e),t}createFileElement(i){let t=document.createElement("div");t.className="tree-node";let e=document.createElement("div");e.className="tree-item flex items-center py-1 px-2 rounded",e.style.cssText="transition: background 120ms ease;",e.onmouseover=()=>{e.style.background="var(--bs-bg-panel-2)"},e.onmouseout=()=>{e.style.background=""};let n=i.name;return i.revision&&(n+=` (v${i.revision})`),e.innerHTML=`
6221      <span class="w-4 mr-1"></span>
6222      <svg class="w-4 h-4 mr-2" style="color: var(--bs-fg-mute);" fill="currentColor" viewBox="0 0 20 20">
6223        <path fill-rule="evenodd" d="M4 4a2 2 0 00-2 2v8a2 2 0 002 2h12a2 2 0 002-2V7.414A2 2 0 0017.414 6L14 2.586A2 2 0 0012.586 2H4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z" clip-rule="evenodd"/>
6224      </svg>
6225      <span class="text-sm" style="color: var(--bs-fg-soft);">${n}</span>
6226    `,t.appendChild(e),t}showLoading(i){let t=i.parentElement,e=t.querySelector(".tree-children");e||(e=document.createElement("div"),e.className="tree-children ml-4",t.appendChild(e));let n=document.createElement("div");n.className="loading-indicator py-2 text-sm",n.style.color="var(--bs-fg-mute)",n.textContent="Loading...",e.appendChild(n),e.style.display="block"}hideLoading(i){let e=i.parentElement.querySelector(".tree-children");if(e){let n=e.querySelector(".loading-indicator");n&&n.remove()}}showError(i,t){let e=document.createElement("span");e.className="error-indicator ml-2 text-xs",e.style.color="var(--bs-err)",e.textContent=t,i.appendChild(e),setTimeout(()=>{e.parentNode&&e.remove()},3e3)}};var kB={};Le(kB,{default:()=>EB});var EB=class extends le{connect(){this.dirty=!1,this.onInput=this.onInput.bind(this),this.onSubmitStart=this.onSubmitStart.bind(this),this.onBeforeUnload=this.onBeforeUnload.bind(this),this.onTurboBeforeVisit=this.onTurboBeforeVisit.bind(this),this.element.addEventListener("input",this.onInput),this.element.addEventListener("turbo:submit-start",this.onSubmitStart),window.addEventListener("beforeunload",this.onBeforeUnload),document.addEventListener("turbo:before-visit",this.onTurboBeforeVisit)}disconnect(){this.element.removeEventListener("input",this.onInput),this.element.removeEventListener("turbo:submit-start",this.onSubmitStart),window.removeEventListener("beforeunload",this.onBeforeUnload),document.removeEventListener("turbo:before-visit",this.onTurboBeforeVisit)}onInput(){this.dirty=!0}onSubmitStart(){this.dirty=!1}onBeforeUnload(i){this.dirty&&(i.preventDefault(),i.returnValue="")}onTurboBeforeVisit(i){this.dirty&&(confirm("Discard unsaved changes?")||i.preventDefault())}};var RB={};Le(RB,{default:()=>PB});var PB=class extends le{static targets=["menu","trigger","search","item"];connect(){this.isOpen=!1,this.boundClickOutside=this.clickOutside.bind(this),this.boundKeydown=this.keydown.bind(this)}toggle(i){i.preventDefault(),this.isOpen?this.close():this.open()}open(){this.menuTarget.classList.remove("hidden"),this.isOpen=!0,this.hasTriggerTarget&&this.triggerTarget.setAttribute("aria-expanded","true"),document.addEventListener("click",this.boundClickOutside),document.addEventListener("keydown",this.boundKeydown),this.hasSearchTarget&&this.searchTarget.focu
6226s()}close(i={}){this.menuTarget.classList.add("hidden"),this.isOpen=!1,this.hasTriggerTarget&&(this.triggerTarget.setAttribute("aria-expanded","false"),i.returnFocus===!0&&this.triggerTarget.focus()),document.removeEventListener("click",this.boundClickOutside),document.removeEventListener("keydown",this.boundKeydown)}clickOutside(i){this.element.contains(i.target)||this.close()}keydown(i){i.key==="Escape"&&this.isOpen&&this.close({returnFocus:!0})}filter(i){let t=i.target.value.trim().toLowerCase();this.itemTargets.forEach(e=>{let n=(e.dataset.dropdownLabel||e.textContent||"").toLowerCase();e.classList.toggle("hidden",t!==""&&!n.includes(t))})}disconnect(){document.removeEventListener("click",this.boundClickOutside),document.removeEventListener("keydown",this.boundKeydown)}};var LB={};Le(LB,{default:()=>DB});var DB=class extends le{static targets=["email","submit","message","form"];connect(){this.originalSubmitText=this.submitTarget.value}async submit(i){i.preventDefault();let t=this.emailTarget.value.trim();if(!t){this.showMessage("Please enter your email address","error");return}this.submitTarget.disabled=!0,this.submitTarget.value="Sending...";try{let e=new FormData(this.formTarget),n=await fetch(this.formTarget.action,{method:"POST",body:e,headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}}),s=await n.json();n.ok?(this.showMessage(s.message||"Thanks! Check your email for the guide.","success"),this.emailTarget.value="",window.posthog&&posthog.capture("Email Capture Success",{email:t,source:"landing_page"})):this.showMessage(s.error||"Something went wrong. Please try again.","error")}catch{this.showMessage("Network error. Please check your connection and try again.","error")}finally{this.submitTarget.disabled=!1,this.submitTarget.value=this.originalSubmitText}}showMessage(i,t){let e=this.messageTarget.querySelector("p");e.textContent=i,e.style.color=t==="error"?"var(--bs-err)":"var(--bs-ok)",this.messageTarget.classList.remove("hidden"),t==="error"&&setTimeout(()=>{this.messageTarget.classList.add("hidden")},5e3)}};var OB={};Le(OB,{default:()=>IB});var IB=class extends le{static targets=["uploadArea","previewArea","fileInput","nameInput","assetTypeSelect","submitBtn","changeFileBtn","fileName","fileSize","fileType","detectedAssetType","imagePreview","audioPreview","genericPreview","previewImage","previewAudio","fileInfo"];connect(){console.log("File upload controller connected!"),this.setupAssetTypeMap(),this.setupEventListeners()}testClick(){console.log("Test click worked! Controller is responding."),alert("Stimulus is working!")}setupAssetTypeMap(){this.assetTypeMap={png:"texture",jpg:"texture",jpeg:"texture",tga:"texture",bmp:"texture",dds:"texture",exr:"texture",hdr:"texture",tiff:"texture",fbx:"model",obj:"model",blend:"model","3ds":"model",dae:"model",gltf:"model",glb:"model",wav:"audio",mp3:"audio",ogg:"audio",flac:"audio",aiff:"audio",m4a:"audio",wma:"audio",cs:"script",cpp:"script",h:"script",hpp:"script",js:"script",ts:"script",py:"script",lua:"script",umap:"level",unity:"level",scene:"level",mat:"material",material:"material",anim:"animation",zip:"archive",rar:"archive","7z":"archive",uasset:"material"}}setupEventListeners(){["dragenter","dragover","dragleave","drop"].forEach(i=>{this.uploadAreaTarget.addEventListener(i,this.preventDefaults.bind(this),!1),document.body.addEventListener(i,this.preventDefaults.bind(this),!1)}).dragover.forEach(i=>{this.uploadAreaTarget.addEventListener(i,this.highlight.bind(this),!1)}).drop.forEach(i=>{this.uploadAreaTarget.addEventListener(i,this.unhighlight.bind(this),!1)}),this.uploadAreaTarget.addEventListener("drop",this.handleDrop.bind(this),!1),this.fileInputTarget.addEventListener("change",this.handleFileSelect.bind(this),!1),this.changeFileBtnTarget.addEventListener("click",this.changeFile.bind(this),!1)}preventDefaults(i){i.preventDefault(),i.stopPropagation()}highlight(i){this.uploadAreaTarget.style.borderColor="var(--bs-accent)",this.uploadAreaTarget.style.background="var(--bs-accent-soft)"}unhighlight(i){this.uploadAreaTarget.style.borderColor="",this.uploadAreaTarget.style.background=""}handleDrop(i){let e=i.dataTransfer.files;e.length>0&&(this.fileInputTarget.files=e,this.handleFileSelect({target:{files:e}}))}handleFileSelect(i){let t=i.target.files;if(t.length>0){let e=t[0];this.processFile(e)}}
6226changeFile(){this.fileInputTarget.click()}enableSubmitButton(){this.submitBtnTarget.disabled=!1,this.submitBtnTarget.classList.remove("opacity-50","cursor-not-allowed"),this.submitBtnTarget.classList.add("cursor-pointer")}processFile(i){if(this.hasNameInputTarget&&!this.nameInputTarget.value){let n=i.name.split(".").slice(0,-1).join(".");this.nameInputTarget.value=n}let t=i.name.split(".").pop().toLowerCase(),e=this.assetTypeMap[t];e&&this.hasAssetTypeSelectTarget&&(this.assetTypeSelectTarget.value=e),this.updateFileDetails(i,e),this.showPreview(i),this.uploadAreaTarget.classList.add("hidden"),this.previewAreaTarget.classList.remove("hidden"),this.enableSubmitButton()}updateFileDetails(i,t){this.fileNameTarget.textContent=i.name,this.fileSizeTarget.textContent=this.formatFileSize(i.size),this.fileTypeTarget.textContent=i.type||"Unknown",this.detectedAssetTypeTarget.textContent=t?t.charAt(0).toUpperCase()+t.slice(1):"Unknown"}showPreview(i){this.imagePreviewTarget.classList.add("hidden"),this.audioPreviewTarget.classList.add("hidden"),this.genericPreviewTarget.classList.add("hidden"),i.type.startsWith("image/")?this.showImagePreview(i):i.type.startsWith("audio/")?this.showAudioPreview(i):this.showGenericPreview(i)}showImagePreview(i){let t=new FileReader;t.onload=e=>{this.previewImageTarget.src=e.target.result,this.imagePreviewTarget.classList.remove("hidden")},t.readAsDataURL(i)}showAudioPreview(i){let t=new FileReader;t.onload=e=>{this.previewAudioTarget.src=e.target.result,this.audioPreviewTarget.classList.remove("hidden")},t.readAsDataURL(i)}showGenericPreview(i){let t=i.name.split(".").pop().toUpperCase();this.fileInfoTarget.textContent=`${t} file - ${this.formatFileSize(i.size)}`,this.genericPreviewTarget.classList.remove("hidden")}formatFileSize(i){if(i===0)return"0 Bytes";let t=1024,e=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(i)/Math.log(t));return parseFloat((i/Math.pow(t,n)).toFixed(2))+" "+e[n]}};var BB={};Le(BB,{default:()=>NB});var NB=class extends le{static targets=["toast"];static values={timeout:{type:Number,default:4e3}};connect(){this.timers=new Map,requestAnimationFrame(()=>{this.toastTargets.forEach(i=>{if(i.classList.add("is-visible"),i.dataset.flashToastSticky==="true")return;let t=setTimeout(()=>this.dismissToast(i),this.timeoutValue);this.timers.set(i,t)})})}disconnect(){this.timers?.forEach(i=>clearTimeout(i)),this.timers?.clear()}dismiss(i){let t=i.currentTarget.closest(".bs-flash__toast");t&&this.dismissToast(t)}dismissToast(i){this.timers?.has(i)&&(clearTimeout(this.timers.get(i)),this.timers.delete(i)),i.classList.remove("is-visible"),i.classList.add("is-leaving"),i.addEventListener("transitionend",()=>i.remove(),{once:!0}),setTimeout(()=>i.remove(),400)}};var UB={};Le(UB,{default:()=>FB});var FB=class extends le{static targets=["configPanel","statusPanel","logPanel","startButton","stopButton","statusBadge","progressBar","logOutput","statTotal","statProcessed","statSubmitted","statSkipped","statErrors"];static values={statusUrl:String};connect(){this.pollingInterval=null,this.startPolling()}disconnect(){this.stopPolling()}startPolling(){this.pollingInterval||(this.pollOnce(),this.pollingInterval=setInterval(()=>this.pollOnce(),2e3))}pollOnce(){this.fetchStatus().then(i=>{i&&(i.status==="running"?this.showRunning(i):(i.status==="completed"||i.status==="failed"||i.status==="cancelled")&&(this.showFinished(i),this.stopPolling()))})}stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null)}async fetchStatus(){try{let i=await fetch(this.statusUrlValue);if(i.ok)return await i.json()}catch(i){console.error("Failed to fetch replay status:",i)}return null}showRunning(i){this.statusPanelTarget.classList.remove("hidden"),this.logPanelTarget.classList.remove("hidden"),this.startButtonTarget.disabled=!0,this.startButtonTarget.textContent="Running...",this.stopButtonTarget.disabled=!1,this.statusBadgeTarget.textContent="running",this.statusBadgeTarget.className="bs-pill bs-pill-info",this.updateStats(i.stats),this.updateLog(i.log_lines)}showFinished(i){this.statusPanelTarget.classList.remove("hidden"),this.logPanelTarget.classList.remove("hidden"),this.startButtonTarget.disabled=!1,this.startButtonTarget.textContent="Start Replay",this.stopButtonTarget.disabled=!0;let t={completed:"bs-pill bs-pill-ok",failed:"bs-pill bs-pill-err",cancelled:"bs-pill bs-pill-warn"};this.statusBadgeTarget.textContent=i.status,this.statusBadgeTarget.className=t[i.status]||"bs-pill bs-pill-neutral",this.updateStats(i.stats),this.updateLog(i.log_lines)}
6226updateStats(i){if(!i)return;let t=i.total_commits||0,e=i.processed||0;this.statTotalTarget.textContent=t,this.statProcessedTarget.textContent=e,this.statSubmittedTarget.textContent=i.submitted||0,this.statSkippedTarget.textContent=i.skipped||0,this.statErrorsTarget.textContent=i.errors||0;let n=t>0?Math.round(e/t*100):0;this.progressBarTarget.style.width=`${n}%`}updateLog(i){!i||i.length===0||(this.logOutputTarget.textContent=i.join(`
6227`),this.logOutputTarget.scrollTop=this.logOutputTarget.scrollHeight)}};var VB={};Le(VB,{default:()=>zB});var zB=class extends le{static targets=["toolCard","statusIndicator","submitButton","hiddenFields","perforceForm","perforceUsername","successTemplate","toolsContainer"];static values={jiraCallbackUrl:String,slackCallbackUrl:String,perforceVerifyUrl:String};connect(){this.connectedTools=[],this.setupOAuthCallbackListener()}disconnect(){this.removeOAuthCallbackListener()}connectOAuth(i){let t=i.currentTarget.dataset.tool,e=this.getOAuthUrl(t);e&&this.openOAuthPopup(e,t)}showPerforceForm(i){let e=i.currentTarget.closest('[data-tool="perforce"]').querySelector('[data-identity-onboarding-target="perforceForm"]'),n=i.currentTarget;e.classList.remove("hidden"),n.classList.add("hidden")}connectPerforce(i){let t=this.perforceUsernameTarget.value.trim();if(!t){this.showError("Please enter your Perforce username");return}this.updateToolStatus("perforce","verifying"),fetch("/integrations/perforce",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content},body:JSON.stringify({username:t})}).then(e=>e.json()).then(e=>{e.success?this.handleToolConnected("perforce",{tool_name:"perforce",external_identifier:t,display_name:t,verification_method:"api_key"}):(this.updateToolStatus("perforce","failed"),this.showError(e.message||"Failed to verify Perforce account"))}).catch(e=>{this.updateToolStatus("perforce","failed"),this.showError("Connection failed. Please try again.")})}skipStep(i){i.preventDefault();let t=i.currentTarget.closest("form"),e=document.createElement("input");e.type="hidden",e.name="skip",e.value="1",t.appendChild(e),this.submitStep()}handleSuccess(i){i.detail[0].completed?(this.showCompletionMessage(),setTimeout(()=>{window.location.href="/dashboard"},2e3)):window.location.reload()}handleError(i){let t=i.detail[0];this.showError(t.error||"Something went wrong. Please try again.")}
6227getOAuthUrl(i){return{jira:"/integrations/jira/new",slack:"/integrations/slack/new"}[i]}openOAuthPopup(i,t){let e=window.open(i,`${t}_oauth`,"width=600,height=700,scrollbars=yes,resizable=yes");this.currentOAuthTool=t,this.currentPopup=e;let n=setInterval(()=>{e.closed&&(clearInterval(n),this.currentOAuthTool=null,this.currentPopup=null)},1e3)}setupOAuthCallbackListener(){this.oauthCallbackHandler=i=>{i.data.type==="oauth_success"?this.handleOAuthSuccess(i.data):i.data.type==="oauth_error"&&this.handleOAuthError(i.data)},window.addEventListener("message",this.oauthCallbackHandler)}removeOAuthCallbackListener(){this.oauthCallbackHandler&&window.removeEventListener("message",this.oauthCallbackHandler)}handleOAuthSuccess(i){let t=this.currentOAuthTool;t&&this.currentPopup&&(this.currentPopup.close(),this.currentPopup=null,this.handleToolConnected(t,{tool_name:t,external_identifier:i.email,display_name:i.display_name||i.email,access_token:i.access_token,verification_method:"oauth",metadata:i.metadata||{}})),this.currentOAuthTool=null}handleOAuthError(i){this.currentPopup&&(this.currentPopup.close(),this.currentPopup=null),this.showError(i.message||"OAuth connection failed"),this.currentOAuthTool=null}handleToolConnected(i,t){this.updateToolStatus(i,"connected"),this.connectedTools=this.connectedTools.filter(e=>e.tool_name!==i),this.connectedTools.push(t),this.updateHiddenFields(),this.showSuccess(`${i.charAt(0).toUpperCase()+i.slice(1)} connected successfully!`)}updateToolStatus(i,t){let e=this.toolsContainerTarget.querySelector(`[data-tool="${i}"]`);if(!e)return;let n=e.querySelector('[data-identity-onboarding-target="statusIndicator"]'),s={connected:"bs-pill bs-pill-ok",verifying:"bs-pill bs-pill-warn",failed:"bs-pill bs-pill-err"},r={connected:'<svg class="mr-1 h-3 w-3" fill="currentColor" viewBox="0 0 8 8"><circle cx="4" cy="4" r="3" /></svg>',verifying:'<svg class="mr-1 h-3 w-3 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="m4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>',failed:'<svg class="mr-1 h-3 w-3" fill="currentColor" viewBox="0 0 8 8"><circle cx="4" cy="4" r="3" /></svg>'},o={connected:"Connected",verifying:"Verifying",failed:"Failed"};n&&(n.className="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium",n.className+=" "+s[t],n.innerHTML=r[t]+o[t])}updateHiddenFields(){let i=this.connectedTools.map((t,e)=>Object.keys(t).map(n=>`<input type="hidden" name="metadata[connected_tools][${e}][${n}]" value="${this.escapeHtml(t[n])}">`).join("")).join("");this.hiddenFieldsTarget.innerHTML=i}submitStep(){this.updateHiddenFields(),this.submitButtonTarget.disabled=!0,this.submitButtonTarget.innerHTML="Saving...";let i=this.submitButtonTarget.closest("form"),t=new FormData(i);fetch(i.action,{method:"POST",body:t,headers:{"X-CSRF-Token":document.querySelector('[name="csrf-token"]').content,Accept:"application/json"}}).then(e=>e.json()).then(e=>{e.success?this.handleSuccess({detail:[e]}):this.handleError({detail:[e]})}).catch(e=>{this.handleError({detail:[{error:"Connection failed"}]})}).finally(()=>{this.submitButtonTarget.disabled=!1,this.submitButtonTarget.innerHTML="Continue"})}showSuccess(i){this.showNotification(i,"success")}showError(i){this.showNotification(i,"error")}showNotification(i,t){let e=t==="success"?"var(--bs-ok)":"var(--bs-err)",n=t==="success"?"var(--bs-ok-soft)":"var(--bs-err-soft)",s=document.createElement("div");s.style.cssText=`
6228      position: fixed; top: 16px; right: 16px;
6229      padding: 14px 16px; border-radius: var(--bs-r-md);
6230      border: 1px solid ${n}; background: ${n}; color: ${e};
6231      z-index: 50; font-size: 13px; font-weight: 500;
6232      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
6233    `,s.innerHTML=`
6234      <div style="display: flex; align-items: center; gap: 12px;">
6235        <p style="margin: 0;">${i}</p>
6236      </div>
6237    `,document.body.appendChild(s),setTimeout(()=>{s.parentNode&&s.parentNode.removeChild(s)},5e3)}showCompletionMessage(){let i=document.createElement("div");i.style.cssText="position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 50;",i.innerHTML=`
6238      <div class="bs-card" style="padding: 32px; max-width: 28rem; margin: 0 16px; text-align: center;">
6239        <div style="margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; height: 48px; width: 48px; border-radius: 9999px; background: var(--bs-ok-soft);">
6240          <svg style="height: 24px; width: 24px; color: var(--bs-ok);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6241            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
6242          </svg>
6243        </div>
6244        <h3 style="font-size: 18px; font-weight: 600; color: var(--bs-fg); margin: 0 0 8px;">Setup Complete!</h3>
6245        <p style="font-size: 13px; color: var(--bs-fg-soft); margin: 0;">Your team identity connections have been configured.</p>
6246      </div>
6247    `,document.body.appendChild(i)}escapeHtml(i){let t=document.createElement("div");return t.textContent=i,t.innerHTML}};var jB={};Le(jB,{default:()=>HB});var HB=class extends le{static targets=["configSection","credentialsSection"];connect(){requestAnimationFrame(()=>this.initializeForm())}initializeForm(){let i=this.element.querySelector('select[name="integration[integration_type]"]'),t=this.element.querySelector('input[name="integration[integration_type]"]'),e=i?i.value:t?t.value:"",n=this.hasConfigSectionTarget&&this.configSectionTarget.querySelector(`#${e}-config`),s=this.hasCredentialsSectionTarget&&this.credentialsSectionTarget.querySelector(`#${e}-credentials`);e&&e!==""&&(this.hasConfigSectionTarget&&!n&&this.updateConfigSection(e),this.hasCredentialsSectionTarget&&!s&&this.updateCredentialsSection(e),this.initializeConfigSpecificFeatures(e))}updateFields(i){let t=this.element.querySelector('select[name="integration[integration_type]"]'),e=t?t.value:"";this.hasConfigSectionTarget&&this.updateConfigSection(e),this.hasCredentialsSectionTarget&&this.updateCredentialsSection(e),this.updateHelpSection(e)}updateHelpSection(i){let t=document.querySelectorAll("[data-help-type]");if(t.length===0)return;t.forEach(n=>n.classList.add("hidden"));let e=document.querySelector(`[data-help-type="${i}"]`);if(e)e.classList.remove("hidden");else{let n=document.querySelector('[data-help-type="default"]');n&&n.classList.remove("hidden")}}updateConfigSection(i){let t=this.configSectionTarget,e="";switch(i){case"perforce":e=this.getPerforceConfig();break;case"jira":e=this.getJiraConfig();break;case"slack":e=this.getSlackConfig();break;case"discord":e=this.getDiscordConfig();break;case"unreal":e=this.getUnrealConfig();break;case"jenkins":e=this.getJenkinsConfig();break;case"trello":e=this.getTrelloConfig();break;case"steam":e=this.getSteamConfig();break;case"github":e=this.getGithubConfig();break;case"lore":e=this.getLoreConfig();break;case"buildkite":e=this.getBuildkiteConfig();break;case"diversion":e=this.getDiversionConfig();break;case"teamcity":e=this.getTeamcityConfig();break;case"epic_games_store":e=this.getEpicGamesStoreConfig();break;case"linear":e=this.getLinearConfig();break;default:e=this.getDefaultConfig()}t.innerHTML=e,this.initializeConfigSpecificFeatures(i)}updateCredentialsSection(i){let t=this.credentialsSectionTarget,e=t.closest(".bs-card, .bg-white");if(["slack","discord","webhook","email","unreal"].includes(i)){e&&(e.style.display="none");return}else e&&(e.style.display="");let s="";switch(i){case"perforce":s=this.getPerforceCredentials();break;case"jira":s=this.getJiraCredentials();break;case"jenkins":s=this.getJenkinsCredentials();break;case"trello":s=this.getTrelloCredentials();break;case"steam":s=this.getSteamCredentials();break;case"github":s=this.getGithubCredentials();break;case"lore":s=this.getLoreCredentials();break;case"buildkite":s=this.getBuildkiteCredentials();break;case"diversion":s=this.getDiversionCredentials();break;case"teamcity":s=this.getTeamcityCredentials();break;case"epic_games_store":s=this.getEpicGamesStoreCredentials();break;case"linear":s=this.getLinearCredentials();break;default:s=this.getDefaultCredentials()}t.innerHTML=s}initializeConfigSpecificFeatures(i){i==="jenkins"&&this.initializeJobSelector()}initializeJobSelector(){console.log("initializeJobSelector called");
6247let i=document.querySelector("#job-selection-placeholder");if(!i){console.warn("Job selection placeholder not found");return}let t=this.getIntegrationId(),e=this.getProjectId();console.log("Integration ID:",t,"Project ID:",e);let n=document.querySelector("[data-available-jobs]"),s=document.querySelector("[data-selected-jobs]");console.log("Available jobs element:",n),console.log("Selected jobs element:",s);let r=[],o=[];if(n)try{r=JSON.parse(n.dataset.availableJobs||"[]"),console.log("Parsed available jobs:",r)}catch(a){console.warn("Error parsing available jobs:",a)}if(s)try{o=JSON.parse(s.dataset.selectedJobs||"[]"),console.log("Parsed selected jobs:",o)}catch(a){console.warn("Error parsing selected jobs:",a)}i.innerHTML=`
6248      <div id="job-selector" class="space-y-4" 
6249           data-controller="job-selector"
6250           data-job-selector-integration-id-value="${t}"
6251           data-job-selector-project-id-value="${e}"
6252           data-job-selector-available-jobs-value='${JSON.stringify(r)}'
6253           data-job-selector-selected-jobs-value='${JSON.stringify(o)}'>
6254        
6255        <div class="mb-4">
6256          <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">
6257            Jenkins Job Selection
6258          </label>
6259          <p class="text-xs mb-4" style="color: var(--bs-fg-mute);">
6260            Select which Jenkins jobs can be triggered by this integration. If no jobs are selected, all jobs are allowed.
6261          </p>
6262        </div>
6263        
6264        <!-- Loading State -->
6265        <div class="job-selector-loading" data-job-selector-target="loading">
6266          <div class="flex items-center justify-center py-8">
6267            <div class="flex items-center space-x-3">
6268              <svg class="animate-spin h-5 w-5" style="color: var(--bs-accent);" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
6269                <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
6270                <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
6271              </svg>
6272              <span class="text-sm" style="color: var(--bs-fg-soft);">Loading Jenkins jobs...</span>
6273            </div>
6274          </div>
6275        </div>
6276
6277        <!-- Placeholder State -->
6278        <div class="job-selector-placeholder hidden" data-job-selector-target="placeholder">
6279          <div class="rounded-lg p-6" style="background: var(--bs-info-soft); border: 1px solid var(--bs-info-soft);">
6280            <div class="text-center">
6281              <svg class="mx-auto h-12 w-12" style="color: var(--bs-info); mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6282                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
6283              </svg>
6284              <h4 class="text-lg font-medium mb-2" style="color: var(--bs-info);">Job Selection</h4>
6285              <p class="text-sm" style="color: var(--bs-fg-soft); mb-4">
6286                Configure server connection first, then save the integration to enable job selection.
6287              </p>
6288              <p class="text-xs" style="color: var(--bs-info);">
6289                Job selection will be available after saving
6290              </p>
6291            </div>
6292          </div>
6293        </div>
6294
6295        <!-- Error State -->
6296        <div class="job-selector-error hidden" data-job-selector-target="error">
6297          <div class="rounded-lg p-4" style="background: var(--bs-err-soft); border: 1px solid var(--bs-err-soft);">
6298            <div class="flex">
6299              <div class="flex-shrink-0">
6300                <svg class="h-5 w-5" style="color: var(--bs-err);" viewBox="0 0 20 20" fill="currentColor">
6301                  <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
6302                </svg>
6303              </div>
6304              <div class="ml-3">
6305                <h3 class="text-sm font-medium" style="color: var(--bs-err);">Error loading jobs</h3>
6306                <p class="mt-1 text-sm" style="color: var(--bs-fg-soft);" data-job-selector-target="errorMessage"></p>
6307              </div>
6308            </div>
6309          </div>
6310        </div>
6311
6312        <!-- Main Job Selector Interface -->
6313        <div class="job-selector-main hidden" data-job-selector-target="main">
6314          <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
6315            <!-- Available Jobs Column -->
6316            <div>
6317              <div class="rounded-lg" style="background: var(--bs-bg-panel); border: 1px solid var(--bs-line);">
6318                <div class="px-4 py-3" style="border-bottom: 1px solid var(--bs-line);">
6319                  <h3 class="text-sm font-medium" style="color: var(--bs-fg);">Available Jobs</h3>
6320                  <div class="mt-2">
6321                    <input type="text" 
6322                           placeholder="Search jobs..." 
6323                           data-job-selector-target="searchInput"
6324                           data-action="input->job-selector#filterJobs"
6325                           class="bs-input">
6326                  </div>
6327                  <div class="mt-2 flex items-center justify-between">
6328                    <span class="text-xs" style="color: var(--bs-fg-mute);">
6329                      <span data-job-selector-target="availableCount">0</span> jobs available
6330                    </span>
6331                    <button type="button" 
6332                            data-action="click->job-selector#selectAll"
6333                            class="text-xs" style="color: var(--bs-accent);">
6334                      Select All
6335                    </button>
6336                  </div>
6337                </div>
6338                <div class="overflow-y-auto max-h-64">
6339                  <div class="divide-y divide-slate-200 dark:divide-slate-700" data-job-selector-target="availableList">
6340                    <!-- Available jobs will be populated here -->
6341                  </div>
6342                </div>
6343              </div>
6344            </div>
6345
6346            <!-- Selected Jobs Column -->
6347            <div>
6348              <div class="rounded-lg" style="background: var(--bs-bg-panel); border: 1px solid var(--bs-line);">
6349                <div class="px-4 py-3" style="border-bottom: 1px solid var(--bs-line);">
6350                  <h3 class="text-sm font-medium" style="color: var(--bs-fg);">Selected Jobs</h3>
6351                  <div class="mt-2 flex items-center justify-between">
6352                    <span class="text-xs" style="color: var(--bs-fg-mute);">
6353                      <span data-job-selector-target="selectedCount">0</span> jobs selected
6354                    </span>
6355                    <button type="button" 
6356                            data-action="click->job-selector#clearAll"
6357                            class="text-xs" style="color: var(--bs-accent);">
6358                      Clear All
6359                    </button>
6360                  </div>
6361                </div>
6362                <div class="overflow-y-auto max-h-64">
6363                  <div class="divide-y divide-slate-200 dark:divide-slate-700" data-job-selector-target="selectedList">
6364                    <!-- Selected jobs will be populated here -->
6365                  </div>
6366                </div>
6367              </div>
6368            </div>
6369          </div>
6370
6371          <!-- Hidden input to store selected job names -->
6372          <input type="hidden" 
6373                 name="integration[config][selected_jobs]" 
6374                 data-job-selector-target="selectedJobsInput"
6375                 value="${JSON.stringify(o)}">
6376        </div>
6377      </div>
6378    `}getJenkinsConfig(){let i=this.getExistingValue("integration[config][server_url]")||this.configSectionTarget.dataset.jenkinsServerUrl||"",t=this.getExistingValue("integration[config][job_name]")||this.configSectionTarget.dataset.jenkinsJobName||"",e=this.getExistingValue("integration[config][build_parameters]")||this.configSectionTarget.dataset.jenkinsBuildParams||"";return`
6379      <div id="jenkins-config" class="integration-config">
6380        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6381          <div>
6382            <label for="integration_config_server_url" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">CI/CD Server URL</label>
6383            <input type="text" name="integration[config][server_url]" id="integration_config_server_url"
6384                   class="bs-input"
6385                   placeholder="https://ci.example.com"
6386                   value="${i}">
6387            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">URL to your CI/CD server</p>
6388          </div>
6389          <div>
6390            <label for="integration_config_job_name" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Job Name</label>
6391            <input type="text" name="integration[config][job_name]" id="integration_config_job_name"
6392                   class="bs-input"
6393                   placeholder="ButterStack-Build"
6394                   value="${t}">
6395            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Name of the CI/CD job to trigger</p>
6396          </div>
6397        </div>
6398        <div class="mt-4">
6399          <label for="integration_config_build_parameters" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Build Parameters (JSON)</label>
6400          <textarea name="integration[config][build_parameters]" id="integration_config_build_parameters"
6401                    class="bs-input"
6402                    rows="3"
6403                    placeholder='{"BRANCH": "main", "CONFIGURATION": "Development"}'>${e}</textarea>
6404          <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Optional JSON object with default build parameters</p>
6405        </div>
6406        
6407        <!-- Job Selection will be handled by JavaScript -->
6408        <div class="mt-6" id="job-selection-placeholder">
6409          <!-- JavaScript will replace this -->
6410        </div>
6411      </div>
6412    `}getJenkinsCredentials(){let i=this.getExistingValue("integration[credentials][username]")||this.credentialsSectionTarget.dataset.jenkinsUsername||"",t=this.getExistingValue("integration[credentials][api_token]")||"",n=this.credentialsSectionTarget.dataset.hasSavedJenkinsApiToken==="true"?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022 (saved, leave blank to keep)":"Enter Jenkins API token";return`
6413      <div id="jenkins-credentials" class="integration-credentials">
6414        <!-- Important API Token Notice -->
6415        <div class="bg-warn-soft dark:bg-warn/20 border border-warn-soft dark:border-warn rounded-md p-3 mb-4">
6416          <p class="text-sm text-warn dark:text-warn-soft">
6417            <strong>Important:</strong> Use a Jenkins API token, not your password!<br>
6418            API tokens are 32+ character hex strings (e.g., <code class="bg-warn-soft dark:bg-warn px-1 rounded">11a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7</code>)
6419          </p>
6420        </div>
6421        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6422          <div>
6423            <label for="integration_credentials_jenkins_server_account" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Username</label>
6424            <input type="text" name="integration[credentials][jenkins_server_account]" id="integration_credentials_jenkins_server_account"
6425                   class="bs-input"
6426                   autocomplete="nope"
6427                   placeholder="jenkins-user"
6428                   value="${i}">
6429            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Jenkins username</p>
6430          </div>
6431          <div>
6432            <label for="integration_credentials_jenkins_server_key" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">API Token</label>
6433            <input type="text" name="integration[credentials][jenkins_server_key]" id="integration_credentials_jenkins_server_key"
6434                   class="bs-input"
6435                   autocomplete="nope"
6436                   placeholder="${n}"
6437                   value="${t}">
6438            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Generate from Jenkins > User Icon > Security > API Token</p>
6439          </div>
6440        </div>
6441      </div>
6442    `}getPerforceConfig(){let i=this.getExistingValue("integration[config][server_url]")||"",t=this.getExistingValue("integration[config][workspace]")||"";return`
6443      <div id="perforce-config" class="integration-config">
6444        <!-- SSL Connection Notice -->
6445        <div class="rounded-md p-3 mb-4" style="background: var(--bs-info-soft); border: 1px solid var(--bs-info-soft);">
6446          <p class="text-sm" style="color: var(--bs-info);">
6447            <strong>Tip:</strong> For secure connections, use "ssl:" prefix in the server URL<br>
6448            Example: <code class="px-1 rounded" style="background: var(--bs-info-soft);">ssl:perforce.company.com:1666</code>
6449          </p>
6450        </div>
6451        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6452          <div>
6453            <label for="integration_config_server_url" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Server URL</label>
6454            <input type="text" name="integration[config][server_url]" id="integration_config_server_url"
6455                   class="bs-input"
6456                   placeholder="perforce.company.com:1666"
6457                   value="${i}">
6458          </div>
6459          <div>
6460            <label for="integration_config_workspace" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Workspace</label>
6461            <input type="text" name="integration[config][workspace]" id="integration_config_workspace"
6462                   class="bs-input"
6463                   placeholder="butterstack-workspace"
6464                   value="${t}">
6465          </div>
6466        </div>
6467        
6468        <!-- Depot Selection -->
6469        <div class="mt-6" id="depot-selection-container">
6470          ${this.getDepotSelectorHTML()}
6471        </div>
6472
6473        <!-- Asset Preview via REST API -->
6474        <div class="mt-6">
6475          <div class="flex items-center mb-3">
6476            <h4 class="text-md font-medium" style="color: var(--bs-fg);">Asset Preview via REST API</h4>
6477            <span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-warn-soft text-warn dark:bg-warn/30 dark:text-warn">Experimental</span>
6478          </div>
6479          <div class="rounded-md p-3 mb-4" style="background: var(--bs-info-soft); border: 1px solid var(--bs-info-soft);">
6480            <p class="text-sm" style="color: var(--bs-info);">
6481              Requires the P4 REST API webserver (p4d 2025.2+) to be running. This enables image previews for assets stored in Perforce.
6482            </p>
6483          </div>
6484          <div class="space-y-4">
6485            <div>
6486              <input type="hidden" name="integration[config][rest_api_enabled]" value="false">
6487              <label class="flex items-center">
6488                <input type="checkbox" name="integration[config][rest_api_enabled]" value="true"
6489                       class="rounded" style="accent-color: var(--bs-accent); width: 16px; height: 16px;">
6490                <span class="ml-2 text-sm font-medium" style="color: var(--bs-fg);">Enable asset preview via REST API</span>
6491              </label>
6492            </div>
6493            <div>
6494              <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">REST API URL</label>
6495              <input type="text" name="integration[config][rest_api_url]"
6496                     class="bs-input"
6497                     placeholder="http://perforce:8090"
6498                     autocomplete="new-password">
6499            </div>
6500            <div>
6501              <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Max Preview Size (MB)</label>
6502              <input type="number" name="integration[config][max_preview_size_mb]" value="5" min="1" max="50"
6503                     class="bs-input" style="width: 8rem;">
6504              <p class="text-xs" style="color: var(--bs-fg-mute); mt-1">Maximum file size for asset previews (1-50 MB)</p>
6505            </div>
6506          </div>
6507        </div>
6508      </div>
6509    `}getPerforceCredentials(){let i=this.getExistingValue("integration[credentials][username]")||"",t=this.getExistingValue("integration[credentials][password]")||"";return`
6510      <div id="perforce-credentials" class="integration-credentials">
6511        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6512          <div>
6513            <label for="integration_credentials_username" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Username</label>
6514            <input type="text" name="integration[credentials][username]" id="integration_credentials_username"
6515                   class="bs-input"
6516                   autocomplete="username"
6517                   value="${i}">
6518          </div>
6519          <div>
6520            <label for="integration_credentials_password" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Password</label>
6521            <input type="password" name="integration[credentials][password]" id="integration_credentials_password"
6522                   class="bs-input"
6523                   autocomplete="current-password"
6524                   value="${t}">
6525          </div>
6526        </div>
6527      </div>
6528    `}getJiraConfig(){let i=this.getExistingValue("integration[config][server_url]")||"",t=this.getExistingValue("integration[config][project_key]")||"";return`
6529      <div id="jira-config" class="integration-config">
6530        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6531          <div>
6532            <label for="integration_config_server_url" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Jira URL</label>
6533            <input type="text" name="integration[config][server_url]" id="integration_config_server_url"
6534                   class="bs-input"
6535                   placeholder="https://company.atlassian.net"
6536                   value="${i}">
6537          </div>
6538          <div>
6539            <label for="integration_config_project_key" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Project Key</label>
6540            <input type="text" name="integration[config][project_key]" id="integration_config_project_key"
6541                   class="bs-input"
6542                   placeholder="PROJ"
6543                   value="${t}">
6544          </div>
6545        </div>
6546      </div>
6547    `}getJiraCredentials(){let i=this.getExistingValue("integration[credentials][email]")||"",t=this.getExistingValue("integration[credentials][api_token]")||"";return`
6548      <div id="jira-credentials" class="integration-credentials">
6549        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6550          <div>
6551            <label for="integration_credentials_email" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Email Address</label>
6552            <input type="email" name="integration[credentials][email]" id="integration_credentials_email"
6553                   class="bs-input"
6554                   autocomplete="email"
6555                   placeholder="[email protected]"
6556                   value="${i}">
6557            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Your Atlassian account email</p>
6558          </div>
6559          <div>
6560            <label for="integration_credentials_api_token" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">API Token</label>
6561            <input type="password" name="integration[credentials][api_token]" id="integration_credentials_api_token"
6562                   class="bs-input"
6563                   autocomplete="new-password"
6564                   placeholder="Jira API token"
6565                   value="${t}">
6566            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Generate from <a href="https://id.atlassian.com/manage-profile/security/api-tokens" target="_blank" style="color: var(--bs-accent);">Atlassian API tokens</a></p>
6567          </div>
6568        </div>
6569      </div>
6570    `}getSlackConfig(){return`
6571      <div id="slack-config" class="integration-config">
6572        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6573          <div>
6574            <label for="integration_config_webhook_url" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Webhook URL</label>
6575            <input type="text" name="integration[config][webhook_url]" id="integration_config_webhook_url"
6576                   class="bs-input"
6577                   placeholder="https://hooks.slack.com/services/...">
6578          </div>
6579          <div>
6580            <label for="integration_config_channel" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Channel (optional)</label>
6581            <input type="text" name="integration[config][channel]" id="integration_config_channel"
6582                   class="bs-input"
6583                   placeholder="#builds">
6584          </div>
6585        </div>
6586      </div>
6587    `}getDiscordConfig(){let i="bs-input",t='block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);',e="bs-input",n='flex items-center text-sm" style="color: var(--bs-fg);',s=this.configSectionTarget.dataset,o=s.hasSavedDiscordWebhookUrl==="true"?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022 (saved, leave blank to keep)":"https://discord.com/api/webhooks/...",a=s.discordBuildNotifications||"builds_all",l=s.discordAssetNotifications||"assets_all_changes",c=s.discordApprovalNotifications||"approvals_all",u=s.hasSavedDiscordBuildsCh
6587annelWebhookUrl==="true",h=s.hasSavedDiscordAssetsChannelWebhookUrl==="true",d=s.hasSavedDiscordAlertsChannelWebhookUrl==="true",p=s.hasSavedDiscordApprovalsChannelWebhookUrl==="true",g="https://discord.com/api/webhooks/...",y=u?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022 (saved, leave blank to keep)":g,x=h?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022 (saved, leave blank to keep)":g,w=d?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022 (saved, leave blank to keep)":g,M=p?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022 (saved, leave blank to keep)":g,A=s.discordWatchedPaths||"",C=s.discordIgnoredPaths||"",R=s.discordBatchWindowMinutes||"5",k=s.discordMaxNotificationsPerHour||"50",O=s.discordThrottleWindowMinutes||"30",I=s.discordMentionOnBuildFailure==="true",U=s.discordUseHereForCritical==="true",V=s.discordQuietHoursEnabled==="true",q=s.discordQuietHoursStart||"18:00",X=s.discordQuietHoursEnd||"09:00",j=s.discordQuietHoursTimezone||"UTC",W=(_,at)=>_===at?"selected":"";return`
6588      <div id="discord-config" class="integration-config space-y-6">
6589        <!-- Default Webhook URL -->
6590        <div>
6591          <label for="integration_config_webhook_url" class="${t}">Default Webhook URL</label>
6592          <input type="text" name="integration[config][webhook_url]" id="integration_config_webhook_url"
6593                 class="${i}"
6594                 value=""
6595                 placeholder="${o}">
6596          <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Get this from Discord Server Settings \u2192 Integrations \u2192 Webhooks</p>
6597        </div>
6598
6599        <!-- Notification Frequencies -->
6600        <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
6601          <div>
6602            <label class="${t}">Build Notifications</label>
6603            <select name="integration[discord_notification_preference_attributes][build_notifications]" class="${e}">
6604              <option value="builds_all" ${W("builds_all",a)}>All builds</option>
6605              <option value="builds_failures_only" ${W("builds_failures_only",a)}>Failures only</option>
6606              <option value="builds_daily_digest" ${W("builds_daily_digest",a)}>Daily digest</option>
6607              <option value="builds_disabled" ${W("builds_disabled",a)}>Disabled</option>
6608            </select>
6609          </div>
6610          <div>
6611            <label class="${t}">Asset Notifications</label>
6612            <select name="integration[discord_notification_preference_attributes][asset_notifications]" class="${e}">
6613              <option value="assets_all_changes" ${W("assets_all_changes",l)}>All changes</option>
6614              <option value="assets_warnings_only" ${W("assets_warnings_only",l)}>Warnings only</option>
6615              <option value="assets_daily_digest" ${W("assets_daily_digest",l)}>Daily digest</option>
6616              <option value="assets_disabled" ${W("assets_disabled",l)}>Disabled</option>
6617            </select>
6618          </div>
6619          <div>
6620            <label class="${t}">Approval Notifications</label>
6621            <select name="integration[discord_notification_preference_attributes][approval_notifications]" class="${e}">
6622              <option value="approvals_all" ${W("approvals_all",c)}>All approvals</option>
6623              <option value="approvals_daily_digest" ${W("approvals_daily_digest",c)}>Daily digest</option>
6624              <option value="approvals_disabled" ${W("approvals_disabled",c)}>Disabled</option>
6625            </select>
6626          </div>
6627        </div>
6628
6629        <!-- Collapsible: Channel Routing -->
6630        <div class="rounded-xl p-4" style="background: var(--bs-bg-panel-2); border: 1px solid var(--bs-line);">
6631          <details class="group">
6632            <summary class="cursor-pointer text-sm font-medium flex items-center" style="color: var(--bs-fg-soft);">
6633              <svg class="w-4 h-4 mr-2 transition-transform group-open:rotate-90" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6634                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
6635              </svg>
6636              Channel Routing (optional)
6637            </summary>
6638            <div class="mt-4 grid grid-cols-1 md:grid-cols-2 gap-4">
6639              <div>
6640                <label class="${t}">Builds Channel</label>
6641                <input type="text" name="integration[discord_notification_preference_attributes][builds_channel_webhook_url]"
6642                       class="${i}" value="" placeholder="${y}">
6643              </div>
6644              <div>
6645                <label class="${t}">Assets Channel</label>
6646                <input type="text" name="integration[discord_notification_preference_attributes][assets_channel_webhook_url]"
6647                       class="${i}" value="" placeholder="${x}">
6648              </div>
6649              <div>
6650                <label class="${t}">Alerts Channel</label>
6651                <input type="text" name="integration[discord_notification_preference_attributes][alerts_channel_webhook_url]"
6652                       class="${i}" value="" placeholder="${w}">
6653              </div>
6654              <div>
6655                <label class="${t}">Approvals Channel</label>
6656                <input type="text" name="integration[discord_notification_preference_attributes][approvals_channel_webhook_url]"
6657                       class="${i}" value="" placeholder="${M}">
6658              </div>
6659            </div>
6660            <p class="text-xs mt-3" style="color: var(--bs-fg-mute);">Route different notification types to separate Discord channels. Leave empty to use the default webhook.</p>
6661          </details>
6662        </div>
6663
6664        <!-- Collapsible: Path Filtering -->
6665        <div class="rounded-xl p-4" style="background: var(--bs-bg-panel-2); border: 1px solid var(--bs-line);">
6666          <details class="group">
6667            <summary class="cursor-pointer text-sm font-medium flex items-center" style="color: var(--bs-fg-soft);">
6668              <svg class="w-4 h-4 mr-2 transition-transform group-open:rotate-90" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6669                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
6670              </svg>
6671              Path Filtering
6672            </summary>
6673            <div class="mt-4 grid grid-cols-1 md:grid-cols-2 gap-4">
6674              <div>
6675                <label class="${t}">Watched Paths</label>
6676                <textarea name="integration[discord_notification_preference_attributes][watched_paths]"
6677                          class="${i}" rows="3"
6678                          placeholder="//depot/Art/**&#10;//depot/Audio/**">${this.escapeHtml(A)}</textarea>
6679                <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">One path per line. Only notify for changes in these paths.</p>
6680              </div>
6681              <div>
6682                <label class="${t}">Ignored Paths</label>
6683                <textarea name="integration[discord_notification_preference_attributes][ignored_paths]"
6684                          class="${i}" rows="3"
6685                          placeholder="//depot/WIP/**&#10;//depot/Archive/**">${this.escapeHtml(C)}</textarea>
6686                <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">One path per line. Never notify for changes in these paths.</p>
6687              </div>
6688            </div>
6689          </details>
6690        </div>
6691
6692        <!-- Collapsible: Noise Control -->
6693        <div class="rounded-xl p-4" style="background: var(--bs-bg-panel-2); border: 1px solid var(--bs-line);">
6694          <details class="group">
6695            <summary class="cursor-pointer text-sm font-medium flex items-center" style="color: var(--bs-fg-soft);">
6696              <svg class="w-4 h-4 mr-2 transition-transform group-open:rotate-90" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6697                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
6698              </svg>
6699              Noise Control
6700            </summary>
6701            <div class="mt-4 space-y-4">
6702              <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
6703                <div>
6704                  <label class="${t}">Batch Window</label>
6705                  <select name="integration[discord_notification_preference_attributes][batch_window_minutes]" class="${e}">
6706                    <option value="5" ${W("5",R)}>5 minutes</option>
6707                    <option value="15" ${W("15",R)}>15 minutes</option>
6708                    <option value="30" ${W("30",R)}>30 minutes</option>
6709                  </select>
6710                  <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Group notifications within this window</p>
6711                </div>
6712                <div>
6713                  <label class="${t}">Max per Hour</label>
6714                  <select name="integration[discord_notification_preference_attributes][max_n
6714otifications_per_hour]" class="${e}">
6715                    <option value="10" ${W("10",k)}>10</option>
6716                    <option value="25" ${W("25",k)}>25</option>
6717                    <option value="50" ${W("50",k)}>50</option>
6718                    <option value="0" ${W("0",k)}>Unlimited</option>
6719                  </select>
6720                  <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Rate limit notifications</p>
6721                </div>
6722                <div>
6723                  <label class="${t}">Cooldown per Asset</label>
6724                  <select name="integration[discord_notification_preference_attributes][throttle_window_minutes]" class="${e}">
6725                    <option value="15" ${W("15",O)}>15 minutes</option>
6726                    <option value="30" ${W("30",O)}>30 minutes</option>
6727                    <option value="60" ${W("60",O)}>1 hour</option>
6728                  </select>
6729                  <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Min time between same-asset notifications</p>
6730                </div>
6731              </div>
6732              <div class="flex flex-wrap gap-6 pt-2">
6733                <label class="${n}">
6734                  <input type="checkbox" name="integration[discord_notification_preference_attributes][mention_on_build_failure]" value="1"
6735                         class="rounded mr-2" style="accent-color: var(--bs-accent); width: 16px; height: 16px;" ${I?"checked":""}>
6736                  @mention on build failure
6737                </label>
6738                <label class="${n}">
6739                  <input type="checkbox" name="integration[discord_notification_preference_attributes][use_here_for_critical]" value="1"
6740                         class="rounded mr-2" style="accent-color: var(--bs-accent); width: 16px; height: 16px;" ${U?"checked":""}>
6741                  Use @here for critical alerts
6742                </label>
6743              </div>
6744            </div>
6745          </details>
6746        </div>
6747
6748        <!-- Collapsible: Quiet Hours -->
6749        <div class="rounded-xl p-4" style="background: var(--bs-bg-panel-2); border: 1px solid var(--bs-line);">
6750          <details class="group">
6751            <summary class="cursor-pointer text-sm font-medium flex items-center" style="color: var(--bs-fg-soft);">
6752              <svg class="w-4 h-4 mr-2 transition-transform group-open:rotate-90" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6753                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
6754              </svg>
6755              Quiet Hours
6756            </summary>
6757            <div class="mt-4 space-y-4">
6758              <label class="${n}">
6759                <input type="checkbox" name="integration[discord_notification_preference_attributes][quiet_hours_enabled]" value="1"
6760                       class="rounded mr-2" style="accent-color: var(--bs-accent); width: 16px; height: 16px;"
6761                       data-action="change->integration-form#toggleQuietHours" ${V?"checked":""}>
6762                Enable quiet hours
6763              </label>
6764              <div id="quiet-hours-fields" class="grid grid-cols-1 md:grid-cols-3 gap-4 ${V?"":"opacity-50"}">
6765                <div>
6766                  <label class="${t}">Start Time</label>
6767                  <input type="time" name="integration[discord_notification_preference_attributes][quiet_hours_start]"
6768                         class="${i}" value="${q}" ${V?"":"disabled"}>
6769                </div>
6770                <div>
6771                  <label class="${t}">End Time</label>
6772                  <input type="time" name="integration[discord_notification_preference_attributes][quiet_hours_end]"
6773                         class="${i}" value="${X}" ${V?"":"disabled"}>
6774                </div>
6775                <div>
6776                  <label class="${t}">Timezone</label>
6777                  <select name="integration[discord_notification_preference_attributes][quiet_hours_timezone]" class="${e}" ${V?"":"disabled"}>
6778                    <option value="UTC" ${W("UTC",j)}>UTC</option>
6779                    <option value="America/Los_Angeles" ${W("America/Los_Angeles",j)}>
6779Pacific Time</option>
6780                    <option value="America/Denver" ${W("America/Denver",j)}>Mountain Time</option>
6781                    <option value="America/Chicago" ${W("America/Chicago",j)}>Central Time</option>
6782                    <option value="America/New_York" ${W("America/New_York",j)}>Eastern Time</option>
6783                    <option value="Europe/London" ${W("Europe/London",j)}>London</option>
6784                    <option value="Europe/Paris" ${W("Europe/Paris",j)}>Paris</option>
6785                    <option value="Asia/Tokyo" ${W("Asia/Tokyo",j)}>Tokyo</option>
6786                  </select>
6787                </div>
6788              </div>
6789              <p class="text-xs" style="color: var(--bs-fg-mute);">Notifications will be held during quiet hours and sent when they end.</p>
6790            </div>
6791          </details>
6792        </div>
6793      </div>
6794    `}escapeHtml(i){if(!i)return"";let t=document.createElement("div");return t.textContent=i,t.innerHTML}toggleQuietHours(i){let t=i.target.checked,e=document.getElementById("quiet-hours-fields");e&&(e.classList.toggle("opacity-50",!t),e.querySelectorAll("input, select").forEach(n=>{n.disabled=!t}))}getUnrealConfig(){return`
6795      <div id="unreal-config" class="integration-config">
6796        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6797          <div>
6798            <label for="integration_config_engine_path" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Engine Path</label>
6799            <input type="text" name="integration[config][engine_path]" id="integration_config_engine_path"
6800                   class="bs-input"
6801                   placeholder="C:\\Program Files\\Epic Games\\UE_5.3">
6802          </div>
6803          <div>
6804            <label for="integration_config_project_path" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Project Path</label>
6805            <input type="text" name="integration[config][project_path]" id="integration_config_project_path"
6806                   class="bs-input"
6807                   placeholder="/path/to/project.uproject">
6808          </div>
6809        </div>
6810      </div>
6811    `}getTrelloConfig(){return`
6812      <div id="trello-config" class="integration-config">
6813        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6814          <div>
6815            <label for="integration_config_board_id" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Board ID</label>
6816            <input type="text" name="integration[config][board_id]" id="integration_config_board_id"
6817                   class="bs-input"
6818                   placeholder="5f0c123abc456def789">
6819            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Trello board ID (optional - leave blank to monitor all boards)</p>
6820          </div>
6821          <div>
6822            <label class="flex items-center">
6823              <input type="checkbox" name="integration[config][webhook_enabled]" value="true" checked
6824                     class="rounded" style="accent-color: var(--bs-accent); width: 16px; height: 16px;">
6825              <span class="ml-2 text-sm font-medium" style="color: var(--bs-fg);">Enable webhook notifications</span>
6826            </label>
6827            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Receive real-time updates when cards are created, updated, or moved</p>
6828          </div>
6829        </div>
6830      </div>
6831    `}getTrelloCredentials(){return`
6832      <div id="trello-credentials" class="integration-credentials">
6833        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6834          <div>
6835            <label for="integration_credentials_api_key" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">API Key</label>
6836            <input type="password" name="integration[credentials][api_key]" id="integration_credentials_api_key"
6837                   class="bs-input"
6838                   autocomplete="new-password"
6839                   placeholder="Your Trello API key">
6840            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Get from <a href="https://trello.com/app-key" target="_blank" style="color: var(--bs-accent);">Trello API Key</a></p>
6841          </div>
6842          <div>
6843            <label for="integration_credentials_api_token" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">API Token</label>
6844            <input type="password" name="integration[credentials][api_token]" id="integration_credentials_api_token"
6845                   class="bs-input"
6846                   autocomplete="new-password"
6847                   placeholder="Your Trello API token">
6848            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Generate token after getting API key</p>
6849          </div>
6850        </div>
6851      </div>
6852    `}getSteamConfig(){let i=this.getExistingValue("integration[config][steam_app_id]")||"",t=this.getExistingValue("integration[config][steam_branch]")||"public",e=this.getExistingValue("integration[config][steam_depot_id]")||"",n=this.getExistingValue("integration[config][steam_poll_interval]")||"15",s=(r,o)=>r===o?"selected":"";return`
6853      <div id="steam-config" class="integration-config">
6854        <div class="rounded-md p-4 mb-4" style="background: var(--bs-info-soft); border: 1px solid var(--bs-info-soft);">
6855          <div class="flex">
6856            <div class="flex-shrink-0">
6857              <svg class="h-5 w-5" style="color: var(--bs-info);" viewBox="0 0 20 20" fill="currentColor">
6858                <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd" />
6859              </svg>
6860            </div>
6861            <div class="ml-3">
6862              <p class="text-sm" style="color: var(--bs-fg-soft);">
6863                <strong>Steam Deployment Tracking:</strong> Monitor your game deployments on Steam.
6864                ButterStack will poll Steam's API to track build status and notify you when builds go live.
6865              </p>
6866            </div>
6867          </div>
6868        </div>
6869        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6870          <div>
6871            <label for="integration_config_steam_app_id" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Steam App ID</label>
6872            <input type="text" name="integration[config][steam_app_id]" id="integration_config_steam_app_id"
6873                   class="bs-input"
6874                   placeholder="480"
6875                   value="${i}">
6876            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Your game's Steam App ID from Steamworks</p>
6877          </div>
6878          <div>
6879            <label for="integration_config_steam_branch" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Default Branch</label>
6880            <select name="integration[config][steam_branch]" id="integration_config_steam_branch"
6881                    class="bs-input">
6882              <option value="public" ${s("public",t)}>public</option>
6883              <option value="beta" ${s("beta",t)}>beta</option>
6884              <option value="internal" ${s("internal",t)}>internal</option>
6885              <option value="staging" ${s("staging",t)}>staging</option>
6886            </select>
6887            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Steam branch to monitor for deployments</p>
6888          </div>
6889        </div>
6890        <div class="mt-4 grid grid-cols-1 md:grid-cols-2 gap-4">
6891          <div>
6892            <label for="integration_config_steam_depot_id" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Depot ID (optional)</label>
6893            <input type="text" name="integration[config][steam_depot_id]" id="integration_config_steam_depot_id"
6894                   class="bs-input"
6895                   placeholder="481"
6896                   value="${e}">
6897            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Specific depot to track (leave blank for all)</p>
6898          </div>
6899          <div>
6900            <label for="integration_config_steam_poll_interval" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Poll Interval (minutes)</label>
6901            <input type="number" name="integration[config][steam_poll_interval]" id="integration_config_steam_poll_interval"
6902                   class="bs-input"
6903                   min="5" max="60" step="5"
6904                   placeholder="15"
6905                   value="${n}">
6906            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">How often to check deployment status (5-60 min)</p>
6907          </div>
6908        </div>
6909      </div>
6910    `}getSteamCredentials(){let i=this.getExistingValue("integration[credentials][web_api_key]")||"",t=this.getExistingValue("integration[credentials][publisher_key]")||"";return`
6911      <div id="steam-credentials" class="integration-credentials">
6912        <div class="rounded-md p-3 mb-4" style="background: var(--bs-info-soft); border: 1px solid var(--bs-info-soft);">
6913          <p class="text-sm" style="color: var(--bs-info);">
6914            Both API keys are <strong>optional</strong>. Game info (name, images, price) works without any keys.
6915            See the Setup Guide for instructions on getting each key.
6916          </p>
6917        </div>
6918        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6919          <div>
6920            <label for="integration_credentials_web_api_key" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Web API Key (optional)</label>
6921            <input type="password" name="integration[credentials][web_api_key]" id="integration_credentials_web_api_key"
6922                   class="bs-input"
6923                   autocomplete="new-password"
6924                   placeholder="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
6925                   value="${i}">
6926            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Free - enables player count tracking</p>
6927          </div>
6928          <div>
6929            <label for="integration_credentials_publisher_key" class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Publisher Web API Key (optional)</label>
6930            <input type="password" name="integration[credentials][publisher_key]" id="integration_credentials_publisher_key"
6931                   class="bs-input"
6932                   autocomplete="new-password"
6933                   placeholder="Your Steam Publisher Web API Key"
6934                   value="${t}">
6935            <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Required for accessing Steam deployment status</p>
6936          </div>
6937        </div>
6938      </div>
6939    `}getGithubConfig(){return`
6940      <div id="git-config" class="space-y-4">
6941        <div>
6942          <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Repository Owner/Organization</label>
6943          <input type="text" name="integration[config][github_owner]"
6944                 class="bs-input"
6945                 placeholder="e.g., your-org" />
6946          <p class="text-xs" style="color: var(--bs-fg-mute); mt-1">GitHub username or organization name</p>
6947        </div>
6948        <div>
6949          <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Repository Name</label>
6950          <input type="text" name="integration[config][github_repo]"
6951                 class="bs-input"
6952                 placeholder="e.g., my-game" />
6953        </div>
6954        <div>
6955          <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Default Branch</label>
6956          <input type="text" name="integration[config][github_default_branch]"
6957                 class="bs-input"
6958                 placeholder="main" value="main" />
6959        </div>
6960        <div>
6961          <div class="flex items-center">
6962            <input type="hidden" name="integration[config][github_monitor_ci_events]" value="false" />
6963            <input type="checkbox" name="integration[config][github_monitor_ci_events]" value="true" checked
6964                   class="h-4 w-4 rounded" style="accent-color: var(--bs-accent);" data-testid="github-actions-monitoring-checkbox" />
6965            <label class="ml-2 text-sm" style="color: var(--bs-fg);">Enable GitHub Actions monitoring</label>
6966          </div>
6967          <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">GitHub Actions workflow runs on the default branch appear as build runs, and check_suite, check_run, and workflow_run events are logged in the monitoring feed. Disable to reduce noise from CI status updates or stop creating build runs from Actions.</p>
6968        </div>
6969        <div>
6970          <div class="flex items-center">
6971            <input type="hidden" name="integration[config][github_record_commits]" value="false" />
6972            <input type="checkbox" name="integration[config][github_record_commits]" value="true" checked
6973                   class="h-4 w-4 rounded" style="accent-color: var(--bs-accent);" />
6974            <label class="ml-2 text-sm" style="color: var(--bs-fg);">Record commits from GitHub pushes</label>
6975          </div>
6976          <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Create commit/changelist records from GitHub push events. Disable if this project's commit history of record is Perforce (or another VCS integration) and GitHub is used for issue tracking only.</p>
6977        </div>
6978      </div>
6979    `}getGithubCredentials(){return`
6980      <div class="space-y-4">
6981        <div>
6982          <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Personal Access Token (PAT)</label>
6983          <input type="password" name="integration[credentials][access_token]"
6984                 class="bs-input"
6985                 placeholder="ghp_..." autocomplete="new-password" />
6986          <p class="text-xs" style="color: var(--bs-fg-mute); mt-1">Required scopes: repo, workflow, read:org</p>
6987        </div>
6988      </div>
6989    `}getLoreConfig(){return`
6990      <div id="lore-config" class="integration-config space-y-4">
6991        <div>
6992          <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Remote URL</label>
6993          <input type="text" name="integration[config][remote_url]"
6994                 class="bs-input"
6995                 placeholder="lore://lore.company.com:41337/your-repo" autocomplete="new-password" />
6996          <p class="text-xs" style="color: var(--bs-fg-mute);">Your Lore server address (lore://host:port/repo). ButterStack health-checks the HTTP port (41339).</p>
6997        </div>
6998        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
6999          <div>
7000            <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Repository</label>
7001            <input type="text" name="integration[config][lore_repository]"
7002                   class="bs-input"
7003                   placeholder="your-repo" autocomplete="new-password" />
7004          </div>
7005          <div>
7006            <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Branch</label>
7007            <input type="text" name="integration[config][lore_branch]"
7008                   class="bs-input"
7009                   placeholder="main" value="main" autocomplete="new-password" />
7010          </div>
7011        </div>
7012        <div>
7013          <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Watch Paths</label>
7014          <input type="text" name="integration[config][watch_paths]"
7015                 class="bs-input"
7016                 placeholder="/Content/, /Source/" value="/Content/, /Source/" autocomplete="new-password" />
7017          <p class="text-xs" style="color: var(--bs-fg-mute);">Paths of interest for asset tracking (comma-separated)</p>
7018        </div>
7019        <div class="bs-banner bs-banner--info">
7020          <p style="color: var(--bs-info); font-size: 13px;">Lore has no built-in webhook. After saving, run the <code>lore-bridge</code> relay near your server (see setup instructions).</p>
7021        </div>
7022      </div>
7023    `}getLoreCredentials(){return`
7024      <div id="lore-credentials" class="integration-credentials space-y-4">
7025        <div class="bs-banner bs-banner--info">
7026          <p style="color: var(--bs-info); font-size: 13px;">An auth token is optional \u2014 Lore servers run unauthenticated unless [server.auth] is configured.</p>
7027        </div>
7028        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
7029          <div>
7030            <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Auth Token (optional)</label>
7031            <input type="password" name="integration[credentials][auth_token]"
7032                   class="bs-input"
7033                   placeholder="eyJhbGciOi..." autocomplete="new-password" />
7034          </div>
7035          <div>
7036            <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">Identity (optional)</label>
7037            <input type="text" name="integration[credentials][identity]"
7038                   class="bs-input"
7039                   placeholder="[email protected]" autocomplete="new-password" />
7040          </div>
7041        </div>
7042      </div>
7043    `}getDiversionConfig(){let i=this.getExistingValue("integration[config][repository_url]")||"",t=this.getExistingValue("integration[config][workspace_name]")||"",e=this.getExistingValue("integration[config][branch]")||"main",n=this.getExistingValue("integration[config][build_triggers]")||"#ci, #build, [ci]",s=this.getExistingValue("integration[config][watch_paths]")||"/Content/, /Source/",r=this.element.querySelector('[name="integration[config][asset_sync]"][type="checkbox"]'),o=r?r.checked:!1,a=this.element.querySelector('[name="integration[config][conflict_notifications]"][type="checkbox"]'),l=a?a.checked:!1;return`
7044      <div id="diversion-config" class="integration-config">
7045        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
7046          <div>
7047            <label for="integration_config_repository_url" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Repository URL</label>
7048            <input type="text" name="integration[config][repository_url]" id="integration_config_repository_url"
7049                   class="bs-input"
7050                   autocomplete="new-password"
7051                   placeholder="https://app.diversion.dev/workspace/repo"
7052                   value="${i}">
7053            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">Diversion repository URL</p>
7054          </div>
7055          <div>
7056            <label for="integration_config_workspace_name" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Workspace Name</label>
7057            <input type="text" name="integration[config][workspace_name]" id="integration_config_workspace_name"
7058                   class="bs-input"
7059                   autocomplete="new-password"
7060                   placeholder="my-game-project"
7061                   value="${t}">
7062            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">Diversion workspace name</p>
7063          </div>
7064        </div>
7065        <div class="mt-4 grid grid-cols-1 md:grid-cols-2 gap-4">
7066          <div>
7067            <label for="integration_config_branch" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Branch</label>
7068            <input type="text" name="integration[config][branch]" id="integration_config_branch"
7069                   class="bs-input"
7070                   autocomplete="new-password"
7071                   placeholder="main"
7072                   value="${e}">
7073            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">Branch to monitor for changes</p>
7074          </div>
7075          <div>
7076            <label for="integration_config_build_triggers" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Build Triggers</label>
7077            <input type="text" name="integration[config][build_triggers]" id="integration_config_build_triggers"
7078                   class="bs-input"
7079                   autocomplete="new-password"
7080                   placeholder="#ci, #build, [ci]"
7081                   value="${n}">
7082            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">Commit message tags that trigger builds (comma-separated)</p>
7083          </div>
7084        </div>
7085        <div class="mt-4 grid grid-cols-1 md:grid-cols-2 gap-4">
7086          <div>
7087            <label for="integration_config_asset_sync" class="flex items-center">
7088              <input type="checkbox" name="integration[config][asset_sync]" id="integration_config_asset_sync" value="true"
7089                     class="bs-checkbox" style="accent-color: var(--bs-accent);" ${o?"checked":""}>
7090              <span class="bs-fg-soft-text" style="margin-left: 8px; font-size: 13px; font-weight: 500;">Sync asset changes</span>
7091            </label>
7092          </div>
7093          <div>
7094            <label for="integration_config_conflict_notifications" class="flex items-center">
7095              <input type="checkbox" name="integration[config][conflict_notifications]" id="integration_config_conflict_notifications" value="true"
7096                     class="bs-checkbox" style="accent-color: var(--bs-accent);" ${l?"checked":""}>
7097              <span class="bs-fg-soft-text" style="margin-left: 8px; font-size: 13px; font-weight: 500;">Notify on conflicts</span>
7098            </label>
7099          </div>
7100        </div>
7101        <div class="mt-4">
7102          <label for="integration_config_watch_paths" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Watch Paths</label>
7103          <input type="text" name="integration[config][watch_paths]" id="integration_config_watch_paths"
7104                 class="bs-input"
7105                 autocomplete="new-password"
7106                 placeholder="/Content/, /Source/, /Assets/"
7107                 value="${s}">
7108          <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">Paths to monitor for changes (comma-separated)</p>
7109        </div>
7110      </div>
7111    `}getDiversionCredentials(){let i=this.getExistingValue("integration[config][username]")||"",t=this.getExistingValue("integration[config][api_token]")||"";return`
7112      <div id="diversion-credentials" class="integration-credentials">
7113        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
7114          <div>
7115            <label for="integration_config_username" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Username</label>
7116            <input type="text" name="integration[config][username]" id="integration_config_username"
7117                   class="bs-input"
7118                   autocomplete="new-password"
7119                   placeholder="your-username"
7120                   value="${i}">
7121            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">Your Diversion username</p>
7122          </div>
7123          <div>
7124            <label for="integration_config_api_token" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">API Token</label>
7125            <input type="password" name="integration[config][api_token]" id="integration_config_api_token"
7126                   class="bs-input"
7127                   autocomplete="new-password"
7128                   placeholder="div_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
7129                   value="${t}">
7130            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">Generate from Diversion avatar > API Tokens</p>
7131          </div>
7132        </div>
7133      </div>
7134    `}getBuildkiteConfig(){let i=this.getExistingValue("integration[config][buildkite_organization]")||"",t=this.getExistingValue("integration[config][buildkite_pipeline]")||"",n=this.getExistingValue("integration[config][webhook_secret]")||""?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022 (saved, leave blank to keep)":"Paste the token from your Buildkite webhook";return`
7135      <div id="buildkite-config" class="integration-config">
7136        <div class="bs-banner bs-banner--info" style="margin-bottom: 16px;">
7137          <p style="color: var(--bs-info); font-size: 13px;">
7138            <strong>Buildkite</strong> reports build status to ButterStack over a signed webhook.
7139            Organization and pipeline are the slugs from your Buildkite URL:
7140            <code>buildkite.com/<strong>organization</strong>/<strong>pipeline</strong></code>.
7141          </p>
7142        </div>
7143        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
7144          <div>
7145            <label for="integration_config_buildkite_organization" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Organization Slug</label>
7146            <input type="text" name="integration[config][buildkite_organization]" id="integration_config_buildkite_organization"
7147                   class="bs-input"
7148                   autocomplete="new-password"
7149                   placeholder="your-studio"
7150                   value="${i}">
7151            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">Optional, enables the pipeline check on Test Connection</p>
7152          </div>
7153          <div>
7154            <label for="integration_config_buildkite_pipeline" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Pipeline Slug</label>
7155            <input type="text" name="integration[config][buildkite_pipeline]" id="integration_config_buildkite_pipeline"
7156                   class="bs-input"
7157                   autocomplete="new-password"
7158                   placeholder="tracer-bullet"
7159                   value="${t}">
7160            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">Optional, leave blank to accept every pipeline in the organization</p>
7161          </div>
7162        </div>
7163        <div class="mt-4">
7164          <label for="integration_config_webhook_secret" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Webhook Signing Secret</label>
7165          <input type="password" name="integration[config][webhook_secret]" id="integration_config_webhook_secret"
7166                 class="bs-input"
7167                 autocomplete="new-password"
7168                 placeholder="${n}">
7169          <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">
7170            Buildkite shows this as the webhook's <strong>Token</strong>. ButterStack verifies the
7171            <code>X-Buildkite-Signature</code> HMAC against it and rejects every unsigned delivery, so
7172            builds will not report until this is set.
7173          </p>
7174        </div>
7175      </div>
7176    `}getBuildkiteCredentials(){return`
7177      <div id="buildkite-credentials" class="integration-credentials">
7178        <div>
7179          <label for="integration_credentials_api_token" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">API Access Token</label>
7180          <input type="password" name="integration[credentials][api_token]" id="integration_credentials_api_token"
7181                 class="bs-input"
7182                 autocomplete="new-password"
7183                 placeholder="${this.getExistingValue("integration[credentials][api_token]")||""?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022 (saved, leave blank to keep)":"bkua_..."}">
7184          <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">
7185            Buildkite \u2192 Personal Settings \u2192 API Access Tokens. Required scopes: <code>read_builds</code>, <code>read_pipelines</code>.
7186          </p>
7187        </div>
7188      </div>
7189    `}getTeamcityConfig(){let i=this.getExistingValue("integration[config][server_url]")||"",t=this.element.querySelector('[name="integration[config][allow_insecure_tls]"][type="checkbox"]'),e=t?t.checked:!1;return`
7190      <div id="teamcity-config" class="integration-config">
7191        <div>
7192          <label for="integration_config_server_url" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Server URL</label>
7193          <input type="text" name="integration[config][server_url]" id="integration_config_server_url"
7194                 class="bs-input"
7195                 autocomplete="new-password"
7196                 placeholder="https://teamcity.example.com:8111"
7197                 value="${i}">
7198          <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">
7199            URL to your TeamCity server. If TeamCity is served under a context path (for example, behind a
7200            reverse proxy), include the context path in the URL.
7201          </p>
7202        </div>
7203        <div class="mt-4">
7204          <label for="integration_config_allow_insecure_tls" class="flex items-center">
7205            <input type="checkbox" name="integration[config][allow_insecure_tls]" id="integration_config_allow_insecure_tls" value="true"
7206                   class="bs-checkbox" style="accent-color: var(--bs-accent);" ${e?"checked":""}>
7207            <span class="bs-fg-soft-text" style="margin-left: 8px; font-size: 13px; font-weight: 500;">Allow insecure TLS</span>
7208          </label>
7209          <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">
7210            Skips certificate verification when connecting to this server. Only enable this for a
7211            self-signed or internal TeamCity server you trust.
7212          </p>
7213        </div>
7214      </div>
7215    `}getTeamcityCredentials(){return`
7216      <div id="teamcity-credentials" class="integration-credentials">
7217        <div>
7218          <label for="integration_credentials_api_token" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">API Access Token</label>
7219          <input type="password" name="integration[credentials][api_token]" id="integration_credentials_api_token"
7220                 class="bs-input"
7221                 autocomplete="new-password"
7222                 placeholder="${this.getExistingValue("integration[credentials][api_token]")||""?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022 (saved, leave blank to keep)":"Paste your TeamCity access token"}">
7223          <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">
7224            TeamCity &gt; Profile &gt; Access Tokens. Scope: read-only, plus build queue if you want ButterStack to trigger builds.
7225          </p>
7226        </div>
7227      </div>
7228    `}getEpicGamesStoreConfig(){let i=this.getExistingValue("integration[config][product_id]")||"",t=this.getExistingValue("integration[config][artifact_id]")||"",e=this.getExistingValue("integration[config][sandbox_id]")||"",n=this.getExistingValue("integration[config][deployment_id]")||"",s=this.getExistingValue("integration[config][portal_org_slug]")||"",r=this.getExistingValue("integration[config][portal_product_slug]")||"";return`
7229      <div id="epic_games_store-config" class="integration-config" data-testid="epic-config-section">
7230        <div class="bs-banner bs-banner--info" style="margin-bottom: 16px;">
7231          <p style="color: var(--bs-info); font-size: 13px;">
7232            <strong>Epic Games Store</strong> deployments are reported by your pipeline: it uploads with
7233            BuildPatchTool, then posts the result to ButterStack's deployment webhook. Copy these IDs from the
7234            Epic Developer Portal (your product's <strong>Product Settings</strong> and <strong>Artifacts</strong> pages).
7235          </p>
7236        </div>
7237        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
7238          <div>
7239            <label for="integration_config_product_id" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Product ID *</label>
7240            <input type="text" name="integration[config][product_id]" id="integration_config_product_id"
7241                   class="bs-input"
7242                   autocomplete="new-password"
7243                   required
7244                   placeholder="32-character product ID"
7245                   data-testid="epic-config-product-id"
7246                   value="${i}">
7247            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">Epic Developer Portal \u2192 Product Settings</p>
7248          </div>
7249          <div>
7250            <label for="integration_config_artifact_id" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Artifact ID *</label>
7251            <input type="text" name="integration[config][artifact_id]" id="integration_config_artifact_id"
7252                   class="bs-input"
7253                   autocomplete="new-password"
7254                   required
7255                   placeholder="32-character artifact ID"
7256                   data-testid="epic-config-artifact-id"
7257                   value="${t}">
7258            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">The artifact BuildPatchTool uploads to</p>
7259          </div>
7260          <div>
7261            <label for="integration_config_sandbox_id" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Sandbox ID *</label>
7262            <input type="text" name="integration[config][sandbox_id]" id="integration_config_sandbox_id"
7263                   class="bs-input"
7264                   autocomplete="new-password"
7265                   required
7266                   placeholder="Sandbox the build is labeled in"
7267                   data-testid="epic-config-sandbox-id"
7268                   value="${e}">
7269            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">For example, your Dev sandbox</p>
7270          </div>
7271          <div>
7272            <label for="integration_config_deployment_id" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Deployment ID *</label>
7273            <input type="text" name="integration[config][deployment_id]" id="integration_config_deployment_id"
7274                   class="bs-input"
7275                   autocomplete="new-password"
7276                   required
7277                   placeholder="Deployment in that sandbox"
7278                   data-testid="epic-config-deployment-id"
7279                   value="${n}">
7280            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">The deployment in the sandbox above</p>
7281          </div>
7282          <div>
7283            <label for="integration_config_portal_org_slug" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Portal organization slug</label>
7284            <input type="text" name="integration[config][portal_org_slug]" id="integration_config_portal_org_slug"
7285                   class="bs-input"
7286                   autocomplete="off"
7287                   placeholder="Optional"
7288                   data-testid="epic-config-portal-org-slug"
7289                   value="${s}">
7290            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">From your portal URL: dev.epicgames.com/portal/&lt;org&gt;/products/&lt;product&gt;/...</p>
7291          </div>
7292          <div>
7293            <label for="integration_config_portal_product_slug" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Portal product slug</label>
7294            <input type="text" name="integration[config][portal_product_slug]" id="integration_config_portal_product_slug"
7295                   class="bs-input"
7296                   autocomplete="off"
7297                   placeholder="Optional"
7298                   data-testid="epic-config-portal-product-slug"
7299                   value="${r}">
7300            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">From your portal URL: dev.epicgames.com/portal/&lt;org&gt;/products/&lt;product&gt;/...</p>
7301          </div>
7302        </div>
7303      </div>
7304    `}getEpicGamesStoreCredentials(){return`
7305      <div id="epic_games_store-credentials" class="integration-credentials" data-testid="epic-credentials-section">
7306        <div class="bs-banner bs-banner--info" style="margin-bottom: 16px;">
7307          <p style="color: var(--bs-info); font-size: 13px;">
7308            Both are <strong>optional</strong> and not used by ButterStack yet. BuildPatchTool reads its client
7309            credentials from your CI secret store; store them here only if you want them on file for a future native upload.
7310          </p>
7311        </div>
7312        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
7313          <div>
7314            <label for="integration_credentials_client_id" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">BuildPatchTool Client ID (optional)</label>
7315            <input type="text" name="integration[credentials][client_id]" id="integration_credentials_client_id"
7316                   class="bs-input"
7317                   autocomplete="new-password"
7318                   placeholder="Client ID"
7319                   data-testid="epic-credentials-client-id"
7320                   value="${this.getExistingValue("integration[credentials][client_id]")||""}">
7321          </div>
7322          <div>
7323            <label for="integration_credentials_client_secret" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">BuildPatchTool Client Secret (optional)</label>
7324            <input type="password" name="integration[credentials][client_secret]" id="integration_credentials_client_secret"
7325                   class="bs-input"
7326                   autocomplete="new-password"
7327                   placeholder="Client secret"
7328                   data-testid="epic-credentials-client-secret">
7329          </div>
7330        </div>
7331      </div>
7332    `}getLinearConfig(){let i=this.getExistingValue("integration[config][team_key]")||"",t=this.getExistingValue("integration[config][project_filter]")||"";return`
7333      <div id="linear-config" class="integration-config" data-testid="linear-config-section">
7334        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
7335          <div>
7336            <label for="integration_config_team_key" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Team key *</label>
7337            <input type="text" name="integration[config][team_key]" id="integration_config_team_key"
7338                   class="bs-input"
7339                   autocomplete="off"
7340                   required
7341                   placeholder="BUT"
7342                   data-testid="linear-config-team-key"
7343                   value="${i}">
7344            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">The prefix of the team's issue identifiers: BUT for BUT-12</p>
7345          </div>
7346          <div>
7347            <label for="integration_config_project_filter" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">Project filter (optional)</label>
7348            <input type="text" name="integration[config][project_filter]" id="integration_config_project_filter"
7349                   class="bs-input"
7350                   autocomplete="off"
7351                   placeholder="Linear project name or ID"
7352                   data-testid="linear-config-project-filter"
7353                   value="${t}">
7354            <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">When set, only that project's issues sync</p>
7355          </div>
7356        </div>
7357        <div class="mt-4">
7358          <input type="hidden" name="integration[config][complete_on_deploy]" value="false">
7359          <label for="integration_config_complete_on_deploy" class="flex items-center">
7360            <input type="checkbox" name="integration[config][complete_on_deploy]" id="integration_config_complete_on_deploy" value="true"
7361                   class="bs-checkbox" style="accent-color: var(--bs-accent);"
7362                   data-testid="linear-complete-on-deploy">
7363            <span class="bs-fg-soft-text" style="margin-left: 8px; font-size: 13px; font-weight: 500;">Move issue to Done when deployed</span>
7364          </label>
7365          <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">Every linked issue gets a comment with the deployment link either way</p>
7366        </div>
7367      </div>
7368    `}getLinearCredentials(){return`
7369      <div id="linear-credentials" class="integration-credentials" data-testid="linear-credentials-section">
7370        <div>
7371          <label for="integration_credentials_api_key" class="bs-fg-soft-text" style="display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px;">API Key *</label>
7372          <input type="password" name="integration[credentials][api_key]" id="integration_credentials_api_key"
7373                 class="bs-input"
7374                 autocomplete="new-password"
7375                 required
7376                 placeholder="lin_api_..."
7377                 data-testid="linear-credentials-api-key">
7378          <p class="bs-fg-mute-text" style="font-size: 12px; margin-top: 4px;">A personal API key from <a href="https://linear.app/settings/account/security" target="_blank" rel="noopener" class="bs-accent-text">Linear Settings &gt; Security &amp; access</a></p>
7379        </div>
7380      </div>
7381    `}getDefaultConfig(){return`
7382      <div id="default-config" class="integration-config">
7383        <p class="text-sm" style="color: var(--bs-fg-soft);">Select an integration type to see configuration options.</p>
7384      </div>
7385    `}getDefaultCredentials(){return`
7386      <div id="default-credentials" class="integration-credentials">
7387        <p class="text-sm" style="color: var(--bs-fg-soft);">Select an integration type to see credential fields.</p>
7388      </div>
7389    `}getExistingValue(i){let t=this.element.querySelector(`[name="${i}"]`);return t?t.value:""}getDepotSelectorHTML(){let i=this.getSelectedDepots();return`
7390      <div class="depot-selector" 
7391           data-controller="depot-selector"
7392           data-depot-selector-integration-id-value="${this.getIntegrationId()}"
7393           data-depot-selector-project-id-value="${this.getProjectId()}"
7394           data-depot-selector-selected-depots-value='${i}'
7395           data-depot-selector-available-depots-value='${this.getAvailableDepots()}'>
7396        
7397        <div class="mb-4">
7398          <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">
7399            Depot Selection
7400          </label>
7401          <p class="text-xs mb-4" style="color: var(--bs-fg-mute);">
7402            Select which depots this integration should monitor. If no depots are selected, all available depots will be monitored.
7403          </p>
7404        </div>
7405
7406        <!-- Loading state -->
7407        <div class="depot-loading hidden" data-depot-selector-target="loading">
7408          <div class="flex items-center justify-center py-8">
7409            <div class="flex items-center space-x-2">
7410              <div class="animate-spin rounded-full h-4 w-4" style="border-bottom: 2px solid var(--bs-accent);"></div>
7411              <span class="text-sm" style="color: var(--bs-fg-mute);">Loading depots...</span>
7412            </div>
7413          </div>
7414        </div>
7415
7416        <!-- Placeholder state for new integrations -->
7417        <div class="depot-placeholder" data-depot-selector-target="placeholder">
7418          <div class="rounded-lg p-6" style="background: var(--bs-info-soft); border: 1px solid var(--bs-info-soft);">
7419            <div class="text-center">
7420              <svg class="mx-auto h-12 w-12" style="color: var(--bs-info); mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7421                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z"/>
7422              </svg>
7423              <h4 class="text-lg font-medium mb-2" style="color: var(--bs-info);">Depot Selection</h4>
7424              <p class="text-sm" style="color: var(--bs-fg-soft); mb-4">
7425                Configure server connection first, then save the integration to enable depot selection.
7426              </p>
7427              <p class="text-xs" style="color: var(--bs-info);">
7428                Depot selection will be available after saving
7429              </p>
7430            </div>
7431          </div>
7432        </div>
7433
7434        <!-- Error state -->
7435        <div class="depot-error hidden" data-depot-selector-target="error">
7436          <div class="rounded-lg p-4" style="background: var(--bs-err-soft); border: 1px solid var(--bs-err-soft);">
7437            <div class="flex">
7438              <svg class="h-5 w-5" style="color: var(--bs-err); mt-0.5" fill="currentColor" viewBox="0 0 20 20">
7439                <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
7440              </svg>
7441              <div class="ml-3">
7442                <h4 class="text-sm font-medium" style="color: var(--bs-err);">Unable to load depots</h4>
7443                <p class="text-sm mt-1" style="color: var(--bs-fg-soft);" data-depot-selector-target="errorMessage">
7444                  Please ensure the integration is properly configured and test the connection.
7445                </p>
7446              </div>
7447            </div>
7448          </div>
7449        </div>
7450
7451        <!-- Main depot selector interface -->
7452        <div class="depot-interface hidden" data-depot-selector-target="interface">
7453          <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
7454            
7455            <!-- Available Depots (Left) -->
7456            <div class="space-y-3">
7457              <div class="flex items-center justify-between">
7458                <h4 class="text-sm font-medium" style="color: var(--bs-fg);">Available Depots</h4>
7459                <span class="text-xs" style="color: var(--bs-fg-mute);" data-depot-selector-target="availableCount">0 depots</span>
7460              </div>
7461              
7462              <!-- Search -->
7463              <div class="relative">
7464                <svg class="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4" style="color: var(--bs-fg-mute);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7465                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
7466                </svg>
7467                <input type="text" 
7468                       placeholder="Search depots..." 
7469                       class="bs-input" style="padding-left: 2.5rem;"
7470                       data-depot-selector-target="searchInput"
7471                       data-action="input->depot-selector#filterDepots">
7472              </div>
7473              
7474              <!-- Available depot list -->
7475              <div class="rounded-lg min-h-48 max-h-64 overflow-y-auto" style="border: 1px solid var(--bs-line); background: var(--bs-bg-panel-2);">
7476                <div class="p-3 space-y-1" data-depot-selector-target="availableList">
7477                  <!-- Available depots will be populated here -->
7478                </div>
7479                <div class="depot-empty-state hidden p-6 text-center" data-depot-selector-target="availableEmpty">
7480                  <svg class="mx-auto h-8 w-8 mb-2" style="color: var(--bs-fg-mute);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7481                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2M4 13h2m13-8l-8 8-4-4m0 9l4-4 8 8-12 0z"/>
7482                  </svg>
7483                  <p class="text-sm" style="color: var(--bs-fg-mute);">No depots available</p>
7484                </div>
7485              </div>
7486            </div>
7487
7488            <!-- Selected Depots (Right) -->
7489            <div class="space-y-3">
7490              <div class="flex items-center justify-between">
7491                <h4 class="text-sm font-medium" style="color: var(--bs-fg);">Selected Depots</h4>
7492                <span class="text-xs" style="color: var(--bs-fg-mute);" data-depot-selector-target="selectedCount">0 selected</span>
7493              </div>
7494              
7495              <!-- Action buttons -->
7496              <div class="flex space-x-2">
7497                <button type="button" 
7498                        class="flex-1 px-3 py-2 text-xs rounded-lg transition-colors" style="background: var(--bs-accent-soft); color: var(--bs-accent); border: 1px solid var(--bs-accent-soft);"
7499                        data-action="click->depot-selector#selectAll"
7500                        data-depot-selector-target="selectAllBtn">
7501                  Select All
7502                </button>
7503                <button type="button" 
7504                        class="flex-1 px-3 py-2 text-xs rounded-lg transition-colors" style="background: var(--bs-bg-panel-2); color: var(--bs-fg); border: 1px solid var(--bs-line);"
7505                        data-action="click->depot-selector#clearAll"
7506                        data-depot-selector-target="clearAllBtn">
7507                  Clear All
7508                </button>
7509              </div>
7510              
7511              <!-- Selected depot list -->
7512              <div class="rounded-lg min-h-48 max-h-64 overflow-y-auto" style="border: 1px solid var(--bs-line); background: var(--bs-bg-panel-2);">
7513                <div class="p-3 space-y-1" data-depot-selector-target="selectedList">
7514                  <!-- Selected depots will be populated here -->
7515                </div>
7516                <div class="depot-empty-state" data-depot-selector-target="selectedEmpty">
7517                  <div class="p-6 text-center">
7518                    <svg class="mx-auto h-8 w-8 mb-2" style="color: var(--bs-fg-mute);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7519                      <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"/>
7520                    </svg>
7521                    <p class="text-sm" style="color: var(--bs-fg-mute);">No depots selected</p>
7522                    <p class="text-xs mt-1" style="color: var(--bs-fg-faint);">All available depots will be monitored</p>
7523                  </div>
7524                </div>
7525              </div>
7526            </div>
7527          </div>
7528
7529          <!-- Hidden input to store selected depot names -->
7530          <input type="hidden" 
7531                 name="integration[config][selected_depots]" 
7532                 data-depot-selector-target="hiddenInput"
7533                 value="${i}">
7534        </div>
7535      </div>
7536    `}getJobSelectorHTML(){let i=this.getSelectedJobs(),t=this.getIntegrationId(),e=this.getProjectId();return`
7537      <div class="mb-4">
7538        <label class="block text-sm font-medium mb-2" style="color: var(--bs-fg-mute);">
7539          Jenkins Job Selection
7540        </label>
7541        <p class="text-xs mb-4" style="color: var(--bs-fg-mute);">
7542          Select which Jenkins jobs can be triggered by this integration. If no jobs are selected, all jobs are allowed.
7543        </p>
7544      </div>
7545      
7546      <div id="job-selector" class="space-y-4" 
7547           data-controller="job-selector"
7548           data-integration-id="${t}"
7549           data-project-id="${e}">
7550        ${this.renderJobSelector()}
7551      </div>
7552    `}renderJobSelector(){let i=this.getIntegrationId(),t=this.getSelectedJobs();return i?`
7553        <!-- Loading State -->
7554        <div class="job-selector-loading" data-job-selector-target="loading">
7555          <div class="flex items-center justify-center py-8">
7556            <div class="flex items-center space-x-3">
7557              <svg class="animate-spin h-5 w-5" style="color: var(--bs-accent);" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
7558                <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
7559                <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
7560              </svg>
7561              <span class="text-sm" style="color: var(--bs-fg-soft);">Loading Jenkins jobs...</span>
7562            </div>
7563          </div>
7564        </div>
7565
7566        <!-- Error State -->
7567        <div class="job-selector-error hidden" data-job-selector-target="error">
7568          <div class="rounded-lg p-4" style="background: var(--bs-err-soft); border: 1px solid var(--bs-err-soft);">
7569            <div class="flex">
7570              <div class="flex-shrink-0">
7571                <svg class="h-5 w-5" style="color: var(--bs-err);" viewBox="0 0 20 20" fill="currentColor">
7572                  <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
7573                </svg>
7574              </div>
7575              <div class="ml-3">
7576                <h3 class="text-sm font-medium" style="color: var(--bs-err);">Error loading jobs</h3>
7577                <p class="mt-1 text-sm" style="color: var(--bs-fg-soft);" data-job-selector-target="errorMessage"></p>
7578              </div>
7579            </div>
7580          </div>
7581        </div>
7582
7583        <!-- Main Job Selector Interface -->
7584        <div class="job-selector-main hidden" data-job-selector-target="main">
7585          <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
7586            <!-- Available Jobs Column -->
7587            <div>
7588              <div class="rounded-lg" style="background: var(--bs-bg-panel); border: 1px solid var(--bs-line);">
7589                <div class="px-4 py-3" style="border-bottom: 1px solid var(--bs-line);">
7590                  <h3 class="text-sm font-medium" style="color: var(--bs-fg);">Available Jobs</h3>
7591                  <div class="mt-2">
7592                    <input type="text" 
7593                           placeholder="Search jobs..." 
7594                           data-job-selector-target="searchInput"
7595                           data-action="input->job-selector#filterJobs"
7596                           class="bs-input">
7597                  </div>
7598                  <div class="mt-2 flex items-center justify-between">
7599                    <span class="text-xs" style="color: var(--bs-fg-mute);">
7600                      <span data-job-selector-target="availableCount">0</span> jobs available
7601                    </span>
7602                    <button type="button" 
7603                            data-action="click->job-selector#selectAll"
7604                            class="text-xs" style="color: var(--bs-accent);">
7605                      Select All
7606                    </button>
7607                  </div>
7608                </div>
7609                <div class="overflow-y-auto max-h-64">
7610                  <div class="divide-y divide-slate-200 dark:divide-slate-700" data-job-selector-target="availableList">
7611                    <!-- Available jobs will be populated here -->
7612                  </div>
7613                </div>
7614              </div>
7615            </div>
7616
7617            <!-- Selected Jobs Column -->
7618            <div>
7619              <div class="rounded-lg" style="background: var(--bs-bg-panel); border: 1px solid var(--bs-line);">
7620                <div class="px-4 py-3" style="border-bottom: 1px solid var(--bs-line);">
7621                  <h3 class="text-sm font-medium" style="color: var(--bs-fg);">Selected Jobs</h3>
7622                  <div class="mt-2 flex items-center justify-between">
7623                    <span class="text-xs" style="color: var(--bs-fg-mute);">
7624                      <span data-job-selector-target="selectedCount">0</span> jobs selected
7625                    </span>
7626                    <button type="button" 
7627                            data-action="click->job-selector#clearAll"
7628                            class="text-xs" style="color: var(--bs-accent);">
7629                      Clear All
7630                    </button>
7631                  </div>
7632                </div>
7633                <div class="overflow-y-auto max-h-64">
7634                  <div class="divide-y divide-slate-200 dark:divide-slate-700" data-job-selector-target="selectedList">
7635                    <!-- Selected jobs will be populated here -->
7636                  </div>
7637                </div>
7638              </div>
7639            </div>
7640          </div>
7641
7642          <!-- Hidden input to store selected job names -->
7643          <input type="hidden" 
7644                 name="integration[config][selected_jobs]" 
7645                 data-job-selector-target="selectedJobsInput"
7646                 value="${t}">
7647        </div>
7648      `:`
7649        <div class="job-selector-placeholder" data-job-selector-target="placeholder">
7650          <div class="rounded-lg p-6" style="background: var(--bs-info-soft); border: 1px solid var(--bs-info-soft);">
7651            <div class="text-center">
7652              <svg class="mx-auto h-12 w-12" style="color: var(--bs-info); mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7653                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
7654              </svg>
7655              <h4 class="text-lg font-medium mb-2" style="color: var(--bs-info);">Job Selection</h4>
7656              <p class="text-sm" style="color: var(--bs-fg-soft); mb-4">
7657                Configure server connection first, then save the integration to enable job selection.
7658              </p>
7659              <p class="text-xs" style="color: var(--bs-info);">
7660                Job selection will be available after saving
7661              </p>
7662            </div>
7663          </div>
7664        </div>
7665      `}getSelectedJobs(){let i=this.getExistingValue("integration[config][selected_jobs]");return i||this.configSectionTarget.dataset.jenkinsSelectedJobs||"[]"}getIntegrationId(){let t=window.location.pathname.match(/\/integrations\/(\d+)/);return t?t[1]:""}getProjectId(){let t=window.location.pathname.match(/\/projects\/(\d+)/);return t?t[1]:""}getAvailableDepots(){let i=document.querySelector("[data-available-depots]");return i?i.dataset.availableDepots:"[]"}getSelectedDepots(){let i=document.querySelector("[data-selected-depots]");return i?i.dataset.selectedDepots:"[]"}};var $B={};Le($B,{default:()=>WB});var WB=class extends le{static targets=["usernameContainer","tokenContainer"];connect(){this.createFields()}createFields(){if(this.hasUsernameContainerTarget){let i=document.createElement("input");i.type="text",i.name="integration[credentials][jenkins_username]",i.className="bs-input",i.placeholder="jenkins-user",i.value=this.usernameContainerTarget.dataset.storedUsername||"",i.autocomplete="nope",i.setAttribute("data-lpignore","true"),this.usernameContainerTarget.appendChild(i)}if(this.hasTokenContainerTarget){let i=document.createElement("input");i.type="text",i.name="integration[credentials][jenkins_api_token]",i.className="bs-input",i.placeholder="\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",i.value=this.tokenContainerTarget.dataset.storedToken||"",i.autocomplete="nope",i.setAttribute("data-lpignore","true"),this.tokenContainerTarget.appendChild(i)}}};var qB={};Le(qB,{default:()=>GB});var GB=class extends le{static targets=["jobName","templateType","engineType","engineOptions","loading","error","errorMessage"];static values={integrationId:Number,projectId:Number};connect(){this.templateTypeTarget.addEventListener("change",this.toggleEngineOptions.bind(this)),this.toggleEngineOptions()}toggleEngineOptions(){let i=this.templateTypeTarget.value;i==="unreal"||i==="unity"?this.engineOptionsTarget.classList.remove("hidden"):this.engineOptionsTarget.classList.add("hidden")}createJob(i){i.preventDefault();let t=i.currentTarget,e=t.innerHTML,n=this.jobNameTarget.value.trim(),s=this.templateTypeTarget.value,r=this.engineTypeTarget.value;if(!n){this.showError("Please enter a job name");return}this.hideError(),this.showLoading(),t.disabled=!0;let o={job_name:n,template_type:s,engine_type:r,build_platforms:this.getBuildPlatforms(r),engine_version:this.getEngineVersion(r)};console.log("Creating Jenkins job with data:",o),console.log("URL:",`/projects/${this.projectIdValue}/integrations/${this.integrationIdValue}
7665/create_jenkins_job`),fetch(`/projects/${this.projectIdValue}/integrations/${this.integrationIdValue}/create_jenkins_job`,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content,Accept:"application/json"},body:JSON.stringify(o)}).then(a=>(a.ok||(console.error("Response status:",a.status),console.error("Response headers:",a.headers)),a.json())).then(a=>{console.log("Response data:",a),a.success?(this.hideLoading(),this.showSuccessModal(a),this.resetForm()):(this.hideLoading(),this.showError(a.error||"Failed to create Jenkins job"),t.disabled=!1)}).catch(a=>{console.error("Error:",a),this.hideLoading(),this.showError("An error occurred while creating the Jenkins job"),t.disabled=!1})}getBuildPlatforms(i){switch(i){case"unreal":return"Linux,Windows";case"unity":return"StandaloneLinux64,StandaloneWindows64";default:return"Linux"}}getEngineVersion(i){switch(i){case"unreal":return"5.3";case"unity":return"2022.3.10f1";default:return"1.0"}}resetForm(){this.templateTypeTarget.value="generic",this.engineTypeTarget.value="generic"}showSuccessModal(i){let t=document.createElement("div");t.style.cssText="position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); z-index: 50; overflow-y: auto;",t.addEventListener("click",s=>{s.target===t&&t.remove()});let e=document.createElement("div");e.className="flex items-center justify-center min-h-screen p-4";let n=document.createElement("div");n.className="bs-card",n.style.cssText="max-width: 42rem; width: 100%; margin: 32px auto; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);",n.addEventListener("click",s=>s.stopPropagation()),n.innerHTML=`
7666      <div class="p-6" style="border-bottom: 1px solid var(--bs-line);">
7667        <div class="flex items-center">
7668          <div class="w-12 h-12 rounded-full flex items-center justify-center mr-4" style="background: var(--bs-ok-soft);">
7669            <svg class="w-6 h-6" style="color: var(--bs-ok);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7670              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
7671            </svg>
7672          </div>
7673          <div>
7674            <h3 class="text-lg font-semibold" style="color: var(--bs-fg); margin: 0;">Jenkins Job Created Successfully!</h3>
7675            <p class="text-sm" style="color: var(--bs-fg-mute); margin: 0;">Your Jenkins job has been created with ButterStack webhook integration</p>
7676          </div>
7677        </div>
7678      </div>
7679
7680      <div class="p-6">
7681        <div class="space-y-4">
7682          <div>
7683            <label class="block text-sm font-medium mb-1" style="color: var(--bs-fg-mute);">Job URL</label>
7684            <div class="flex items-center space-x-2">
7685              <code class="flex-1 px-3 py-2 rounded text-sm" style="background: var(--bs-bg-panel-2); color: var(--bs-fg); border: 1px solid var(--bs-line);">
7686                ${i.job_url}
7687              </code>
7688              <button class="bs-btn bs-btn-primary copy-job-url"
7689                      data-url="${i.job_url}">
7690                Copy
7691              </button>
7692            </div>
7693          </div>
7694
7695          <div>
7696            <label class="block text-sm font-medium mb-1" style="color: var(--bs-fg-mute);">Webhook URL</label>
7697            <div class="flex items-center space-x-2">
7698              <code class="flex-1 px-3 py-2 rounded text-sm overflow-x-auto whitespace-nowrap" style="background: var(--bs-bg-panel-2); color: var(--bs-fg); border: 1px solid var(--bs-line);">
7699                ${i.webhook_url}
7700              </code>
7701              <button class="bs-btn bs-btn-primary copy-webhook-url flex-shrink-0"
7702                      data-url="${i.webhook_url}">
7703                Copy
7704              </button>
7705            </div>
7706          </div>
7707
7708          <div class="rounded-lg p-4" style="background: var(--bs-info-soft); border: 1px solid var(--bs-info-soft);">
7709            <div class="flex">
7710              <svg class="h-5 w-5 mt-0.5 mr-2" style="color: var(--bs-info);" fill="currentColor" viewBox="0 0 20 20">
7711                <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
7712              </svg>
7713              <div>
7714                <h4 class="text-sm font-medium" style="color: var(--bs-info); margin: 0;">Next Steps</h4>
7715                <ul class="mt-2 text-sm space-y-1" style="color: var(--bs-fg-soft);">
7716                  <li>\u2022 Jenkins job is ready to use and includes webhook notifications</li>
7717                  <li>\u2022 Test the job by clicking "Build Now" in Jenkins</li>
7718                  <li>\u2022 Build status will be reported back to ButterStack automatically</li>
7719                  <li>\u2022 Configure additional build parameters as needed</li>
7720                </ul>
7721              </div>
7722            </div>
7723          </div>
7724        </div>
7725      </div>
7726
7727      <div class="p-6 flex justify-between" style="border-top: 1px solid var(--bs-line);">
7728        <div class="flex space-x-2">
7729          <a href="${i.job_url}" target="_blank" class="bs-btn" style="background: var(--bs-warn); color: #fff; border-color: transparent;">
7730            <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7731              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"/>
7732            </svg>
7733            Open in Jenkins
7734          </a>
7735
7736          <button class="bs-btn download-credentials" style="background: var(--bs-ok); color: #fff; border-color: transparent;"
7737                  data-job-name="${i.job_name||"jenkins-job"}"
7738                  data-job-url="${i.job_url}"
7739                  data-webhook-url="${i.webhook_url}">
7740            <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7741              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"/>
7742            </svg>
7743            Download Credentials
7744          </button>
7745        </div>
7746
7747        <button class="bs-btn bs-btn-ghost close-modal">
7748          Close
7749        </button>
7750      </div>
7751    `,n.querySelector(".copy-job-url").onclick=s=>{let r=s.target.dataset.url;navigator.clipboard.writeText(r),s.target.textContent="Copied!",setTimeout(()=>s.target.textContent="Copy",1e3)}
7751,n.querySelector(".copy-webhook-url").onclick=s=>{let r=s.target.dataset.url;navigator.clipboard.writeText(r),s.target.textContent="Copied!",setTimeout(()=>s.target.textContent="Copy",1e3)},n.querySelector(".download-credentials").onclick=s=>{let r=s.currentTarget.dataset.jobName,o=s.currentTarget.dataset.jobUrl,a=s.currentTarget.dataset.webhookUrl,l=`Jenkins Job Credentials
7752========================
7753
7754Job Name: ${r}
7755Job URL: ${o}
7756Webhook URL: ${a}
7757
7758Jenkins Integration Details
7759---------------------------
7760Server: ${o.split("/job/")[0]}/
7761Username: ${this.integrationIdValue?"Check your integration settings":"N/A"}
7762
7763Next Steps
7764----------
77651. Jenkins job is ready to use and includes webhook notifications
77662. Test the job by clicking "Build Now" in Jenkins
77673. Build status will be reported back to ButterStack automatically
77684. Configure additional build parameters as needed
7769
7770Important Notes
7771---------------
7772- Keep these credentials secure
7773- The webhook URL contains your unique authentication token
7774- Do not share the webhook URL publicly
7775- If you need to regenerate the webhook token, edit your Jenkins integration in ButterStack
7776
7777Generated by ButterStack on ${new Date().toLocaleString()}
7778`,c=new Blob([l],{type:"text/plain"}),u=window.URL.createObjectURL(c),h=document.createElement("a");h.href=u,h.download=`jenkins-credentials-${r}.txt`,document.body.appendChild(h),h.click(),document.body.removeChild(h),window.URL.revokeObjectURL(u)},n.querySelector(".close-modal").onclick=()=>t.remove(),e.appendChild(n),t.appendChild(e),document.body.appendChild(t)}showLoading(){this.hasLoadingTarget&&this.loadingTarget.classList.remove("hidden")}hideLoading(){this.hasLoadingTarget&&this.loadingTarget.classList.add("hidden")}showError(i){this.hasErrorTarget&&this.hasErrorMessageTarget&&(this.errorMessageTarget.textContent=i,this.errorTarget.classList.remove("hidden"))}hideError(){this.hasErrorTarget&&this.errorTarget.classList.add("hidden")}showNotification(i,t="info"){let e=t==="success"?"var(--bs-ok)":t==="error"?"var(--bs-err)":"var(--bs-info)",n=document.createElement("div");n.style.cssText=`
7779      position: fixed; top: 16px; right: 16px; z-index: 50;
7780      padding: 14px 20px; border-radius: var(--bs-r-md);
7781      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
7782      background: ${e}; color: #fff; font-size: 13px;
7783      transform: translateX(100%); transition: transform 300ms ease;
7784    `,n.innerHTML=`
7785      <div style="display: flex; align-items: center; gap: 16px;">
7786        <span>${i}</span>
7787        <button style="background: transparent; border: 0; color: #fff; opacity: 0.75; cursor: pointer; padding: 0; display: inline-flex;" onclick="this.parentElement.parentElement.remove()">
7788          <svg style="width: 16px; height: 16px;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7789            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
7790          </svg>
7791        </button>
7792      </div>
7793    `,document.body.appendChild(n),setTimeout(()=>{n.style.transform="translateX(0)"},10),setTimeout(()=>{n.style.transform="translateX(100%)",setTimeout(()=>n.remove(),300)},5e3)}};var XB={};Le(XB,{default:()=>YB});var YB=class extends le{static values={integrationId:Number,projectId:Number};async setupJenkinsTrigger(){let i=event.currentTarget,t=i.innerHTML;i.disabled=!0,i.innerHTML=`
7794      <svg class="animate-spin w-4 h-4 mr-2" fill="none" viewBox="0 0 24 24">
7795        <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
7796        <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
7797      </svg>
7798      Loading...
7799    `;try{let n=await(await fetch(`/projects/${this.projectIdValue}/integrations/${this.integrationIdValue}/jenkins_trigger_setup`,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content,Accept:"application/json"}})).json();n.success?this.showJenkinsSetupModal(n):this.showError(n.error||"Failed to get Jenkins trigger setup")}catch(e){console.error("Jenkins trigger setup failed:",e),this.showError("Network error occurred")}finally{i.disabled=!1,i.innerHTML=t}}showJenkinsSetupModal(i){let t=i.jenkins_setup,e=document.createElement("div");e.style.cssText="position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); z-index: 50; overflow-y: auto;",e.addEventListener("click",h=>{h.target===e&&e.remove()});let n=document.createElement("div");n.className="flex items-center justify-center min-h-screen p-4";let s=document.createElement("div");s.className="bs-card",s.style.cssText="max-width: 56rem; width: 100%; margin: 32px auto; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);",s.addEventListener("click",h=>h.stopPropagation());let r=t.jenkins_integration_exists?"\u2705":"\u274C",o=t.trigger_configured?"\u2705":"\u26A0\uFE0F",a="",l="";t.jenkins_integration_exists?t.trigger_configured?a=`
7800        <div class="rounded-lg p-4" style="background: var(--bs-ok-soft); border: 1px solid var(--bs-ok-soft);">
7801          <div class="flex items-center">
7802            <svg class="w-5 h-5 mr-3" style="color: var(--bs-ok);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7803              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
7804            </svg>
7805            <div>
7806              <h4 class="font-medium" style="color: var(--bs-ok);">Jenkins Triggers Configured</h4>
7807              <p class="text-sm mt-1" style="color: var(--bs-fg-soft);">Your Perforce server is configured to trigger Jenkins builds automatically.</p>
7808              ${t.existing_trigger?`
7809                <div class="mt-2 text-xs font-mono p-2 rounded" style="color: var(--bs-fg-soft); background: var(--bs-ok-soft);">
7810                  ${t.existing_trigger.name}: ${t.existing_trigger.command}
7811                </div>
7812              `:""}
7813            </div>
7814          </div>
7815        </div>
7816      `:l=`
7817        <div class="mt-6">
7818          <h4 class="text-lg font-semibold mb-4" style="color: var(--bs-fg);">
7818Setup Instructions</h4>
7819          
7820          <div class="space-y-4">
7821            <div class="rounded-lg p-4" style="border: 1px solid var(--bs-line);">
7822              <h5 class="font-medium mb-2" style="color: var(--bs-fg);">Step 1: Edit Perforce Triggers</h5>
7823              <div class="flex items-center space-x-2">
7824                <code class="flex-1 px-3 py-2 rounded font-mono text-sm" style="background: var(--bs-bg-panel-2); color: var(--bs-fg);">p4 triggers -e</code>
7825                <button class="px-3 py-2 bs-btn bs-btn-ghost copy-cmd" data-command="p4 triggers -e">Copy</button>
7826              </div>
7827            </div>
7828            
7829            <div class="rounded-lg p-4" style="border: 1px solid var(--bs-line);">
7830              <h5 class="font-medium mb-2" style="color: var(--bs-fg);">Step 2: Add This Line to the Triggers Section</h5>
7831              <div class="flex items-center space-x-2">
7832                <code class="flex-1 px-3 py-2 rounded font-mono text-sm" style="background: var(--bs-bg-panel-2); color: var(--bs-fg); break-all">${t.trigger_command}</code>
7833                <button class="px-3 py-2 bs-btn bs-btn-primary copy-trigger-cmd">Copy</button>
7834              </div>
7835            </div>
7836            
7837            <div class="rounded-lg p-4" style="border: 1px solid var(--bs-line);">
7838              <h5 class="font-medium mb-2" style="color: var(--bs-fg);">Step 3: Create the Trigger Script</h5>
7839              <p class="text-sm mb-2" style="color: var(--bs-fg-soft);">Create the file <code class="" style="color: var(--bs-accent);">${t.recommended_setup.script_path}</code> with the following content:</p>
7840              <div class="relative">
7841                <pre class="p-3 rounded font-mono text-sm" style="background: var(--bs-bg-panel-2); color: var(--bs-fg); overflow-x-auto">#!/bin/bash
7842# Jenkins Build Trigger for Perforce
7843# This script is called by Perforce triggers to notify Jenkins of changes
7844
7845CHANGELIST=$1
7846
7847# Jenkins job configuration
7848JENKINS_URL="${t.jenkins_integrations[0]?.url||"http://your-jenkins-server:8080"}"
7849JOB_NAME="${t.jenkins_integrations[0]?.job_name||"ButterStack-Build"}"
7850JENKINS_USER="${t.jenkins_integrations[0]?.username||"your-jenkins-user"}"
7851JENKINS_TOKEN="${t.jenkins_integrations[0]?.api_token||"YOUR-JENKINS-API-TOKEN-HERE"}"
7852
7853# Trigger Jenkins build with changelist parameter
7854curl -X POST \\
7855  -u "\${JENKINS_USER}:\${JENKINS_TOKEN}" \\
7856  "\${JENKINS_URL}/job/\${JOB_NAME}/buildWithParameters?CHANGELIST=\${CHANGELIST}" \\
7857  --fail --silent --show-error
7858
7859# Log the trigger (optional)
7860echo "[$(date)] Triggered Jenkins build for changelist \${CHANGELIST}" >> /var/log/jenkins-trigger.log
7861
7862exit 0</pre>
7863                <button class="absolute top-2 right-2 px-3 py-1 bs-btn bs-btn-primary copy-script">Copy Script</button>
7864              </div>
7865              <div class="mt-2 text-sm" style="color: var(--bs-fg-soft);">
7866                <p>Make the script executable:</p>
7867                <div class="flex items-center space-x-2 mt-1">
7868                  <code class="flex-1 px-3 py-2 rounded font-mono text-sm" style="background: var(--bs-bg-panel-2); color: var(--bs-fg);">chmod +x ${t.recommended_setup.script_path}</code>
7869                  <button class="px-3 py-2 bs-btn bs-btn-ghost copy-cmd" data-command="chmod +x ${t.recommended_setup.script_path}">Copy</button>
7870                </div>
7871              </div>
7872            </div>
7873            
7874            <div class="rounded-lg p-4" style="border: 1px solid var(--bs-line);">
7875              <h5 class="font-medium mb-2" style="color: var(--bs-fg);">Step 4: Save and Verify</h5>
7876              <div class="flex items-center space-x-2">
7877                <code class="flex-1 px-3 py-2 rounded font-mono text-sm" style="background: var(--bs-bg-panel-2); color: var(--bs-fg);">p4 triggers -o</code>
7878                <button class="px-3 py-2 bs-btn bs-btn-ghost copy-cmd" data-command="p4 triggers -o">Copy</button>
7879              </div>
7880              <p class="text-sm mt-2" style="color: var(--bs-fg-mute);">Look for: <code class="" style="color: var(--bs-accent);">${t.recommended_setup.trigger_name}</code> trigger in the output</p>
7881            </div>
7882          </div>
7883        </div>
7884      `:a=`
7885        <div class="bg-warn-soft dark:bg-warn/20 border border-warn-soft dark:border-warn rounded-lg p-4">
7886          <div class="flex items-center">
7887            <svg class="w-5 h-5 text-warn dark:text-warn mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7888              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"/>
7889            </svg>
7890            <div>
7891              <h4 class="font-medium text-warn dark:text-warn-soft">Jenkins Integration Required</h4>
7892              <p class="text-sm text-warn dark:text-warn mt-1">You need to set up a Jenkins integration first before configuring build triggers.</p>
7893            </div>
7894          </div>
7895        </div>
7896      `,s.innerHTML=`
7897      <div class="p-6" style="border-bottom: 1px solid var(--bs-line);">
7898        <div class="flex items-center justify-between">
7899          <div>
7900            <h3 class="text-xl font-semibold" style="color: var(--bs-fg);">Jenkins Build Triggers</h3>
7901            <p class="text-sm mt-1" style="color: var(--bs-fg-mute);">Configure Perforce to automatically trigger Jenkins builds</p>
7902          </div>
7903          <button class="close-modal" style="background: transparent; border: 0; color: var(--bs-fg-mute); cursor: pointer; padding: 0; display: inline-flex;">
7904            <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7905              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
7906            </svg>
7907          </button>
7908        </div>
7909      </div>
7910      
7911      <div class="p-6">
7912        <div class="grid grid-cols-2 gap-4 mb-6">
7913          <div class="flex items-center p-3 rounded-lg" style="border: 1px solid var(--bs-line);">
7914            <span class="text-2xl mr-3">${r}</span>
7915            <div>
7916              <p class="font-medium" style="color: var(--bs-fg);">Jenkins Integration</p>
7917              <p class="text-sm" style="color: var(--bs-fg-soft);">${t.jenkins_integration_exists?"Connected":"Not Found"}</p>
7918            </div>
7919          </div>
7920          
7921          <div class="flex items-center p-3 rounded-lg" style="border: 1px solid var(--bs-line);">
7922            <span class="text-2xl mr-3">${o}</span>
7923            <div>
7924              <p class="font-medium" style="color: var(--bs-fg);">Build Trigger</p>
7925              <p class="text-sm" style="color: var(--bs-fg-soft);">${t.trigger_configured?"Configured":"Not Configured"}</p>
7926            </div>
7927          </div>
7928        </div>
7929        
7930        ${a}
7931        ${l}
7932      </div>
7933      
7934      <div class="p-6 flex justify-end" style="border-top: 1px solid var(--bs-line);">
7935        <button class="px-4 py-2 bs-btn bs-btn-ghost close-modal">
7936          Close
7937        </button>
7938      </div>
7939    `,s.querySelectorAll(".close-modal").forEach(h=>{h.onclick=()=>e.remove()}),s.querySelectorAll(".copy-cmd").forEach(h=>{h.onclick=d=>{let p=d.target.dataset.command;navigator.clipboard.writeText(p),d.target.textContent="Copied!",setTimeout(()=>d.target.textContent="Copy",1500)}});let c=s.querySelector(".copy-trigger-cmd");c&&(c.onclick=h=>{let d=t.trigger_command;navigator.clipboard.writeText(d),h.target.textContent="Copied!",setTimeout(()=>h.target.textContent="Copy",1500)});let u=s.querySelector(".copy-script");u&&(u.onclick=h=>{let d=`#!/bin/bash
7940# Jenkins Build Trigger for Perforce
7941# This script is called by Perforce triggers to notify Jenkins of changes
7942
7943CHANGELIST=$1
7944
7945# Jenkins job configuration
7946JENKINS_URL="${t.jenkins_integrations[0]?.url||"http://your-jenkins-server:8080"}"
7947JOB_NAME="${t.jenkins_integrations[0]?.job_name||"ButterStack-Build"}"
7948JENKINS_USER="${t.jenkins_integrations[0]?.username||"your-jenkins-user"}"
7949JENKINS_TOKEN="${t.jenkins_integrations[0]?.api_token||"YOUR-JENKINS-API-TOKEN-HERE"}"
7950
7951# Trigger Jenkins build with changelist parameter
7952curl -X POST \\
7953  -u "\${JENKINS_USER}:\${JENKINS_TOKEN}" \\
7954  "\${JENKINS_URL}/job/\${JOB_NAME}/buildWithParameters?CHANGELIST=\${CHANGELIST}" \\
7955  --fail --silent --show-error
7956
7957# Log the trigger (optional)
7958echo "[$(date)] Triggered Jenkins build for changelist \${CHANGELIST}" >> /var/log/jenkins-trigger.log
7959
7960exit 0`;navigator.clipboard.writeText(d),h.target.textContent="Copied!",setTimeout(()=>h.target.textContent="Copy Script",2e3)}),n.appendChild(s),e.appendChild(n),document.body.appendChild(e)}showError(i){alert(`Error: ${i}`)}};var JB={};Le(JB,{default:()=>KB});var KB=class extends le{static targets=["loading","placeholder","error","errorMessage","main","searchInput","availableList","selectedList","availableCount","selectedCount","selectedJobsInput"];static values={integrationId:String,projectId:String,selectedJobs:Array,availableJobs:Array};connect(){this.allJobs=[],this.selectedJobNames=new Set(this.selectedJobsValue||[]),this.filteredJobs=[],this.loadJobs()}async loadJobs(){if(console.log("loadJobs called"),!this.integrationIdValue){console.log("No integration ID, showing placeholder"),this.showPlaceholder();return}console.log("Raw availableJobsValue:",this.data.get("availableJobs")),console.log("Parsed availableJobsValue:",this.availableJobsValue);try{if(this.availableJobsValue&&this.availableJobsValue.length>0){console.log("Using preloaded job data:",this.availableJobsValue.length,"jobs"),this.allJobs=this.availableJobsValue,this.filteredJobs=[...this.allJobs],this.showInterface(),this.updateUI();return}}catch(i){console.warn("Error with preloaded job data:",i)}this.showLoading();try{let i=await fetch(`/projects/${this.projectIdValue}/integrations/${this.integrationIdValue}/jenkins_jobs`,{headers:{Accept:"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content}});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let t=await i.json();this.processJobs(t.jobs||[])}catch(i){console.error("Error loading jobs:",i),this.showError("Failed to load Jenkins jobs. Please check your connection settings.")}}processJobs(i){this.allJobs=i||[],this.filteredJobs=[...this.allJobs],this.showInterface(),this.updateUI()}showInterface(){this.hideAll(),this.mainTarget.classList.remove("hidden")}filterJobs(){let i=this.searchInputTarget.value.toLowerCase();i===""?this.filteredJobs=this.allJobs.filter(t=>!this.selectedJobNames.has(t.name)):this.filteredJobs=this.allJobs.filter(t=>!this.selectedJobNames.has(t.name)&&(t.name.toLowerCase().includes(i)||t.displayName&&t.dis
7960playName.toLowerCase().includes(i))),this.updateAvailableList()}selectJob(i){let t=i.currentTarget.dataset.jobName;this.selectedJobNames.has(t)||(this.selectedJobNames.add(t),this.filterJobs(),this.updateUI(),this.updateHiddenInput())}deselectJob(i){let t=i.currentTarget.dataset.jobName;this.selectedJobNames.has(t)&&(this.selectedJobNames.delete(t),this.filterJobs(),this.updateUI(),this.updateHiddenInput())}selectAll(){this.filteredJobs.forEach(i=>{this.selectedJobNames.add(i.name)}),this.filterJobs(),this.updateUI(),this.updateHiddenInput()}clearAll(){this.selectedJobNames.clear(),this.filterJobs(),this.updateUI(),this.updateHiddenInput()}updateUI(){this.updateAvailableList(),this.updateSelectedList(),this.updateCounts()}updateAvailableList(){if(this.availableListTarget.innerHTML="",this.filteredJobs.length===0){this.availableListTarget.innerHTML=`
7961        <div class="px-4 py-3 text-sm text-center" style="color: var(--bs-fg-mute);">
7962          ${this.searchInputTarget.value?"No jobs match your search":"No available jobs"}
7963        </div>
7964      `;return}this.filteredJobs.forEach(i=>{let t=document.createElement("div");t.className="px-4 py-2 cursor-pointer flex items-center justify-between",t.style.cssText="transition: background 120ms ease;",t.onmouseover=()=>{t.style.background="var(--bs-bg-panel-2)"},t.onmouseout=()=>{t.style.background=""},t.dataset.jobName=i.name,t.dataset.action="click->job-selector#selectJob",t.innerHTML=`
7965        <div class="flex-1">
7966          <div class="text-sm font-medium" style="color: var(--bs-fg);">${this.escapeHtml(i.displayName||i.name)}</div>
7967          ${i.name!==i.displayName?`<div class="text-xs" style="color: var(--bs-fg-mute);">${this.escapeHtml(i.name)}</div>`:""}
7968        </div>
7969        <svg class="h-4 w-4" style="color: var(--bs-fg-mute);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7970          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
7971        </svg>
7972      `,this.availableListTarget.appendChild(t)})}updateSelectedList(){if(this.selectedListTarget.innerHTML="",this.selectedJobNames.size===0){this.selectedListTarget.innerHTML=`
7973        <div class="px-4 py-3 text-sm text-center" style="color: var(--bs-fg-mute);">
7974          No jobs selected
7975        </div>
7976      `;return}Array.from(this.selectedJobNames).forEach(i=>{let t=document.createElement("div");t.className="px-4 py-2 cursor-pointer flex items-center justify-between",t.style.cssText="transition: background 120ms ease;",t.onmouseover=()=>{t.style.background="var(--bs-bg-panel-2)"},t.onmouseout=()=>{t.style.background=""},t.dataset.jobName=i,t.dataset.action="click->job-selector#deselectJob",t.innerHTML=`
7977        <svg class="h-4 w-4" style="color: var(--bs-fg-mute);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
7978          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path>
7979        </svg>
7980        <div class="flex-1 ml-3">
7981          <div class="text-sm font-medium" style="color: var(--bs-fg);">${this.escapeHtml(i)}</div>
7982        </div>
7983      `,this.selectedListTarget.appendChild(t)})}updateCounts(){this.availableCountTarget.textContent=this.filteredJobs.length,this.selectedCountTarget.textContent=this.selectedJobNames.size}updateHiddenInput(){this.selectedJobsInputTarget.value=JSON.stringify(Array.from(this.selectedJobNames))}showLoading(){this.hideAll(),this.loadingTarget.classList.remove("hidden")}showPlaceholder(){this.hideAll(),this.placeholderTarget.classList.remove("hidden")}showError(i){this.hideAll(),this.errorMessageTarget.textContent=i,this.errorTarget.classList.remove("hidden")}showMain(){this.hideAll(),this.mainTarget.classList.remove("hidden")}hideAll(){this.loadingTarget.classList.add("hidden"),this.placeholderTarget.classList.add("hidden"),this.errorTarget.classList.add("hidden"),this.mainTarget.classList.add("hidden")}escapeHtml(i){let t=document.createElement("div");return t.textContent=i,t.innerHTML}};var QB={};Le(QB,{default:()=>ZB});var ZB=class extends le{static targets=["image"];open(i){let t=i.currentTarget.querySelector("img")||i.currentTarget,e=document.createElement("div");e.className="fixed inset-0 z-50 flex items-center justify-center bg-black/80 cursor-zoom-out",e.innerHTML=`<img src="${t.src}" class="max-w-[90vw] max-h-[90vh] object-contain rounded-lg shadow-2xl" />`,e.addEventListener("click",()=>e.remove()),document.addEventListener("keydown",n=>{n.key==="Escape"&&e.remove()},{once:!0}),document.body.appendChild(e)}};var eF={};Le(eF,{default:()=>tF});var tF=class extends le{static targets=["preview","toggleBtn","toggleText","code","copyText"];connect(){this.visible=!0}toggle(){this.visible=!this.visible,this.visible?(this.previewTarget.classList.remove("hidden"),this.toggleTextTarget.textContent="Hide JSON"):(this.previewTarget.classList.add("hidden"),this.toggleTextTarget.textContent="Preview JSON")}async copy(){try{let i=this.codeTarget.textContent;await navigator.clipboard.writeText(i);let t=this.copyTextTarget.textContent;this.copyTextTarget.textContent="Copied!",setTimeout(()=>{this.copyTextTarget.textContent=t},2e3)}catch(i){console.error("Failed to copy:",i),this.copyTextTarget.textContent="Failed",setTimeout(()=>{this.copyTextTarget.textContent="Copy"},2e3)}}};var s4={};Le(s4,{default:()=>i4});var AZ=il(bJ());var $Tt="2.1.19",qp="[data-trix-attachment]",XF={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}},$o={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(i){return vJ(i.parentNode)===$o[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",group:!1,nestable:!0,test(i){return vJ(i.parentNode)===$o[this.listAttribute].tagName}},attachmentGallery:{tagName:"div",exclusive:!0,terminal:!0,parse:!1,group:!1}},vJ=i=>{var t;return i==null||(t=i.tagName)===null||t===void 0?void 0:t.toLowerCase()},yJ=navigator.userAgent.match(/android\s([0-9]+.*Chrome)/i),sF=yJ&&parseInt(yJ[1]),Ew={composesExistingText:/Android.*Chrome/.test(navigator.userAgent),recentAndroid:sF&&sF>12,samsungAndroid:sF&&navigator.userAgent.match(/Android.*SM-/),forcesObjectResizing:/Trident.*rv:11/.test(navigator.userAgent),supportsInputEvents:typeof InputEvent<"u"&&["data","getTargetRanges","inputType"].every((i=>i in InputEvent.prototype))},eZ={ADD_ATTR:["language"],SAFE_FOR_XML:!1,RETURN_DOM:!0},Kn={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"},GTt=[Kn.bytes,Kn.KB,Kn.MB,Kn.GB,Kn.TB,Kn.PB],nZ={prefix:"IEC",precision:2,formatter(i){switch(i){case 0:return"0 ".concat(Kn.bytes);case 1:return"1 ".concat(Kn.byte);default:let t;this.prefix==="SI"?t=1e3:this.prefix==="IEC"&&(t=1024);let e=Math.floor(Math.log(i)/Math.log(t)),n=(i/Math.pow(t,e)).toFixed(this.precision).replace(/0*$/,"").replace(/\.$/,"");return"".concat(n," ").concat(GTt[e])}}},ME="\uFEFF",Bd="\xA0",iZ=function(i){for(let t in i){let e=i[t];this[t]=e}return this},KF=document.documentElement,qTt=KF.matches,Ns=function(i){let{onElement:t,matchingSelector:e,withCallback:n,inPhase:s,preventDefault:r,times:o}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=t||KF,l=e,c=s==="capturing",u=function(h){o!=null&&--o==0&&u.destroy();let d=Ud(h.target,{matchingSelector:l});d!=null&&(n?.call(d,h,d),r&&h.preventDefault())};return u.destroy=()=>a.removeEventListener(i,u,c),a.addEventListener(i,u,c),u},sZ=function(i){let{bubbles:t,cancelable:e,attributes:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t=t!==!1,e=e!==!1;let s=document.createEvent("Events");return s.initEvent(i,t,e),n!=null&&iZ.call(s,n),s},yw=function(i){let{onElement:t,bubbles:e,cancelable:n,attributes:s}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t??KF,o=sZ(i,{bubbles:e,cancelable:n,attributes:s});return r.dispatchEvent(o)},rZ=function(i,t){if(i?.nodeType===1)return qTt.call(i,t)},Ud=function(i){let{matchingSelector:t,untilNode:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(;i&&i.nodeType!==Node.ELEMENT_NODE;)i=i.parentNode;if(i!=null){if(t==null)return i;if(i.closest&&e==null)return i.closest(t);for(;i&&i!==e;){if(rZ(i,t))return i;i=i.parentNode}}},JF=i=>document.activeElement!==i&&Gp(i,document.activeElement),Gp=function(i,t){if(i&&t)for(;t;){if(t===i)return!0;t=t.parentNode}},rF=function(i){var t;if((t=i)===null||t===void 0||!t.parentNode)return;let e=0;for(i=i.previousSibling;i;)e++,i=i.previousSibling;return e},zd=i=>{var t;return i==null||(t=i.parentNode)===null||t===void 0?void 0:t.removeChild(i)},sE=function(i){let{onlyNodesOfType:t,usingFilter:e,expandEntityReferences:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=(()=>{switch(t){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(i,s,e??null,n===!0)},Wo=i=>{var t;return i==null||(t=i.tagName)===null||t===void 0?void 0:t.toLowerCase()},fi=function(i){let t,e,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof i=="object"?(n=i,i=n.tagName):n={attributes:n};let s=document.createElement(i);if(n.editable!=null&&(n.attributes==null&&(n.attributes={}),n.attributes.contenteditable=n.editable),n.attributes)for(t in n.attributes)e=n.attributes[t],s.setAttribute(t,e);if(n.style)for(t in n.style)e=n.style[t],s.style[t]=e;if(n.data)for(t in n.data)e=n.data[t],s.dataset[t]=e;return n.className&&n.className.split(" ").forEach((r=>{s.classList.add(r)})),n.textContent&&(s.textContent=n.textContent),n.childNodes&&[].concat(n.childNodes).forEac
7983h((r=>{s.appendChild(r)})),s},dw,xw=function(){if(dw!=null)return dw;dw=[];for(let i in $o){let t=$o[i];t.tagName&&dw.push(t.tagName)}return dw},oF=i=>Z0(i?.firstChild),aF=function(i){let{strict:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{strict:!0};return t?Z0(i):Z0(i)||!Z0(i.firstChild)&&(function(e){return xw().includes(Wo(e))&&!xw().includes(Wo(e.firstChild))})(i)},Z0=i=>YTt(i)&&i?.data==="block",YTt=i=>i?.nodeType===Node.COMMENT_NODE,Q0=function(i){let{name:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(i)return ww(i)?i.data===ME?!t||i.parentNode.dataset.trixCursorTarget===t:void 0:Q0(i.firstChild)},Yp=i=>rZ(i,qp),oZ=i=>ww(i)&&i?.data==="",ww=i=>i?.nodeType===Node.TEXT_NODE,ZF={level2Enabled:!0,getLevel(){return this.level2Enabled&&Ew.supportsInputEvents?2:0},pickFiles(i){let t=fi("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId});t.addEventListener("change",(()=>{i(t.files),zd(t)})),zd(document.getElementById(this.fileInputId)),document.body.appendChild(t),t.click()}},nE={removeBlankTableCells:!1,tableCellSeparator:" | ",tableRowSeparator:`
7984`},Jp={bold:{tagName:"strong",inheritable:!0,parser(i){let t=window.getComputedStyle(i);return t.fontWeight==="bold"||t.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:i=>window.getComputedStyle(i).fontStyle==="italic"},href:{groupTagName:"a",parser(i){let t="a:not(".concat(qp,")"),e=i.closest(t);if(e)return e.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},aZ={getDefaultHTML:()=>`<div class="trix-button-row">
7985      <span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">
7986        <button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="`.concat(Kn.bold,'" tabindex="-1">').concat(Kn.bold,`</button>
7987        <button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="`).concat(Kn.italic,'" tabindex="-1">').concat(Kn.italic,`</button>
7988        <button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="`).concat(Kn.strike,'" tabindex="-1">').concat(Kn.strike,`</button>
7989        <button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="`).concat(Kn.link,'" tabindex="-1">').concat(Kn.link,`</button>
7990      </span>
7991
7992      <span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">
7993        <button type="button" class="trix-button trix-button--icon trix-button--icon-heading-1" data-trix-attribute="heading1" title="`).concat(Kn.heading1,'" tabindex="-1">').concat(Kn.heading1,`</button>
7994        <button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="`).concat(Kn.quote,'" tabindex="-1">').concat(Kn.quote,`</button>
7995        <button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="`).concat(Kn.code,'" tabindex="-1">').concat(Kn.code,`</button>
7996        <button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="`).concat(Kn.bullets,'" tabindex="-1">').concat(Kn.bullets,`</button>
7997        <button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="`).concat(Kn.numbers,'" tabindex="-1">').concat(Kn.numbers,`</button>
7998        <button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="`).concat(Kn.outdent,'" tabindex="-1">').concat(Kn.outdent,`</button>
7999        <button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="`).concat(Kn.indent,'" tabindex="-1">').concat(Kn.indent,`</button>
8000      </span>
8001
8002      <span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">
8003        <button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="`).concat(Kn.attachFiles,'" tabindex="-1">').concat(Kn.attachFiles,`</button>
8004      </span>
8005
8006      <span class="trix-button-group-spacer"></span>
8007
8008      <span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">
8009        <button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="`).concat(Kn.undo,'" tabindex="-1">').concat(Kn.undo,`</button>
8010        <button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="`).concat(Kn.redo,'" tabindex="-1">').concat(Kn.redo,`</button>
8011      </span>
8012    </div>
8013
8014    <div class="trix-dialogs" data-trix-dialogs>
8015      <div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">
8016        <div class="trix-dialog__link-fields">
8017          <input type="url" name="href" class="trix-input trix-input--dialog" placeholder="`).concat(Kn.urlPlaceholder,'" aria-label="').concat(Kn.url,`" data-trix-validate-href required data-trix-input>
8018          <div class="trix-button-group">
8019            <input type="button" class="trix-button trix-button--dialog" value="`).concat(Kn.link,`" data-trix-method="setAttribute">
8020            <input type="button" class="trix-button trix-button--dialog" value="`).concat(Kn.unlink,`" data-trix-method="removeAttribute">
8021          </div>
8022        </div>
8023      </div>
8024    </div>`)},RF={interval:5e3},kw=Object.freeze({__proto__:null,attachments:XF,blockAttributes:$o,browser:Ew,css:{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"},dompurify:eZ,fileSize:nZ,input:ZF,keyNames:{8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},lang:Kn,parser:nE,textAttributes:Jp,toolbar:aZ,undo:RF}),Ws=class{static proxyMethod(t){let{name:e,toMethod:n,toProperty:s,optional:r}=XTt(t);this.prototype[e]=function(){let o,a;var l,c;return n?a=r?(l=this[n])===null||l===void 0?void 0:l.call(this):this[n]():s&&(a=this[s]),r?(o=(c=a)===null||c===void 0?void 0:c[e],o?xJ.call(o,a,arguments):void 0):(o=a[e],xJ.call(o,a,arguments))}}},XTt=function(i){let t=i.match(KTt);if(!t)throw new Error("can't parse @proxyMethod expression: ".concat(i));let e={name:t[4]};return t[2]!=null?e.toMethod=t[1]:e.toProperty=t[1],t[3]!=null&&(e.optional=!0),e},{apply:xJ}=Function.prototype,KTt=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$"),lF,cF,uF,Zp=class extends Ws{static box(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return t instanceof this?t:this.fromUCS2String(t?.toString())}static fromUCS2String(t){return new this(t,DF(t))}static fromCodepoints(t){return new this(LF(t),t)}constructor(t,e){super(...arguments),this.ucs2String=t,this.codepoints=e,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}offsetToUCS2Offset(t){return LF(this.codepoints.slice(0,Math.max(0,t))).length}offsetFromUCS2Offset(t){return DF(this.ucs2String.slice(0,Math.max(0,t))).length}slice(){return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))}charAt(t){return this.slice(t,t+1)}isEqualTo(t){return this.constructor.box(t).ucs2String===this.ucs2String}toJSON(){return this.ucs2String}getCacheKey(){return this.ucs2String}toString(){return this.ucs2String}},JTt=((lF=Array.from)===null||lF===void 0?void 0:lF.call(Array,"\u{1F47C}").length)===1,ZTt=((cF=" ".codePointAt)===null||cF===void 0?void 0:cF.call(" ",0))!=null,QTt=((uF=String.fromCodePoint)===null||uF===void 0?void 0:uF.call(String,32,128124))===" \u{1F47C}",DF,LF;DF=JTt&&ZTt?i=>Array.from(i).map((t=>t.codePointAt(0))):function(i){let t=[],e=0,{length:n}=i;for(;e<n;){let s=i.charCodeAt(e++);if(55296<=s&&s<=56319&&e<n){let r=i.charCodeAt(e++);(64512&r)==56320?s=((1023&s)<<10)+(1023&r)+65536:e--}t.push(s)}return t},LF=QTt?i=>String.fromCodePoint(...Array.from(i||[])):function(i){return(()=>{let t=[];
8024return Array.from(i).forEach((e=>{let n="";e>65535&&(e-=65536,n+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t.push(n+String.fromCharCode(e))})),t})().join("")};var tAt=0,Zu=class extends Ws{static fromJSONString(t){return this.fromJSON(JSON.parse(t))}constructor(){super(...arguments),this.id=++tAt}hasSameConstructorAs(t){return this.constructor===t?.constructor}isEqualTo(t){return this===t}inspect(){let t=[],e=this.contentsForInspection()||{};for(let n in e){let s=e[n];t.push("".concat(n,"=").concat(s))}return"#<".concat(this.constructor.name,":").concat(this.id).concat(t.length?" ".concat(t.join(", ")):"",">")}contentsForInspection(){}toJSONString(){return JSON.stringify(this)}toUTF16String(){return Zp.box(this)}getCacheKey(){return this.id.toString()}},Qp=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(i.length!==t.length)return!1;for(let e=0;e<i.length;e++)if(i[e]!==t[e])return!1;return!0},QF=function(i){let t=i.slice(0);for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return t.splice(...n),t},eAt=/[\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]/,nAt=(function(){let i=fi("input",{dir:"auto",name:"x",dirName:"x.dir"}),t=fi("textarea",{dir:"auto",name:"y",dirName:"y.dir"}),e=fi("form");e.appendChild(i),e.appendChild(t);let n=(function(){try{return new FormData(e).has(t.dirName)}catch{return!1}})(),s=(function(){try{return i.matches(":dir(ltr),:dir(rtl)")}catch{return!1}})();return n?function(r){return t.value=r,new FormData(e).get(t.dirName)}:s?function(r){return i.value=r,i.matches(":dir(rtl)")?"rtl":"ltr"}:function(r){let o=r.trim().charAt(0);return eAt.test(o)?"rtl":"ltr"}})(),hF=null,dF=null,fF=null,YA=null,IF=()=>(hF||(hF=sAt().concat(iAt())),hF),ir=i=>$o[i],iAt=()=>(dF||(dF=Object.keys($o)),dF),OF=i=>Jp[i],sAt=()=>(fF||(fF=Object.keys(Jp)),fF),lZ=function(i,t){rAt(i).textContent=t.replace(/%t/g,i)},rAt=function(i){let t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("data-tag-name",i.toLowerCase());let e=oAt();return e&&t.setAttribute("nonce",e),document.head.insertBefore(t,document.head.firstChild),t},oAt=function(){let i=wJ("trix-csp-nonce")||wJ("csp-nonce");if(i){let{nonce:t,content:e}=i;return t==""?e:t}},wJ=i=>document.head.querySelector("meta[name=".concat(i,"]")),_J={"application/x-trix-feature-detection":"test"},cZ=function(i){let t=i.getData("text/plain"),e=i.getData("text/html");if(!t||!e)return t?.length;{let{body:n}=new DOMParser().parseFromString(e,"text/html");if(n.textContent===t)return!n.querySelector("*")}},uZ=/Mac|^iP/.test(navigator.platform)?i=>i.metaKey:i=>i.ctrlKey,t4=i=>setTimeout(i,1),hZ=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t={};for(let e in i){let n=i[e];t[e]=n}return t},ub=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Object.keys(i).length!==Object.keys(t).length)return!1;for(let e in i)if(i[e]!==t[e])return!1;return!0},Zi=function(i){if(i!=null)return Array.isArray(i)||(i=[i,i]),[SJ(i[0]),SJ(i[1]!=null?i[1]:i[0])]},Ju=function(i){if(i==null)return;let[t,e]=Zi(i);return NF(t,e)},rE=function(i,t){if(i==null||t==null)return;let[e,n]=Zi(i),[s,r]=Zi(t);return NF(e,s)&&NF(n,r)},SJ=function(i){return typeof i=="number"?i:hZ(i)},NF=function(i,t){return typeof i=="number"?i===t:ub(i,t)},oE=class extends Ws{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(t){if(!this.selectionManagers.includes(t))return this.selectionManagers.push(t),this.start()}unregisterSelectionManager(t){if(this.selectionManagers=this.selectionManagers.filter((e=>e!==t)),this.selectionManagers.length===0)return this.stop()}notifySelectionManagersOfSelectionChange(){return this.selectionManagers.map((t=>t.selectionDidChange()))}update(){this.notifySelectionManagersOfSelectionChange()}reset(){this.update()}},tg=new oE,dZ=function(){let i=window.getSelection();if(i.rangeCount>0)return i},_w=function(){var i;let t=(i=dZ())===null||i===void 0?void 0:i.getRangeAt(0);if(t&&!aAt(t))return t},fZ=function(i){let t=window.getSelection();
8024return t.removeAllRanges(),t.addRange(i),tg.update()},aAt=i=>CJ(i.startContainer)||CJ(i.endContainer),CJ=i=>!Object.getPrototypeOf(i),bw=i=>i.replace(new RegExp("".concat(ME),"g"),"").replace(new RegExp("".concat(Bd),"g")," "),e4=new RegExp("[^\\S".concat(Bd,"]")),n4=i=>i.replace(new RegExp("".concat(e4.source),"g")," ").replace(/\ {2,}/g," "),MJ=function(i,t){if(i.isEqualTo(t))return["",""];let e=pF(i,t),{length:n}=e.utf16String,s;if(n){let{offset:r}=e,o=i.codepoints.slice(0,r).concat(i.codepoints.slice(r+n));s=pF(t,Zp.fromCodepoints(o))}else s=pF(t,i);return[e.utf16String.toString(),s.utf16String.toString()]},pF=function(i,t){let e=0,n=i.length,s=t.length;for(;e<n&&i.charAt(e).isEqualTo(t.charAt(e));)e++;for(;n>e+1&&i.charAt(n-1).isEqualTo(t.charAt(s-1));)n--,s--;return{utf16String:i.slice(e,n),offset:e}},rc=class i extends Zu{static fromCommonAttributesOfObjects(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(!t.length)return new this;let e=fw(t[0]),n=e.getKeys();return t.slice(1).forEach((s=>{n=e.getKeysCommonToHash(fw(s)),e=e.slice(n)})),e}static box(t){return fw(t)}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(...arguments),this.values=iE(t)}add(t,e){return this.merge(lAt(t,e))}remove(t){return new i(iE(this.values,t))}get(t){return this.values[t]}has(t){return t in this.values}merge(t){return new i(cAt(this.values,uAt(t)))}slice(t){let e={};return Array.from(t).forEach((n=>{this.has(n)&&(e[n]=this.values[n])})),new i(e)}getKeys(){return Object.keys(this.values)}getKeysCommonToHash(t){return t=fw(t),this.getKeys().filter((e=>this.values[e]===t.values[e]))}isEqualTo(t){return Qp(this.toArray(),fw(t).toArray())}isEmpty(){return this.getKeys().length===0}toArray(){if(!this.array){let t=[];for(let e in this.values){let n=this.values[e];t.push(t.push(e,n))}this.array=t.slice(0)}return this.array}toObject(){return iE(this.values)}toJSON(){return this.toObject()}contentsForInspection(){return{values:JSON.stringify(this.values)}}},lAt=function(i,t){let e={};return e[i]=t,e},cAt=function(i,t){let e=iE(i);for(let n in t){let s=t[n];e[n]=s}return e},iE=function(i,t){let e={};return Object.keys(i).sort().forEach((n=>{n!==t&&(e[n]=i[n])})),e},fw=function(i){return i instanceof rc?i:new rc(i)},uAt=function(i){return i instanceof rc?i.values:i},Cw=class{static groupObjects(){let t,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{depth:n,asTree:s}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};s&&n==null&&(n=0);let r=[];return Array.from(e).forEach((o=>{var a;if(t){var l,c,u;
8024if((l=o.canBeGrouped)!==null&&l!==void 0&&l.call(o,n)&&(c=(u=t[t.length-1]).canBeGroupedWith)!==null&&c!==void 0&&c.call(u,o,n))return void t.push(o);r.push(new this(t,{depth:n,asTree:s})),t=null}(a=o.canBeGrouped)!==null&&a!==void 0&&a.call(o,n)?t=[o]:r.push(o)})),t&&r.push(new this(t,{depth:n,asTree:s})),r}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{depth:e,asTree:n}=arguments.length>1?arguments[1]:void 0;this.objects=t,n&&(this.depth=e,this.objects=this.constructor.groupObjects(this.objects,{asTree:n,depth:this.depth+1}))}getObjects(){return this.objects}getDepth(){return this.depth}getCacheKey(){let t=["objectGroup"];return Array.from(this.getObjects()).forEach((e=>{t.push(e.getCacheKey())})),t.join("/")}},BF=class extends Ws{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects={},Array.from(t).forEach((e=>{let n=JSON.stringify(e);this.objects[n]==null&&(this.objects[n]=e)}))}find(t){let e=JSON.stringify(t);return this.objects[e]}},FF=class{constructor(t){this.reset(t)}add(t){let e=TJ(t);this.elements[e]=t}remove(t){let e=TJ(t),n=this.elements[e];if(n)return delete this.elements[e],n}reset(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return this.elements={},Array.from(t).forEach((e=>{this.add(e)})),t}},TJ=i=>i.dataset.trixStoreKey,eb=class extends Ws{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(((t,e)=>(this.performing=!0,this.perform(((n,s)=>{this.succeeded=n,this.performing=!1,this.performed=!0,this.succeeded?t(s):e(s)})))))),this.promise}perform(t){return t(!1)}release(){var t,e;(t=this.promise)===null||t===void 0||(e=t.cancel)===null||e===void 0||e.call(t),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null}};eb.proxyMethod("getPromise().then"),eb.proxyMethod("getPromise().catch");var Qu=class extends Ws{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.object=t,this.options=e,this.childViews=[],this.rootView=this}getNodes(){return this.nodes||(this.nodes=this.createNodes()),this.nodes.map((t=>t.cloneNode(!0)))}invalidate(){var t;return this.nodes=null,this.childViews=[],(t=this.parentView)===null||t===void 0?void 0:t.invalidate()}invalidateViewForObject(t){var e;return(e=this.findViewForObject(t))===null||e===void 0?void 0:e.invalidate()}findOrCreateCachedChildView(t,e,n){let s=this.getCachedViewForObject(e);return s?this.recordChildView(s):(s=this.createChildView(...arguments),this.cacheViewForObject(s,e)),s}createChildView(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};e instanceof Cw&&(n.viewClass=t,t=UF);let s=new t(e,n);return this.recordChildView(s)}recordChildView(t){return t.parentView=this,t.rootView=this.rootView,this.childViews.push(t),t}getAllChildViews(){let t=[];return this.childViews.forEach((e=>{t.push(e),t=t.concat(e.getAllChildViews())})),t}findElement(){return this.findElementForObject(this.object)}findElementForObject(t){let e=t?.id;if(e)return this.rootView.element.querySelector("[data-trix-id='".concat(e,"']"))}findViewForObject(t){for(let e of this.getAllChildViews())if(e.object===t)return e}getViewCache(){return this.rootView!==this?this.rootView.getViewCache():this.isViewCachingEnabled()?(this.viewCache||(this.viewCache={}),this.viewCache):void 0}isViewCachingEnabled(){return this.shouldCacheViews!==!1}enableViewCaching(){this.shouldCacheViews=!0}disableViewCaching(){this.shouldCacheViews=!1}getCachedViewForObject(t){var e;return(e=this.getViewCache())===null||e===void 0?void 0:e[t.getCacheKey()]}cacheViewForObject(t,e){let n=this.getViewCache();n&&(n[e.getCacheKey()]=t)}garbageCollectCachedViews(){let t=this.getViewCache();if(t){let e=this.getAllChildViews().concat(this).map((n=>n.object.getCacheKey()));for(let n in t)e.includes(n)||delete t[n]}}},UF=class extends Qu{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()).forEac
8024h((t=>{this.findOrCreateCachedChildView(this.viewClass,t,this.options)})),this.childViews}createNodes(){let t=this.createContainerElement();return this.getChildViews().forEach((e=>{Array.from(e.getNodes()).forEach((n=>{t.appendChild(n)}))})),[t]}createContainerElement(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.objectGroup.getDepth();return this.getChildViews()[0].createContainerElement(t)}};var{entries:pZ,setPrototypeOf:AJ,isFrozen:hAt,getPrototypeOf:dAt,getOwnPropertyDescriptor:fAt}=Object,{freeze:Go,seal:vl,create:K0}=Object,{apply:zF,construct:VF}=typeof Reflect<"u"&&Reflect;Go||(Go=function(i){return i}),vl||(vl=function(i){return i}),zF||(zF=function(i,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),s=2;s<e;s++)n[s-2]=arguments[s];return i.apply(t,n)}),VF||(VF=function(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return new i(...e)});var pw=dr(Array.prototype.forEach),pAt=dr(Array.prototype.lastIndexOf),EJ=dr(Array.prototype.pop),gw=dr(Array.prototype.push),gAt=dr(Array.prototype.splice),jo=Array.isArray,vw=dr(String.prototype.toLowerCase),gF=dr(String.prototype.toString),kJ=dr(String.prototype.match),Y0=dr(String.prototype.replace),PJ=dr(String.prototype.indexOf),mAt=dr(String.prototype.trim),bAt=dr(Number.prototype.toString),vAt=dr(Boolean.prototype.toString),RJ=typeof BigInt>"u"?null:dr(BigInt.prototype.toString),DJ=typeof Symbol>"u"?null:dr(Symbol.prototype.toString),js=dr(Object.prototype.hasOwnProperty),XA=dr(Object.prototype.toString),eo=dr(RegExp.prototype.test),KA=(LJ=TypeError,function(){for(var i=arguments.length,t=new Array(i),e=0;e<i;e++)t[e]=arguments[e];return VF(LJ,t)}),LJ;function dr(i){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return zF(i,t,n)}}function ni(i,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vw;if(AJ&&AJ(i,null),!jo(t))return i;let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){let r=e(s);r!==s&&(hAt(t)||(t[n]=r),s=r)}i[s]=!0}return i}function yAt(i){for(let t=0;t<i.length;t++)js(i,t)||(i[t]=null);return i}function ga(i){let t=K0(null);for(let[e,n]of pZ(i))js(i,e)&&(jo(n)?t[e]=yAt(n):n&&typeof n=="object"&&n.constructor===Object?t[e]=ga(n):t[e]=n);return t}function X0(i,t){for(;i!==null;){let e=fAt(i,t);if(e){if(e.get)return dr(e.get);if(typeof e.value=="function")return dr(e.value)}i=dAt(i)}return function(){return null}}var IJ=Go(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),mF=Go(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),bF=Go(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),xAt=Go(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),vF=Go(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),wAt=Go(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),OJ=Go(["#text"]),NJ=Go(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","
8024spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),yF=Go(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),BJ=Go(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),JA=Go(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),_At=vl(/\{\{[\w\W]*|[\w\W]*\}\}/gm),SAt=vl(/<%[\w\W]*|[\w\W]*%>/gm),CAt=vl(/\$\{[\w\W]*/gm),MAt=vl(/^data-[\-\w.\u00B7-\uFFFF]+$/),TAt=vl(/^aria-[\-\w]+$/),gZ=vl(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),AAt=vl(/^(?:\w+script|data):/i),EAt=vl(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),mZ=vl(/^html$/i),kAt=vl(/^[a-z][.\w]*(-[.\w]+)+$/i),FJ=Object.freeze({__proto__:null,ARIA_ATTR:TAt,ATTR_WHITESPACE:EAt,CUSTOM_ELEMENT:kAt,DATA_ATTR:MAt,DOCTYPE_NAME:mZ,ERB_EXPR:SAt,IS_ALLOWED_URI:gZ,IS_SCRIPT_OR_DATA:AAt,MUSTACHE_EXPR:_At,TMPLIT_EXPR:CAt}),PAt=1,RAt=3,DAt=7,LAt=8,IAt=9,OAt=function(){return typeof window>"u"?null:window},nb=(function i(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:OAt(),e=Pt=>i(Pt);if(e.version="3.4.2",e.removed=[],!t||!t.document||t.document.nodeType!==IAt||!t.Element)return e.isSupported=!1,e;let{document:n}=t,s=n,r=s.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:u,NamedNodeMap:h=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:p,trustedTypes:g}=t,y=c.prototype,x=X0(y,"cloneNode"),w=X0(y,"remove"),M=X0(y,"nextSibling"),A=X0(y,"childNodes"),C=X0(y,"parentNode");if(typeof a=="function"){let Pt=n.createElement("template");Pt.content&&Pt.content.ownerDocument&&(n=Pt.content.ownerDocument)}let R,k="",{implementation:O,createNodeIterator:I,createDocumentFragment:U,getElementsByTagName:V}=n,{importNode:q}=s,X={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};e.isSupported=typeof pZ=="function"&&typeof C=="function"&&O&&O.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:j,ERB_EXPR:W,TMPLIT_EXPR:_,DATA_ATTR:at,ARIA_ATTR:ct,IS_SCRIPT_OR_DATA:pt,ATTR_WHITESPACE:Et,CUSTOM_ELEMENT:vt}=FJ,{IS_ALLOWED_URI:yt}=FJ,kt=null,Wt=ni({},[...IJ,...mF,...bF,...vF,...OJ]),jt=null,ae=ni({},[...NJ,...yF,...BJ,...JA]),ee=Object.seal(K0(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}})),Bt=null,Gt=null,Qt=Object.seal(K0(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),xe=!0,Ut=!0,zt=!1,St=!0,it=!1,gt=!0,ft=!1,de=!1,ve=!1,we=!1,Ae=!1,Ue=!1,en=!0,It=!1,Cn="user-content-",mn=!0,mt=!1,K={},Vt=null,te=ni({},["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"]),Nt=null,Se=ni({},["audio","video","img","source","image","track"]),Me=null,ie=ni({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),_t="http://www.w3.org/1998/Math/MathML",Zt="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml",ce=fe,pe=!1,Fe=null,je=ni({},[_t,Zt,fe],gF),Re=ni({},["mi","mo","mn","ms","mtext"]),Ft=ni({},["annotation-xml"]),Ee=ni({},["title","style","font","a","script"]),J=null,lt=["application/xhtml+xml","text/html"],xt=null,At=null,st=n.createElement("form"),rt=function(Pt){return Pt instanceof RegExp||Pt instanceof Function},Tt=function(){let Pt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(At&&At===Pt)return;Pt&&typeof Pt=="object"||(Pt={}
vendor: 5,060 bytes, line 8024
8024),Pt=ga(Pt),J=lt.indexOf(Pt.PARSER_MEDIA_TYPE)===-1?"text/html":Pt.PARSER_MEDIA_TYPE,xt=J==="application/xhtml+xml"?gF:vw,kt=js(Pt,"ALLOWED_TAGS")&&jo(Pt.ALLOWED_TAGS)?ni({},Pt.ALLOWED_TAGS,xt):Wt,jt=js(Pt,"ALLOWED_ATTR")&&jo(Pt.ALLOWED_ATTR)?ni({},Pt.ALLOWED_ATTR,xt):ae,Fe=js(Pt,"ALLOWED_NAMESPACES")&&jo(Pt.ALLOWED_NAMESPACES)?ni({},Pt.ALLOWED_NAMESPACES,gF):je,Me=js(Pt,"ADD_URI_SAFE_ATTR")&&jo(Pt.ADD_URI_SAFE_ATTR)?ni(ga(ie),Pt.ADD_URI_SAFE_ATTR,xt):ie,Nt=js(Pt,"ADD_DATA_URI_TAGS")&&jo(Pt.ADD_DATA_URI_TAGS)?ni(ga(Se),Pt.ADD_DATA_URI_TAGS,xt):Se,Vt=js(Pt,"FORBID_CONTENTS")&&jo(Pt.FORBID_CONTENTS)?ni({},Pt.FORBID_CONTENTS,xt):te,Bt=js(Pt,"FORBID_TAGS")&&jo(Pt.FORBID_TAGS)?ni({},Pt.FORBID_TAGS,xt):ga({}),Gt=js(Pt,"FORBID_ATTR")&&jo(Pt.FORBID_ATTR)?ni({},Pt.FORBID_ATTR,xt):ga({}),K=!!js(Pt,"USE_PROFILES")&&(Pt.USE_PROFILES&&typeof Pt.USE_PROFILES=="object"?ga(Pt.USE_PROFILES):Pt.USE_PROFILES),xe=Pt.ALLOW_ARIA_ATTR!==!1,Ut=Pt.ALLOW_DATA_ATTR!==!1,zt=Pt.ALLOW_UNKNOWN_PROTOCOLS||!1,St=Pt.ALLOW_SELF_CLOSE_IN_ATTR!==!1,it=Pt.SAFE_FOR_TEMPLATES||!1,gt=Pt.SAFE_FOR_XML!==!1,ft=Pt.WHOLE_DOCUMENT||!1,we=Pt.RETURN_DOM||!1,Ae=Pt.RETURN_DOM_FRAGMENT||!1,Ue=Pt.RETURN_TRUSTED_TYPE||!1,ve=Pt.FORCE_BODY||!1,en=Pt.SANITIZE_DOM!==!1,It=Pt.SANITIZE_NAMED_PROPS||!1,mn=Pt.KEEP_CONTENT!==!1,mt=Pt.IN_PLACE||!1,yt=(function(Ie){try{return eo(Ie,""),!0}catch{return!1}})(Pt.ALLOWED_URI_REGEXP)?Pt.ALLOWED_URI_REGEXP:gZ,ce=typeof Pt.NAMESPACE=="string"?Pt.NAMESPACE:fe,Re=js(Pt,"MATHML_TEXT_INTEGRATION_POINTS")&&Pt.MATHML_TEXT_INTEGRATION_POINTS&&typeof Pt.MATHML_TEXT_INTEGRATION_POINTS=="object"?ga(Pt.MATHML_TEXT_INTEGRATION_POINTS):ni({},["mi","mo","mn","ms","mtext"]),Ft=js(Pt,"HTML_INTEGRATION_POINTS")&&Pt.HTML_INTEGRATION_POINTS&&typeof Pt.HTML_INTEGRATION_POINTS=="object"?ga(Pt.HTML_INTEGRATION_POINTS):ni({},["annotation-xml"]);let ze=js(Pt,"CUSTOM_ELEMENT_HANDLING")&&Pt.CUSTOM_ELEMENT_HANDLING&&typeof Pt.CUSTOM_ELEMENT_HANDLING=="object"?ga(Pt.CUSTOM_ELEMENT_HANDLING):K0(null);if(ee=K0(null),js(ze,"tagNameCheck")&&rt(ze.tagNameCheck)&&(ee.tagNameCheck=ze.tagNameCheck),js(ze,"attributeNameCheck")&&rt(ze.attributeNameCheck)&&(ee.attributeNameCheck=ze.attributeNameCheck),js(ze,"allowCustomizedBuiltInElements")&&typeof ze.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=ze.allowCustomizedBuiltInElements),it&&(Ut=!1),Ae&&(we=!0),K&&(kt=ni({},OJ),jt=K0(null),K.html===!0&&(ni(kt,IJ),ni(jt,NJ)),K.svg===!0&&(ni(kt,mF),ni(jt,yF),ni(jt,JA)),K.svgFilters===!0&&(ni(kt,bF),ni(jt,yF),ni(jt,JA)),K.mathMl===!0&&(ni(kt,vF),ni(jt,BJ),ni(jt,JA))),Qt.tagCheck=null,Qt.attributeCheck=null,js(Pt,"ADD_TAGS")&&(typeof Pt.ADD_TAGS=="function"?Qt.tagCheck=Pt.ADD_TAGS:jo(Pt.ADD_TAGS)&&(kt===Wt&&(kt=ga(kt)),ni(kt,Pt.ADD_TAGS,xt))),js(Pt,"ADD_ATTR")&&(typeof Pt.ADD_ATTR=="function"?Qt.attributeCheck=Pt.ADD_ATTR:jo(Pt.ADD_ATTR)&&(jt===ae&&(jt=ga(jt)),ni(jt,Pt.ADD_ATTR,xt))),js(Pt,"ADD_URI_SAFE_ATTR")&&jo(Pt.ADD_URI_SAFE_ATTR)&&ni(Me,Pt.ADD_URI_SAFE_ATTR,xt),js(Pt,"FORBID_CONTENTS")&&jo(Pt.FORBID_CONTENTS)&&(Vt===te&&(Vt=ga(Vt)),ni(Vt,Pt.FORBID_CONTENTS,xt)),js(Pt,"ADD_FORBID_CONTENTS")&&jo(Pt.ADD_FORBID_CONTENTS)&&(Vt===te&&(Vt=ga(Vt)),ni(Vt,Pt.ADD_FORBID_CONTENTS,xt)),mn&&(kt["#text"]=!0),ft&&ni(kt,["html","head","body"]),kt.table&&(ni(kt,["tbody"]),delete Bt.tbody),Pt.TRUSTED_TYPES_POLICY){if(typeof Pt.TRUSTED_TYPES_POLICY.createHTML!="function")throw KA('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Pt.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw KA('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');R=Pt.TRUSTED_TYPES_POLICY,k=R.createHTML("")}else R===void 0&&(R=(function(Ie,En){if(typeof Ie!="object"||typeof Ie.createPolicy!="function")return null;let Dn=null,Xe="data-tt-policy-suffix";En&&En.hasAttribute(Xe)&&(Dn=En.getAttribute(Xe));let mi="dompurify"+(Dn?"#"+Dn:"");try{return Ie.createPolicy(mi,{createHTML:Qi=>Qi,createScriptURL:Qi=>Qi})}catch{return console.warn("TrustedTypes policy "+mi+" could not be created."),null}})(g,r)),R!==null&&typeof k=="string"&&(k=R.createHTML(""));Go&&Go(Pt),At=Pt},Dt=ni({},[...mF,...bF,...xAt]),he=ni({},[...vF,...wAt]),se=function(Pt){gw(e.removed,{element:Pt});try{C(Pt).removeChild(Pt)}catch{w(Pt)}},ye=function(Pt,ze){try{gw(e.removed,{attribute:ze.getAttributeNode(Pt),from:ze})}catch{gw(e.removed,{attribute:null,from:ze})}if(ze.removeAttribute(Pt),Pt==="is")if(we||Ae)try{se(ze)}catch{}else try{ze.setAttribute(Pt,"")}catch{}},be=function(Pt){let ze=null,Ie=null;if(ve)Pt="<remove></remove>"+Pt;else{let Xe=kJ(Pt,/^[\r\n\t ]+/);Ie=Xe&&Xe[0]}J==="application/xhtml+xml"&&ce===fe&&(Pt='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Pt+"</body></html>");let En=R?R.createHTML(Pt):Pt;if(ce===fe)try{ze=new p().parseFromString(En,J)}catch{}if(!ze||!ze.documentElement){ze=O.createDocument(ce,"template",null);try{ze.documentElement.innerHTML=pe?k:En}catch{}}let Dn=ze.body||ze.documentElement;return Pt&&Ie&&Dn.insertBefore(n.createTextNode(Ie),Dn.childNodes[0]||null),
8024ce===fe?V.call(ze,ft?"html":"body")[0]:ft?ze.documentElement:Dn},fn=function(Pt){return I.call(Pt.ownerDocument||Pt,Pt,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},qe=function(Pt){return Pt instanceof d&&(typeof Pt.nodeName!="string"||typeof Pt.textContent!="string"||typeof Pt.removeChild!="function"||!(Pt.attributes instanceof h)||typeof Pt.removeAttribute!="function"||typeof Pt.setAttribute!="function"||typeof Pt.namespaceURI!="string"||typeof Pt.insertBefore!="function"||typeof Pt.hasChildNodes!="function")},xn=function(Pt){return typeof l=="function"&&Pt instanceof l};function vn(Pt,ze,Ie){pw(Pt,(En=>{En.call(e,ze,Ie,At)}))}let jn=function(Pt){let ze=null;if(vn(X.beforeSanitizeElements,Pt,null),qe(Pt))return se(Pt),!0;let Ie=xt(Pt.nodeName);if(vn(X.uponSanitizeElement,Pt,{tagName:Ie,allowedTags:kt}),gt&&Pt.hasChildNodes()&&!xn(Pt.firstElementChild)&&eo(/<[/\w!]/g,Pt.innerHTML)&&eo(/<[/\w!]/g,Pt.textContent)||gt&&Pt.namespaceURI===fe&&Ie==="style"&&xn(Pt.firstElementChild)||Pt.nodeType===DAt||gt&&Pt.nodeType===LAt&&eo(/<[/\w]/g,Pt.data))return se(Pt),!0;if(Bt[Ie]||!(Qt.tagCheck instanceof Function&&Qt.tagCheck(Ie))&&!kt[Ie]){if(!Bt[Ie]&&Ti(Ie)&&(ee.tagNameCheck instanceof RegExp&&eo(ee.tagNameCheck,Ie)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(Ie)))return!1;if(mn&&!Vt[Ie]){let En=C(Pt)||Pt.parentNode,Dn=A(Pt)||Pt.childNodes;if(Dn&&En)for(let Xe=Dn.length-1;Xe>=0;--Xe){let mi=x(Dn[Xe],!0);En.insertBefore(mi,M(Pt))}}return se(Pt),!0}return Pt instanceof c&&!(function(En){let Dn=C(En);Dn&&Dn.tagName||(Dn={namespaceURI:ce,tagName:"template"});let Xe=vw(En.tagName),mi=vw(Dn.tagName);return!!Fe[En.namespaceURI]&&(En.namespaceURI===Zt?Dn.namespaceURI===fe?Xe==="svg":Dn.namespaceURI===_t?Xe==="svg"&&(mi==="annotation-xml"||Re[mi]):!!Dt[Xe]:En.namespaceURI===_t?Dn.namespaceURI===fe?Xe==="math":Dn.namespaceURI===Zt?Xe==="math"&&Ft[mi]:!!he[Xe]:En.namespaceURI===fe?!(Dn.namespaceURI===Zt&&!Ft[mi])&&!(Dn.namespaceURI===_t&&!Re[mi])&&!he[Xe]&&(Ee[Xe]||!Dt[Xe]):!(J!=="application/xhtml+xml"||!Fe[En.namespaceURI]))})(Pt)?(se(Pt),!0):Ie!=="noscript"&&Ie!=="noembed"&&Ie!=="noframes"||!eo(/<\/no(script|embed|frames)/i,Pt.innerHTML)?(it&&Pt.nodeType===RAt&&(ze=Pt.textContent,pw([j,W,_],(En=>{ze=Y0(ze,En," ")})),Pt.textContent!==ze&&(gw(e.removed,{element:Pt.cloneNode()}),Pt.textContent=ze)),vn(X.afterSanitizeElements,Pt,null),!1):(se(Pt),!0)},Fn=function(Pt,ze,Ie){if(Gt[ze]||en&&(ze==="id"||ze==="name")&&(Ie in n||Ie in st))return!1;let En=jt[ze]||Qt.attributeCheck instanceof Function&&Qt.attributeCheck(ze,Pt);if(!(Ut&&!Gt[ze]&&eo(at,ze))){if(!(xe&&eo(ct,ze))){if(!En||Gt[ze]){if(!(Ti(Pt)&&(ee.tagNameCheck instanceof RegExp&&eo(ee.tagNameCheck,Pt)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(Pt))&&(ee.attributeNameCheck instanceof RegExp&&eo(ee.attributeNameCheck,ze)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(ze,Pt))||ze==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&eo(ee.tagNameCheck,Ie)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(Ie))))return!1}else if(!Me[ze]){if(!eo(yt,Y0(Ie,Et,""))){if((ze!=="src"&&ze!=="xlink:href"&&ze!=="href"||Pt==="script"||PJ(Ie,"data:")!==0||!Nt[Pt])&&!(zt&&!eo(pt,Y0(Ie,Et,"")))){if(Ie)return!1}}}}}return!0},si=ni({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ti=function(Pt){return!si[vw(Pt)]&&eo(vt,Pt)},Yi=function(Pt){vn(X.beforeSanitizeAttributes,Pt,null);let{attributes:ze}=Pt;if(!ze||qe(Pt))return;let Ie={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:jt,forceKeepAttr:void 0},En=ze.length;for(;En--;){let Dn=ze[En],{name:Xe,namespaceURI:mi,value:Qi}=Dn,hi=xt(Xe),nt=Qi,Ot=Xe==="value"?nt:mAt(nt);if(Ie.attrName=hi,Ie.attrValue=Ot,Ie.keepAttr=!0,Ie.forceKeepAttr=void 0,vn(X.uponSanitizeAttribute,Pt,Ie),Ot=Ie.attrValue,!It||hi!=="id"&&hi!=="name"||PJ(Ot,Cn)===0||(ye(Xe,Pt),Ot=Cn+Ot),gt&&eo(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ot)){ye(Xe,Pt);continue}if(hi==="attributename"&&kJ(Ot,"href")){ye(Xe,Pt);continue}if(Ie.forceKeepAttr)continue;if(!Ie.keepAttr){ye(Xe,Pt);continue}if(!St&&eo(/\/>/i,Ot)){ye(Xe,Pt);continue}it&&pw([j,W,_],(Kt=>{Ot=Y0(Ot,Kt," ")}));let re=xt(Pt.nodeName);if(Fn(re,hi,Ot)){if(R&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!mi
8024)switch(g.getAttributeType(re,hi)){case"TrustedHTML":Ot=R.createHTML(Ot);break;case"TrustedScriptURL":Ot=R.createScriptURL(Ot)}if(Ot!==nt)try{mi?Pt.setAttributeNS(mi,Xe,Ot):Pt.setAttribute(Xe,Ot),qe(Pt)?se(Pt):EJ(e.removed)}catch{ye(Xe,Pt)}}else ye(Xe,Pt)}vn(X.afterSanitizeAttributes,Pt,null)},_s=function(Pt){let ze=null,Ie=fn(Pt);for(vn(X.beforeSanitizeShadowDOM,Pt,null);ze=Ie.nextNode();)vn(X.uponSanitizeShadowNode,ze,null),jn(ze),Yi(ze),ze.content instanceof o&&_s(ze.content);vn(X.afterSanitizeShadowDOM,Pt,null)};return e.sanitize=function(Pt){let ze=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ie=null,En=null,Dn=null,Xe=null;if(pe=!Pt,pe&&(Pt="<!-->"),typeof Pt!="string"&&!xn(Pt)&&typeof(Pt=(function(hi){switch(typeof hi){case"string":return hi;case"number":return bAt(hi);case"boolean":return vAt(hi);case"bigint":return RJ?RJ(hi):"0";case"symbol":return DJ?DJ(hi):"Symbol()";case"undefined":default:return XA(hi);case"function":case"object":{if(hi===null)return XA(hi);let nt=hi,Ot=X0(nt,"toString");if(typeof Ot=="function"){let re=Ot(nt);return typeof re=="string"?re:XA(re)}return XA(hi)}}})(Pt))!="string")throw KA("dirty is not a string, aborting");if(!e.isSupported)return Pt;if(de||Tt(ze),e.removed=[],typeof Pt=="string"&&(mt=!1),mt){let hi=Pt.nodeName;if(typeof hi=="string"){let nt=xt(hi);if(!kt[nt]||Bt[nt])throw KA("root node is forbidden and cannot be sanitized in-place")}}else if(Pt instanceof l)Ie=be("<!---->"),En=Ie.ownerDocument.importNode(Pt,!0),En.nodeType===PAt&&En.nodeName==="BODY"||En.nodeName==="HTML"?Ie=En:Ie.appendChild(En);else{if(!we&&!it&&!ft&&Pt.indexOf("<")===-1)return R&&Ue?R.createHTML(Pt):Pt;if(Ie=be(Pt),!Ie)return we?null:Ue?k:""}Ie&&ve&&se(Ie.firstChild);let mi=fn(mt?Pt:Ie);for(;Dn=mi.nextNode();)jn(Dn),Yi(Dn),Dn.content instanceof o&&_s(Dn.content);if(mt)return Pt;if(we){if(it){Ie.normalize();let hi=Ie.innerHTML;pw([j,W,_],(nt=>{hi=Y0(hi,nt," ")})),Ie.innerHTML=hi}if(Ae)for(Xe=U.call(Ie.ownerDocument);Ie.firstChild;)Xe.appendChild(Ie.firstChild);else Xe=Ie;return(jt.shadowroot||jt.shadowrootmode)&&(Xe=q.call(s,Xe,!0)),Xe}let Qi=ft?Ie.outerHTML:Ie.innerHTML;return ft&&kt["!doctype"]&&Ie.ownerDocument&&Ie.ownerDocument.doctype&&Ie.ownerDocument.doctype.name&&eo(mZ,Ie.ownerDocument.doctype.name)&&(Qi="<!DOCTYPE "+Ie.ownerDocument.doctype.name+`>
8025`+Qi),it&&pw([j,W,_],(hi=>{Qi=Y0(Qi,hi," ")})),R&&Ue?R.createHTML(Qi):Qi},e.setConfig=function(){Tt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),de=!0},e.clearConfig=function(){At=null,de=!1},e.isValidAttribute=function(Pt,ze,Ie){At||Tt({});let En=xt(Pt),Dn=xt(ze);return Fn(En,Dn,Ie)},e.addHook=function(Pt,ze){typeof ze=="function"&&gw(X[Pt],ze)},e.removeHook=function(Pt,ze){if(ze!==void 0){let Ie=pAt(X[Pt],ze);return Ie===-1?void 0:gAt(X[Pt],Ie,1)[0]}return EJ(X[Pt])},e.removeHooks=function(Pt){X[Pt]=[]},e.removeAllHooks=function(){X={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},e})();nb.addHook("uponSanitizeAttribute",(function(i,t){if(t.attrName==="data-trix-serialized-attributes")return void(t.keepAttr=!1);/^data-trix-/.test(t.attrName)&&(t.forceKeepAttr=!0)}));var NAt="style href src width height language class".split(" "),BAt="javascript:".split(" "),FAt="script iframe form noscript".split(" "),ib=class extends Ws{static setHTML(t,e,n){let s=new this(e,n).sanitize(),r=s.getHTML?s.getHTML():s.outerHTML;t.innerHTML=r}static sanitize(t,e){let n=new this(t,e);return n.sanitize(),n}constructor(t){let{allowedAttributes:e,forbiddenProtocols:n,forbiddenElements:s,purifyOptions:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.allowedAttributes=e||NAt,this.forbiddenProtocols=n||BAt,this.forbiddenElements=s||FAt,this.purifyOptions=r||{},this.body=UAt(t)}sanitize(){this.sanitizeElements(),this.normalizeListElementNesting();let t=Object.assign({},eZ,this.purifyOptions);return nb.setConfig(t),this.body=nb.sanitize(this.body),this.body}getHTML(){return this.body.innerHTML}getBody(){return this.body}sanitizeElements(){let t=sE(this.body),e=[];for(;t.nextNode();){let n=t.currentNode;switch(n.nodeType){case Node.ELEMENT_NODE:this.elementIsRemovable(n)?e.push(n):this.sanitizeElement(n);break;case Node.COMMENT_NODE:e.push(n)}}return e.forEach((n=>zd(n))),this.body}sanitizeElement(t){return t.hasAttribute("href")&&this.forbiddenProtocols.includes(t.protocol)&&t.removeAttribute("href"),Array.from(t.attributes).forEac
8025h((e=>{let{name:n}=e;this.allowedAttributes.includes(n)||n.indexOf("data-trix")===0||t.removeAttribute(n)})),t}normalizeListElementNesting(){return Array.from(this.body.querySelectorAll("ul,ol")).forEach((t=>{let e=t.previousElementSibling;e&&Wo(e)==="li"&&e.appendChild(t)})),this.body}elementIsRemovable(t){if(t?.nodeType===Node.ELEMENT_NODE)return this.elementIsForbidden(t)||this.elementIsntSerializable(t)}elementIsForbidden(t){return this.forbiddenElements.includes(Wo(t))}elementIsntSerializable(t){return t.getAttribute("data-trix-serialize")==="false"&&!Yp(t)}},UAt=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";i=i.replace(/<\/html[^>]*>[^]*$/i,"</html>");let t=document.implementation.createHTMLDocument("");return t.documentElement.innerHTML=i,Array.from(t.head.querySelectorAll("style")).forEach((e=>{t.body.appendChild(e)})),t.body},{css:Nd}=kw,Mw=class extends Qu{constructor(){super(...arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}createContentNodes(){return[]}createNodes(){let t,e=t=fi({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),n=this.getHref();return n&&(t=fi({tagName:"a",editable:!1,attributes:{href:n,tabindex:-1}}),e.appendChild(t)),this.attachment.hasContent()?ib.setHTML(t,this.attachment.getContent()):this.createContentNodes().forEach((s=>{t.appendChild(s)})),t.appendChild(this.createCaptionElement()),this.attachment.isPending()&&(this.progressElement=fi({tagName:"progress",attributes:{class:Nd.attachmentProgress,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:["progressElement",this.attachment.id].join("/")}}),e.appendChild(this.progressElement)),[UJ("left"),e,UJ("right")]}createCaptionElement(){let t=fi({tagName:"figcaption",className:Nd.attachmentCaption}),e=this.attachmentPiece.getCaption();if(e)t.classList.add("".concat(Nd.attachmentCaption,"--edited")),t.textContent=e;else{let n,s,r=this.getCaptionConfig();if(r.name&&(n=this.attachment.getFilename()),r.size&&(s=this.attachment.getFormattedFilesize()),n){let o=fi({tagName:"span",className:Nd.attachmentName,textContent:n});t.appendChild(o)}if(s){n&&t.appendChild(document.createTextNode(" "));let o=fi({tagName:"span",className:Nd.attachmentSize,textContent:s});t.appendChild(o)}}return t}getClassName(){let t=[Nd.attachment,"".concat(Nd.attachment,"--").concat(this.attachment.getType())],e=this.attachment.getExtension();return e&&t.push("".concat(Nd.attachment,"--").concat(e)),t.join(" ")}getData(){let t={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:this.attachment.id},{attributes:e}=this.attachmentPiece;return e.isEmpty()||(t.trixAttributes=JSON.stringify(e)),this.attachment.isPending()&&(t.trixSerialize=!1),t}getHref(){if(!zAt(this.attachment.getContent(),"a")){let t=this.attachment.getHref();if(t&&nb.isValidAttribute("a","href",t))return t}}getCaptionConfig(){var t;let e=this.attachment.getType(),n=hZ((t=XF[e])===null||t===void 0?void 0:t.caption);return e==="file"&&(n.name=!0),n}findProgressElement(){var t;return(t=this.findElement())===null||t===void 0?void 0:t.querySelector("progress")}attachmentDidChangeUploadProgress(){let t=this.attachment.getUploadProgress(),e=this.findProgressElement();e&&(e.value=t)}},UJ=i=>fi({tagName:"span",textContent:ME,data:{trixCursorTarget:i,trixSerialize:!1}}),zAt=function(i,t){let e=fi("div");return ib.setHTML(e,i||""),e.querySelector(t)},aE=class extends Mw{constructor(){super(...arguments),this.attachment.previewDelegate=this}createContentNodes(){return this.image=fi({tagName:"img",attributes:{src:""},data:{trixMutable:!0}}),this.refresh(this.image),[this.image]}createCaptionElement(){let t=super.createCaptionElement(...arguments);return t.textContent||t.setAttribute("data-trix-placeholder",Kn.captionPlaceholder),t}refresh(t){var e;if(t||(t=(e=this.findElement())===null||e===void 0?void 0:e.querySelector("img")),t)return this.updateAttributesForImage(t)}updateAttributesForImage(t){let e=this.attachment.getURL(),n=this.attachment.getPreviewURL();if(t.src=n||e,n===e)t.removeAttribute("data-trix-serialized-attributes");else{let l=JSON.stringify({src:e});t.setAttribute("data-trix-serialized-attributes",l)}let s=this.attachment.getWidth(),r=this.attachment.getHeight(),o=this.attachment.getAttribute("alt");s!=null&&(t.width=s),r!=null&&(t.height=r),o!=null&&(t.alt=o);let a=["imageElement",this.attachment.id,t.src,t.width,t.height].join("/");t.dataset.trixStoreKey=a}attachmentDidChangeAttributes(){return this.refresh(this.image),this.refresh()}},lE=class extends Qu{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 t=this.attachment?this.createAttachmentNodes():this.createStringNodes(),e=this.createElement();if(e){let n=(function(s){for(;(r=s)!==null&&r!==void 0&&r.firstElementChild;){var r;s=s.firstElementChild}return s})(e);Array.from(t).forEach((s=>{n.appendChild(s)})),t=[e]}return t}createAttachmentNodes(){let t=this.attachment.isPreviewable()?aE:Mw;return this.createChildView(t,this.piece.attachment,{piece:this.piece}).getNodes()}createStringNodes(){var t;if((t=this.textConfig)!==null&&t!==void 0&&t.plaintext)return[document.createTextNode(this.string)];{let e=[],n=this.string.split(`
8026`);for(let s=0;s<n.length;s++){let r=n[s];if(s>0){let o=fi("br");e.push(o)}if(r.length){let o=document.createTextNode(this.preserveSpaces(r));e.push(o)}}return e}}createElement(){let t,e,n,s={};for(e in this.attributes){n=this.attributes[e];let o=OF(e);if(o){if(o.tagName){var r;let a=fi(o.tagName);r?(r.appendChild(a),r=a):t=r=a}if(o.styleProperty&&(s[o.styleProperty]=n),o.style)for(e in o.style)n=o.style[e],s[e]=n}}if(Object.keys(s).length)for(e in t||(t=fi("span")),s)n=s[e],t.style[e]=n;return t}createContainerElement(){for(let t in this.attributes){let e=this.attributes[t],n=OF(t);if(n&&n.groupTagName){let s={};return s[t]=e,fi(n.groupTagName,s)}}}
8026preserveSpaces(t){return this.context.isLast&&(t=t.replace(/\ $/,Bd)),t=t.replace(/(\S)\ {3}(\S)/g,"$1 ".concat(Bd," $2")).replace(/\ {2}/g,"".concat(Bd," ")).replace(/\ {2}/g," ".concat(Bd)),(this.context.isFirst||this.context.followsWhitespace)&&(t=t.replace(/^\ /,Bd)),t}},cE=class extends Qu{constructor(){super(...arguments),this.text=this.object,this.textConfig=this.options.textConfig}createNodes(){let t=[],e=Cw.groupObjects(this.getPieces()),n=e.length-1;for(let r=0;r<e.length;r++){let o=e[r],a={};r===0&&(a.isFirst=!0),r===n&&(a.isLast=!0),VAt(s)&&(a.followsWhitespace=!0);let l=this.findOrCreateCachedChildView(lE,o,{textConfig:this.textConfig,context:a});t.push(...Array.from(l.getNodes()||[]));var s=o}return t}getPieces(){return Array.from(this.text.getPieces()).filter((t=>!t.hasAttribute("blockBreak")))}},VAt=i=>/\s$/.test(i?.toString()),{css:zJ}=kw,uE=class extends Qu{constructor(){super(...arguments),this.block=this.object,this.attributes=this.block.getAttributes()}createNodes(){let t=[document.createComment("block")];if(this.block.isEmpty())t.push(fi("br"));else{var e;let n=(e=ir(this.block.getLastAttribute()))===null||e===void 0?void 0:e.text,s=this.findOrCreateCachedChildView(cE,this.block.text,{textConfig:n});t.push(...Array.from(s.getNodes()||[])),this.shouldAddExtraNewlineElement()&&t.push(fi("br"))}if(this.attributes.length)return t;{let n,{tagName:s}=$o.default;this.block.isRTL()&&(n={dir:"rtl"});let r=fi({tagName:s,attributes:n});return t.forEach((o=>r.appendChild(o))),[r]}}createContainerElement(t){let e={},n,s=this.attributes[t],{tagName:r,htmlAttributes:o=[]}=ir(s);if(t===0&&this.block.isRTL()&&Object.assign(e,{dir:"rtl"}),s==="attachmentGallery"){let a=this.block.getBlockBreakPosition();n="".concat(zJ.attachmentGallery," ").concat(zJ.attachmentGallery,"--").concat(a)}return Object.entries(this.block.htmlAttributes).forEach((a=>{let[l,c]=a;o.includes(l)&&(e[l]=c)})),fi({tagName:r,className:n,attributes:e})}shouldAddExtraNewlineElement(){return/\n\n$/.test(this.block.toString())}},sb=class extends Qu{static render(t){let e=fi("div"),n=new this(t,{element:e});return n.render(),n.sync(),e}constructor(){super(...arguments),this.element=this.options.element,this.elementStore=new FF,this.setDocument(this.object)}setDocument(t){t.isEqualTo(this.document)||(this.document=this.object=t)}render(){if(this.childViews=[],this.shadowElement=fi("div"),!this.document.isEmpty()){let t=Cw.groupObjects(this.document.getBlocks(),{asTree:!0});Array.from(t).forEach((e=>{let n=this.findOrCreateCachedChildView(uE,e);Array.from(n.getNodes()).map((s=>this.shadowElement.appendChild(s)))}))}}isSynced(){return HAt(this.shadowElement,this.element)}sync(){let t=sZ("trix-before-render",{cancelable:!1,attributes:{render:(n,s)=>{for(;n.lastChild;)n.removeChild(n.lastChild);n.appendChild(s)}}});this.element.dispatchEvent(t);let e=this.createDocumentFragmentForSync();return t.render(this.element,e),this.didSync()}didSync(){return this.elementStore.reset(VJ(this.element)),t4((()=>this.garbageCollectCachedViews()))}createDocumentFragmentForSync(){let t=document.createDocumentFragment();return Array.from(this.shadowElement.childNodes).forEach((e=>{t.appendChild(e.cloneNode(!0))})),Array.from(VJ(t)).forEach((e=>{let n=this.elementStore.remove(e);n&&e.parentNode.replaceChild(n,e)})),t}},VJ=i=>i.querySelectorAll("[data-trix-store-key]"),HAt=(i,t)=>HJ(i.innerHTML)===HJ(t.innerHTML),HJ=i=>i.replace(/&nbsp;/g," ");function ZA(i){var t,e;function n(r,o){try{var a=i[r](o),l=a.value,c=l instanceof jAt;Promise.resolve(c?l.v:l).then((function(u){if(c){var h=r==="return"?"return":"next";if(!l.k||u.done)return n(h,u);u=i[h](u).value}s(a.done?"return":"normal",u)}),(function(u){n("throw",u)}))}catch(u){s("throw",u)}}function s(r,o){switch(r){case"return":t.resolve({value:o,done:!0});break;case"throw":t.reject(o);break;default:t.resolve({value:o,done:!1})}(t=t.next)?n(t.key,t.arg):e=null}this._invoke=function(r,o){return new Promise((function(a,l){var c={key:r,arg:o,resolve:a,reject:l,next:null};e?e=e.next=c:(t=e=c,n(r,o))}))},typeof i.return!="function"&&(this.return=void 0)}function jAt(i,t){this.v=i,this.k=t}function WAt(i){var t=(function(e,n){if(typeof e!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var r=s.call(e,n||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)})(i,"string");return typeof t=="symbol"?t:String(t)}function go(i,t,e){return(t=WAt(t))in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}ZA.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},ZA.prototype.next=function(i){return this._invoke("next",i)},ZA.prototype.throw=function(i){return this._invoke("throw",i)},ZA.prototype.return=function(i){return this._invoke("return",i)};function Pi(i,t){return $At(i,bZ(i,t,"get"))}function Sw(i,t,e){return GAt(i,bZ(i,t,"set"),e),e}function bZ(i,t,e){if(!t.has(i))throw new TypeError("attempted to "+e+" private field on non-instance");return t.get(i)}function $At(i,t){return t.get?t.get.call(i):t.value}function GAt(i,t,e){if(t.set)t.set.call(i,e);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=e}}function QA(i,t,e){if(!t.has(i))throw new TypeError("attempted to get private field on non-instance");return e}function vZ(i,t){if(t.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function tb(i,t,e){vZ(i,t),t.set(i,e)}var th=class extends Zu{static registerType(t,e){e.type=t,this.types[t]=e}static fromJSON(t){let e=this.types[t.type];if(e)return e.fromJSON(t)}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.attributes=rc.box(e)}copyWithAttributes(t){return new this.constructor(this.getValue(),t)}copyWithAdditionalAttributes(t){return this.copyWithAttributes(this.attributes.merge(t))}copyWithoutAttribute(t){return this.copyWithAttributes(this.attributes.remove(t))}copy(){return this.copyWithAttributes(this.attributes)}getAttribute(t){return this.attributes.get(t)}getAttributesHash(){return this.attributes}getAttributes(){return this.attributes.toObject()}hasAttribute(t){return this.attributes.has(t)}hasSameStringValueAsPiece(t){return t&&this.toString()===t.toString()}hasSameAttributesAsPiece(t){return t&&(this.attributes===t.attributes||this.attributes.isEqualTo(t.attributes))}isBlockBreak(){return!1}isEqualTo(t){return super.isEqualTo(...arguments)||this.hasSameConstructorAs(t)&&this.hasSameStringValueAsPiece(t)&&this.hasSameAttributesAsPiece(t)}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(t){return this.getAttribute("href")===t.getAttribute("href")}getLength(){return this.length}canBeConsolidatedWith(t){return!1}};go(th,"types",{});var hE=class extends eb{constructor(t){super(...arguments),this.url=t}perform(t){let e=new Image;e.onload=()=>
8026(e.width=this.width=e.naturalWidth,e.height=this.height=e.naturalHeight,t(!0,e)),e.onerror=()=>t(!1),e.src=this.url}},rb=class i extends Zu{static attachmentForFile(t){let e=new this(this.attributesForFile(t));return e.setFile(t),e}static attributesForFile(t){return new rc({filename:t.name,filesize:t.size,contentType:t.type})}static fromJSON(t){return new this(t)}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(t),this.releaseFile=this.releaseFile.bind(this),this.attributes=rc.box(t),this.didChangeAttributes()}setAttribute(t,e){this.setAttributes({[t]:e})}getAttribute(t){return this.attributes.get(t)}hasAttribute(t){return this.attributes.has(t)}getAttributes(){return this.attributes.toObject()}setAttributes(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=this.attributes.merge(t);var n,s,r,o;if(!this.attributes.isEqualTo(e))return this.attributes=e,this.didChangeAttributes(),(n=this.previewDelegate)===null||n===void 0||(s=n.attachmentDidChangeAttributes)===null||s===void 0||s.call(n,this),(r=this.delegate)===null||r===void 0||(o=r.attachmentDidChangeAttributes)===null||o===void 0?void 0:o.call(r,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"):i.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 t=this.attributes.get("filesize");return typeof t=="number"?nZ.formatter(t):""}getExtension(){var t;return(t=this.getFilename().match(/\.(\w+)$/))===null||t===void 0?void 0:t[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(t){if(this.file=t,this.isPreviewable())return this.preloadFile()}releaseFile(){this.releasePreloadedFile(),this.file=null}getUploadProgress(){return this.uploadProgress!=null?this.uploadProgress:0}setUploadProgress(t){var e,n;if(this.uploadProgress!==t)return this.uploadProgress=t,(e=this.uploadProgressDelegate)===null||e===void 0||(n=e.attachmentDidChangeUploadProgress)===null||n===void 0?void 0:n.call(e,this)}toJSON(){return this.getAttributes()}getCacheKey(){return[super.getCacheKey(...arguments),this.attributes.getCacheKey(),this.getPreviewURL()].join("/")}getPreviewURL(){return this.previewURL||this.preloadingURL}setPreviewURL(t){var e,n,s,r;if(t!==this.getPreviewURL())return this.previewURL=t,(e=this.previewDelegate)===null||e===void 0||(n=e.attachmentDidChangeAttributes)===null||n===void 0||n.call(e,this),(s=this.delegate)===null||s===void 0||(r=s.attachmentDidChangePreviewURL)===null||r===void 0?void 0:r.call(s,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(t,e){if(t&&t!==this.getPreviewURL())return this.preloadingURL=t,new hE(t).then((n=>{let{width:s,height:r}=n;return this.getWidth()&&this.getHeight()||this.setAttributes({width:s,height:r}),this.preloadingURL=null,this.setPreviewURL(t),e?.()})).catch((()=>(this.preloadingURL=null,e?.())))}};go(rb,"previewablePattern",/^image(\/(gif|png|webp|jpe?g)|$)/);var ob=class i extends th{static fromJSON(t){return new this(rb.fromJSON(t.attachment),t.attributes)}constructor(t){super(...arguments),this.attachment=t,this.length=1,this.ensureAttachmentExclusivelyHasAttribute("href"),this.attachment.hasContent()||this.removeProhibitedAttributes()}ensureAttachmentExclusivelyHasAttribute(t){this.hasAttribute(t)&&(this.attachment.hasAttribute(t)||this.attachment.setAttributes(this.attributes.slice([t])),this.attributes=this.attributes.remove(t))}removeProhibitedAttributes(){let t=this.attributes.slice(i.permittedAttributes);t.isEqualTo(this.attributes)||(this.attributes=t)}getValue(){return this.attachment}isSerializable(){return!this.attachment.isPending()}getCaption(){return this.attributes.get("caption")||""}isEqualTo(t){var e;return super.isEqualTo(t)&&this.attachment.id===(t==null||(e=t.attachment)===null||e===void 0?void 0:e.id)}toString(){return"\uFFFC"}toJSON(){let t=super.toJSON(...arguments);return t.attachment=this.attachment,t}getCacheKey(){return[super.getCacheKey(...arguments),this.attachment.getCacheKey()].join("/")}toConsole(){return JSON.stringify(this.toString())}};go(ob,"permittedAttributes",["caption","presentation"]),th.registerType("attachment",ob);var Tw=class extends th{static fromJSON(t){let e={...t.attributes};return e.href&&!nb.isValidAttribute("a","href",e.href)&&delete e.href,new this(t.string,e)}constructor(t){super(...arguments),this.string=(e=>e.replace(/\r\n?/g,`
8027`))(t),this.length=this.string.length}getValue(){return this.string}toString(){return this.string.toString()}isBlockBreak(){return this.toString()===`
8028`&&this.getAttribute("blockBreak")===!0}toJSON(){let t=super.toJSON(...arguments);return t.string=this.string,t}canBeConsolidatedWith(t){return t&&this.hasSameConstructorAs(t)&&this.hasSameAttributesAsPiece(t)}consolidateWith(t){return new this.constructor(this.toString()+t.toString(),this.attributes)}splitAtOffset(t){let e,n;return t===0?(e=null,n=this):t===this.length?(e=this,n=null):(e=new this.constructor(this.string.slice(0,t),this.attributes),n=new this.constructor(this.string.slice(t),this.attributes)),[e,n]}toConsole(){let{string:t}=this;return t.length>15&&(t=t.slice(0,14)+"\u2026"),JSON.stringify(t.toString())}};th.registerType("string",Tw);var ab=class extends Zu{static box(t){return t instanceof this?t:new this(t)}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects=t.slice(0),this.length=this.objects.length}indexOf(t){return this.objects.indexOf(t)}splice(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new this.constructor(QF(this.objects,...e))}eachObject(t){return this.objects.map(((e,n)=>t(e,n)))}insertObjectAtIndex(t,e){return this.splice(e,0,t)}insertSplittableListAtIndex(t,e){return this.splice(e,0,...t.objects)}insertSplittableListAtPosition(t,e){let[n,s]=this.splitObjectAtPosition(e);return new this.constructor(n).insertSplittableListAtIndex(t,s)}editObjectAtIndex(t,e){return this.replaceObjectAtIndex(e(this.objects[t]),t)}replaceObjectAtIndex(t,e){return this.splice(e,1,t)}removeObjectAtIndex(t){return this.splice(t,1)}getObjectAtIndex(t){return this.objects[t]}getSplittableListInRange(t){let[e,n,s]=this.splitObjectsAtRange(t);return new this.constructor(e.slice(n,s+1))}selectSplittableList(t){let e=this.objects.filter((n=>t(n)));return new this.constructor(e)}removeObjectsInRange(t){let[e,n,s]=this.splitObjectsAtRange(t);return new this.constructor(e).splice(n,s-n+1)}transformObjectsInRange(t,e){let[n,s,r]=this.splitObjectsAtRange(t),o=n.map(((a,l)=>s<=l&&l<=r?e(a):a));return new this.constructor(o)}splitObjectsAtRange(t){let e,[n,s,r]=this.splitObjectAtPosition(YAt(t));return[n,e]=new this.constructor(n).splitObjectAtPosition(XAt(t)+r),[n,s,e-1]}getObjectAtPosition(t){let{index:e}=this.findIndexAndOffsetAtPosition(t);return this.objects[e]}splitObjectAtPosition(t){let e,n,{index:s,offset:r}=this.findIndexAndOffsetAtPosition(t),o=this.objects.slice(0);if(s!=null)if(r===0)e=s,n=0;else{let a=this.getObjectAtIndex(s),[l,c]=a.splitAtOffset(r);o.splice(s,1,l,c),e=s+1,n=l.getLength()-r}else e=o.length,n=0;return[o,e,n]}consolidate(){let t=[],e=this.objects[0];
8028return this.objects.slice(1).forEach((n=>{var s,r;(s=(r=e).canBeConsolidatedWith)!==null&&s!==void 0&&s.call(r,n)?e=e.consolidateWith(n):(t.push(e),e=n)})),e&&t.push(e),new this.constructor(t)}consolidateFromIndexToIndex(t,e){let n=this.objects.slice(0).slice(t,e+1),s=new this.constructor(n).consolidate().toArray();return this.splice(t,n.length,...s)}findIndexAndOffsetAtPosition(t){let e,n=0;for(e=0;e<this.objects.length;e++){let s=n+this.objects[e].getLength();if(n<=t&&t<s)return{index:e,offset:t-n};n=s}return{index:null,offset:null}}findPositionAtIndexAndOffset(t,e){let n=0;for(let s=0;s<this.objects.length;s++){let r=this.objects[s];if(s<t)n+=r.getLength();else if(s===t){n+=e;break}}return n}getEndPosition(){return this.endPosition==null&&(this.endPosition=0,this.objects.forEach((t=>this.endPosition+=t.getLength()))),this.endPosition}toString(){return this.objects.join("")}toArray(){return this.objects.slice(0)}toJSON(){return this.toArray()}isEqualTo(t){return super.isEqualTo(...arguments)||qAt(this.objects,t?.objects)}contentsForInspection(){return{objects:"[".concat(this.objects.map((t=>t.inspect())).join(", "),"]")}}},qAt=function(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(i.length!==t.length)return!1;let e=!0;for(let n=0;n<i.length;n++){let s=i[n];e&&!s.isEqualTo(t[n])&&(e=!1)}return e},YAt=i=>i[0],XAt=i=>i[1],Ua=class extends Zu{static textForAttachmentWithAttributes(t,e){return new this([new ob(t,e)])}static textForStringWithAttributes(t,e){return new this([new Tw(t,e)])}static fromJSON(t){return new this(Array.from(t).map((e=>th.fromJSON(e))))}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments);let e=t.filter((n=>!n.isEmpty()));this.pieceList=new ab(e)}copy(){return this.copyWithPieceList(this.pieceList)}copyWithPieceList(t){return new this.constructor(t.consolidate().toArray())}copyUsingObjectMap(t){let e=this.getPieces().map((n=>t.find(n)||n));return new this.constructor(e)}appendText(t){return this.insertTextAtPosition(t,this.getLength())}insertTextAtPosition(t,e){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(t.pieceList,e))}removeTextAtRange(t){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(t))}replaceTextAtRange(t,e){return this.removeTextAtRange(e).insertTextAtPosition(t,e[0])}moveTextFromRangeToPosition(t,e){if(t[0]<=e&&e<=t[1])return;let n=this.getTextAtRange(t),s=n.getLength();return t[0]<e&&(e-=s),this.removeTextAtRange(t).insertTextAtPosition(n,e)}addAttributeAtRange(t,e,n){let s={};return s[t]=e,this.addAttributesAtRange(s,n)}addAttributesAtRange(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,(n=>n.copyWithAdditionalAttributes(t))))}removeAttributeAtRange(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,(n=>n.copyWithoutAttribute(t))))}setAttributesAtRange(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,(n=>n.copyWithAttributes(t))))}getAttributesAtPosition(t){var e;return((e=this.pieceList.getObjectAtPosition(t))===null||e===void 0?void 0:e.getAttributes())||{}}getCommonAttributes(){let t=Array.from(this.pieceList.toArray()).map((e=>e.getAttributes()));return rc.fromCommonAttributesOfObjects(t).toObject()}getCommonAttributesAtRange(t){return this.getTextAtRange(t).getCommonAttributes()||{}}getExpandedRangeForAttributeAtOffset(t,e){let n,s=n=e,r=this.getLength();for(;s>0&&this.getCommonAttributesAtRange([s-1,n])[t];)s--;for(;n<r&&this.getCommonAttributesAtRange([e,n+1])[t];)n++;return[s,n]}getTextAtRange(t){return this.copyWithPieceList(this.pieceList.getSplittableListInRange(t))}getStringAtRange(t){return this.pieceList.getSplittableListInRange(t).toString()}getStringAtPosition(t){return this.getStringAtRange([t,t+1])}startsWithString(t){return this.getStringAtRange([0,t.length])===t}endsWithString(t){let e=this.getLength();return this.getStringAtRange([e-t.length,e])===t}getAttachmentPieces(){return this.pieceList.toArray().filter((t=>!!t.attachment))}getAttachments(){return this.getAttachmentPieces().map((t=>t.attachment))}getAttachmentAndPositionById(t){let e=0;for(let s of this.pieceList.toArray()){var n;if(((n=s.attachment)===null||n===void 0?void 0:n.id)===t)return{attachment:s.attachment,position:e};e+=s.length}return{attachment:null,position:null}}getAttachmentById(t){let{attachment:e}=this.getAttachmentAndPositionById(t);return e}getRangeOfAttachment(t){let e=this.getAttachmentAndPositionById(t.id),n=e.position;if(t=e.attachment)return[n,n+1]}updateAttributesForAttachment(t,e){let n=this.getRangeOfAttachment(e);return n?this.addAttributesAtRange(t,n):this}getLength(){return this.pieceList.getEndPosition()}isEmpty(){return this.getLength()===0}isEqualTo(t){var e;return super.isEqualTo(t)||(t==null||(e=t.pieceList)===null||e===void 0?void 0:e.isEqualTo(this.pieceList))}isBlockBreak(){return this.getLength()===1&&this.pieceList.getObjectAtIndex(0).isBlockBreak()}eachPiece(t){return this.pieceList.eachObject(t)}getPieces(){return this.pieceList.toArray()}getPieceAtPosition(t){return this.pieceList.getObjectAtPosition(t)}contentsForInspection(){return{pieceList:this.pieceList.inspect()}}toSerializableText(){let t=this.pieceList.selectSplittableList((e=>e.isSerializable()));return this.copyWithPieceList(t)}toString(){return this.pieceList.toString()}toJSON(){return this.pieceList.toJSON()}toConsole(){return JSON.stringify(this.pieceList.toArray().map((t=>JSON.parse(t.toConsole()))))}getDirection(){return nAt(this.toString())}isRTL(){return this.getDirection()==="rtl"}},Fd=class i extends Zu{static fromJSON(t){return new this(Ua.fromJSON(t.text),t.attributes,t.htmlAttributes)}constructor(t,e,n){super(...arguments),this.text=KAt(t||new Ua),this.attributes=e||[],this.htmlAttributes=n||{}}isEmpty(){return this.text.isBlockBreak()}isEqualTo(t){return!!super.isEqualTo(t)||this.text.isEqualTo(t?.text)&&Qp(this.attributes,t?.attributes)&&ub(this.htmlAttributes,t?.htmlAttributes)}copyWithText(t){return new i(t,this.attributes,this.htmlAttributes)}copyWithoutText(){return this.copyWithText(null)}copyWithAttributes(t){return new i(this.text,t,this.htmlAttributes)}copyWithoutAttributes(){return this.copyWithAttributes(null)}copyUsingObjectMap(t){let e=t.find(this.text);return e?this.copyWithText(e):this.copyWithText(this.text.copyUsingObjectMap(t))}addAttribute(t){let e=this.attributes.concat(jJ(t));return this.copyWithAttributes(e)}addHTMLAttribute(t,e){let n=Object.assign({},this.htmlAttributes,{[t]:e});return new i(this.text,this.attributes,n)}removeAttribute(t){let{listAttribute:e}=ir(t),n=$J($J(this.attributes,t),e);return this.copyWithAttributes(n)}removeLastAttribute(){return this.removeAttribute(this.getLastAttribute())}getLastAttribute(){return WJ(this.attributes)}getAttributes(){return this.attributes.slice(0)}getAttributeLevel(){return this.attributes.length}getAttributeAtLevel(t){return this.attributes[t-1]}hasAttribute(t){return this.attributes.includes(t)}hasAttributes(){return this.getAttributeLevel()>0}getLastNestableAttribute(){return WJ(this.getNestableAttributes())}getNestableAttributes(){return this.attributes.filter((t=>ir(t).nestable))}getNestingLevel(){return this.getNestableAttributes().length}decreaseNestingLevel(){let t=this.getLastNestableAttribute();return t?this.removeAttribute(t):this}increaseNestingLevel(){let t=this.getLastNestableAttribute();if(t){let e=this.attributes.lastIndexOf(t),n=QF(this.attributes,e+1,0,...jJ(t));return this.copyWithAttributes(n)}return this}getListItemAttributes(){return this.attributes.filter((t=>ir(t).listAttribute))}isListItem(){var t;return(t=ir(this.getLastAttribute()))===null||t===void 0?void 0:t.listAttribute}isTerminalBlock(){var t;return(t=ir(this.getLastAttribute()))===null||t===void 0?void 0:t.terminal}breaksOnReturn(){var t;return(t=ir(this.getLastAttribute()))===null||t===void 0?void 0:t.breakOnReturn}findLineBreakInDirectionFromPosition(t,e){let n=this.toString(),s;switch(t){case"forward":s=n.indexOf(`
8029`,e);break;case"backward":s=n.slice(0,e).lastIndexOf(`
8030`)}if(s!==-1)return s}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(t){return!this.hasAttributes()&&!t.hasAttributes()&&this.getDirection()===t.getDirection()}consolidateWith(t){let e=Ua.textForStringWithAttributes(`
8031`),n=this.getTextWithoutBlockBreak().appendText(e);return this.copyWithText(n.appendText(t.text))}splitAtOffset(t){let e,n;return t===0?(e=null,n=this):t===this.getLength()?(e=this,n=null):(e=this.copyWithText(this.text.getTextAtRange([0,t])),n=this.copyWithText(this.text.getTextAtRange([t,this.getLength()]))),[e,n]}getBlockBreakPosition(){return this.text.getLength()-1}getTextWithoutBlockBreak(){return yZ(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()}canBeGrouped(t){return this.attributes[t]}canBeGroupedWith(t,e){let n=t.getAttributes(),s=n[e],r=this.attributes[e];return r===s&&!(ir(r).group===!1&&!(()=>
8031{if(!YA){YA=[];for(let o in $o){let{listAttribute:a}=$o[o];a!=null&&YA.push(a)}}return YA})().includes(n[e+1]))&&(this.getDirection()===t.getDirection()||t.isEmpty())}},KAt=function(i){return i=JAt(i),i=QAt(i)},JAt=function(i){let t=!1,e=i.getPieces(),n=e.slice(0,e.length-1),s=e[e.length-1];return s?(n=n.map((r=>r.isBlockBreak()?(t=!0,tEt(r)):r)),t?new Ua([...n,s]):i):i},ZAt=Ua.textForStringWithAttributes(`
8032`,{blockBreak:!0}),QAt=function(i){return yZ(i)?i:i.appendText(ZAt)},yZ=function(i){let t=i.getLength();return t===0?!1:i.getTextAtRange([t-1,t]).isBlockBreak()},tEt=i=>i.copyWithoutAttribute("blockBreak"),jJ=function(i){let{listAttribute:t}=ir(i);return t?[t,i]:[i]},WJ=i=>i.slice(-1)[0],$J=function(i,t){let e=i.lastIndexOf(t);return e===-1?i:QF(i,e,1)},ma=class extends Zu{static fromJSON(t){return new this(Array.from(t).map((e=>Fd.fromJSON(e))))}static fromString(t,e){let n=Ua.textForStringWithAttributes(t,e);return new this([new Fd(n)])}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),t.length===0&&(t=[new Fd]),this.blockList=ab.box(t)}isEmpty(){let t=this.getBlockAtIndex(0);return this.blockList.length===1&&t.isEmpty()&&!t.hasAttributes()}copy(){let t=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray();return new this.constructor(t)}copyUsingObjectsFromDocument(t){let e=new BF(t.getObjects());return this.copyUsingObjectMap(e)}copyUsingObjectMap(t){let e=this.getBlocks().map((n=>t.find(n)||n.copyUsingObjectMap(t)));return new this.constructor(e)}copyWithBaseBlockAttributes(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=this.getBlocks().map((n=>{let s=t.concat(n.getAttributes());return n.copyWithAttributes(s)}));return new this.constructor(e)}replaceBlock(t,e){let n=this.blockList.indexOf(t);return n===-1?this:new this.constructor(this.blockList.replaceObjectAtIndex(e,n))}insertDocumentAtRange(t,e){let{blockList:n}=t;e=Zi(e);let[s]=e,{index:r,offset:o}=this.locationFromPosition(s),a=this,l=this.getBlockAtPosition(s);return Ju(e)&&l.isEmpty()&&!l.hasAttributes()?a=new this.constructor(a.blockList.removeObjectAtIndex(r)):l.getBlockBreakPosition()===o&&s++,a=a.removeTextAtRange(e),new this.constructor(a.blockList.insertSplittableListAtPosition(n,s))}mergeDocumentAtRange(t,e){let n,s;e=Zi(e);let[r]=e,o=this.locationFromPosition(r),a=this.getBlockAtIndex(o.index).getAttributes(),l=t.getBaseBlockAttributes(),c=a.slice(-l.length);if(Qp(l,c)){let d=a.slice(0,-l.length);n=t.copyWithBaseBlockAttributes(d)}else n=t.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(a);let u=n.getBlockCount(),h=n.getBlockAtIndex(0);if(Qp(a,h.getAttributes())){let d=h.getTextWithoutBlockBreak();if(s=this.insertTextAtRange(d,e),u>1){n=new this.constructor(n.getBlocks().slice(1));let p=r+d.getLength();s=s.insertDocumentAtRange(n,p)}}else s=this.insertDocumentAtRange(n,e);return s}insertTextAtRange(t,e){e=Zi(e);let[n]=e,{index:s,offset:r}=this.locationFromPosition(n),o=this.removeTextAtRange(e);return new this.constructor(o.blockList.editObjectAtIndex(s,(a=>a.copyWithText(a.text.insertTextAtPosition(t,r)))))}removeTextAtRange(t){let e;t=Zi(t);let[n,s]=t;if(Ju(t))return this;let[r,o]=Array.from(this.locationRangeFromRange(t)),a=r.index,l=r.offset,c=this.getBlockAtIndex(a),u=o.index,h=o.offset,d=this.getBlockAtIndex(u);if(s-n==1&&c.getBlockBreakPosition()===l&&d.getBlockBreakPosition()!==h&&d.text.getStringAtPosition(h)===`
8033`)e=this.blockList.editObjectAtIndex(u,(p=>p.copyWithText(p.text.removeTextAtRange([h,h+1]))));else{let p,g=c.text.getTextAtRange([0,l]),y=d.text.getTextAtRange([h,d.getLength()]),x=g.appendText(y);p=a!==u&&l===0&&c.getAttributeLevel()>=d.getAttributeLevel()?d.copyWithText(x):c.copyWithText(x);let w=u+1-a;e=this.blockList.splice(a,w,p)}return new this.constructor(e)}moveTextFromRangeToPosition(t,e){let n;t=Zi(t);let[s,r]=t;if(s<=e&&e<=r)return this;let o=this.getDocumentAtRange(t),a=this.removeTextAtRange(t),l=s<e;l&&(e-=o.getLength());let[c,...u]=o.getBlocks();return u.length===0?(n=c.getTextWithoutBlockBreak(),l&&(e+=1)):n=c.text,a=a.insertTextAtRange(n,e),u.length===0?a:(o=new this.constructor(u),e+=n.getLength(),a.insertDocumentAtRange(o,e))}
8033addAttributeAtRange(t,e,n){let{blockList:s}=this;return this.eachBlockAtRange(n,((r,o,a)=>s=s.editObjectAtIndex(a,(function(){return ir(t)?r.addAttribute(t,e):o[0]===o[1]?r:r.copyWithText(r.text.addAttributeAtRange(t,e,o))})))),new this.constructor(s)}addAttribute(t,e){let{blockList:n}=this;return this.eachBlock(((s,r)=>n=n.editObjectAtIndex(r,(()=>s.addAttribute(t,e))))),new this.constructor(n)}removeAttributeAtRange(t,e){let{blockList:n}=this;return this.eachBlockAtRange(e,(function(s,r,o){ir(t)?n=n.editObjectAtIndex(o,(()=>s.removeAttribute(t))):r[0]!==r[1]&&(n=n.editObjectAtIndex(o,(()=>s.copyWithText(s.text.removeAttributeAtRange(t,r)))))})),new this.constructor(n)}updateAttributesForAttachment(t,e){let n=this.getRangeOfAttachment(e),[s]=Array.from(n),{index:r}=this.locationFromPosition(s),o=this.getTextAtIndex(r);return new this.constructor(this.blockList.editObjectAtIndex(r,(a=>a.copyWithText(o.updateAttributesForAttachment(t,e)))))}removeAttributeForAttachment(t,e){let n=this.getRangeOfAttachment(e);return this.removeAttributeAtRange(t,n)}setHTMLAttributeAtPosition(t,e,n){let s=this.getBlockAtPosition(t),r=s.addHTMLAttribute(e,n);return this.replaceBlock(s,r)}insertBlockBreakAtRange(t){let e;t=Zi(t);let[n]=t,{offset:s}=this.locationFromPosition(n),r=this.removeTextAtRange(t);return s===0&&(e=[new Fd]),new this.constructor(r.blockList.insertSplittableListAtPosition(new ab(e),n))}applyBlockAttributeAtRange(t,e,n){let s=this.expandRangeToLineBreaksAndSplitBlocks(n),r=s.document;n=s.range;let o=ir(t);if(o.listAttribute){r=r.removeLastListAttributeAtRange(n,{exceptAttributeName:t});let a=r.convertLineBreaksToBlockBreaksInRange(n);r=a.document,n=a.range}else r=o.exclusive?r.removeBlockAttributesAtRange(n):o.terminal?r.removeLastTerminalAttributeAtRange(n):r.consolidateBlocksAtRange(n);return r.addAttributeAtRange(t,e,n)}removeLastListAttributeAtRange(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{blockList:n}=this;return this.eachBlockAtRange(t,(function(s,r,o){let a=s.getLastAttribute();a&&ir(a).listAttribute&&a!==e.exceptAttributeName&&(n=n.editObjectAtIndex(o,(()=>s.removeAttribute(a))))})),new this.constructor(n)}removeLastTerminalAttributeAtRange(t){let{blockList:e}=this;return this.eachBlockAtRange(t,(function(n,s,r){let o=n.getLastAttribute();o&&ir(o).terminal&&(e=e.editObjectAtIndex(r,(()=>n.removeAttribute(o))))})),new this.constructor(e)}removeBlockAttributesAtRange(t){let{blockList:e}=this;return this.eachBlockAtRange(t,(function(n,s,r){n.hasAttributes()&&(e=e.editObjectAtIndex(r,(()=>n.copyWithoutAttributes())))})),new this.constructor(e)}expandRangeToLineBreaksAndSplitBlocks(t){let e;t=Zi(t);let[n,s]=t,r=this.locationFromPosition(n),o=this.locationFromPosition(s),a=this,l=a.getBlockAtIndex(r.index);if(r.offset=l.findLineBreakInDirectionFromPosition("backward",r.offset),r.offset!=null&&(e=a.positionFromLocation(r),a=a.insertBlockBreakAtRange([e,e+1]),o.index+=1,o.offset-=a.getBlockAtIndex(r.index).getLength(),r.index+=1),r.offset=0,o.offset===0&&o.index>r.index)o.index-=1,o.offset=a.getBlockAtIndex(o.index).getBlockBreakPosition();else{let c=a.getBlockAtIndex(o.index);c.text.getStringAtRange([o.offset-1,o.offset])===`
8034`?o.offset-=1:o.offset=c.findLineBreakInDirectionFromPosition("forward",o.offset),o.offset!==c.getBlockBreakPosition()&&(e=a.positionFromLocation(o),a=a.insertBlockBreakAtRange([e,e+1]))}return n=a.positionFromLocation(r),s=a.positionFromLocation(o),{document:a,range:t=Zi([n,s])}}convertLineBreaksToBlockBreaksInRange(t){t=Zi(t);let[e]=t,n=this.getStringAtRange(t).slice(0,-1),s=this;return n.replace(/.*?\n/g,(function(r){e+=r.length,s=s.insertBlockBreakAtRange([e-1,e])})),{document:s,range:t}}consolidateBlocksAtRange(t){t=Zi(t);let[e,n]=t,s=this.locationFromPosition(e).index,r=this.locationFromPosition(n).index;return new this.constructor(this.blockList.consolidateFromIndexToIndex(s,r))}getDocumentAtRange(t){t=Zi(t);let e=this.blockList.getSplittableListInRange(t).toArray();return new this.constructor(e)}getStringAtRange(t){let e,n=t=Zi(t);return n[n.length-1]!==this.getLength()&&(e=-1),this.getDocumentAtRange(t).toString().slice(0,e)}getBlockAtIndex(t){return this.blockList.getObjectAtIndex(t)}getBlockAtPosition(t){let{index:e}=this.locationFromPosition(t);return this.getBlockAtIndex(e)}getTextAtIndex(t){var e;return(e=this.getBlockAtIndex(t))===null||e===void 0?void 0:e.text}getTextAtPosition(t){let{index:e}=this.locationFromPosition(t);return this.getTextAtIndex(e)}getPieceAtPosition(t){let{index:e,offset:n}=this.locationFromPosition(t);return this.getTextAtIndex(e).getPieceAtPosition(n)}getCharacterAtPosition(t){let{index:e,offset:n}=this.locationFromPosition(t);return this.getTextAtIndex(e).getStringAtRange([n,n+1])}getLength(){return this.blockList.getEndPosition()}getBlocks(){return this.blockList.toArray()}getBlockCount(){return this.blockList.length}getEditCount(){return this.editCount}eachBlock(t){return this.blockList.eachObject(t)}eachBlockAtRange(t,e){let n,s;t=Zi(t);let[r,o]=t,a=this.locationFromPosition(r),l=this.locationFromPosition(o);if(a.index===l.index)return n=this.getBlockAtIndex(a.index),s=[a.offset,l.offset],e(n,s,a.index);for(let c=a.index;c<=l.index;c++)if(n=this.getBlockAtIndex(c),n){switch(c){case a.index:s=[a.offset,n.text.getLength()];break;case l.index:s=[0,l.offset];break;default:s=[0,n.text.getLength()]}
8034e(n,s,c)}}getCommonAttributesAtRange(t){t=Zi(t);let[e]=t;if(Ju(t))return this.getCommonAttributesAtPosition(e);{let n=[],s=[];return this.eachBlockAtRange(t,(function(r,o){if(o[0]!==o[1])return n.push(r.text.getCommonAttributesAtRange(o)),s.push(GJ(r))})),rc.fromCommonAttributesOfObjects(n).merge(rc.fromCommonAttributesOfObjects(s)).toObject()}}getCommonAttributesAtPosition(t){let e,n,{index:s,offset:r}=this.locationFromPosition(t),o=this.getBlockAtIndex(s);if(!o)return{};let a=GJ(o),l=o.text.getAttributesAtPosition(r),c=o.text.getAttributesAtPosition(r-1),u=Object.keys(Jp).filter((h=>Jp[h].inheritable));for(e in c)n=c[e],(n===l[e]||u.includes(e))&&(a[e]=n);return a}getRangeOfCommonAttributeAtPosition(t,e){let{index:n,offset:s}=this.locationFromPosition(e),r=this.getTextAtIndex(n),[o,a]=Array.from(r.getExpandedRangeForAttributeAtOffset(t,s)),l=this.positionFromLocation({index:n,offset:o}),c=this.positionFromLocation({index:n,offset:a});return Zi([l,c])}getBaseBlockAttributes(){let t=this.getBlockAtIndex(0).getAttributes();for(let e=1;e<this.getBlockCount();e++){let n=this.getBlockAtIndex(e).getAttributes(),s=Math.min(t.length,n.length);t=(()=>{let r=[];for(let o=0;o<s&&n[o]===t[o];o++)r.push(n[o]);return r})()}return t}getAttachmentById(t){for(let e of this.getAttachments())if(e.id===t)return e}getAttachmentPieces(){let t=[];return this.blockList.eachObject((e=>{let{text:n}=e;return t=t.concat(n.getAttachmentPieces())})),t}getAttachments(){return this.getAttachmentPieces().map((t=>t.attachment))}getRangeOfAttachment(t){let e=0,n=this.blockList.toArray();for(let s=0;s<n.length;s++){let{text:r}=n[s],o=r.getRangeOfAttachment(t);if(o)return Zi([e+o[0],e+o[1]]);e+=r.getLength()}}getLocationRangeOfAttachment(t){let e=this.getRangeOfAttachment(t);return this.locationRangeFromRange(e)}getAttachmentPieceForAttachment(t){for(let e of this.getAttachmentPieces())if(e.attachment===t)return e}findRangesForBlockAttribute(t){let e=0,n=[];return this.getBlocks().forEach((s=>{let r=s.getLength();s.hasAttribute(t)&&n.push([e,e+r]),e+=r})),n}findRangesForTextAttribute(t){let{withValue:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=0,s=[],r=[];return this.getPieces().forEach((o=>{let a=o.getLength();(function(l){return e?l.getAttribute(t)===e:l.hasAttribute(t)})(o)&&(s[1]===n?s[1]=n+a:r.push(s=[n,n+a])),n+=a})),r}locationFromPosition(t){let e=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,t));if(e.index!=null)return e;{let n=this.getBlocks();return{index:n.length-1,offset:n[n.length-1].getLength()}}}positionFromLocation(t){return this.blockList.findPositionAtIndexAndOffset(t.index,t.offset)}locationRangeFromPosition(t){return Zi(this.locationFromPosition(t))}locationRangeFromRange(t){if(!(t=Zi(t)))return;let[e,n]=Array.from(t),s=this.locationFromPosition(e),r=this.locationFromPosition(n);return Zi([s,r])}rangeFromLocationRange(t){let e;t=Zi(t);let n=this.positionFromLocation(t[0]);return Ju(t)||(e=this.positionFromLocation(t[1])),Zi([n,e])}isEqualTo(t){return this.blockList.isEqualTo(t?.blockList)}getTexts(){return this.getBlocks().map((t=>t.text))}getPieces(){let t=[];return Array.from(this.getTexts()).forEach((e=>{t.push(...Array.from(e.getPieces()||[]))})),t}getObjects(){return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())}toSerializableDocument(){let t=[];return this.blockList.eachObject((e=>t.push(e.copyWithText(e.text.toSerializableText())))),new this.constructor(t)}toString(){return this.blockList.toString()}toJSON(){return this.blockList.toJSON()}toConsole(){return JSON.stringify(this.blockList.toArray().map((t=>JSON.parse(t.text.toConsole()))))}},GJ=function(i){let t={},e=i.getLastAttribute();return e&&(t[e]=!0),t},xF=function(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return{string:i=bw(i),attributes:t,type:"string"}},qJ=(i,t)=>{try{return JSON.parse(i.getAttribute("data-trix-".concat(t)))}catch{return{}}},eg=class extends Ws{static parse(t,e){let n=new this(t,e);return n.parse(),n}constructor(t){let{referenceElement:e,purifyOptions:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.html=t,this.referenceElement=e,this.purifyOptions=n,this.blocks=[],this.blockElements=[],this.processedElements=[]}getDocument(){return ma.fromJSON(this.blocks)}parse(){try{this.createHiddenContainer(),ib.setHTML(this.containerElement,this.html,{purifyOptions:this.purifyOptions});let t=sE(this.containerElement,{usingFilter:nEt});for(;t.nextNode();)this.processNode(t.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=fi({tagName:"div",style:{display:"none"}}),document.body.appendChild(this.containerElement))}removeHiddenContainer(){return zd(this.containerElement)}processNode(t){switch(t.nodeType){case Node.TEXT_NODE:if(!this.isInsignificantTextNode(t))return this.appendBlockForTextNode(t),this.processTextNode(t);break;case Node.ELEMENT_NODE:return this.appendBlockForElement(t),this.processElement(t)}}appendBlockForTextNode(t){let e=t.parentNode;if(e===this.currentBlockElement&&this.isBlockElement(t.previousSibling))return this.appendStringWithAttributes(`
8035`);if(e===this.containerElement||this.isBlockElement(e)){var n;let s=this.getBlockAttributes(e),r=this.getBlockHTMLAttributes(e);Qp(s,(n=this.currentBlock)===null||n===void 0?void 0:n.attributes)||(this.currentBlock=this.appendBlockForAttributesWithElement(s,e,r),this.currentBlockElement=e)}}appendBlockForElement(t){let e=this.isBlockElement(t),n=Gp(this.currentBlockElement,t);if(e&&!this.isBlockElement(t.firstChild)){if(!this.isInsignificantTextNode(t.firstChild)||!this.isBlockElement(t.firstElementChild)){let s=this.getBlockAttributes(t),r=this.getBlockHTMLAttributes(t);if(t.firstChild){if(n&&Qp(s,this.currentBlock.attributes))return this.appendStringWithAttributes(`
8036`);this.currentBlock=this.appendBlockForAttributesWithElement(s,t,r),this.currentBlockElement=t}}}else if(this.currentBlockElement&&!n&&!e){let s=this.findParentBlockElement(t);if(s)return this.appendBlockForElement(s);this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null}}findParentBlockElement(t){let{parentElement:e}=t;for(;e&&e!==this.containerElement;){if(this.isBlockElement(e)&&this.blockElements.includes(e))return e;e=e.parentElement}return null}processTextNode(t){let e=t.data;var n;return YJ(t.parentNode)||(e=n4(e),xZ((n=t.previousSibling)===null||n===void 0?void 0:n.textContent)&&(e=iEt(e))),this.appendStringWithAttributes(e,this.getTextAttributes(t.parentNode))}processElement(t){let e;if(Yp(t)){if(e=qJ(t,"attachment"),Object.keys(e).length){let n=this.getTextAttributes(t);this.appendAttachmentWithAttributes(e,n),t.innerHTML=""}return this.processedElements.push(t)}switch(Wo(t)){case"br":return this.isExtraBR(t)||this.isBlockElement(t.nextSibling)||this.appendStringWithAttributes(`
8037`,this.getTextAttributes(t)),this.processedElements.push(t);case"img":e={url:t.getAttribute("src"),contentType:"image"};let n=(s=>{let r=s.getAttribute("width"),o=s.getAttribute("height"),a={};return r&&(a.width=parseInt(r,10)),o&&(a.height=parseInt(o,10)),a})(t);for(let s in n){let r=n[s];e[s]=r}return this.appendAttachmentWithAttributes(e,this.getTextAttributes(t)),this.processedElements.push(t);case"tr":if(this.needsTableSeparator(t))return this.appendStringWithAttributes(nE.tableRowSeparator);break;case"td":if(this.needsTableSeparator(t))return this.appendStringWithAttributes(nE.tableCellSeparator)}}appendBlockForAttributesWithElement(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.blockElements.push(e);let s=(function(){return{text:[],attributes:arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},htmlAttributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}}})(t,n);return this.blocks.push(s),s}appendEmptyBlock(){return this.appendBlockForAttributesWithElement([],null)}appendStringWithAttributes(t,e){return this.appendPiece(xF(t,e))}appendAttachmentWithAttributes(t,e){return this.appendPiece((function(n){return{attachment:n,attributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},type:"attachment"}})(t,e))}appendPiece(t){return this.blocks.length===0&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(t)}appendStringToTextAtIndex(t,e){let{text:n}=this.blocks[e],s=n[n.length-1];if(s?.type!=="string")return n.push(xF(t));s.string+=t}prependStringToTextAtIndex(t,e){let{text:n}=this.blocks[e],s=n[0];if(s?.type!=="string")return n.unshift(xF(t));s.string=t+s.string}getTextAttributes(t){let e,n={};for(let s in Jp){let r=Jp[s];if(r.tagName&&Ud(t,{matchingSelector:r.tagName,untilNode:this.containerElement}))n[s]=!0;else if(r.parser){if(e=r.parser(t),e){let o=!1;for(let a of this.findBlockElementAncestors(t))if(r.parser(a)===e){o=!0;break}o||(n[s]=e)}}else r.styleProperty&&(e=t.style[r.styleProperty],e&&(n[s]=e))}if(Yp(t)){let s=qJ(t,"attributes");for(let r in s)e=s[r],n[r]=e}return n}getBlockAttributes(t){let e=[];for(;t&&t!==this.containerElement;){for(let s in $o){let r=$o[s];var n;r.parse!==!1&&Wo(t)===r.tagName&&((n=r.test)!==null&&n!==void 0&&n.call(r,t)||!r.test)&&(e.push(s),r.listAttribute&&e.push(r.listAttribute))}t=t.parentNode}return e.reverse()}getBlockHTMLAttributes(t){let e={},n=Object.values($o).find((s=>s.tagName===Wo(t)));
8037return(n?.htmlAttributes||[]).forEach((s=>{t.hasAttribute(s)&&(e[s]=t.getAttribute(s))})),e}findBlockElementAncestors(t){let e=[];for(;t&&t!==this.containerElement;){let n=Wo(t);xw().includes(n)&&e.push(t),t=t.parentNode}return e}isBlockElement(t){if(t?.nodeType===Node.ELEMENT_NODE&&!Yp(t)&&!Ud(t,{matchingSelector:"td",untilNode:this.containerElement}))return xw().includes(Wo(t))||window.getComputedStyle(t).display==="block"}isInsignificantTextNode(t){if(t?.nodeType!==Node.TEXT_NODE||!sEt(t.data))return;let{parentNode:e,previousSibling:n,nextSibling:s}=t;return eEt(e.previousSibling)&&!this.isBlockElement(e.previousSibling)||YJ(e)?void 0:!n||this.isBlockElement(n)||!s||this.isBlockElement(s)}isExtraBR(t){return Wo(t)==="br"&&this.isBlockElement(t.parentNode)&&t.parentNode.lastChild===t}needsTableSeparator(t){if(nE.removeBlankTableCells){var e;let n=(e=t.previousSibling)===null||e===void 0?void 0:e.textContent;return n&&/\S/.test(n)}return t.previousSibling}translateBlockElementMarginsToNewlines(){let t=this.getMarginOfDefaultBlockElement();for(let e=0;e<this.blocks.length;e++){let n=this.getMarginOfBlockElementAtIndex(e);n&&(n.top>2*t.top&&this.prependStringToTextAtIndex(`
8038`,e),n.bottom>2*t.bottom&&this.appendStringToTextAtIndex(`
8039`,e))}}getMarginOfBlockElementAtIndex(t){let e=this.blockElements[t];if(e&&e.textContent&&!xw().includes(Wo(e))&&!this.processedElements.includes(e))return XJ(e)}getMarginOfDefaultBlockElement(){let t=fi($o.default.tagName);return this.containerElement.appendChild(t),XJ(t)}},YJ=function(i){let{whiteSpace:t}=window.getComputedStyle(i);return["pre","pre-wrap","pre-line"].includes(t)},eEt=i=>i&&!xZ(i.textContent),XJ=function(i){let t=window.getComputedStyle(i);if(t.display==="block")return{top:parseInt(t.marginTop),bottom:parseInt(t.marginBottom)}},nEt=function(i){return Wo(i)==="style"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},iEt=i=>i.replace(new RegExp("^".concat(e4.source,"+")),""),sEt=i=>new RegExp("^".concat(e4.source,"*$")).test(i),xZ=i=>/\s$/.test(i),rEt=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],HF="data-trix-serialized-attributes",oEt="[".concat(HF,"]"),aEt=new RegExp("<!--block-->","g"),lEt={"application/json":function(i){let t;if(i instanceof ma)t=i;else{if(!(i instanceof HTMLElement))throw new Error("unserializable object");t=eg.parse(i.innerHTML).getDocument()}return t.toSerializableDocument().toJSONString()},"text/html":function(i){let t;if(i instanceof ma)t=sb.render(i);else{if(!(i instanceof HTMLElement))throw new Error("unserializable object");t=i.cloneNode(!0)}return Array.from(t.querySelectorAll("[data-trix-serialize=false]")).forEach((e=>{zd(e)})),rEt.forEach((e=>{Array.from(t.querySelectorAll("[".concat(e,"]"))).forEach((n=>{n.removeAttribute(e)}))})),Array.from(t.querySelectorAll(oEt)).forEach((e=>{try{let n=JSON.parse(e.getAttribute(HF));e.removeAttribute(HF);for(let s in n){let r=n[s];e.setAttribute(s,r)}}catch{}})),t.innerHTML.replace(aEt,"")}},cEt=Object.freeze({__proto__:null}),ys=class extends Ws{constructor(t,e){super(...arguments),this.attachmentManager=t,this.attachment=e,this.id=this.attachment.id,this.file=this.attachment.file}remove(){return this.attachmentManager.requestRemovalOfAttachment(this.attachment)}};ys.proxyMethod("attachment.getAttribute"),ys.proxyMethod("attachment.hasAttribute"),ys.proxyMethod("attachment.setAttribute"),ys.proxyMethod("attachment.getAttributes"),ys.proxyMethod("attachment.setAttributes"),ys.proxyMethod("attachment.isPending"),ys.proxyMethod("attachment.isPreviewable"),ys.proxyMethod("attachment.getURL"),ys.proxyMethod("attachment.getPreviewURL"),ys.proxyMethod("attachment.setPreviewURL"),ys.proxyMethod("attachment.getHref"),ys.proxyMethod("attachment.getFilename"),ys.proxyMethod("attachment.getFilesize"),ys.proxyMethod("attachment.getFormattedFilesize"),ys.proxyMethod("attachment.getExtension"),ys.proxyMethod("attachment.getContentType"),ys.proxyMethod("attachment.getFile"),ys.proxyMethod("attachment.setFile"),ys.proxyMethod("attachment.releaseFile"),ys.proxyMethod("attachment.getUploadProgress"),ys.proxyMethod("attachment.setUploadProgress");var dE=class extends Ws{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.managedAttachments={},Array.from(t).forEach((e=>{this.manageAttachment(e)}))}getAttachments(){let t=[];for(let e in this.managedAttachments){let n=this.managedAttachments[e];t.push(n)}return t}manageAttachment(t){return this.managedAttachments[t.id]||(this.managedAttachments[t.id]=new ys(this,t)),this.managedAttachments[t.id]}attachmentIsManaged(t){return t.id in this.managedAttachments}requestRemovalOfAttachment(t){var e,n;if(this.attachmentIsManaged(t))return(e=this.delegate)===null||e===void 0||(n=e.attachmentManagerDidRequestRemovalOfAttachment)===null||n===void 0?void 0:n.call(e,t)}unmanageAttachment(t){let e=this.managedAttachments[t.id];return delete this.managedAttachments[t.id],e}},fE=class{constructor(t){this.composition=t,this.document=this.composition.document;let e=this.composition.getSelectedRange();this.startPosition=e[0],this.endPosition=e[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!==`
8040`}shouldBreakFormattedBlock(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&this.nextCharacter===`
8041`||this.previousCharacter===`
8042`)}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()}},nu=class extends Ws{constructor(){super(...arguments),this.document=new ma,this.attachments=[],this.currentAttributes={},this.revision=0}setDocument(t){var e,n;if(!t.isEqualTo(this.document))return this.document=t,this.refreshAttachments(),this.revision++,(e=this.delegate)===null||e===void 0||(n=e.compositionDidChangeDocument)===null||n===void 0?void 0:n.call(e,t)}getSnapshot(){return{document:this.document,selectedRange:this.getSelectedRange()}}
8042loadSnapshot(t){var e,n,s,r;let{document:o,selectedRange:a}=t;return(e=this.delegate)===null||e===void 0||(n=e.compositionWillLoadSnapshot)===null||n===void 0||n.call(e),this.setDocument(o??new ma),this.setSelection(a??[0,0]),(s=this.delegate)===null||s===void 0||(r=s.compositionDidLoadSnapshot)===null||r===void 0?void 0:r.call(s)}insertText(t){let{updatePosition:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{updatePosition:!0},n=this.getSelectedRange();this.setDocument(this.document.insertTextAtRange(t,n));let s=n[0],r=s+t.getLength();return e&&this.setSelection(r),this.notifyDelegateOfInsertionAtRange([s,r])}insertBlock(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Fd,e=new ma([t]);return this.insertDocument(e)}insertDocument(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new ma,e=this.getSelectedRange();this.setDocument(this.document.insertDocumentAtRange(t,e));let n=e[0],s=n+t.getLength();return this.setSelection(s),this.notifyDelegateOfInsertionAtRange([n,s])}insertString(t,e){let n=this.getCurrentTextAttributes(),s=Ua.textForStringWithAttributes(t,n);return this.insertText(s,e)}insertBlockBreak(){let t=this.getSelectedRange();this.setDocument(this.document.insertBlockBreakAtRange(t));let e=t[0],n=e+1;return this.setSelection(n),this.notifyDelegateOfInsertionAtRange([e,n])}insertLineBreak(){let t=new fE(this);if(t.shouldDecreaseListLevel())return this.decreaseListLevel(),this.setSelection(t.startPosition);if(t.shouldPrependListItem()){let e=new ma([t.block.copyWithoutText()]);return this.insertDocument(e)}return t.shouldInsertBlockBreak()?this.insertBlockBreak():t.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():t.shouldBreakFormattedBlock()?this.breakFormattedBlock(t):this.insertString(`
8043`)}insertHTML(t){let e=eg.parse(t,{purifyOptions:{SAFE_FOR_XML:!0}}).getDocument(),n=this.getSelectedRange();this.setDocument(this.document.mergeDocumentAtRange(e,n));let s=n[0],r=s+e.getLength()-1;return this.setSelection(r),this.notifyDelegateOfInsertionAtRange([s,r])}replaceHTML(t){let e=eg.parse(t).getDocument().copyUsingObjectsFromDocument(this.document),n=this.getLocationRange({strict:!1}),s=this.document.rangeFromLocationRange(n);return this.setDocument(e),this.setSelection(s)}insertFile(t){return this.insertFiles([t])}insertFiles(t){let e=[];return Array.from(t).forEach((n=>{var s;if((s=this.delegate)!==null&&s!==void 0&&s.compositionShouldAcceptFile(n)){let r=rb.attachmentForFile(n);e.push(r)}})),this.insertAttachments(e)}insertAttachment(t){return this.insertAttachments([t])}insertAttachments(t){let e=new Ua;return Array.from(t).forEach((n=>{var s;let r=n.getType(),o=(s=XF[r])===null||s===void 0?void 0:s.presentation,a=this.getCurrentTextAttributes();o&&(a.presentation=o);let l=Ua.textForAttachmentWithAttributes(n,a);e=e.appendText(l)})),this.insertText(e)}shouldManageDeletingInDirection(t){let e=this.getLocationRange();if(Ju(e)){if(t==="backward"&&e[0].offset===0||this.shouldManageMovingCursorInDirection(t))return!0}else if(e[0].index!==e[1].index)return!0;return!1}deleteInDirection(t){let e,n,s,{length:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=this.getLocationRange(),a=this.getSelectedRange(),l=Ju(a);if(l?n=t==="backward"&&o[0].offset===0:s=o[0].index!==o[1].index,n&&this.canDecreaseBlockAttributeLevel()){let c=this.getBlock();if(c.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(a[0]),c.isEmpty())return!1}return l&&(a=this.getExpandedRangeInDirection(t,{length:r}),t==="backward"&&(e=this.getAttachmentAtRange(a))),e?(this.editAttachment(e),!1):(this.setDocument(this.document.removeTextAtRange(a)),this.setSelection(a[0]),!n&&!s&&void 0)}moveTextFromRange(t){let[e]=Array.from(this.getSelectedRange());return this.setDocument(this.document.moveTextFromRangeToPosition(t,e)),this.setSelection(e)}removeAttachment(t){let e=this.document.getRangeOfAttachment(t);if(e)return this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(e)),this.setSelection(e[0])}removeLastBlockAttribute(){let[t,e]=Array.from(this.getSelectedRange()),n=this.document.getBlockAtPosition(e);return this.removeCurrentAttribute(n.getLastAttribute()),this.setSelection(t)}insertPlaceholder(){return this.placeholderPosition=this.getPosition(),this.insertString(" ")}selectPlaceholder(){if(this.placeholderPosition!=null)return this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+1]),this.get
8043SelectedRange()}forgetPlaceholder(){this.placeholderPosition=null}hasCurrentAttribute(t){let e=this.currentAttributes[t];return e!=null&&e!==!1}toggleCurrentAttribute(t){let e=!this.currentAttributes[t];return e?this.setCurrentAttribute(t,e):this.removeCurrentAttribute(t)}canSetCurrentAttribute(t){return ir(t)?this.canSetCurrentBlockAttribute(t):this.canSetCurrentTextAttribute(t)}canSetCurrentTextAttribute(t){let e=this.getSelectedDocument();if(e){for(let n of Array.from(e.getAttachments()))if(!n.hasContent())return!1;return!0}}canSetCurrentBlockAttribute(t){let e=this.getBlock();if(e)return!e.isTerminalBlock()}setCurrentAttribute(t,e){return ir(t)?this.setBlockAttribute(t,e):(this.setTextAttribute(t,e),this.currentAttributes[t]=e,this.notifyDelegateOfCurrentAttributesChange())}setHTMLAtributeAtPosition(t,e,n){var s;let r=this.document.getBlockAtPosition(t),o=(s=ir(r.getLastAttribute()))===null||s===void 0?void 0:s.htmlAttributes;if(r&&o!=null&&o.includes(e)){let a=this.document.setHTMLAttributeAtPosition(t,e,n);this.setDocument(a)}}setTextAttribute(t,e){let n=this.getSelectedRange();if(!n)return;let[s,r]=Array.from(n);if(s!==r)return this.setDocument(this.document.addAttributeAtRange(t,e,n));if(t==="href"){let o=Ua.textForStringWithAttributes(e,{href:e});return this.insertText(o)}}setBlockAttribute(t,e){let n=this.getSelectedRange();if(this.canSetCurrentAttribute(t))return this.setDocument(this.document.applyBlockAttributeAtRange(t,e,n)),this.setSelection(n)}removeCurrentAttribute(t){return ir(t)?(this.removeBlockAttribute(t),this.updateCurrentAttributes()):(this.removeTextAttribute(t),delete this.currentAttributes[t],this.notifyDelegateOfCurrentAttributesChange())}removeTextAttribute(t){let e=this.getSelectedRange();if(e)return this.setDocument(this.document.removeAttributeAtRange(t,e))}removeBlockAttribute(t){let e=this.getSelectedRange();if(e)return this.setDocument(this.document.removeAttributeAtRange(t,e))}canDecreaseNestingLevel(){var t;return((t=this.getBlock())===null||t===void 0?void 0:t.getNestingLevel())>0}canIncreaseNestingLevel(){var t;let e=this.getBlock();if(e){if((t=ir(e.getLastNestableAttribute()))===null||t===void 0||!t.listAttribute)return e.getNestingLevel()>0;{let n=this.getPreviousBlock();if(n)return(function(){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return Qp((arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).slice(0,s.length),s)})(n.getListItemAttributes(),e.getListItemAttributes())}}}decreaseNestingLevel(){let t=this.getBlock();if(t)return this.setDocument(this.document.replaceBlock(t,t.decreaseNestingLevel()))}increaseNestingLevel(){let t=this.getBlock();if(t)return this.setDocument(this.document.replaceBlock(t,t.increaseNestingLevel()))}canDecreaseBlockAttributeLevel(){var t;return((t=this.getBlock())===null||t===void 0?void 0:t.getAttributeLevel())>0}decreaseBlockAttributeLevel(){var t;let e=(t=this.getBlock())===null||t===void 0?void 0:t.getLastAttribute();if(e)return this.removeCurrentAttribute(e)}decreaseListLevel(){let[t]=Array.from(this.getSelectedRange()),{index:e}=this.document.locationFromPosition(t),n=e,s=this.getBlock().getAttributeLevel(),r=this.document.getBlockAtIndex(n+1);for(;r&&r.isListItem()&&!(r.getAttributeLevel()<=s);)n++,r=this.document.getBlockAtIndex(n+1);t=this.document.positionFromLocation({index:e,offset:0});let o=this.document.positionFromLocation({index:n,offset:0});return this.setDocument(this.document.removeLastListAttributeAtRange([t,o]))}updateCurrentAttributes(){let t=this.getSelectedRange({ignoreLock:!0});if(t){let e=this.document.getCommonAttributesAtRange(t);if(Array.from(IF()).forEach((n=>{e[n]||this.canSetCurrentAttribute(n)||(e[n]=!1)})),!ub(e,this.currentAttributes))return this.currentAttributes=e,this.notifyDelegateOfCurrentAttributesChange()}}getCurrentAttributes(){return iZ.call({},this.currentAttributes)}getCurrentTextAttributes(){let t={};for(let e in this.currentAttributes){let n=this.currentAttributes[e];n!==!1&&OF(e)&&(t[e]=n)}return t}freezeSelection(){return this.setCurrentAttribute("frozen",!0)}thawSelection(){return this.removeCurrentAttribute("frozen")}hasFrozenSelection(){return this.hasCurrentAttribute("frozen")}setSelection(t){var e;let n=this.document.locationRangeFromRange(t);return(e=this.delegate)===null||e===void 0?void 0:e.compositionDidRequestChangingSelectionToLocationRange(n)}getSelectedRange(){let t=this.getLocationRange();if(t)return this.document.rangeFromLocationRange(t)}
8043setSelectedRange(t){let e=this.document.locationRangeFromRange(t);return this.getSelectionManager().setLocationRange(e)}getPosition(){let t=this.getLocationRange();if(t)return this.document.positionFromLocation(t[0])}getLocationRange(t){return this.targetLocationRange?this.targetLocationRange:this.getSelectionManager().getLocationRange(t)||Zi({index:0,offset:0})}withTargetLocationRange(t,e){let n;this.targetLocationRange=t;try{n=e()}finally{this.targetLocationRange=null}return n}withTargetRange(t,e){let n=this.document.locationRangeFromRange(t);return this.withTargetLocationRange(n,e)}withTargetDOMRange(t,e){let n=this.createLocationRangeFromDOMRange(t,{strict:!1});return this.withTargetLocationRange(n,e)}getExpandedRangeInDirection(t){let{length:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},[n,s]=Array.from(this.getSelectedRange());return t==="backward"?e?n-=e:n=this.translateUTF16PositionFromOffset(n,-1):e?s+=e:s=this.translateUTF16PositionFromOffset(s,1),Zi([n,s])}shouldManageMovingCursorInDirection(t){if(this.editingAttachment)return!0;let e=this.getExpandedRangeInDirection(t);return this.getAttachmentAtRange(e)!=null}moveCursorInDirection(t){let e,n;if(this.editingAttachment)n=this.document.getRangeOfAttachment(this.editingAttachment);else{let s=this.getSelectedRange();n=this.getExpandedRangeInDirection(t),e=!rE(s,n)}if(t==="backward"?this.setSelectedRange(n[0]):this.setSelectedRange(n[1]),e){let s=this.getAttachmentAtRange(n);if(s)return this.editAttachment(s)}}expandSelectionInDirection(t){let{length:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=this.getExpandedRangeInDirection(t,{length:e});return this.setSelectedRange(n)}expandSelectionForEditing(){if(this.hasCurrentAttribute("href"))return this.expandSelectionAroundCommonAttribute("href")}expandSelectionAroundCommonAttribute(t){let e=this.getPosition(),n=this.document.getRangeOfCommonAttributeAtPosition(t,e);return this.setSelectedRange(n)}selectionContainsAttachments(){var t;return((t=this.getSelectedAttachments())===null||t===void 0?void 0:t.length)>0}selectionIsInCursorTarget(){return this.editingAttachment||this.positionIsCursorTarget(this.getPosition())}positionIsCursorTarget(t){let e=this.document.locationFromPosition(t);if(e)return this.locationIsCursorTarget(e)}positionIsBlockBreak(t){var e;return(e=this.document.getPieceAtPosition(t))===null||e===void 0?void 0:e.isBlockBreak()}getSelectedDocument(){let t=this.getSelectedRange();if(t)return this.document.getDocumentAtRange(t)}getSelectedAttachments(){var t;return(t=this.getSelectedDocument())===null||t===void 0?void 0:t.getAttachments()}getAttachments(){return this.attachments.slice(0)}refreshAttachments(){let t=this.document.getAttachments(),{added:e,removed:n}=(function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=[],a=[],l=new Set;s.forEach((u=>{l.add(u)}));let c=new Set;return r.forEach((u=>{c.add(u),l.has(u)||o.push(u)})),s.forEach((u=>{c.has(u)||a.push(u)})),{added:o,removed:a}})(this.attachments,t);return this.attachments=t,Array.from(n).forEach((s=>{var r,o;s.delegate=null,(r=this.delegate)===null||r===void 0||(o=r.compositionDidRemoveAttachment)===null||o===void 0||o.call(r,s)})),(()=>{let s=[];return Array.from(e).forEach((r=>{var o,a;r.delegate=this,s.push((o=this.delegate)===null||o===void 0||(a=o.c
8043ompositionDidAddAttachment)===null||a===void 0?void 0:a.call(o,r))})),s})()}attachmentDidChangeAttributes(t){var e,n;return this.revision++,(e=this.delegate)===null||e===void 0||(n=e.compositionDidEditAttachment)===null||n===void 0?void 0:n.call(e,t)}attachmentDidChangePreviewURL(t){var e,n;return this.revision++,(e=this.delegate)===null||e===void 0||(n=e.compositionDidChangeAttachmentPreviewURL)===null||n===void 0?void 0:n.call(e,t)}editAttachment(t,e){var n,s;if(t!==this.editingAttachment)return this.stopEditingAttachment(),this.editingAttachment=t,(n=this.delegate)===null||n===void 0||(s=n.compositionDidStartEditingAttachment)===null||s===void 0?void 0:s.call(n,this.editingAttachment,e)}stopEditingAttachment(){var t,e;this.editingAttachment&&((t=this.delegate)===null||t===void 0||(e=t.compositionDidStopEditingAttachment)===null||e===void 0||e.call(t,this.editingAttachment),this.editingAttachment=null)}updateAttributesForAttachment(t,e){return this.setDocument(this.document.updateAttributesForAttachment(t,e))}removeAttributeForAttachment(t,e){return this.setDocument(this.document.removeAttributeForAttachment(t,e))}breakFormattedBlock(t){let{document:e}=t,{block:n}=t,s=t.startPosition,r=[s-1,s];n.getBlockBreakPosition()===t.startLocation.offset?(n.breaksOnReturn()&&t.nextCharacter===`
8044`?s+=1:e=e.removeTextAtRange(r),r=[s,s]):t.nextCharacter===`
8045`?t.previousCharacter===`
8046`?r=[s-1,s+1]:(r=[s,s+1],s+=1):t.startLocation.offset-1!=0&&(s+=1);let o=new ma([n.removeLastAttribute().copyWithoutText()]);return this.setDocument(e.insertDocumentAtRange(o,r)),this.setSelection(s)}getPreviousBlock(){let t=this.getLocationRange();if(t){let{index:e}=t[0];if(e>0)return this.document.getBlockAtIndex(e-1)}}getBlock(){let t=this.getLocationRange();if(t)return this.document.getBlockAtIndex(t[0].index)}getAttachmentAtRange(t){let e=this.document.getDocumentAtRange(t);if(e.toString()==="".concat("\uFFFC",`
8047`))return e.getAttachments()[0]}notifyDelegateOfCurrentAttributesChange(){var t,e;return(t=this.delegate)===null||t===void 0||(e=t.compositionDidChangeCurrentAttributes)===null||e===void 0?void 0:e.call(t,this.currentAttributes)}notifyDelegateOfInsertionAtRange(t){var e,n;return(e=this.delegate)===null||e===void 0||(n=e.compositionDidPerformInsertionAtRange)===null||n===void 0?void 0:n.call(e,t)}translateUTF16PositionFromOffset(t,e){let n=this.document.toUTF16String(),s=n.offsetFromUCS2Offset(t);return n.offsetToUCS2Offset(s+e)}};nu.proxyMethod("getSelectionManager().getPointRange"),nu.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),nu.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),nu.proxyMethod("getSelectionManager().locationIsCursorTarget"),nu.proxyMethod("getSelectionManager().selectionIsExpanded"),nu.proxyMethod("delegate?.getSelectionManager");var Aw=class extends Ws{constructor(t){super(...arguments),this.composition=t,this.undoEntries=[],this.redoEntries=[]}recordUndoEntry(t){let{context:e,consolidatable:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=this.undoEntries.slice(-1)[0];if(!n||!uEt(s,t,e)){let r=this.createEntry({description:t,context:e});this.undoEntries.push(r),this.redoEntries=[]}}undo(){let t=this.undoEntries.pop();if(t){let e=this.createEntry(t);return this.redoEntries.push(e),this.composition.loadSnapshot(t.snapshot)}}redo(){let t=this.redoEntries.pop();if(t){let e=this.createEntry(t);return this.undoEntries.push(e),this.composition.loadSnapshot(t.snapshot)}}canUndo(){return this.undoEntries.length>0}canRedo(){return this.redoEntries.length>0}createEntry(){let{description:t,context:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{description:t?.toString(),context:JSON.stringify(e),snapshot:this.composition.getSnapshot()}}},uEt=(i,t,e)=>i?.description===t?.toString()&&i?.context===JSON.stringify(e),wF="attachmentGallery",pE=class{constructor(t){this.document=t.document,this.selectedRange=t.selectedRange}perform(){return this.removeBlockAttribute(),this.applyBlockAttribute()}getSnapshot(){return{document:this.document,selectedRange:this.selectedRange}}removeBlockAttribute(){return this.findRangesOfBlocks().map((t=>this.document=this.document.removeAttributeAtRange(wF,t)))}applyBlockAttribute(){let t=0;
8047this.findRangesOfPieces().forEach((e=>{e[1]-e[0]>1&&(e[0]+=t,e[1]+=t,this.document.getCharacterAtPosition(e[1])!==`
8048`&&(this.document=this.document.insertBlockBreakAtRange(e[1]),e[1]<this.selectedRange[1]&&this.moveSelectedRangeForward(),e[1]++,t++),e[0]!==0&&this.document.getCharacterAtPosition(e[0]-1)!==`
8049`&&(this.document=this.document.insertBlockBreakAtRange(e[0]),e[0]<this.selectedRange[0]&&this.moveSelectedRangeForward(),e[0]++,t++),this.document=this.document.applyBlockAttributeAtRange(wF,!0,e))}))}findRangesOfBlocks(){return this.document.findRangesForBlockAttribute(wF)}findRangesOfPieces(){return this.document.findRangesForTextAttribute("presentation",{withValue:"gallery"})}moveSelectedRangeForward(){this.selectedRange[0]+=1,this.selectedRange[1]+=1}},wZ=function(i){let t=new pE(i);return t.perform(),t.getSnapshot()},hEt=[wZ],gE=class{constructor(t,e,n){this.insertFiles=this.insertFiles.bind(this),this.composition=t,this.selectionManager=e,this.element=n,this.undoManager=new Aw(this.composition),this.filters=hEt.slice(0)}loadDocument(t){return this.loadSnapshot({document:t,selectedRange:[0,0]})}loadHTML(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=eg.parse(t,{referenceElement:this.element}).getDocument();return this.loadDocument(e)}loadJSON(t){let{document:e,selectedRange:n}=t;return e=ma.fromJSON(e),this.loadSnapshot({document:e,selectedRange:n})}loadSnapshot(t){return this.undoManager=new Aw(this.composition),this.composition.loadSnapshot(t)}getDocument(){return this.composition.document}getSelectedDocument(){return this.composition.getSelectedDocument()}getSnapshot(){return this.composition.getSnapshot()}toJSON(){return this.getSnapshot()}deleteInDirection(t){return this.composition.deleteInDirection(t)}insertAttachment(t){return this.composition.insertAttachment(t)}insertAttachments(t){return this.composition.insertAttachments(t)}insertDocument(t){return this.composition.insertDocument(t)}insertFile(t){return this.composition.insertFile(t)}insertFiles(t){return this.composition.insertFiles(t)}insertHTML(t){return this.composition.insertHTML(t)}insertString(t){return this.composition.insertString(t)}insertText(t){return this.composition.insertText(t)}insertLineBreak(){return this.composition.insertLineBreak()}getSelectedRange(){return this.composition.getSelectedRange()}getPosition(){return this.composition.getPosition()}getClientRectAtPosition(t){let e=this.getDocument().locationRangeFromRange([t,t+1]);return this.selectionManager.getClientRectAtLocationRange(e)}expandSelectionInDirection(t){return this.composition.expandSelectionInDirection(t)}moveCursorInDirection(t){return this.composition.moveCursorInDirection(t)}setSelectedRange(t){return this.composition.setSelectedRange(t)}activateAttribute(t){let e=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return this.composition.setCurrentAttribute(t,e)}attributeIsActive(t){return this.composition.hasCurrentAttribute(t)}canActivateAttribute(t){return this.composition.canSetCurrentAttribute(t)}deactivateAttribute(t){return this.composition.removeCurrentAttribute(t)}setHTMLAtributeAtPosition(t,e,n){this.composition.setHTMLAtributeAtPosition(t,e,n)}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(t){let{context:e,consolidatable:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.undoManager.recordUndoEntry(t,{context:e,consolidatable:n})}redo(){if(this.canRedo())return this.undoManager.redo()}undo(){if(this.canUndo())return this.undoManager.undo()}},mE=class{constructor(t){this.element=t}findLocationFromContainerAndOffset(t,e){let{strict:n}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{strict:!0},s=0,r=!1,o={index:0,offset:0},a=this.findAttachmentElementParentForNode(t);a&&(t=a.parentNode,e=rF(a));let l=sE(this.element,{usingFilter:_Z});for(;l.nextNode();){let c=l.currentNode;if(c===t&&ww(t)){Q0(c)||(o.offset+=e);break}if(c.parentNode===t){if(s++===e){!n&&aF(c,{strict:n})&&(r&&o.index++,o.offset=0,r=!0);break}}else if(!Gp(t,c)&&s>0)break;aF(c,{strict:n})?(r&&o.index++,o.offset=0,r=!0):o.offset+=_F(c)}return o}findContainerAndOffsetFromLocation(t){let e,n;if(t.index===0&&t.offset===0){for(e=this.element,n=0;e.firstChild;)if(e=e.firstChild,oF(e)){n=1;break}return[e,n]}let[s,r]=this.findNodeAndOffsetFromLocation(t);
8049if(s){if(ww(s))_F(s)===0?(e=s.parentNode.parentNode,n=rF(s.parentNode),Q0(s,{name:"right"})&&n++):(e=s,n=t.offset-r);else{if(e=s.parentNode,!aF(s.previousSibling)&&!oF(e))for(;s===e.lastChild&&(s=e,e=e.parentNode,!oF(e)););n=rF(s),t.offset!==0&&n++}return[e,n]}}findNodeAndOffsetFromLocation(t){let e,n,s=0;for(let r of this.getSignificantNodesForIndex(t.index)){let o=_F(r);if(t.offset<=s+o)if(ww(r)){if(e=r,n=s,t.offset===n&&Q0(e))break}else e||(e=r,n=s);if(s+=o,s>t.offset)break}return[e,n]}findAttachmentElementParentForNode(t){for(;t&&t!==this.element;){if(Yp(t))return t;t=t.parentNode}}getSignificantNodesForIndex(t){let e=[],n=sE(this.element,{usingFilter:dEt}),s=!1;for(;n.nextNode();){let o=n.currentNode;var r;if(Z0(o)){if(r!=null?r++:r=0,r===t)s=!0;else if(s)break}else s&&e.push(o)}return e}},_F=function(i){return i.nodeType===Node.TEXT_NODE?Q0(i)?0:i.textContent.length:Wo(i)==="br"||Yp(i)?1:0},dEt=function(i){return fEt(i)===NodeFilter.FILTER_ACCEPT?_Z(i):NodeFilter.FILTER_REJECT},fEt=function(i){return oZ(i)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},_Z=function(i){return Yp(i.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},bE=class{createDOMRangeFromPoint(t){let e,{x:n,y:s}=t;if(document.caretPositionFromPoint){let{offsetNode:r,offset:o}=document.caretPositionFromPoint(n,s);return e=document.createRange(),e.setStart(r,o),e}if(document.caretRangeFromPoint)return document.caretRangeFromPoint(n,s);if(document.body.createTextRange){let r=_w();try{let o=document.body.createTextRange();o.moveToPoint(n,s),o.select()}catch{}return e=_w(),fZ(r),e}}getClientRectsForDOMRange(t){let e=Array.from(t.getClientRects());return[e[0],e[e.length-1]]}},Ku=class extends Ws{constructor(t){super(...arguments),this.didMouseDown=this.didMouseDown.bind(this),this.selectionDidChange=this.selectionDidChange.bind(this),this.element=t,this.locationMapper=new mE(this.element),this.pointMapper=new bE,this.lockCount=0,Ns("mousedown",{onElement:this.element,withCallback:this.didMouseDown})}getLocationRange(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t.strict===!1?this.createLocationRangeFromDOMRange(_w()):t.ignoreLock?this.currentLocationRange:this.lockedLocationRange?this.lockedLocationRange:this.currentLocationRange}setLocationRange(t){if(this.lockedLocationRange)return;t=Zi(t);let e=this.createDOMRangeFromLocationRange(t);e&&(fZ(e),this.updateCurrentLocationRange(t))}setLocationRangeFromPointRange(t){t=Zi(t);let e=this.getLocationAtPoint(t[0]),n=this.getLocationAtPoint(t[1]);this.setLocationRange([e,n])}getClientRectAtLocationRange(t){let e=this.createDOMRangeFromLocationRange(t);if(e)return this.getClientRectsForDOMRange(e)[1]}locationIsCursorTarget(t){let e=Array.from(this.findNodeAndOffsetFromLocation(t))[0];return Q0(e)}lock(){this.lockCount++==0&&(this.updateCurrentLocationRange(),this.lockedLocationRange=this.getLocationRange())}unlock(){if(--this.lockCount==0){let{lockedLocationRange:t}=this;if(this.lockedLocationRange=null,t!=null)return this.setLocationRange(t)}}clearSelection(){var t;return(t=dZ())===null||t===void 0?void 0:t.removeAllRanges()}selectionIsCollapsed(){var t;return((t=_w())===null||t===void 0?void 0:t.collapsed)===!0}selectionIsExpanded(){return!this.selectionIsCollapsed()}createLocationRangeFromDOMRange(t,e){if(t==null||!this.domRangeWithinElement(t))return;let n=this.findLocationFromContainerAndOffset(t.startContainer,t.startOffset,e);if(!n)return;let s=t.collapsed?void 0:this.findLocationFromContainerAndOffset(t.endContainer,t.endOffset,e);return Zi([n,s])}didMouseDown(){return this.pauseTemporarily()}pauseTemporarily(){let t;this.paused=!0;let e=()=>{if(this.paused=!1,clearTimeout(n),Array.from(t).forEach((s=>{s.destroy()})),Gp(document,this.element))return this.selectionDidChange()},n=setTimeout(e,200);t=["mousemove","keydown"].map((s=>Ns(s,{onElement:document,withCallback:e})))}selectionDidChange(){if(!this.paused&&!JF(this.element))return this.updateCurrentLocationRange()}updateCurrentLocationRange(t){var e,n;if((t??(t=this.createLocationRangeFromDOMRange(_w())))&&!rE(t,this.currentLocationRange))return this.currentLocationRange=t,(e=this.delegate)===null||e===void 0||(n=e.locationRangeDidChange)===null||n===void 0?void 0:n.call(e,this.currentLocationRange.slice(0))}createDOMRangeFromLocationRange(t){let e=this.findContainerAndOffsetFromLocation(t[0]),n=Ju(t)?e:this.findContainerAndOffsetFromLocation(t[1])||e;if(e!=null&&n!=null){let s=document.createRange();return s.setStart(...Array.from(e||[])),s.setEnd(...Array.from(n||[])),s}}getLocationAtPoint(t){let e=this.createDOMRangeFromPoint(t);var n;if(e)return(n=this.createLocationRangeFromDOMRange(e))===null||n===void 0?void 0:n[0]}domRangeWithinElement(t){return t.collapsed?Gp(this.element,t.startContainer):Gp(this.element,t.startContainer)&&Gp(this.element,t.endContainer)}};Ku.proxyMethod("locationMapper.findLocationFromContainerAndOffset"),Ku.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"),Ku.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"),Ku.proxyMethod("pointMapper.createDOMRangeFromPoint"),Ku.proxyMethod("pointMapper.getClientRectsForDOMRange");var SZ=Object.freeze({__proto__:null,Attachment:rb,AttachmentManager:dE,AttachmentPiece:ob,Block:Fd,Composition:nu,Document:ma,Editor:gE,HTMLParser:eg,HTMLSanitizer:ib,LineBreakInsertion:fE,LocationMapper:mE,ManagedAttachment:ys,Piece:th,PointMapper:bE,SelectionManager:Ku,SplittableList:ab,StringPiece:Tw,Text:Ua,UndoManager:Aw}),pEt=Object.freeze({__proto__:null,ObjectView:Qu,AttachmentView:Mw,BlockView:uE,DocumentView:sb,P
8049ieceView:lE,PreviewableAttachmentView:aE,TextView:cE}),{lang:SF,css:$p,keyNames:gEt}=kw,CF=function(i){return function(){let t=i.apply(this,arguments);t.do(),this.undos||(this.undos=[]),this.undos.push(t.undo)}},vE=class extends Ws{constructor(t,e,n){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(...arguments),go(this,"makeElementMutable",CF((()=>({do:()=>{this.element.dataset.trixMutable=!0},undo:()=>delete this.element.dataset.trixMutable})))),go(this,"addToolbar",CF((()=>{let r=fi({tagName:"div",className:$p.attachmentToolbar,data:{trixMutable:!0},childNodes:fi({tagName:"div",className:"trix-button-row",childNodes:fi({tagName:"span",className:"trix-button-group trix-button-group--actions",childNodes:fi({tagName:"button",className:"trix-button trix-button--remove",textContent:SF.remove,attributes:{title:SF.remove},data:{trixAction:"remove"}})})})});return this.attachment.isPreviewable()&&r.appendChild(fi({tagName:"div",className:$p.attachmentMetadataContainer,childNodes:fi({tagName:"span",className:$p.attachmentMetadata,childNodes:[fi({tagName:"span",className:$p.attachmentName,textContent:this.attachment.getFilename(),attributes:{title:this.attachment.getFilename()}}),fi({tagName:"span",className:$p.attachmentSize,textContent:this.attachment.getFormattedFilesize()})]})})),Ns("click",{onElement:r,withCallback:this.didClickToolbar}),Ns("click",{onElement:r,matchingSelector:"[data-trix-action]",withCallback:this.didClickActionButton}),yw("trix-attachment-before-toolbar",{onElement:this.element,attributes:{toolbar:r,attachment:this.attachment}}),{do:()=>this.element.appendChild(r),undo:()=>zd(r)}}))),go(this,"installCaptionEditor",CF((()=>{let r=fi({tagName:"textarea",className:$p.attachmentCaptionEditor,attributes:{placeholder:SF.captionPlaceholder},data:{trixMutable:!0}});r.value=this.attachmentPiece.getCaption();let o=r.cloneNode();o.classList.add("trix-autoresize-clone"),o.tabIndex=-1;let a=function(){o.value=r.value,r.style.height=o.scrollHeight+"px"};Ns("input",{onElement:r,withCallback:a}),Ns("input",{onElement:r,withCallback:this.didInputCaption}),Ns("keydown",{onElement:r,withCallback:this.didKeyDownCaption}),Ns("change",{onElement:r,withCallback:this.didChangeCaption}),Ns("blur",{onElement:r,withCallback:this.didBlurCaption});let l=this.element.querySelector("figcaption"),c=l.cloneNode();return{do:()=>{if(l.style.display="none",c.appendChild(r),c.appendChild(o),c.classList.add("".concat($p.attachmentCaption,"--editing")),l.parentElement.insertBefore(c,l),a(),this.options.editCaption)return t4((()=>r.focus()))},undo(){zd(c),l.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=t,this.element=e,this.container=n,this.options=s,this.attachment=this.attachmentPiece.attachment,Wo(this.element)==="a"&&(this.element=this.element.firstChild),this.install()}install(){this.makeElementMutable(),this.addToolbar(),this.attachment.isPreviewable()&&this.installCaptionEditor()}uninstall(){var t;let e=this.undos.pop();for(this.savePendingCaption();e;)e(),e=this.undos.pop();(t=this.delegate)===null||t===void 0||t.didUninstallAttachmentEditor(this)}savePendingCaption(){if(this.pendingCaption!=null){let r=this.pendingCaption;var t,e,n,s;this.pendingCaption=null,r?(t=this.delegate)===null||t===void 0||(e=t.attachmentEditorDidRequestUpdatingAttributesForAttachment)===null||e===void 0||e.call(t,{caption:r},this.attachment):(n=this.delegate)===null||n===void 0||(s=n.attachmentEditorDidRequestRemovingAttributeForAttachment)===null||s===void 0||s.call(n,"caption",this.attachment)}}didClickToolbar(t){return t.preventDefault(),t.stopPropagation()}didClickActionButton(t){var e;if(t.target.getAttribute("data-trix-action")==="remove")return(e=this.delegate)===null||e===void 0?void 0:e.attachmentEditorDidRequestRemovalOfAttachment(this.attachment)}didKeyDownCaption(t){var e,n;
8049if(gEt[t.keyCode]==="return")return t.preventDefault(),this.savePendingCaption(),(e=this.delegate)===null||e===void 0||(n=e.attachmentEditorDidRequestDeselectingAttachment)===null||n===void 0?void 0:n.call(e,this.attachment)}didInputCaption(t){this.pendingCaption=t.target.value.replace(/\s/g," ").trim()}didChangeCaption(t){return this.savePendingCaption()}didBlurCaption(t){return this.savePendingCaption()}},yE=class extends Ws{constructor(t,e){super(...arguments),this.didFocus=this.didFocus.bind(this),this.didBlur=this.didBlur.bind(this),this.didClickAttachment=this.didClickAttachment.bind(this),this.element=t,this.composition=e,this.documentView=new sb(this.composition.document,{element:this.element}),Ns("focus",{onElement:this.element,withCallback:this.didFocus}),Ns("blur",{onElement:this.element,withCallback:this.didBlur}),Ns("click",{onElement:this.element,matchingSelector:"a[contenteditable=false]",preventDefault:!0}),Ns("mousedown",{onElement:this.element,matchingSelector:qp,withCallback:this.didClickAttachment}),Ns("click",{onElement:this.element,matchingSelector:"a".concat(qp),preventDefault:!0})}didFocus(t){var e;let n=()=>{var s,r;if(!this.focused)return this.focused=!0,(s=this.delegate)===null||s===void 0||(r=s.compositionControllerDidFocus)===null||r===void 0?void 0:r.call(s)};return((e=this.blurPromise)===null||e===void 0?void 0:e.then(n))||n()}didBlur(t){this.blurPromise=new Promise((e=>t4((()=>{var n,s;return JF(this.element)||(this.focused=null,(n=this.delegate)===null||n===void 0||(s=n.compositionControllerDidBlur)===null||s===void 0||s.call(n)),this.blurPromise=null,e()}))))}didClickAttachment(t,e){var n,s;let r=this.findAttachmentForElement(e),o=!!Ud(t.target,{matchingSelector:"figcaption"});return(n=this.delegate)===null||n===void 0||(s=n.compositionControllerDidSelectAttachment)===null||s===void 0?void 0:s.call(n,r,{editCaption:o})}getSerializableElement(){return this.isEditingAttachment()?this.documentView.shadowElement:this.element}render(){var t,e,n,s,r,o;return this.revision!==this.composition.revision&&(this.documentView.setDocument(this.composition.document),this.documentView.render(),this.revision=this.composition.revision),this.canSyncDocumentView()&&!this.documentView.isSynced()&&((n=this.delegate)===null||n===void 0||(s=n.compositionControllerWillSyncDocumentView)===null||s===void 0||s.call(n),this.documentView.sync(),(r=this.delegate)===null||r===void 0||(o=r.compositionControllerDidSyncDocumentView)===null||o===void 0||o.call(r)),(t=this.delegate)===null||t===void 0||(e=t.compositionControllerDidRender)===null||e===void 0?void 0:e.call(t)}rerenderViewForObject(t){return this.invalidateViewForObject(t),this.render()}invalidateViewForObject(t){return this.documentView.invalidateViewForObject(t)}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(t,e){var n;if(((n=this.attachmentEditor)===null||n===void 0?void 0:n.attachment)===t)return;let s=this.documentView.findElementForObject(t);if(!s)return;this.uninstallAttachmentEditor();let r=this.composition.document.getAttachmentPieceForAttachment(t);this.attachmentEditor=new vE(r,s,this.element,e),this.attachmentEditor.delegate=this}uninstallAttachmentEditor(){var t;return(t=this.attachmentEditor)===null||t===void 0?void 0:t.uninstall()}didUninstallAttachmentEditor(){return this.attachmentEditor=null,this.render()}attachmentEditorDidRequestUpdatingAttributesForAttachment(t,e){var n,s;return(n=this.delegate)===null||n===void 0||(s=n.compositionControllerWillUpdateAttachment)===null||s===void 0||s.call(n,e),this.composition.updateAttributesForAttachment(t,e)}attachmentEditorDidRequestRemovingAttributeForAttachment(t,e){var n,s;return(n=this.delegate)===null||n===void 0||(s=n.compositionControllerWillUpdateAttachment)===null||s===void 0||s.call(n,e),this.composition.removeAttributeForAttachment(t,e)}attachmentEditorDidRequestRemovalOfAttachment(t){var e,n;return(e=this.delegate)===null||e===void 0||(n=e.compositionControllerDidRequestRemovalOfAttachment)===null||n===void 0?void 0:n.call(e,t)}attachmentEditorDidRequestDeselectingAttachment(t){var e,n;return(e=this.delegate)===null||e===void 0||(n=e.compositionControllerDidRequestDeselectingAttachment)===null||n===void 0?void 0:n.call(e,t)}canSyncDocumentView(){return!this.isEditingAttachment()}findAttachmentForElement(t){return this.composition.document.getAttachmentById(parseInt(t.dataset.trixId,10))}},xE=class extends Ws{},CZ="data-trix-mutable",mEt="[".concat(CZ,"]"),bEt={attributes:!0,childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0},wE=class extends Ws{constructor(t){super(t),this.didMutate=this.didMutate.bind(this),this.element=t,this.observer=new window.MutationObserver(this.didMutate),this.start()}start(){return this.reset(),this.observer.observe(this.element,bEt)}stop(){return this.observer.disconnect()}didMutate(t){var e,n;if(this.mutations.push(...Array.from(this.findSignificantMutations(t)||[])),this.mutations.length)return(e=this.delegate)===null||e===void 0||(n=e.elementDidMutate)===null||n===void 0||n.call(e,this.getMutationSummary()),this.reset()}reset(){this.mutations=[]}findSignificantMutations(t){return t.filter((e=>this.mutationIsSignificant(e)))}mutationIsSignificant(t){if(this.nodeIsMutable(t.target))return!1;for(let e of Array.from(this.nodesModifiedByMutation(t)))if(this.nodeIsSignificant(e))return!0;return!1}nodeIsSignificant(t){return t!==this.element&&!this.nodeIsMutable(t)&&!oZ(t)}nodeIsMutable(t){return Ud(t,{matchingSelector:mEt})}nodesModifiedByMutation(t){let e=[];switch(t.type){case"attributes":t.attributeName!==CZ&&e.push(t.target);break;case"characterData":e.push(t.target.parentNode),e.push(t.target);break;case"childList":e.push(...Array.from(t.addedNodes||[])),e.push(...Array.from(t.removedNodes||[]))}return e}getMutationSummary(){return this.getTextMutationSummary()}getTextMutationSummary(){let{additions:t,deletions:e}=this.getTextChangesFromCharacterData(),n=this.getTextChangesFromChildList();
8049Array.from(n.additions).forEach((a=>{Array.from(t).includes(a)||t.push(a)})),e.push(...Array.from(n.deletions||[]));let s={},r=t.join("");r&&(s.textAdded=r);let o=e.join("");return o&&(s.textDeleted=o),s}getMutationsByType(t){return Array.from(this.mutations).filter((e=>e.type===t))}getTextChangesFromChildList(){let t,e,n=[],s=[];Array.from(this.getMutationsByType("childList")).forEach((a=>{n.push(...Array.from(a.addedNodes||[])),s.push(...Array.from(a.removedNodes||[]))})),n.length===0&&s.length===1&&Z0(s[0])?(t=[],e=[`
8050`]):(t=jF(n),e=jF(s));let r=t.filter(((a,l)=>a!==e[l])).map(bw),o=e.filter(((a,l)=>a!==t[l])).map(bw);return{additions:r,deletions:o}}getTextChangesFromCharacterData(){let t,e,n=this.getMutationsByType("characterData");if(n.length){let s=n[0],r=n[n.length-1],o=(function(a,l){let c,u;return a=Zp.box(a),(l=Zp.box(l)).length<a.length?[u,c]=MJ(a,l):[c,u]=MJ(l,a),{added:c,removed:u}})(bw(s.oldValue),bw(r.target.data));t=o.added,e=o.removed}return{additions:t?[t]:[],deletions:e?[e]:[]}}},jF=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=[];for(let e of Array.from(i))switch(e.nodeType){case Node.TEXT_NODE:t.push(e.data);break;case Node.ELEMENT_NODE:Wo(e)==="br"?t.push(`
8051`):t.push(...Array.from(jF(e.childNodes)||[]))}return t},_E=class extends eb{constructor(t){super(...arguments),this.file=t}perform(t){let e=new FileReader;return e.onerror=()=>t(!1),e.onload=()=>{e.onerror=null;try{e.abort()}catch{}return t(!0,this.file)},e.readAsArrayBuffer(this.file)}},WF=class{constructor(t){this.element=t}shouldIgnore(t){return!!Ew.samsungAndroid&&(this.previousEvent=this.event,this.event=t,this.checkSamsungKeyboardBuggyModeStart(),this.checkSamsungKeyboardBuggyModeEnd(),this.buggyMode)}checkSamsungKeyboardBuggyModeStart(){this.insertingLongTextAfterUnidentifiedChar()&&vEt(this.element.innerText,this.event.data)&&(this.buggyMode=!0,this.event.preventDefault())}checkSamsungKeyboardBuggyModeEnd(){this.buggyMode&&this.event.inputType!=="insertText"&&(this.buggyMode=!1)}insertingLongTextAfterUnidentifiedChar(){var t;return this.isBeforeInputInsertText()&&this.previousEventWasUnidentifiedKeydown()&&((t=this.event.data)===null||t===void 0?void 0:t.length)>50}isBeforeInputInsertText(){return this.event.type==="beforeinput"&&this.event.inputType==="insertText"}previousEventWasUnidentifiedKeydown(){var t,e;return((t=this.previousEvent)===null||t===void 0?void 0:t.type)==="keydown"&&((e=this.previousEvent)===null||e===void 0?void 0:e.key)==="Unidentified"}},vEt=(i,t)=>KJ(i)===KJ(t),yEt=new RegExp("(".concat("\uFFFC","|").concat(ME,"|").concat(Bd,"|\\s)+"),"g"),KJ=i=>i.replace(yEt," ").trim(),lb=class extends Ws{constructor(t){super(...arguments),this.element=t,this.mutationObserver=new wE(this.element),this.mutationObserver.delegate=this,this.flakyKeyboardDetector=new WF(this.element);for(let e in this.constructor.events)Ns(e,{onElement:this.element,withCallback:this.handlerFor(e)})}elementDidMutate(t){}editorWillSyncDocumentView(){return this.mutationObserver.stop()}editorDidSyncDocumentView(){return this.mutationObserver.start()}requestRender(){var t,e;return(t=this.delegate)===null||t===void 0||(e=t.inputControllerDidRequestRender)===null||e===void 0?void 0:e.call(t)}requestReparse(){var t,e;return(t=this.delegate)===null||t===void 0||(e=t.inputControllerDidRequestReparse)===null||e===void 0||e.call(t),this.requestRender()}attachFiles(t){let e=Array.from(t).map((n=>new _E(n)));return Promise.all(e).then((n=>{this.handleInput((function(){var s,r;return(s=this.delegate)===null||s===void 0||s.inputControllerWillAttachFiles(),(r=this.responder)===null||r===void 0||r.insertFiles(n),this.requestRender()}))}))}handlerFor(t){return e=>{e.defaultPrevented||this.handleInput((()=>{if(!JF(this.element)){if(this.flakyKeyboardDetector.shouldIgnore(e))return;this.eventName=t,this.constructor.events[t].call(this,e)}}))}}handleInput(t){try{var e;(e=this.delegate)===null||e===void 0||e.inputControllerWillHandleInput(),t.call(this)}finally{var n;(n=this.delegate)===null||n===void 0||n.inputControllerDidHandleInput()}}createLinkHTML(t,e){let n=document.createElement("a");return n.href=t,n.textContent=e||t,n.outerHTML}},MF;go(lb,"events",{});var{browser:xEt,keyNames:MZ}=kw,wEt=0,sc=class extends lb{constructor(){super(...arguments),this.resetInputSummary()}setInputSummary(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.inputSummary.eventName=this.eventName;for(let e in t){let n=t[e];this.inputSummary[e]=n}return this.inputSummary}resetInputSummary(){this.inputSummary={}}reset(){return this.resetInputSummary(),tg.reset()}elementDidMutate(t){var e,n;return this.isComposing()?(e=this.delegate)===null||e===void 0||(n=e.inputControllerDidAllowUnhandledInput)===null||n===void 0?void 0:n.call(e):this.handleInput((function(){return this.mutationIsSignificant(t)&&(this.mutationIsExpected(t)?this.requestRender():this.requestReparse()),this.reset()}))}mutationIsExpected(t){let{textAdded:e,textDeleted:n}=t;if(this.inputSummary.preferDocument)return!0;let s=e!=null?e===this.inputSummary.textAdded:!this.inputSummary.textAdded,r=n!=null?this.inputSummary.didDelete:!this.inputSummary.didDelete,o=[`
8052`,` 
8053`].includes(e)&&!s,a=n===`
8054`&&!r;if(o&&!a||a&&!o){let c=this.getSelectedRange();if(c){var l;let u=o?e.replace(/\n$/,"").length||-1:e?.length||1;if((l=this.responder)!==null&&l!==void 0&&l.positionIsBlockBreak(c[1]+u))return!0}}return s&&r}mutationIsSignificant(t){var e;let n=Object.keys(t).length>0,s=((e=this.compositionInput)===null||e===void 0?void 0:e.getEndData())==="";return n||!s}getCompositionInput(){if(this.isComposing())return this.compositionInput;this.compositionInput=new eu(this)}isComposing(){return this.compositionInput&&!this.compositionInput.isEnded()}deleteInDirection(t,e){var n;return((n=this.responder)===null||n===void 0?void 0:n.deleteInDirection(t))!==!1?this.setInputSummary({didDelete:!0}):e?(e.preventDefault(),this.requestRender()):void 0}serializeSelectionToDataTransfer(t){var e;if(!(function(s){if(s==null||!s.setData)return!1;for(let r in _J){let o=_J[r];try{if(s.setData(r,o),!s.getData(r)===o)return!1}catch{return!1}}return!0})(t))return;let n=(e=this.responder)===null||e===void 0?void 0:e.getSelectedDocument().toSerializableDocument();return t.setData("application/x-trix-document",JSON.stringify(n)),t.setData("text/html",sb.render(n).innerHTML),t.setData("text/plain",n.toString().replace(/\n$/,"")),!0}canAcceptDataTransfer(t){let e={};
8054return Array.from(t?.types||[]).forEach((n=>{e[n]=!0})),e.Files||e["application/x-trix-document"]||e["text/html"]||e["text/plain"]}getPastedHTMLUsingHiddenElement(t){let e=this.getSelectedRange(),n={position:"absolute",left:"".concat(window.pageXOffset,"px"),top:"".concat(window.pageYOffset,"px"),opacity:0},s=fi({style:n,tagName:"div",editable:!0});return document.body.appendChild(s),s.focus(),requestAnimationFrame((()=>{let r=s.innerHTML;return zd(s),this.setSelectedRange(e),t(r)}))}};go(sc,"events",{keydown(i){this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0;let t=MZ[i.keyCode];if(t){var e;let s=this.keys;["ctrl","alt","shift","meta"].forEach((r=>{var o;i["".concat(r,"Key")]&&(r==="ctrl"&&(r="control"),s=(o=s)===null||o===void 0?void 0:o[r])})),((e=s)===null||e===void 0?void 0:e[t])!=null&&(this.setInputSummary({keyName:t}),tg.reset(),s[t].call(this,i))}if(uZ(i)){let s=String.fromCharCode(i.keyCode).toLowerCase();if(s){var n;let r=["alt","shift"].map((o=>{if(i["".concat(o,"Key")])return o})).filter((o=>o));r.push(s),(n=this.delegate)!==null&&n!==void 0&&n.inputControllerDidReceiveKeyboardCommand(r)&&i.preventDefault()}}},keypress(i){if(this.inputSummary.eventName!=null||i.metaKey||i.ctrlKey&&!i.altKey)return;let t=CEt(i);var e,n;return t?((e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0||n.insertString(t),this.setInputSummary({textAdded:t,didDelete:this.selectionIsExpanded()})):void 0},textInput(i){let{data:t}=i,{textAdded:e}=this.inputSummary;if(e&&e!==t&&e.toUpperCase()===t){var n;let s=this.getSelectedRange();return this.setSelectedRange([s[0],s[1]+e.length]),(n=this.responder)===null||n===void 0||n.insertString(t),this.setInputSummary({textAdded:t}),this.setSelectedRange(s)}},dragenter(i){i.preventDefault()},dragstart(i){var t,e;return this.serializeSelectionToDataTransfer(i.dataTransfer),this.draggedRange=this.getSelectedRange(),(t=this.delegate)===null||t===void 0||(e=t.inputControllerDidStartDrag)===null||e===void 0?void 0:e.call(t)},dragover(i){if(this.draggedRange||this.canAcceptDataTransfer(i.dataTransfer)){i.preventDefault();let n={x:i.clientX,y:i.clientY};var t,e;if(!ub(n,this.draggingPoint))return this.draggingPoint=n,(t=this.delegate)===null||t===void 0||(e=t.inputControllerDidReceiveDragOverPoint)===null||e===void 0?void 0:e.call(t,this.draggingPoint)}},dragend(i){var t,e;(t=this.delegate)===null||t===void 0||(e=t.inputControllerDidCancelDrag)===null||e===void 0||e.call(t),this.draggedRange=null,this.draggingPoint=null},drop(i){var t,e;i.preventDefault();let n=(t=i.dataTransfer)===null||t===void 0?void 0:t.files,s=i.dataTransfer.getData("application/x-trix-document"),r={x:i.clientX,y:i.clientY};if((e=this.responder)===null||e===void 0||e.setLocationRangeFromPointRange(r),n!=null&&n.length)this.attachFiles(n);else if(this.draggedRange){var o,a;(o=this.delegate)===null||o===void 0||o.inputControllerWillMoveText(),(a=this.responder)===null||a===void 0||a.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()}else if(s){var l;let c=ma.fromJSONString(s);(l=this.responder)===null||l===void 0||l.insertDocument(c),this.requestRender()}this.draggedRange=null,this.draggingPoint=null},cut(i){var t,e;if((t=this.responder)!==null&&t!==void 0&&t.selectionIsExpanded()&&(this.serializeSelectionToDataTransfer(i.clipboardData)&&i.preventDefault(),(e=this.delegate)===null||e===void 0||e.inputControllerWillCutText(),this.deleteInDirection("backward"),i.defaultPrevented))return this.requestRender()},copy(i){var t;(t=this.responder)!==null&&t!==void 0&&t.selectionIsExpanded()&&this.serializeSelectionToDataTransfer(i.clipboardData)&&i.preventDefault()},paste(i){let t=i.clipboardData||i.testClipboardData,e={clipboard:t};if(!t||MEt(i))return void this.getPastedHTMLUsingHiddenElement((C=>{var R,k,O;return e.type="text/html",e.html=C,(R=this.delegate)===null||R===void 0||R.inputControllerWillPaste(e),(k=this.responder)===null||k===void 0||k.insertHTML(e.html),this.requestRender(),(O=this.delegate)===null||O===void 0?void 0:O.inputControllerDidPaste(e)}
8054));let n=t.getData("URL"),s=t.getData("text/html"),r=t.getData("public.url-name");if(n){var o,a,l;let C;e.type="text/html",C=r?n4(r).trim():n,e.html=this.createLinkHTML(n,C),(o=this.delegate)===null||o===void 0||o.inputControllerWillPaste(e),this.setInputSummary({textAdded:C,didDelete:this.selectionIsExpanded()}),(a=this.responder)===null||a===void 0||a.insertHTML(e.html),this.requestRender(),(l=this.delegate)===null||l===void 0||l.inputControllerDidPaste(e)}else if(cZ(t)){var c,u,h;e.type="text/plain",e.string=t.getData("text/plain"),(c=this.delegate)===null||c===void 0||c.inputControllerWillPaste(e),this.setInputSummary({textAdded:e.string,didDelete:this.selectionIsExpanded()}),(u=this.responder)===null||u===void 0||u.insertString(e.string),this.requestRender(),(h=this.delegate)===null||h===void 0||h.inputControllerDidPaste(e)}else if(s){var d,p,g;e.type="text/html",e.html=s,(d=this.delegate)===null||d===void 0||d.inputControllerWillPaste(e),(p=this.responder)===null||p===void 0||p.insertHTML(e.html),this.requestRender(),(g=this.delegate)===null||g===void 0||g.inputControllerDidPaste(e)}else if(Array.from(t.types).includes("Files")){var y,x;let C=(y=t.items)===null||y===void 0||(y=y[0])===null||y===void 0||(x=y.getAsFile)===null||x===void 0?void 0:x.call(y);if(C){var w,M,A;let R=_Et(C);!C.name&&R&&(C.name="pasted-file-".concat(++wEt,".").concat(R)),e.type="File",e.file=C,(w=this.delegate)===null||w===void 0||w.inputControllerWillAttachFiles(),(M=this.responder)===null||M===void 0||M.insertFile(e.file),this.requestRender(),(A=this.delegate)===null||A===void 0||A.inputControllerDidPaste(e)}}i.preventDefault()},compositionstart(i){return this.getCompositionInput().start(i.data)},compositionupdate(i){return this.getCompositionInput().update(i.data)},compositionend(i){return this.getCompositionInput().end(i.data)},beforeinput(i){this.inputSummary.didInput=!0},input(i){return this.inputSummary.didInput=!0,i.stopPropagation()}}),go(sc,"keys",{backspace(i){var t;return(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),this.deleteInDirection("backward",i)},delete(i){var t;return(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),this.deleteInDirection("forward",i)},return(i){var t,e;return this.setInputSummary({preferDocument:!0}),(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),(e=this.responder)===null||e===void 0?void 0:e.insertLineBreak()},tab(i){var t,e;(t=this.responder)!==null&&t!==void 0&&t.canIncreaseNestingLevel()&&((e=this.responder)===null||e===void 0||e.increaseNestingLevel(),this.requestRender(),i.preventDefault())},left(i){var t;if(this.selectionIsInCursorTarget())return i.preventDefault(),(t=this.responder)===null||t===void 0?void 0:t.moveCursorInDirection("backward")},right(i){var t;if(this.selectionIsInCursorTarget())return i.preventDefault(),(t=this.responder)===null||t===void 0?void 0:t.moveCursorInDirection("forward")},control:{d(i){var t;return(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),this.deleteInDirection("forward",i)},h(i){var t;return(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),this.deleteInDirection("backward",i)},o(i){var t,e;return i.preventDefault(),(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),(e=this.responder)===null||e===void 0||e.insertString(`
8055`,{updatePosition:!1}),this.requestRender()}},shift:{return(i){var t,e;(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),(e=this.responder)===null||e===void 0||e.insertString(`
8056`),this.requestRender(),i.preventDefault()},tab(i){var t,e;(t=this.responder)!==null&&t!==void 0&&t.canDecreaseNestingLevel()&&((e=this.responder)===null||e===void 0||e.decreaseNestingLevel(),this.requestRender(),i.preventDefault())},left(i){if(this.selectionIsInCursorTarget())return i.preventDefault(),this.expandSelectionInDirection("backward")},right(i){if(this.selectionIsInCursorTarget())return i.preventDefault(),this.expandSelectionInDirection("forward")}},alt:{backspace(i){var t;return this.setInputSummary({preferDocument:!1}),(t=this.delegate)===null||t===void 0?void 0:t.inputControllerWillPerformTyping()}},meta:{backspace(i){var t;return this.setInputSummary({preferDocument:!1}),(t=this.delegate)===null||t===void 0?void 0:t.inputControllerWillPerformTyping()}}}),sc.proxyMethod("responder?.getSelectedRange"),sc.proxyMethod("responder?.setSelectedRange"),sc.proxyMethod("responder?.expandSelectionInDirection"),sc.proxyMethod("responder?.selectionIsInCursorTarget"),sc.proxyMethod("responder?.selectionIsExpanded");var _Et=i=>{var t;return(t=i.type)===null||t===void 0||(t=t.match(/\/(\w+)$/))===null||t===void 0?void 0:t[1]},SEt=!((MF=" ".codePointAt)===null||MF===void 0||!MF.call(" ",0)),CEt=function(i){if(i.key&&SEt&&i.key.codePointAt(0)===i.keyCode)return i.key;{let t;
8056if(i.which===null?t=i.keyCode:i.which!==0&&i.charCode!==0&&(t=i.charCode),t!=null&&MZ[t]!=="escape")return Zp.fromCodepoints([t]).toString()}},MEt=function(i){let t=i.clipboardData;if(t){if(t.types.includes("text/html")){for(let e of t.types){let n=/^CorePasteboardFlavorType/.test(e),s=/^dyn\./.test(e)&&t.getData(e);if(n||s)return!0}return!1}{let e=t.types.includes("com.apple.webarchive"),n=t.types.includes("com.apple.flat-rtfd");return e||n}}},eu=class extends Ws{constructor(t){super(...arguments),this.inputController=t,this.responder=this.inputController.responder,this.delegate=this.inputController.delegate,this.inputSummary=this.inputController.inputSummary,this.data={}}start(t){if(this.data.start=t,this.isSignificant()){var e,n;this.inputSummary.eventName==="keypress"&&this.inputSummary.textAdded&&((n=this.responder)===null||n===void 0||n.deleteInDirection("left")),this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=(e=this.responder)===null||e===void 0?void 0:e.getSelectedRange()}}update(t){if(this.data.update=t,this.isSignificant()){let e=this.selectPlaceholder();e&&(this.forgetPlaceholder(),this.range=e)}}end(t){return this.data.end=t,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0||n.setSelectedRange(this.range),(s=this.responder)===null||s===void 0||s.insertString(this.data.end),(r=this.responder)===null||r===void 0?void 0:r.setSelectedRange(this.range[0]+this.data.end.length)):this.data.start!=null||this.data.update!=null?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset();var e,n,s,r}getEndData(){return this.data.end}isEnded(){return this.getEndData()!=null}isSignificant(){return!xEt.composesExistingText||this.inputSummary.didInput}canApplyToDocument(){var t,e;return((t=this.data.start)===null||t===void 0?void 0:t.length)===0&&((e=this.data.end)===null||e===void 0?void 0:e.length)>0&&this.range}};eu.proxyMethod("inputController.setInputSummary"),eu.proxyMethod("inputController.requestRender"),eu.proxyMethod("inputController.requestReparse"),eu.proxyMethod("responder?.selectionIsExpanded"),eu.proxyMethod("responder?.insertPlaceholder"),eu.proxyMethod("responder?.selectPlaceholder"),eu.proxyMethod("responder?.forgetPlaceholder");var Xp=class extends lb{constructor(){super(...arguments),this.render=this.render.bind(this)}elementDidMutate(){return this.scheduledRender?this.composing?(t=this.delegate)===null||t===void 0||(e=t.inputControllerDidAllowUnhandledInput)===null||e===void 0?void 0:e.call(t):void 0:this.reparse();var t,e}scheduleRender(){return this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)}render(){var t,e;cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing||(e=this.delegate)===null||e===void 0||e.render(),(t=this.afterRender)===null||t===void 0||t.call(this),this.afterRender=null}reparse(){var t;return(t=this.delegate)===null||t===void 0?void 0:t.reparse()}insertString(){var t;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;return(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),this.withTargetDOMRange((function(){var s;return(s=this.responder)===null||s===void 0?void 0:s.insertString(e,n)}))}toggleAttributeIfSupported(t){var e;if(IF().includes(t))return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformFormatting(t),this.withTargetDOMRange((function(){var n;return(n=this.responder)===null||n===void 0?void 0:n.toggleCurrentAttribute(t)}))}activateAttributeIfSupported(t,e){var n;if(IF().includes(t))return(n=this.delegate)===null||n===void 0||n.inputControllerWillPerformFormatting(t),this.withTargetDOMRange((function(){var s;return(s=this.responder)===null||s===void 0?void 0:s.setCurrentAttribute(t,e)}))}deleteInDirection(t){let{recordUndoEntry:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{recordUndoEntry:!0};var n;e&&((n=this.delegate)===null||n===void 0||n.inputControllerWillPerformTyping());let s=()=>{var o;return(o=this.responder)===null||o===void 0?void 0:o.deleteInDirection(t)},r=this.getTargetDOMRange({minLength:this.composing?1:2});return r?this.withTargetDOMRange(r,s):s()}withTargetDOMRange(t,e){var n;return typeof t=="function"&&(e=t,t=this.getTargetDOMRange()),t?(n=this.responder)===null||n===void 0?void 0:n.withTargetDOMRange(t,e.bind(this)):(tg.reset(),e.call(this))}getTargetDOMRange(){var t,e;let{minLength:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{minLength:0},s=(t=(e=this.event).getTargetRanges)===null||t===void 0?void 0:t.call(e);
8056if(s&&s.length){let r=TEt(s[0]);if(n===0||r.toString().length>=n)return r}}withEvent(t,e){let n;this.event=t;try{n=e.call(this)}finally{this.event=null}return n}};go(Xp,"events",{keydown(i){if(uZ(i)){var t;let e=kEt(i);(t=this.delegate)!==null&&t!==void 0&&t.inputControllerDidReceiveKeyboardCommand(e)&&i.preventDefault()}else{let e=i.key;i.altKey&&(e+="+Alt"),i.shiftKey&&(e+="+Shift");let n=this.constructor.keys[e];if(n)return this.withEvent(i,n)}},paste(i){var t;let e,n=(t=i.clipboardData)===null||t===void 0?void 0:t.getData("URL");return TZ(i)?(i.preventDefault(),this.attachFiles(i.clipboardData.files)):EEt(i)?(i.preventDefault(),e={type:"text/plain",string:i.clipboardData.getData("text/plain")},(s=this.delegate)===null||s===void 0||s.inputControllerWillPaste(e),(r=this.responder)===null||r===void 0||r.insertString(e.string),this.render(),(o=this.delegate)===null||o===void 0?void 0:o.inputControllerDidPaste(e)):n?(i.preventDefault(),e={type:"text/html",html:this.createLinkHTML(n)},(a=this.delegate)===null||a===void 0||a.inputControllerWillPaste(e),(l=this.responder)===null||l===void 0||l.insertHTML(e.html),this.render(),(c=this.delegate)===null||c===void 0?void 0:c.inputControllerDidPaste(e)):void 0;var s,r,o,a,l,c},beforeinput(i){let t=this.constructor.inputTypes[i.inputType],e=(n=i,!(!/iPhone|iPad/.test(navigator.userAgent)||n.inputType&&n.inputType!=="insertParagraph"));var n;t&&(this.withEvent(i,t),e||this.scheduleRender()),e&&this.render()},input(i){tg.reset()},dragstart(i){var t,e;(t=this.responder)!==null&&t!==void 0&&t.selectionContainsAttachments()&&(i.dataTransfer.setData("application/x-trix-dragging",!0),this.dragging={range:(e=this.responder)===null||e===void 0?void 0:e.getSelectedRange(),point:AF(i)})},dragenter(i){TF(i)&&i.preventDefault()},dragover(i){if(this.dragging){i.preventDefault();let e=AF(i);var t;if(!ub(e,this.dragging.point))return this.dragging.point=e,(t=this.responder)===null||t===void 0?void 0:t.setLocationRangeFromPointRange(e)}else TF(i)&&i.preventDefault()},drop(i){var t,e;if(this.dragging)return i.preventDefault(),(t=this.delegate)===null||t===void 0||t.inputControllerWillMoveText(),(e=this.responder)===null||e===void 0||e.moveTextFromRange(this.dragging.range),this.dragging=null,this.scheduleRender();if(TF(i)){var n;i.preventDefault();let s=AF(i);return(n=this.responder)===null||n===void 0||n.setLocationRangeFromPointRange(s),this.attachFiles(i.dataTransfer.files)}},dragend(){var i;this.dragging&&((i=this.responder)===null||i===void 0||i.setSelectedRange(this.dragging.range),this.dragging=null)},compositionend(i){this.composing&&(this.composing=!1,Ew.recentAndroid||this.scheduleRender())}}),go(Xp,"keys",{ArrowLeft(){var i,t;if((i=this.responder)!==null&&i!==void 0&&i.shouldManageMovingCursorInDirection("backward"))return this.event.preventDefault(),(t=this.responder)===null||t===void 0?void 0:t.moveCursorInDirection("backward")},ArrowRight(){var i,t;if((i=this.responder)!==null&&i!==void 0&&i.shouldManageMovingCursorInDirection("forward"))return this.event.preventDefault(),(t=this.responder)===null||t===void 0?void 0:t.moveCursorInDirection("forward")},Backspace(){var i,t,e;if((i=this.responder)!==null&&i!==void 0&&i.shouldManageDeletingInDirection("backward"))return this.event.preventDefault(),(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),(e=this.responder)===null||e===void 0||e.deleteInDirection("backward"),this.render()},Tab(){var i,t;if((i=this.responder)!==null&&i!==void 0&&i.canIncreaseNestingLevel())return this.event.preventDefault(),(t=this.responder)===null||t===void 0||t.increaseNestingLevel(),this.render()},"Tab+Shift"(){var i,t;if((i=this.responder)!==null&&i!==void 0&&i.canDecreaseNestingLevel())return this.event.preventDefault(),(t=this.responder)===null||t===void 0||t.decreaseNestingLevel(),this.render()}}),go(Xp,"inputTypes",{deleteByComposition(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteByCut(){return this.deleteInDirection("backward")},deleteByDrag(){return this.event.preventDefault(),this.withTargetDOMRange((function(){var i;this.deleteByDragRange=(i=this.responder)===null||i===void 0?void 0:i.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")}
8056,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 i;if((i=this.responder)!==null&&i!==void 0&&i.canIncreaseNestingLevel())return this.withTargetDOMRange((function(){var t;return(t=this.responder)===null||t===void 0?void 0:t.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 i;if((i=this.responder)!==null&&i!==void 0&&i.canDecreaseNestingLevel())return this.withTargetDOMRange((function(){var t;return(t=this.responder)===null||t===void 0?void 0:t.decreaseNestingLevel()}))},formatRemove(){this.withTargetDOMRange((function(){for(let e in(i=this.responder)===null||i===void 0?void 0:i.getCurrentAttributes()){var i,t;(t=this.responder)===null||t===void 0||t.removeCurrentAttribute(e)}}))},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 i;return(i=this.delegate)===null||i===void 0?void 0:i.inputControllerWillPerformRedo()},historyUndo(){var i;return(i=this.delegate)===null||i===void 0?void 0:i.inputControllerWillPerformUndo()},insertCompositionText(){return this.composing=!0,this.insertString(this.event.data)},insertFromComposition(){return this.composing=!1,this.insertString(this.event.data)},insertFromDrop(){let i=this.deleteByDragRange;var t;if(i)return this.deleteByDragRange=null,(t=this.delegate)===null||t===void 0||t.inputControllerWillMoveText(),this.withTargetDOMRange((function(){var e;return(e=this.responder)===null||e===void 0?void 0:e.moveTextFromRange(i)}))},insertFromPaste(){let{dataTransfer:i}=this.event,t={dataTransfer:i},e=i.getData("URL"),n=i.getData("text/html");if(e){var s;let l;this.event.preventDefault(),t.type="text/html";let c=i.getData("public.url-name");l=c?n4(c).trim():e,t.html=this.createLinkHTML(e,l),(s=this.delegate)===null||s===void 0||s.inputControllerWillPaste(t),this.withTargetDOMRange((function(){var u;return(u=this.responder)===null||u===void 0?void 0:u.insertHTML(t.html)})),this.afterRender=()=>{var u;return(u=this.delegate)===null||u===void 0?void 0:u.inputControllerDidPaste(t)}}else if(cZ(i)){var r;t.type="text/plain",t.string=i.getData("text/plain"),(r=this.delegate)===null||r===void 0||r.inputControllerWillPaste(t),this.withTargetDOMRange((function(){var l;return(l=this.responder)===null||l===void 0?void 0:l.insertString(t.string)})),this.afterRender=()=>{var l;return(l=this.delegate)===null||l===void 0?void 0:l.inputControllerDidPaste(t)}}else if(AEt(this.event)){var o;t.type="File",t.file=i.files[0],(o=this.delegate)===null||o===void 0||o.inputControllerWillPaste(t),this.withTargetDOMRange((function(){var l;return(l=this.responder)===null||l===void 0?void 0:l.insertFile(t.file)})),this.afterRender=()=>{var l;return(l=this.delegate)===null||l===void 0?void 0:l.inputControllerDidPaste(t)}}else if(n){var a;this.event.preventDefault(),t.type="text/html",t.html=n,(a=this.delegate)===null||a===void 0||a.inputControllerWillPaste(t),this.withTargetDOMRange((function(){var l;return(l=this.responder)===null||l===void 0?void 0:l.insertHTML(t.html)})),this.afterRender=()=>{var l;return(l=this.delegate)===null||l===void 0?void 0:l.inputControllerDidPaste(t)}}},insertFromYank(){return this.insertString(this.event.data)},insertLineBreak(){return this.insertString(`
8057`)},insertLink(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList(){return this.toggleAttributeIfSupported("number")},insertParagraph(){var i;return(i=this.delegate)===null||i===void 0||i.inputControllerWillPerformTyping(),this.withTargetDOMRange((function(){var t;return(t=this.responder)===null||t===void 0?void 0:t.insertLineBreak()}))},insertReplacementText(){let i=this.event.dataTransfer.getData("text/plain"),t=this.event.getTargetRanges()[0];this.withTargetDOMRange(t,(()=>{this.insertString(i,{updatePosition:!1})}))},insertText(){var i;return this.insertString(this.event.data||((i=this.event.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain")))},insertTranspose(){return this.insertString(this.event.data)},insertUnorderedList(){return this.toggleAttributeIfSupported("bullet")}});var TEt=function(i){let t=document.createRange();return t.setStart(i.startContainer,i.startOffset),t.setEnd(i.endContainer,i.endOffset),t},TF=i=>{var t;return Array.from(((t=i.dataTransfer)===null||t===void 0?void 0:t.types)||[]).includes("Files")},AEt=i=>{var t;return((t=i.dataTransfer.files)===null||t===void 0?void 0:t[0])&&!TZ(i)&&!(e=>{let{dataTransfer:n}=e;return n.types.includes("Files")&&n.types.includes("text/html")&&n.getData("text/html").includes("urn:schemas-microsoft-com:office:office")})(i)},TZ=function(i){let t=i.clipboardData;if(t)return Array.from(t.types).filter((e=>e.match(/file/i))).length===t.types.length&&t.files.length>=1},EEt=function(i){let t=i.clipboardData;if(t)return t.types.includes("text/plain")&&t.types.length===1},kEt=function(i){let t=[];
8057return i.altKey&&t.push("alt"),i.shiftKey&&t.push("shift"),t.push(i.key),t},AF=i=>({x:i.clientX,y:i.clientY}),$F="[data-trix-attribute]",GF="[data-trix-action]",PEt="".concat($F,", ").concat(GF),TE="[data-trix-dialog]",REt="".concat(TE,"[data-trix-active]"),DEt="".concat(TE," [data-trix-method]"),JJ="".concat(TE," [data-trix-input]"),ZJ=(i,t)=>(t||(t=J0(i)),i.querySelector("[data-trix-input][name='".concat(t,"']"))),QJ=i=>i.getAttribute("data-trix-action"),J0=i=>i.getAttribute("data-trix-attribute")||i.getAttribute("data-trix-dialog-attribute"),SE=class extends Ws{constructor(t){super(t),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=t,this.attributes={},this.actions={},this.resetDialogInputs(),Ns("mousedown",{onElement:this.element,matchingSelector:GF,withCallback:this.didClickActionButton}),Ns("mousedown",{onElement:this.element,matchingSelector:$F,withCallback:this.didClickAttributeButton}),Ns("click",{onElement:this.element,matchingSelector:PEt,preventDefault:!0}),Ns("click",{onElement:this.element,matchingSelector:DEt,withCallback:this.didClickDialogButton}),Ns("keydown",{onElement:this.element,matchingSelector:JJ,withCallback:this.didKeyDownDialogInput})}didClickActionButton(t,e){var n;(n=this.delegate)===null||n===void 0||n.toolbarDidClickButton(),t.preventDefault();let s=QJ(e);return this.getDialog(s)?this.toggleDialog(s):(r=this.delegate)===null||r===void 0?void 0:r.toolbarDidInvokeAction(s,e);var r}didClickAttributeButton(t,e){var n;(n=this.delegate)===null||n===void 0||n.toolbarDidClickButton(),t.preventDefault();let s=J0(e);var r;return this.getDialog(s)?this.toggleDialog(s):(r=this.delegate)===null||r===void 0||r.toolbarDidToggleAttribute(s),this.refreshAttributeButtons()}didClickDialogButton(t,e){let n=Ud(e,{matchingSelector:TE});return this[e.getAttribute("data-trix-method")].call(this,n)}didKeyDownDialogInput(t,e){if(t.keyCode===13){t.preventDefault();let n=e.getAttribute("name"),s=this.getDialog(n);this.setAttribute(s)}if(t.keyCode===27)return t.preventDefault(),this.hideDialog()}updateActions(t){return this.actions=t,this.refreshActionButtons()}refreshActionButtons(){return this.eachActionButton(((t,e)=>{t.disabled=this.actions[e]===!1}))}eachActionButton(t){return Array.from(this.element.querySelectorAll(GF)).map((e=>t(e,QJ(e))))}updateAttributes(t){return this.attributes=t,this.refreshAttributeButtons()}refreshAttributeButtons(){return this.eachAttributeButton(((t,e)=>(t.disabled=this.attributes[e]===!1,this.attributes[e]||this.dialogIsVisible(e)?(t.setAttribute("data-trix-active",""),t.classList.add("trix-active")):(t.removeAttribute("data-trix-active"),t.classList.remove("trix-active")))))}eachAttributeButton(t){return Array.from(this.element.querySelectorAll($F)).map((e=>t(e,J0(e))))}applyKeyboardCommand(t){let e=JSON.stringify(t.sort());for(let n of Array.from(this.element.querySelectorAll("[data-trix-key]"))){let s=n.getAttribute("data-trix-key").split("+");if(JSON.stringify(s.sort())===e)return yw("mousedown",{onElement:n}),!0}return!1}dialogIsVisible(t){let e=this.getDialog(t);if(e)return e.hasAttribute("data-trix-active")}toggleDialog(t){return this.dialogIsVisible(t)?this.hideDialog():this.showDialog(t)}showDialog(t){var e,n;this.hideDialog(),(e=this.delegate)===null||e===void 0||e.toolbarWillShowDialog();let s=this.getDialog(t);s.setAttribute("data-trix-active",""),s.classList.add("trix-active"),Array.from(s.querySelectorAll("input[disabled]")).forEach((o=>{o.removeAttribute("disabled")}));let r=J0(s);if(r){let o=ZJ(s,t);o&&(o.value=this.attributes[r]||"",o.select())}return(n=this.delegate)===null||n===void 0?void 0:n.toolbarDidShowDialog(t)}setAttribute(t){var e;let n=J0(t),s=ZJ(t,n);return!s.willValidate||(s.setCustomValidity(""),s.checkValidity()&&this.isSafeAttribute(s))?((e=this.delegate)===null||e===void 0||e.toolbarDidUpdateAttribute(n,s.value),this.hideDialog()):(s.setCustomValidity("Invalid value"),s.setAttribute("data-trix-validate",""),s.classList.add("trix-validate"),s.focus())}isSafeAttribute(t){return!t.hasAttribute("data-trix-validate-href")||nb.isValidAttribute("a","href",t.value)}removeAttribute(t){var e;let n=J0(t);return(e=this.delegate)===null||e===void 0||e.toolbarDidRemoveAttribute(n),this.hideDialog()}hideDialog(){let t=this.element.querySelector(REt);var e;if(t)return t.removeAttribute("data-trix-active"),t.classList.remove("trix-active"),this.resetDialogInputs(),(e=this.delegate)===null||e===void 0?void 0:e.toolbarDidHideDialog((n=>n.getAttribute("data-trix-dialog"))(t))}resetDialogInputs(){Array.from(this.element.querySelectorAll(JJ)).forEac
8057h((t=>{t.setAttribute("disabled","disabled"),t.removeAttribute("data-trix-validate"),t.classList.remove("trix-validate")}))}getDialog(t){return this.element.querySelector("[data-trix-dialog=".concat(t,"]"))}},Kp=class extends xE{constructor(t){let{editorElement:e,document:n,html:s}=t;super(...arguments),this.editorElement=e,this.selectionManager=new Ku(this.editorElement),this.selectionManager.delegate=this,this.composition=new nu,this.composition.delegate=this,this.attachmentManager=new dE(this.composition.getAttachments()),this.attachmentManager.delegate=this,this.inputController=ZF.getLevel()===2?new Xp(this.editorElement):new sc(this.editorElement),this.inputController.delegate=this,this.inputController.responder=this.composition,this.compositionController=new yE(this.editorElement,this.composition),this.compositionController.delegate=this,this.toolbarController=new SE(this.editorElement.toolbarElement),this.toolbarController.delegate=this,this.editor=new gE(this.composition,this.selectionManager,this.editorElement),n?this.editor.loadDocument(n):this.editor.loadHTML(s)}registerSelectionManager(){return tg.registerSelectionManager(this.selectionManager)}unregisterSelectionManager(){return tg.unregisterSelectionManager(this.selectionManager)}render(){return this.compositionController.render()}reparse(){return this.composition.replaceHTML(this.editorElement.innerHTML)}compositionDidChangeDocument(t){if(this.notifyEditorElement("document-change"),!this.handlingInput)return this.render()}compositionDidChangeCurrentAttributes(t){return this.currentAttributes=t,this.toolbarController.updateAttributes(this.currentAttributes),this.updateCurrentActions(),this.notifyEditorElement("attributes-change",{attributes:this.currentAttributes})}compositionDidPerformInsertionAtRange(t){this.pasting&&(this.pastedRange=t)}compositionShouldAcceptFile(t){return this.notifyEditorElement("file-accept",{file:t})}compositionDidAddAttachment(t){let e=this.attachmentManager.manageAttachment(t);return this.notifyEditorElement("attachment-add",{attachment:e})}compositionDidEditAttachment(t){this.compositionController.rerenderViewForObject(t);let e=this.attachmentManager.manageAttachment(t);return this.notifyEditorElement("attachment-edit",{attachment:e}),this.notifyEditorElement("change")}compositionDidChangeAttachmentPreviewURL(t){return this.compositionController.invalidateViewForObject(t),this.notifyEditorElement("change")}compositionDidRemoveAttachment(t){let e=this.attachmentManager.unmanageAttachment(t);return this.notifyEditorElement("attachment-remove",{attachment:e})}compositionDidStartEditingAttachment(t,e){return this.attachmentLocationRange=this.composition.document.getLocationRangeOfAttachment(t),this.compositionController.installAttachmentEditorForAttachment(t,e),this.selectionManager.setLocationRange(this.attachmentLocationRange)}compositionDidStopEditingAttachment(t){this.compositionController.uninstallAttachmentEditor(),this.attachmentLocationRange=null}compositionDidRequestChangingSelectionToLocationRange(t){if(!this.loadingSnapshot||this.isFocused())return this.requestedLocationRange=t,this.compositionRevisionWhenLocationRangeRequested=this.composition.revision,this.handlingInput?void 0:this.render()}compositionWillLoadSnapshot(){this.loadingSnapshot=!0}compositionDidLoadSnapshot(){this.compositionController.refreshViewCache(),this.render(),this.loadingSnapshot=!1}getSelectionManager(){return this.selectionManager}attachmentManagerDidRequestRemovalOfAttachment(t){return this.removeAttachment(t)}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.compositionRevisionWhe
8057nLocationRangeRequested=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(t,e){return this.toolbarController.hideDialog(),this.composition.editAttachment(t,e)}compositionControllerDidRequestDeselectingAttachment(t){let e=this.attachmentLocationRange||this.composition.document.getLocationRangeOfAttachment(t);return this.selectionManager.setLocationRange(e[1])}compositionControllerWillUpdateAttachment(t){return this.editor.recordUndoEntry("Edit Attachment",{context:t.id,consolidatable:!0})}compositionControllerDidRequestRemovalOfAttachment(t){return this.removeAttachment(t)}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(t){return this.recordFormattingUndoEntry(t)}inputControllerWillCutText(){return this.editor.recordUndoEntry("Cut")}inputControllerWillPaste(t){return this.editor.recordUndoEntry("Paste"),this.pasting=!0,this.notifyEditorElement("before-paste",{paste:t})}inputControllerDidPaste(t){return t.range=this.pastedRange,this.pastedRange=null,this.pasting=null,this.notifyEditorElement("paste",{paste:t})}inputControllerWillMoveText(){return this.editor.recordUndoEntry("Move")}inputControllerWillAttachFiles(){return this.editor.recordUndoEntry("Drop Files")}inputControllerWillPerformUndo(){return this.editor.undo()}inputControllerWillPerformRedo(){return this.editor.redo()}inputControllerDidReceiveKeyboardCommand(t){return this.toolbarController.applyKeyboardCommand(t)}inputControllerDidStartDrag(){this.locationRangeBeforeDrag=this.selectionManager.getLocationRange()}inputControllerDidReceiveDragOverPoint(t){return this.selectionManager.setLocationRangeFromPointRange(t)}inputControllerDidCancelDrag(){this.selectionManager.setLocationRange(this.locationRangeBeforeDrag),this.locationRangeBeforeDrag=null}locationRangeDidChange(t){return this.composition.updateCurrentAttributes(),this.updateCurrentActions(),this.attachmentLocationRange&&!rE(this.attachmentLocationRange,t)&&this.composition.stopEditingAttachment(),this.notifyEditorElement("selection-change")}toolbarDidClickButton(){if(!this.getLocationRange())return this.setLocationRange({index:0,offset:0})}toolbarDidInvokeAction(t,e){return this.invokeAction(t,e)}toolbarDidToggleAttribute(t){if(this.recordFormattingUndoEntry(t),this.composition.toggleCurrentAttribute(t),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarDidUpdateAttribute(t,e){if(this.recordFormattingUndoEntry(t),this.composition.setCurrentAttribute(t,e),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarDidRemoveAttribute(t){if(this.recordFormattingUndoEntry(t),this.composition.removeCurrentAttribute(t),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarWillShowDialog(t){return this.composition.expandSelectionForEditing(),this.freezeSelection()}toolbarDidShowDialog(t){return this.notifyEditorElement("toolbar-dialog-show",{dialogName:t})}toolbarDidHideDialog(t){return this.thawSelection(),this.editorElement.focus(),this.notifyEditorElement("toolbar-dialog-hide",{dialogName:t})}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(t){return!!this.actionIsExternal(t)||!((e=this.actions[t])===null||e===void 0||(e=e.test)===null||e===void 0||!e.call(this));var e}invokeAction(t,e){return this.actionIsExternal(t)?this.notifyEditorElement("action-invoke",{actionName:t,invokingElement:e}):(n=this.actions[t])===null||n===void 0||(n=n.perform)===null||n===void 0?void 0:n.call(this);var n}actionIsExternal(t){return/^x-./.test(t)}getCurrentActions(){let t={};for(let e in this.actions)t[e]=this.canInvokeAction(e);return t}updateCurrentActions(){let t=this.getCurrentActions();if(!ub(t,this.currentActions))return this.currentActions=t,this.toolbarController.updateActions(this.currentActions),this.notifyEditorElement("actions-change",{actions:this.currentActions})}runEditorFilters(){let t=this.composition.getSnapshot();
8057if(Array.from(this.editor.filters).forEach((s=>{let{document:r,selectedRange:o}=t;t=s.call(this.editor,t)||{},t.document||(t.document=r),t.selectedRange||(t.selectedRange=o)})),e=t,n=this.composition.getSnapshot(),!rE(e.selectedRange,n.selectedRange)||!e.document.isEqualTo(n.document))return this.composition.loadSnapshot(t);var e,n}updateInputElement(){let t=(function(e,n){let s=lEt[n];if(s)return s(e);throw new Error("unknown content type: ".concat(n))})(this.compositionController.getSerializableElement(),"text/html");return this.editorElement.setFormValue(t)}notifyEditorElement(t,e){switch(t){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()}return this.editorElement.notify(t,e)}removeAttachment(t){return this.editor.recordUndoEntry("Delete Attachment"),this.composition.removeAttachment(t),this.render()}recordFormattingUndoEntry(t){let e=ir(t),n=this.selectionManager.getLocationRange();if(e||!Ju(n))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 t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return[this.getLocationContext(),this.getTimeContext(),...Array.from(e)]}getLocationContext(){let t=this.selectionManager.getLocationRange();return Ju(t)?t[0].index:t}getTimeContext(){return RF.interval>0?Math.floor(new Date().getTime()/RF.interval):0}isFocused(){var t;return this.editorElement===((t=this.editorElement.ownerDocument)===null||t===void 0?void 0:t.activeElement)}isFocusedInvisibly(){return this.isFocused()&&!this.getLocationRange()}get actions(){return this.constructor.actions}};go(Kp,"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:()=>!0,perform(){return ZF.pickFiles(this.editor.insertFiles)}}}),Kp.proxyMethod("getSelectionManager().setLocationRange"),Kp.proxyMethod("getSelectionManager().getLocationRange");var LEt=Object.freeze({__proto__:null,AttachmentEditorController:vE,CompositionController:yE,Controller:xE,EditorController:Kp,InputController:lb,Level0InputController:sc,Level2InputController:Xp,ToolbarController:SE}),IEt=Object.freeze({__proto__:null,MutationObserver:wE,SelectionChangeObserver:oE}),OEt=Object.freeze({__proto__:null,FileVerificationOperation:_E,ImagePreloadOperation:hE});lZ("trix-toolbar",`%t {
8058  display: block;
8059}
8060
8061%t {
8062  white-space: nowrap;
8063}
8064
8065%t [data-trix-dialog] {
8066  display: none;
8067}
8068
8069%t [data-trix-dialog][data-trix-active] {
8070  display: block;
8071}
8072
8073%t [data-trix-dialog] [data-trix-validate]:invalid {
8074  background-color: #ffdddd;
8075}`);var CE=class extends HTMLElement{connectedCallback(){this.innerHTML===""&&(this.innerHTML=aZ.getDefaultHTML())}get editorElements(){if(this.id){var t;let e=(t=this.ownerDocument)===null||t===void 0?void 0:t.querySelectorAll('trix-editor[toolbar="'.concat(this.id,'"]'));return Array.from(e)}return[]}get editorElement(){let[t]=this.editorElements;return t}},NEt=0,BEt=function(i){if(!i.hasAttribute("contenteditable"))return i.toggleAttribute("contenteditable",!i.disabled),(function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.times=1,Ns(t,e)})("focus",{onElement:i,withCallback:()=>FEt(i)})},FEt=function(i){return UEt(i),zEt(i)},UEt=function(i){var t,e;if((t=(e=document).queryCommandSupported)!==null&&t!==void 0&&t.call(e,"enableObjectResizing"))return document.execCommand("enableObjectResizing",!1,!1),Ns("mscontrol
8075select",{onElement:i,preventDefault:!0})},zEt=function(i){var t,e;if((t=(e=document).queryCommandSupported)!==null&&t!==void 0&&t.call(e,"DefaultParagraphSeparator")){let{tagName:n}=$o.default;if(["div","p"].includes(n))return document.execCommand("DefaultParagraphSeparator",!1,n)}},tZ=Ew.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"};lZ("trix-editor",`%t {
8076    display: block;
8077}
8078
8079%t:empty::before {
8080    content: attr(placeholder);
8081    color: graytext;
8082    cursor: text;
8083    pointer-events: none;
8084    white-space: pre-line;
8085}
8086
8087%t a[contenteditable=false] {
8088    cursor: text;
8089}
8090
8091%t img {
8092    max-width: 100%;
8093    height: auto;
8094}
8095
8096%t `.concat(qp,` figcaption textarea {
8097    resize: none;
8098}
8099
8100%t `).concat(qp,` figcaption textarea.trix-autoresize-clone {
8101    position: absolute;
8102    left: -9999px;
8103    max-height: 0px;
8104}
8105
8106%t `).concat(qp,` figcaption[data-trix-placeholder]:empty::before {
8107    content: attr(data-trix-placeholder);
8108    color: graytext;
8109}
8110
8111%t [data-trix-cursor-target] {
8112    display: `).concat(tZ.display,` !important;
8113    width: `).concat(tZ.width,` !important;
8114    padding: 0 !important;
8115    margin: 0 !important;
8116    border: none !important;
8117}
8118
8119%t [data-trix-cursor-target=left] {
8120    vertical-align: top !important;
8121    margin-left: -1px !important;
8122}
8123
8124%t [data-trix-cursor-target=right] {
8125    vertical-align: bottom !important;
8126    margin-right: -1px !important;
8127}`));var ic=new WeakMap,tE=new WeakMap,mw=new WeakSet,qF=class{constructor(t){var e,n;vZ(e=this,n=mw),n.add(e),go(this,"value",""),tb(this,ic,{writable:!0,value:void 0}),tb(this,tE,{writable:!0,value:void 0}),this.element=t,Sw(this,ic,t.attachInternals()),Sw(this,tE,!1)}connectedCallback(){QA(this,mw,eE).call(this)}disconnectedCallback(){}get form(){return Pi(this,ic).form}get name(){return this.element.getAttribute("name")}set name(t){this.element.setAttribute("name",t)}get labels(){return Pi(this,ic).labels}get disabled(){return Pi(this,tE)||this.element.hasAttribute("disabled")}set disabled(t){this.element.toggleAttribute("disabled",t)}get required(){return this.element.hasAttribute("required")}set required(t){this.element.toggleAttribute("required",t),QA(this,mw,eE).call(this)}get validity(){return Pi(this,ic).validity}get validationMessage(){return Pi(this,ic).validationMessage}get willValidate(){return Pi(this,ic).willValidate}formDisabledCallback(t){Sw(this,tE,t)}setFormValue(t){this.value=t,QA(this,mw,eE).call(this),Pi(this,ic).setFormValue(this.element.disabled?void 0:this.value)}checkValidity(){return Pi(this,ic).checkValidity()}reportValidity(){return Pi(this,ic).reportValidity()}setCustomValidity(t){QA(this,mw,eE).call(this,t)}};function eE(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",{required:t,value:e}=this.element,n=t&&!e,s=!!i,r=fi("input",{required:t}),o=i||r.validationMessage;Pi(this,ic).setValidity({valueMissing:n,customError:s},o)}var EF=new WeakMap,kF=new WeakMap,PF=new WeakMap,YF=class{constructor(t){tb(this,EF,{writable:!0,value:void 0}),tb(this,kF,{writable:!0,value:e=>{e.defaultPrevented||e.target===this.element.form&&this.element.reset()}}),tb(this,PF,{writable:!0,value:e=>{if(e.defaultPrevented||this.element.contains(e.target))return;let n=Ud(e.target,{matchingSelector:"label"});n&&Array.from(this.labels).includes(n)&&this.element.focus()}}),this.element=t}connectedCallback(){Sw(this,EF,(function(t){if(t.hasAttribute("aria-label")||t.hasAttribute("aria-labelledby"))return;let e=function(){let n=Array.from(t.labels).map((r=>{if(!r.contains(t))return r.textContent})).filter((r=>r)),s=n.join(" ");return s?t.setAttribute("aria-label",s):t.removeAttribute("aria-label")};return e(),Ns("focus",{onElement:t,withCallback:e})})(this.element)),window.addEventListener("reset",Pi(this,kF),!1),window.addEventListener("click",Pi(this,PF),!1)}disconnectedCallback(){var t;(t=Pi(this,EF))===null||t===void 0||t.destroy(),window.removeEventListener("reset",Pi(this,kF),!1),window.removeEventListener("click",Pi(this,PF),!1)}get labels(){let t=[];this.element.id&&this.element.ownerDocument&&t.push(...Array.from(this.element.ownerDocument.querySelectorAll("label[for='".concat(this.element.i
8127d,"']"))||[]));let e=Ud(this.element,{matchingSelector:"label"});return e&&[this.element,null].includes(e.control)&&t.push(e),t}get form(){return console.warn("This browser does not support the .form property for trix-editor elements."),null}get name(){return console.warn("This browser does not support the .name property for trix-editor elements."),null}set name(t){console.warn("This browser does not support the .name property for trix-editor elements.")}get disabled(){return console.warn("This browser does not support the [disabled] attribute for trix-editor elements."),!1}set disabled(t){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(t){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}formDisabledCallback(t){}setFormValue(t){}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(t){console.warn("This browser does not support setCustomValidity(validationMessage) for trix-editor elements.")}},nr=new WeakMap,cb=class extends HTMLElement{constructor(){super(),tb(this,nr,{writable:!0,value:void 0}),this.willCreateInput=!0,Sw(this,nr,this.constructor.formAssociated?new qF(this):new YF(this))}get trixId(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++NEt),this.trixId)}get labels(){return Pi(this,nr).labels}get disabled(){let{inputElement:t}=this;return t?t.disabled:Pi(this,nr).disabled}set disabled(t){let{inputElement:e}=this;e&&(e.disabled=t),Pi(this,nr).disabled=t}get required(){return Pi(this,nr).required}set required(t){Pi(this,nr).required=t}get validity(){return Pi(this,nr).validity}get validationMessage(){return Pi(this,nr).validationMessage}get willValidate(){return Pi(this,nr).willValidate}get type(){return this.localName}get toolbarElement(){var t;if(this.hasAttribute("toolbar"))return(t=this.ownerDocument)===null||t===void 0?void 0:t.getElementById(this.getAttribute("toolbar"));if(this.parentNode){let e="trix-toolbar-".concat(this.trixId);return this.setAttribute("toolbar",e),this.internalToolbar=fi("trix-toolbar",{id:e}),this.parentNode.insertBefore(this.internalToolbar,this),this.internalToolbar}}get form(){let{inputElement:t}=this;return t?t.form:Pi(this,nr).form}get inputElement(){var t;return this.hasAttribute("input")?(t=this.ownerDocument)===null||t===void 0?void 0:t.getElementById(this.getAttribute("input")):void 0}get editor(){var t;return(t=this.editorController)===null||t===void 0?void 0:t.editor}get name(){let{inputElement:t}=this;return t?t.name:Pi(this,nr).name}set name(t){let{inputElement:e}=this;e?e.name=t:Pi(this,nr).name=t}get value(){let{inputElement:t}=this;return t?t.value:Pi(this,nr).value}set value(t){var e;this.defaultValue=t,(e=this.editor)===null||e===void 0||e.loadHTML(this.defaultValue)}attributeChangedCallback(t,e,n){t==="connected"&&this.isConnected&&e!=null&&e!==n&&requestAnimationFrame((()=>this.reconnect()))}notify(t,e){if(this.editorController)return yw("trix-".concat(t),{onElement:this,attributes:e})}setFormValue(t){let{inputElement:e}=this;e&&(e.value=t),Pi(this,nr).setFormValue(t)}connectedCallback(){if(!this.hasAttribute("data-trix-internal")){if(BEt(this),(function(t){t.hasAttribute("role")||t.setAttribute("role","textbox")})(this),!this.editorController){if(yw("trix-before-initialize",{onElement:this}),this.defaultValue=this.inputElement?this.inputElement.value:this.innerHTML,!this.hasAttribute("input")&&this.parentNode&&this.willCreateInput){let t="trix-input-".concat(this.trixId);this.setAttribute("input",t);let e=fi("input",{type:"hidden",id:t});this.parentNode.insertBefore(e,this.nextElementSibling)}this.editorController=new Kp({editorElement:this,html:this.defaultValue}),requestAnimationFrame((()=>yw("trix-initialize",{onElement:this})))}this.editorController.registerSelectionManager(),Pi(this,nr).connectedCallback(),this.toggleAttribute("connected",!0),(function(t){!document.querySelector(":focus")&&t.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===t&&t.focus()})(this)}}disconnectedCallback(){var t;(t=this.editorController)===null||t===void 0||t.unregisterSelectionManager(),Pi(this,nr).disconnectedCallback(),this.toggleAttribute("connected",!1)}reconnect(){this.removeInternalToolbar(),this.disconnectedCallback(),this.connectedCallback()}removeInternalToolbar(){var t;(t=this.internalToolbar)===null||t===void 0||t.remove(),this.internalToolbar=null}checkValidity(){return Pi(this,nr).checkValidity()}reportValidity(){return Pi(this,nr).reportValidity()}setCustomValidity(t){Pi(this,nr).setCustomValidity(t)}formDisabledCallback(t){let{inputElement:e}=this;e&&(e.disabled=t),this.toggleAttribute("contenteditable",!t),Pi(this,nr).formDisabledCallback(t)}formResetCallback(){this.reset()}reset(){this.value=this.defaultValue}};go(cb,"formAssociated","ElementInternals"in window),go(cb,"observedAttributes",["connected"]);var ng={VERSION:$Tt,config:kw,core:cEt,models:SZ,views:pEt,controllers:LEt,observers:IEt,operations:OEt,elements:Object.freeze({__proto__:null,TrixEditorElement:cb,TrixToolbarElement:CE}),filters:Object.freeze({__proto__:null,Filter:pE,attachmentGalleryFilter:wZ})};Object.assign(ng,SZ),window.Trix=ng,setTimeout((function(){customElements.get("trix-toolbar")||customElements.define("trix-toolbar",CE),customElements.get("trix-editor")||customElements.define("trix-editor",cb)}),0);var i4=class extends le{static targets=["field"];static values={url:{type:String,default:"/users/mentions.json"}};connect(){this.initializeTribute()}initializeTribute(){this.tribute=new AZ.default({allowSpaces:!0,lookup:"name",values:(i,t)=>{fetch(`${this.urlValue}?query=${i}`).then(e=>e.json()).then(e=>t(e)).catch(e=>t([]))},menuShowMinLength:1}),this.tribute.attach(this.fieldTarget),this.fieldTarget.addEventListener("tribute-replaced",this.replaced.bind(this)),this.tribute.range.pasteHtml=this._pasteHtml.bind(this)}disconnect(){this.tribute.detach(this.fieldTarget)}replaced(i){let t=i.detail.item.original,e=new ng.Attachment({content:t.content,sgid:t.sgid});this.editor.insertAttachment(e),this.editor.insertString(" ")}_pasteHtml(i,t,e){let s=this.editor.getSelectedRange()[0],r=e-t;this.editor.setSelectedRange([s-r,s]),this.editor.deleteInDirection("backward")}get editor(){return this.fieldTarget.editor}};var o4={};Le(o4,{default:()=>r4});var r4=class extends le{static targets=["toggle"];
8127toggle(){let i=this.element.classList.toggle("bs-nav-open");this.setExpanded(i)}close(){this.element.classList.remove("bs-nav-open"),this.setExpanded(!1)}closeOnEscape(i){i.key==="Escape"&&this.close()}setExpanded(i){this.hasToggleTarget&&this.toggleTarget.setAttribute("aria-expanded",i?"true":"false")}};var e5={};Le(e5,{default:()=>t5});var t5=class extends le{static targets=["container","loading","error"];static values={url:String,format:String,textures:Array,manifestUrl:String};async connect(){if(window.THREE)this.THREE=window.THREE;else{let i=await Promise.resolve().then(()=>(wh(),wet));window.THREE=i,this.THREE=i}this.scene=null,this.camera=null,this.renderer=null,this.model=null,this.controls=null,this.animationId=null,this.textures=new Map,this.loadModel()}disconnect(){this.cleanup()}async loadModel(){if(!this.urlValue){this.showError("No model URL provided");return}try{this.showLoading(),await this.setupScene(),await this.loadTextures(),await this.loadModelFile(),this.startAnimation(),this.hideLoading()}catch(i){console.error("Failed to load 3D model:",i),i.isVersionError?this.showVersionError(i.message):this.showError("Failed to load 3D model: "+i.message)}}async setupScene(){this.scene=new this.THREE.Scene,this.scene.background=new this.THREE.Color(15857145),this.camera=new this.THREE.PerspectiveCamera(75,this.containerTarget.clientWidth/this.containerTarget.clientHeight,.01,1e4),this.camera.position.set(3,3,3),this.camera.lookAt(0,0,0);let i=document.createElement("canvas");this.containerTarget.appendChild(i);let t;try{t=new this.THREE.WebGLRenderer({canvas:i,antialias:!0,alpha:!0})}catch{throw i.remove(),new Error("Your browser or device does not support WebGL, which is required for 3D previews. Try using a different browser or enabling hardware acceleration in your browser settings.")}if(!t.getContext())throw t.dispose(),i.remove(),new Error("Your browser or device does not support WebGL, which is required for 3D previews. Try using a different browser or enabling hardware acceleration in your browser settings.");this.renderer=t,this.renderer.setSize(this.containerTarget.clientWidth,this.containerTarget.clientHeight),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=this.THREE.PCFSoftShadowMap,this.renderer.toneMapping=this.THREE.ACESFilmicToneMapping,this.renderer.toneMappingExposure=1;let e=new this.THREE.AmbientLight(4210752,.6);this.scene.add(e);let n=new this.THREE.DirectionalLight(16777215,.8);n.position.set(10,10,5),n.castShadow=!0,n.shadow.mapSize.width=2048,n.shadow.mapSize.height=2048,this.scene.add(n);
8127let s=new this.THREE.PlaneGeometry(20,20),r=new this.THREE.MeshLambertMaterial({color:16448250,opacity:.5,transparent:!0}),o=new this.THREE.Mesh(s,r);o.rotation.x=-Math.PI/2,o.position.y=-1,o.receiveShadow=!0,this.scene.add(o),this.setupControls(),this.resizeHandler=this.handleResize.bind(this),window.addEventListener("resize",this.resizeHandler)}async loadTextures(){let i=this.texturesValue||[];if(this.manifestUrlValue&&i.length===0)try{let n=await fetch(this.manifestUrlValue);n.ok?i=(await n.json()).textures.map(r=>({url:r.file_url,slot:r.slot,name:r.name,id:r.id})):console.warn("Failed to load manifest:",n.status,n.statusText)}catch(n){console.error("Error loading manifest:",n)}if(!i||i.length===0)return;let t=new this.THREE.TextureLoader,e=i.map(async n=>{if(!n.url){console.warn("Texture missing URL:",n);return}try{let s=await new Promise((o,a)=>{t.load(n.url,o,void 0,a)});s.wrapS=this.THREE.RepeatWrapping,s.wrapT=this.THREE.RepeatWrapping,s.flipY=!1;let r=n.slot||"diffuse";this.textures.set(r,s)}catch(s){console.error(`Failed to load texture ${n.name}:`,s)}});await Promise.all(e)}setupControls(){let i=!1,t=0,e=0,n=0,s=0,r=0,o=0;this.renderer.domElement.addEventListener("mousedown",a=>{i=!0,t=a.clientX,e=a.clientY}),this.renderer.domElement.addEventListener("mousemove",a=>{if(!i)return;let l=a.clientX-t,c=a.clientY-e;s+=l*.01,n+=c*.01,t=a.clientX,e=a.clientY}),document.addEventListener("mouseup",()=>{i=!1}),this.renderer.domElement.addEventListener("wheel",a=>{a.preventDefault(),this.camera.position.multiplyScalar(a.deltaY>0?1.1:.9),this.camera.position.clampLength(2,50)}),this.updateControls=()=>{r+=(n-r)*.05,o+=(s-o)*.05,this.model&&(this.model.rotation.x=r,this.model.rotation.y=o)}}async loadModelFile(){let t=(this.formatValue?.toLowerCase()||this.getFormatFromUrl()).replace(/^\./,"");try{let e=await fetch(this.urlValue,{method:"HEAD"});if(!e.ok){let n;try{n=(await(await fetch(this.urlValue)).json()).error}catch{}throw new Error(n||`Failed to load model (HTTP ${e.status})`)}}catch(e){if(!(e.message&&!e.message.includes("HTTP ")&&!e.message.includes("Failed to load model")&&!e.message.includes("too large")&&!e.message.includes("not enabled")&&!e.message.includes("Perforce")))throw e}switch(t){case"gltf":case"glb":await this.loadGLTF();break;case"obj":await this.loadOBJ();break;case"fbx":await this.loadFBX();break;default:this.createPlaceholder(t)}}async loadGLTF(){let{GLTFLoader:i}=await Promise.resolve().then(()=>(Let(),Det)),t=new i;return new Promise((e,n)=>{t.load(this.urlValue,s=>{this.model=s.scene,this.processLoadedModel(),e()},void 0,s=>{console.error("GLTF/GLB loading error:",s),n(s)})})}async loadOBJ(){let{OBJLoader:i}=await Promise.resolve().then(()=>(Uet(),Fet)),t=new i,e=null;try{e=await this.loadCompanionMTL(),e&&t.setMaterials(e)}catch(n){console.warn("Could not load companion MTL file:",n)}return new Promise((n,s)=>{t.load(this.urlValue,r=>{this.model=r,e||this.applyDefaultMaterials(this.model),this.processLoadedModel(),n()},void 0,r=>{console.error("OBJ loading error:",r),s(r)})})}async loadCompanionMTL(){let i=this.urlValue.split("/"),t=i[i.length-2],e=i[i.indexOf("projects")+1];if(!t||!e)throw new Error("Could not extract asset/project ID from URL");let n=`/projects/${e}/game-assets/${t}/companion_mtl`,s=await fetch(n);if(!s.ok)throw new Error(`Companion MTL lookup failed: ${s.status}`);let r=await s.json();if(!r.found)return null;let{MTLLoader:o}=await Promise.resolve().then(()=>(Vet(),zet)),a=new o,l=r.mtl_asset.preview_url,c=l.substring(0,l.lastIndexOf("/")+1);return a.setPath(c),new Promise((u,h)=>{a.load(l,d=>{d.preload(),u(d)},void 0,d=>{console.error("MTL loading error:",d),h(d)})})}async loadFBX(){let{FBXLoader:i}=await Promise.resolve().then(()=>(ont(),rnt)),t=new i;return new Promise((e,n)=>{t.load(this.urlValue,s=>{this.model=s,this.processLoadedModel(),e()},void 0,s=>{if(console.error("FBX loading error:",s),s.message&&s.message.includes("FBX version not supported")){let r=s.message.match(/FileVersion: (\d+)/),o=r?r[1]:"unknown",a=new Error(`FBX version ${o} not supported. Please convert to a newer FBX version (2014 or later) or use OBJ/GLTF format instead.`);a.originalError=s,a.isVersionError=!0,n(a)}else n(s)})})}createPlaceholder(i){let t=new this.THREE.BoxGeometry(2,2,2),e=new this.THREE.MeshBasicMaterial({color:6583435,wireframe:!0,transparent:!0,opacity:.7});this.model=new this.THREE.Mesh(t,e),this.processLoadedModel(),this.show
8127FormatInfo(i)}applyDefaultMaterials(i){i.traverse(t=>{if(t.isMesh)if(!t.material||this.isMaterialBlack(t.material))t.material=this.createMaterial();else if(t.material&&typeof t.material.clone=="function"){let e=t.material;t.material=e.clone();let n=t.name?.toLowerCase()||"";(n.includes("body")||!n.includes("wheel")&&!n.includes("glass"))&&this.enhanceMaterialWithTextures(t.material)}else t.material=this.createMaterial()})}createMaterial(){if(this.textures.size>0){let i={side:this.THREE.DoubleSide};if(this.textures.has("diffuse")){let t=this.textures.get("diffuse");i.map=t}else i.color=8947848;return this.textures.has("normal")&&(i.normalMap=this.textures.get("normal")),this.textures.has("roughness")&&(i.roughnessMap=this.textures.get("roughness")),this.textures.has("metallic")&&(i.metalnessMap=this.textures.get("metallic")),this.textures.has("specular")?new this.THREE.MeshLambertMaterial(i):this.textures.has("normal")||this.textures.has("roughness")||this.textures.has("metallic")?new this.THREE.MeshStandardMaterial(i):new this.THREE.MeshLambertMaterial(i)}else return new this.THREE.MeshLambertMaterial({color:8947848,side:this.THREE.DoubleSide})}enhanceMaterialWithTextures(i){if(this.textures.size!==0&&(i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial)){let t=!1;if(this.textures.has("diffuse")&&!i.map){let e=this.textures.get("diffuse");i.map=e,t=!0}i.isMeshPhongMaterial&&this.textures.has("normal")&&!i.normalMap&&(i.normalMap=this.textures.get("normal"),t=!0),i.isMeshStandardMaterial&&(this.textures.has("normal")&&!i.normalMap&&(i.normalMap=this.textures.get("normal"),t=!0),this.textures.has("roughness")&&!i.roughnessMap&&(i.roughnessMap=this.textures.get("roughness"),t=!0),this.textures.has("metallic")&&!i.metalnessMap&&(i.metalnessMap=this.textures.get("metallic"),t=!0)),t&&(i.needsUpdate=!0)}}isMaterialBlack(i){return i.color?i.color.r<.1&&i.color.g<.1&&i.color.b<.1:!1}processLoadedModel(){if(!this.model)return;let i=new this.THREE.Box3().setFromObject(this.model),t=i.getCenter(new this.THREE.Vector3),e=i.getSize(new this.THREE.Vector3);this.model.position.set(0,0,0),this.model.traverse(r=>{r.isMesh&&r.position.sub(t)});let n=Math.max(e.x,e.y,e.z);if(n>4){let r=4/n;this.model.scale.setScalar(r)}else if(n<.1){let r=2/n;this.model.scale.setScalar(r)}let s=0;this.model.traverse(r=>{if(r.isMesh)if(s++,r.castShadow=!0,r.receiveShadow=!0,r.material)if(this.enhanceMaterialWithTextures(r.material),r.material.isMeshBasicMaterial){let o={color:r.material.color||8947848,transparent:r.material.transparent,opacity:r.material.opacity||1,side:this.THREE.DoubleSide};if(this.textures.has("diffuse")){let a=this.textures.get("diffuse");o.map=a}this.textures.has("specular")?(o.specularMap=this.textures.get("specular"),o.specular=new this.THREE.Color(16777215),o.shininess=30,r.material=new this.THREE.MeshPhongMaterial(o)):r.material=new this.THREE.MeshLambertMaterial(o)}else r.material.side=this.THREE.DoubleSide;else r.material=this.createMaterial()}),this.scene.add(this.model)}getFormatFromUrl(){return this.urlValue.split(".").pop()?.toLowerCase()||"unknown"}showFormatInfo(i){}startAnimation(){let i=()=>{this.animationId=requestAnimationFrame(i),this.updateControls&&this.updateControls(),this.renderer.render(this.scene,this.camera)};i()}handleResize(){if(!this.camera||!this.renderer)return;let i=this.containerTarget.clientWidth,t=this.containerTarget.clientHeight;this.camera.aspect=i/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(i,t)}showLoading(){this.hasLoadingTarget&&this.loadingTarget.classList.remove("hidden"),this.hasErrorTarget&&this.errorTarget.classList.add("hidden")}hideLoading(){this.hasLoadingTarget&&this.loadingTarget.classList.add("hidden")}showError(i){this.hideLoading(),this.hasErrorTarget&&(this.errorTarget.textContent=i,this.errorTarget.classList.remove("hidden"))}showVersionError(i){this.hideLoading(),this.hasErrorTarget&&(this.errorTarget.innerHTML=`
8128        <div style="text-align: center; color: var(--bs-err);">
8129          <svg style="width: 32px; height: 32px; margin: 0 auto 8px; display: block;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8130            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L4.232 16.5c-.77.833.192 2.5 1.732 2.5z"/>
8131          </svg>
8132          <p style="font-size: 13px; font-weight: 500; margin: 0 0 8px;">FBX Version Not Supported</p>
8133          <p style="font-size: 12px; color: var(--bs-fg-soft); margin: 0 0 12px;">${i}</p>
8134          <div style="font-size: 12px; color: var(--bs-fg-mute);">
8135            <p style="margin: 0 0 4px;"><strong>Solutions:</strong></p>
8136            <p style="margin: 0;">\u2022 Re-export as FBX 2014+ format</p>
8137            <p style="margin: 0;">\u2022 Convert to OBJ or GLTF format</p>
8138            <p style="margin: 0;">\u2022 Use Blender or other 3D software to convert</p>
8139          </div>
8140        </div>
8141      `,this.errorTarget.classList.remove("hidden"))}cleanup(){this.animationId&&cancelAnimationFrame(this.animationId),this.renderer&&(this.renderer.dispose(),this.renderer.domElement&&this.renderer.domElement.parentNode&&this.renderer.domElement.parentNode.removeChild(this.renderer.domElement)),this.resizeHandler&&window.removeEventListener("resize",this.resizeHandler),this.scene&&this.scene.traverse(i=>{i.geometry&&i.geometry.dispose(),i.material&&(Array.isArray(i.material)?i.material.forEach(t=>t.dispose()):i.material.dispose())})}};var i5={};Le(i5,{default:()=>n5});var n5=class extends le{static targets=["container","userSelection","removeBtn"];connect(){this.updateRemoveButtons()}addUser(){let i=this.containerTarget,e=this.userSelectionTargets[0].cloneNode(!0),n=this.userSelectionTargets.length+1,s=e.querySelector("h3");s.textContent=`User #${n}`;let r=e.querySelector("select");r.selectedIndex=0,e.querySelectorAll('input[type="radio"]').forEach((l,c)=>{l.checked=l.value==="member",l.name="existing_members[][role]"}),e.querySelector('[data-multiple-existing-users-target="removeBtn"]').classList.remove("hidden"),i.appendChild(e),this.updateRemoveButtons()}removeUser(i){i.currentTarget.closest('[data-multiple-existing-users-target="userSelection"]').remove(),this.updateRemoveButtons(),this.updateUserNumbers()}updateRemoveButtons(){let i=this.userSelectionTargets;
8141i.forEach((t,e)=>{let n=t.querySelector('[data-multiple-existing-users-target="removeBtn"]');i.length===1?n.classList.add("hidden"):n.classList.remove("hidden")})}updateUserNumbers(){this.userSelectionTargets.forEach((i,t)=>{let e=i.querySelector("h3");e.textContent=`User #${t+1}`})}};var r5={};Le(r5,{default:()=>s5});var s5=class extends le{static targets=["container","invitation","removeBtn"];connect(){this.invitationCount=1,this.updateRemoveButtons()}addInvitation(){this.invitationCount++;let i=this.createInvitationTemplate(this.invitationCount);this.containerTarget.insertAdjacentHTML("beforeend",i),this.updateRemoveButtons()}removeInvitation(i){let t=i.target.closest('[data-multiple-invitations-target="invitation"]');t&&this.invitationTargets.length>1&&(t.remove(),this.updateRemoveButtons(),this.renumberInvitations())}createInvitationTemplate(i){return`
8142      <div data-multiple-invitations-target="invitation" style="border: 1px solid var(--bs-line); border-radius: var(--bs-r-md); padding: 16px;">
8143        <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;">
8144          <h3 style="font-size: 13px; font-weight: 600; color: var(--bs-fg); margin: 0;">Team Member #${i}</h3>
8145          <button type="button" data-action="click->multiple-invitations#removeInvitation" data-multiple-invitations-target="removeBtn" style="background: transparent; border: 0; color: var(--bs-fg-mute); cursor: pointer; padding: 0; display: inline-flex;">
8146            <svg style="width: 18px; height: 18px;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8147              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
8148            </svg>
8149          </button>
8150        </div>
8151
8152        <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 16px;">
8153          <div>
8154            <label style="display: block; font-size: 12px; font-weight: 500; color: var(--bs-fg-mute); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;">Full Name</label>
8155            <input type="text" name="invitations[][name]" placeholder="Enter full name" required class="bs-input">
8156          </div>
8157
8158          <div>
8159            <label style="display: block; font-size: 12px; font-weight: 500; color: var(--bs-fg-mute); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;">Email Address</label>
8160            <input type="email" name="invitations[][email]" placeholder="[email protected]" required class="bs-input">
8161          </div>
8162        </div>
8163
8164        <!-- Role selection -->
8165        <div style="margin-top: 16px;">
8166          <label style="display: block; font-size: 12px; font-weight: 500; color: var(--bs-fg-mute); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;">Role</label>
8167          <div style="display: flex; flex-wrap: wrap; gap: 16px;">
8168            ${this.getRoleCheckboxes()}
8169          </div>
8170        </div>
8171      </div>
8172    `}getRoleCheckboxes(){let i=this.invitationTargets[0];if(i){let t=i.querySelectorAll('input[type="checkbox"][name*="["]');return Array.from(t).map(e=>{let n=e.name.match(/\[(\w+)\]$/);if(n){let s=n[1];return`
8173            <label style="display: inline-flex; align-items: center; gap: 8px; cursor: pointer;">
8174              <input type="checkbox" name="invitations[][${s}]" value="1" style="width: 16px; height: 16px; accent-color: var(--bs-accent);">
8175              <span style="font-size: 13px; color: var(--bs-fg);">${s.charAt(0).toUpperCase()+s.slice(1)}</span>
8176            </label>
8177          `}return""}).join("")}return`
8178      <label style="display: inline-flex; align-items: center; gap: 8px; cursor: pointer;">
8179        <input type="checkbox" name="invitations[][admin]" value="1" style="width: 16px; height: 16px; accent-color: var(--bs-accent);">
8180        <span style="font-size: 13px; color: var(--bs-fg);">Admin</span>
8181      </label>
8182      <label style="display: inline-flex; align-items: center; gap: 8px; cursor: pointer;">
8183        <input type="checkbox" name="invitations[][member]" value="1" style="width: 16px; height: 16px; accent-color: var(--bs-accent);">
8184        <span style="font-size: 13px; color: var(--bs-fg);">Member</span>
8185      </label>
8186    `}updateRemoveButtons(){let t=this.invitationTargets.length>1;this.removeBtnTargets.forEach(e=>{t?e.classList.remove("hidden"):e.classList.add("hidden")})}renumberInvitations(){this.invitationTargets.forEach((i,t)=>{let e=i.querySelector("h3");e&&(e.textContent=`Team Member #${t+1}`)})}};var a5={};Le(a5,{default:()=>o5});var o5=class extends le{static targets=["badge","list","placeholder","notification"];static values={accountId:String,accountUnread:Number,totalUnread:Number};connect(){this.subscription=Ry.subscriptions.create({channel:"Noticed::NotificationChannel"},{connected:this._connected.bind(this),disconnected:this._disconnected.bind(this),received:this._received.bind(this)}),this.hasUnread()&&this.showUnreadBadge()}disconnect(){this.subscription.unsubscribe()}_connected(){}_disconnected(){}_received(i){this.totalUnreadValue+=1,i.account_id&&i.account_id==this.accountIdValue&&(this.accountUnreadValue+=1),!(i.account_id&&i.account_id!=this.accountIdValue)&&(i.html&&(this.listTarget.insertAdjacentHTML("afterbegin",i.html),this.showUnreadBadge()),i.browser&&this.checkPermissionAndNotify(i.browser))}open(){this.hideUnreadBadge(),this.markAllAsSeen()}hasUnread(){return!!this.accountUnreadValue}showUnreadBadge(){this.hasBadgeTarget!=!1&&this.badgeTarget.classList.remove("hidden")}hideUnreadBadge(){this.hasBadgeTarget!=!1&&this.badgeTarget.classList.add("hidden")}markAllAsSeen(){let i=this.notificationTargets.map(t=>t.dataset.id);this.subscription.perform("mark_as_seen",{ids:i}),this.accountUnreadValue=0,this.totalUnreadValue-=i.length}markAsRead(i){let t=i.currentTarget.dataset.id;t!=null&&this.subscription.perform("mark_as_read",{ids:[t]})}checkPermissionAndNotify(i){"Notification"in window&&(Notification.permission==="granted"?this.browserNotification(i):Notification.permission!=="denied"&&Notification.requestPermission().then(t=>{t==="granted"&&this.browserNotification(i)}))}browserNotification(i){new Notification(i.title,i.options)}totalUnreadValueChanged(){this.syncCountToNative()}accountUnreadValueChanged(){this.syncCountToNative()}syncCountToNative(){window.TurboNativeBridge.setNotificationCount(this.totalUnreadValue,this.accountUnreadValue)}};var c5={};Le(c5,{default:()=>l5});var l5=class extends le{static targets=["loading","form"];connect(){console.log("Onboarding form controller connected")}async submit(i){i.preventDefault();let t=this.hasFormTarget?this.formTarget:this.element.querySelector("form");if(!t||t.tagName!=="FORM"){console.error("Could not find form element",{hasFormTarget:this.hasFormTarget,element:this.element,form:t});return}let e=new FormData(t);this.showLoading();try{let n=await fetch(t.action,{method:t.method,body:e,headers:{"X-Requested-With":"XMLHttpRequest","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content}}),s=await n.json();n.ok?this.handleSuccess(s):this.handleError(s)}catch(n){console.error("Onboarding form submission error:",n),this.handleError({message:"Network error occurred. Please try again."})}}handleSuccess(i){console.log("Step completed successfully:",i),this.dispatch("stepCompleted",{detail:{step:i.step,progress:i.progress,completed:i.completed,nextStep:i.nextStep}}),this.updateProgressBar(i.progress),this.showSuccess(i.message||"Step completed successfully!"),i.completed?setTimeout(()=>{window.location.href=i.redirectUrl||"/dashboard"},1500):i.nextStep&&setTimeout(()=>{window.location.reload()},800)}handleError(i){console.error("Step completion failed:",i),this.hideLoading(),this.showError(i.message||"An error occurred. Please try again."),this.enableForm()}showLoading(){this.hasLoadingTarget&&this.loadingTarget.classList.remove("hidden"),this.disableForm();let i=this.element.querySelector('input[type="submit"], button[type="submit"]');i&&(i.disabled=!0,i.dataset.originalText=i.value||i.textContent,i.tagName==="INPUT"?i.value="Processing...":i.textContent="Processing...")}hideLoading(){this.hasLoadingTarget&&this.loadingTarget.classList.add("hidden"),this.enableForm()}disableForm(){this.element.querySelectorAll("input, select, textarea, button").forEach(t=>t.disabled=!0)}enableForm(){this.element.querySelectorAll("input, select, textarea, button").forEach(e
8186=>e.disabled=!1);let t=this.element.querySelector('input[type="submit"], button[type="submit"]');t&&t.dataset.originalText&&(t.tagName==="INPUT"?t.value=t.dataset.originalText:t.textContent=t.dataset.originalText,delete t.dataset.originalText)}updateProgressBar(i){let t=document.querySelector(".bg-gradient-to-r");t&&(t.style.width=i+"%");let e=document.querySelector("[data-progress-percentage]");e&&(e.textContent=i+"%")}showSuccess(i){this.showNotification(i,"success")}showError(i){this.showNotification(i,"error")}showNotification(i,t="info"){let e=document.createElement("div"),n=t==="success"?"var(--bs-ok)":t==="error"?"var(--bs-err)":"var(--bs-info)";e.style.cssText=`
8187      position: fixed; top: 16px; right: 16px; z-index: 50;
8188      padding: 14px 16px; border-radius: var(--bs-r-md);
8189      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
8190      max-width: 360px;
8191      background: ${n}; color: #fff;
8192      transform: translateX(100%); transition: transform 300ms ease;
8193    `,e.innerHTML=`
8194      <div style="display: flex; align-items: center; gap: 12px;">
8195        <span style="flex: 1; font-size: 13px;">${i}</span>
8196        <button onclick="this.parentElement.parentElement.remove()" style="background: transparent; border: 0; color: #fff; opacity: 0.85; cursor: pointer; padding: 0; display: inline-flex;">
8197          <svg style="width: 16px; height: 16px;" fill="currentColor" viewBox="0 0 20 20">
8198            <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path>
8199          </svg>
8200        </button>
8201      </div>
8202    `,document.body.appendChild(e),setTimeout(()=>{e.style.transform="translateX(0)"},100),setTimeout(()=>{e.style.transform="translateX(100%)",setTimeout(()=>{e.parentElement&&e.remove()},300)},5e3)}};var h5={};Le(h5,{default:()=>u5});var u5=class extends le{static targets=["configSection"];static values={name:String};connect(){this.initializeStep()}initializeStep(){switch(this.nameValue){case"project_creation":this.initializeProjectCreation();break;case"source_control":this.initializeSourceControl();break;case"build_pipeline":this.initializeBuildPipeline();break;case"asset_management":this.initializeAssetManagement();break;case"integrations":this.initializeIntegrations();break}}initializeProjectCreation(){this.element.querySelectorAll('input[name*="project_type"]').forEach(e=>{e.addEventListener("change",this.handleProjectTypeChange.bind(this))});let t=this.element.querySelector('input[name*="project_type"]:checked');t&&this.handleProjectTypeChange({target:t})}initializeSourceControl(){this.element.querySelectorAll('input[name*="integration_type"]').forEach(e=>{e.addEventListener("change",this.handleIntegrationTypeChange.bind(this))});let t=this.element.querySelector('input[name*="integration_type"]:checked');t&&this.handleIntegrationTypeChange({target:t})}initializeBuildPipeline(){this.element.querySelectorAll('input[name*="platform"]').forEach(t=>{t.addEventListener("change",this.handlePlatformChange.bind(this))})}initializeAssetManagement(){let i=this.element.querySelector('input[type="file"]');
8202i&&i.addEventListener("change",this.handleFileUpload.bind(this)),this.element.querySelectorAll('input[name*="optimization_goal"]').forEach(e=>{e.addEventListener("change",this.handleOptimizationGoalChange.bind(this))})}initializeIntegrations(){this.element.querySelectorAll('input[type="radio"], input[type="checkbox"]').forEach(t=>{t.addEventListener("change",this.handleIntegrationChange.bind(this))})}handleProjectTypeChange(i){let t=i.target.value,e=this.element.querySelector('[data-project-type-target="game"]');e&&(t==="game"?e.style.display="block":e.style.display="none")}handleIntegrationTypeChange(i){let t=i.target.value;this.element.querySelectorAll("[data-integration-target]").forEach(n=>{n.classList.add("hidden")});let e=this.element.querySelector(`[data-integration-target="${t}"]`);e&&e.classList.remove("hidden")}handlePlatformChange(i){let t=i.target.value;this.updateBuildTypeRecommendations(t)}handleFileUpload(i){let t=i.target.files,e=this.element.querySelector('[data-target="file-list"]'),n=this.element.querySelector('[data-target="file-items"]');t.length>0&&e&&n?(e.classList.remove("hidden"),n.innerHTML="",Array.from(t).forEach(s=>{let r=this.createFileListItem(s);n.appendChild(r)})):e&&e.classList.add("hidden")}handleOptimizationGoalChange(i){let t=i.target.value;this.updateOptimizationRecommendations(t)}handleIntegrationChange(i){this.updateSubmitButton()}createFileListItem(i){let t=document.createElement("div");t.className="flex items-center text-sm",t.style.color="var(--bs-fg-soft)";let e="\u{1F4C4}";return i.type.startsWith("image/")?e="\u{1F5BC}\uFE0F":i.type.startsWith("audio/")?e="\u{1F3B5}":i.name.match(/\.(fbx|obj|glb|gltf)$/i)?e="\u{1F3AE}":i.name.endsWith(".zip")&&(e="\u{1F4E6}"),t.innerHTML=`
8203      <span class="mr-2">${e}</span>
8204      <span class="flex-1">${i.name}</span>
8205      <span class="text-xs" style="color: var(--bs-fg-mute);">${this.formatFileSize(i.size)}</span>
8206    `,t}updateBuildTypeRecommendations(i){let t={windows:"Windows builds support DirectX 12 and advanced graphics features.",macos:"macOS builds use Metal API for optimal performance.",linux:"Linux builds support Vulkan API for cross-platform compatibility.",android:"Android builds require additional optimization for mobile hardware."}}updateOptimizationRecommendations(i){let t={quality:"Focus on high-resolution textures and detailed models.",performance:"Optimize for frame rate with reduced polygon counts.",size:"Compress textures and use efficient file formats.",balanced:"Balance quality and performance for broad compatibility."}}updateSubmitButton(){let i=this.element.querySelector('input[type="submit"], button[type="submit"]'),t=this.element.querySelectorAll('input[type="radio"]:checked, input[type="checkbox"]:checked').length>0;i&&t?i.classList.add("ring-2","ring-blue-500","ring-offset-2"):i&&i.classList.remove("ring-2","ring-blue-500","ring-offset-2")}formatFileSize(i){if(i===0)return"0 B";let t=1024,e=["B","KB","MB","GB"],n=Math.floor(Math.log(i)/Math.log(t));return parseFloat((i/Math.pow(t,n)).toFixed(1))+" "+e[n]}};var f5={};Le(f5,{default:()=>d5});var d5=class extends le{static targets=["input","dropdown","loading"];static values={searchUrl:String};connect(){this.timeout=null,this.selectedIndex=-1,this.handleInput=this.handleInput.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.handleClickOutside=this.handleClickOutside.bind(this),this.inputTarget.addEventListener("input",this.handleInput),this.inputTarget.addEventListener("keydown",this.handleKeydown),document.addEventListener("click",this.handleClickOutside)}disconnect(){this.inputTarget.removeEventListener("input",this.handleInput),this.inputTarget.removeEventListener("keydown",this.handleKeydown),document.removeEventListener("click",this.handleClickOutside),this.timeout&&clearTimeout(this.timeout)}handleInput(i){let t=i.target.value.trim();if(this.timeout&&clearTimeout(this.timeout),t.length<2){this.hideDropdown();return}this.timeout=setTimeout(()=>{this.searchUsers(t)},300)}handleKeydown(i){let t=this.dropdownTarget.querySelectorAll("[data-username]");switch(i.key){case"ArrowDown":i.preventDefault(),this.selectedIndex=Math.min(this.selectedIndex+1,t.length-1),this.updateSelection(t);break;case"ArrowUp":i.preventDefault(),this.selectedIndex=Math.max(this.selectedIndex-1,-1),this.updateSelection(t);break;case"Enter":i.preventDefault(),this.selectedIndex>=0&&t[this.selectedIndex]&&this.selectUser(t[this.selectedIndex].dataset.username);break;case"Escape":this.hideDropdown();break}}handleClickOutside(i){this.element.contains(i.target)||this.hideDropdown()}async searchUsers(i){try{this.showLoading();let e=await(await fetch(`${this.searchUrlValue}?q=${encodeURIComponent(i)}`)).json();this.hideLoading(),this.displayResults(e)}catch(t){console.error("Perforce user search failed:",t),this.hideLoading(),this.hideDropdown()}}displayResults(i){if(i.length===0){this.dropdownTarget.innerHTML=`
8207        <div class="px-4 py-2 text-sm" style="color: var(--bs-fg-mute);">
8208          No users found
8209        </div>
8210      `,this.showDropdown();return}let t=i.map(e=>`
8211      <div class="cursor-pointer px-4 py-2 flex items-center justify-between"
8212           style="transition: background 120ms ease;"
8213           onmouseover="this.style.background='var(--bs-bg-panel-2)'"
8214           onmouseout="this.style.background=''"
8215           data-username="${e.username}"
8216           data-action="click->
8216perforce-typeahead#selectUser">
8217        <div>
8218          <div class="font-medium" style="color: var(--bs-fg);">${e.username}</div>
8219          ${e.display_name?`<div class="text-sm" style="color: var(--bs-fg-mute);">${e.display_name}</div>`:""}
8220        </div>
8221        ${e.email?`<div class="text-xs" style="color: var(--bs-fg-faint);">${e.email}</div>`:""}
8222      </div>
8223    `).join("");this.dropdownTarget.innerHTML=t,this.selectedIndex=-1,this.showDropdown()}selectUser(i){let t=i.target.closest("[data-username]")?.dataset.username||i;t&&(this.inputTarget.value=t,this.hideDropdown(),this.inputTarget.focus())}updateSelection(i){i.forEach((t,e)=>{t.style.background=e===this.selectedIndex?"var(--bs-bg-panel-2)":""})}showDropdown(){this.dropdownTarget.classList.remove("hidden")}hideDropdown(){this.dropdownTarget.classList.add("hidden"),this.selectedIndex=-1}showLoading(){this.hasLoadingTarget&&this.loadingTarget.classList.remove("hidden")}hideLoading(){this.hasLoadingTarget&&this.loadingTarget.classList.add("hidden")}};var g5={};Le(g5,{default:()=>p5});var p5=class extends le{static targets=["toggle","frequency","plans"];static values={frequency:String};static classes=["activeFrequency","inactiveFrequency","activePlans","inactivePlans","hiddenToggle"];connect(){this.removeEmptyFrequencies(),this.defaultFrequency()}switch(i){this.frequencyValue=i.target.dataset.frequency}removeEmptyFrequencies(){this.frequencyTargets.forEach(i=>{let t=i.dataset.frequency;this.plansTargets.findIndex(n=>n.dataset.frequency==t&&n.childElementCount>0)==-1&&i.remove()}),this.hiddenToggleClasses.forEach(i=>{this.toggleTarget.classList.toggle(i,this.frequencyTargets.length<2)})}defaultFrequency(){this.hasFrequencyValue||(this.frequencyValue=this.frequencyTargets[0].dataset.frequency)}frequencyValueChanged(){this.frequencyTargets.forEach(i=>{i.dataset.frequency==this.frequencyValue?this.showFrequency(i):this.hideFrequency(i)}),this.plansTargets.forEach(i=>{i.dataset.frequency==this.frequencyValue?this.showPlans(i):this.hidePlans(i)})}showFrequency(i){i.classList.add(...this.activeFrequencyClasses),i.classList.remove(...this.inactiveFrequencyClasses)}hideFrequency(i){i.classList.remove(...this.activeFrequencyClasses),i.classList.add(...this.inactiveFrequencyClasses)}showPlans(i){i.classList.add(...this.activePlansClasses),i.classList.remove(...this.inactivePlansClasses)}hidePlans(i){i.classList.remove(...this.activePlansClasses),i.classList.add(...this.inactivePlansClasses)}};var R5={};Le(R5,{default:()=>P5});var tS=class{constructor(t){this.response=t}get statusCode(){return this.response.status}get redirected(){return this.response.redirected}get ok(){return this.response.ok}get unauthenticated(){return this.statusCode===401}get unprocessableEntity(){return this.statusCode===422}get authenticationURL(){return this.response.headers.get("WWW-Authenticate")}get contentType(){return(this.response.headers.get("Content-Type")||"").replace(/;.*$/,"")}get headers(){return this.response.headers}get html(){return this.contentType.match(/^(application|text)\/(html|xhtml\+xml)$/)?this.text:Promise.reject(new Error(`Expected an HTML response but got "${this.contentType}" instead`))}get json(){return this.contentType.match(/^application\/.*json$/)?this.responseJson||(this.responseJson=this.response.json()):Promise.reject(new Error(`Expected a JSON response but got "${this.contentType}" instead`))}get text(){return this.responseText||(this.responseText=this.response.text())}get isTurboStream(){return this.contentType.match(/^text\/vnd\.turbo-stream\.html/)}get isScript(){return this.contentType.match(/\b(?:java|ecma)script\b/)}async renderTurboStream(){if(this.isTurboStream)window.Turbo?await window.Turbo.renderStreamMessage(await this.text):console.warn("You must set `window.Turbo = Turbo` to automatically process Turbo Stream events with request.js");else return Promise.reject(new Error(`Expected a Turbo Stream response but got "${this.contentType}" instead`))}async activeScript(){if(this.isScript){let t=document.createElement("script"),e=document.querySelector("meta[name=csp-nonce]");if(e){let n=e.nonce===""?e.content:e.nonce;n&&t.setAttribute("nonce",n)}t.innerHTML=await this.text,document.body.appendChild(t)}else return Promise.reject(new Error(`Expected a Script response but got "${this.contentType}" instead`))}};var eS=class{static register(t){this.interceptor=t}static get(){return this.interceptor}static reset(){this.interceptor=void 0}};function ant(i){let t=document.cookie?document.cookie.split("; "):[],e=`${encodeURIComponent(i)}=`,n=t.find(s=>
8223s.startsWith(e));if(n){let s=n.split("=").slice(1).join("=");if(s)return decodeURIComponent(s)}}function lnt(i){let t={};for(let e in i){let n=i[e];n!==void 0&&(t[e]=n)}return t}function m5(i){let t=document.head.querySelector(`meta[name="${i}"]`);return t&&t.content}function cnt(i){return[...i].reduce((t,[e,n])=>t.concat(typeof n=="string"?[[e,n]]:[]),[])}function unt(i,t){for(let[e,n]of t)n instanceof window.File||(i.has(e)&&!e.includes("[]")?(i.delete(e),i.set(e,n)):i.append(e,n))}var Mv=class{constructor(t,e,n={}){this.method=t,this.options=n,this.originalUrl=e.toString()}async perform(){try{let s=eS.get();s&&await s(this)}catch(s){console.error(s)}let t=window.Turbo?window.Turbo.fetch:window.fetch,e=new tS(await t(this.url,this.fetchOptions));return e.unauthenticated&&e.authenticationURL?Promise.reject(window.location.href=e.authenticationURL):(e.isScript&&await e.activeScript(),(e.ok||e.unprocessableEntity)&&e.isTurboStream&&await e.renderTurboStream(),e)}addHeader(t,e){let n=this.additionalHeaders;n[t]=e,this.options.headers=n}sameHostname(){if(!this.originalUrl.startsWith("http:")&&!this.originalUrl.startsWith("https:"))return!0;try{return new URL(this.originalUrl).hostname===window.location.hostname}catch{return!0}}get fetchOptions(){return{method:this.method.toUpperCase(),headers:this.headers,body:this.formattedBody,signal:this.signal,credentials:this.credentials,redirect:this.redirect,keepalive:this.keepalive}}get headers(){let t={"X-Requested-With":"XMLHttpRequest","Content-Type":this.contentType,Accept:this.accept};return this.sameHostname()&&(t["X-CSRF-Token"]=this.csrfToken),lnt(Object.assign(t,this.additionalHeaders))}get csrfToken(){return ant(m5("csrf-param"))||m5("csrf-token")}get contentType(){return this.options.contentType?this.options.contentType:this.body==null||this.body instanceof window.FormData?void 0:this.body instanceof window.File?this.body.type:"application/json"}get accept(){switch(this.responseKind){case"html":return"text/html, application/xhtml+xml";case"turbo-stream":return"text/vnd.turbo-stream.html, text/html, application/xhtml+xml";case"json":return"application/json, application/vnd.api+json";case"script":return"text/javascript, application/javascript";default:return"*/*"}}get body(){return this.options.body}get query(){let t=(this.originalUrl.split("?")[1]||"").split("#")[0],e=new URLSearchParams(t),n=this.options.query;n instanceof window.FormData?n=cnt(n):n instanceof window.URLSearchParams?n=n.entries():n=Object.entries(n||{}),unt(e,n);let s=e.toString();return s.length>0?`?${s}`:""}get url(){return this.originalUrl.split("?")[0].split("#")[0]+this.query}get responseKind(){return this.options.responseKind||"html"}get signal(){return this.options.signal}get redirect(){return this.options.redirect||"follow"}get credentials(){return this.options.credentials||"same-origin"}get keepalive(){return this.options.keepalive||!1}get additionalHeaders(){return this.options.headers||{}}get formattedBody(){let t=Object.prototype.toString.call(this.body)==="[object String]";return this.headers["Content-Type"]==="application/json"&&!t?JSON.stringify(this.body):this.body}};async function nS(i,t){return new Mv("get",i,t).perform()}async function b5(i,t){return new Mv("post",i,t).perform()}function v5(i,t){i.split(/\s+/).forEach(e=>{t(e)})}var iS=class{constructor(){this._events={}}on(t,e){v5(t,n=>{let s=this._events[n]||[];s.push(e),this._events[n]=s})}off(t,e){var n=arguments.length;if(n===0){this._events={};return}v5(t,s=>{if(n===1){delete this._events[s];return}let r=this._events[s];r!==void 0&&(r.splice(r.indexOf(e),1),this._events[s]=r)})}trigger(t,...e){var n=this;v5(t,s=>{let r=n._events[s];r!==void 0&&r.forEach(o=>{o.apply(n,e)})})}};function y5(i){return i.plugins={},class extends i{constructor(){super(...arguments),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(t,e){i.plugins[t]={name:t,fn:e}}initializePlugins(t){var e,n;let s=this,r=[];if(Array.isArray(t))t.forEach(o=>{typeof o=="string"?r.push(o):(s.plugins.settings[o.name]=o.options,r.push(o.name))});else if(t)for(e in t)t.hasOwnProperty(e)&&(s.plugins.settings[e]=t[e],r.push(e));for(;n=r.shift();)s.require(n)}loadPlugin(t){var e=this,n=e.plugins,s=i.plugins[t];if(!i.plugins.hasOwnProperty(t))throw new Error('Unable to find "'+t+'" plugin');n.requested[t]=!0,n.loaded[t]=s.fn.apply(e,[e.plugins.settings[t]||{}]),n.names.push(t)}require(t){var e=this,n=e.plugins;if(!e.plugins.loaded.hasOwnProperty(t)){if(n.requested[t])throw new Error('Plugin has circular dependency ("'+t+'")');e.loadPlugin(t)}return n.loaded[t]}}}var sS=i=>
vendor: 18,539 bytes, line 8223
8223(i=i.filter(Boolean),i.length<2?i[0]||"":dOt(i)==1?"["+i.join("")+"]":"(?:"+i.join("|")+")"),x5=i=>{if(!hOt(i))return i.join("");let t="",e=0,n=()=>{e>1&&(t+="{"+e+"}")};return i.forEach((s,r)=>{if(s===i[r-1]){e++;return}n(),t+=s,e=1}),n(),t},w5=i=>{let t=Array.from(i);return sS(t)},hOt=i=>new Set(i).size!==i.length,hf=i=>(i+"").replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu,"\\$1"),dOt=i=>i.reduce((t,e)=>Math.max(t,fOt(e)),0),fOt=i=>Array.from(i).length;var _5=i=>{if(i.length===1)return[[i]];let t=[],e=i.substring(1);return _5(e).forEach(function(s){let r=s.slice(0);r[0]=i.charAt(0)+r[0],t.push(r),r=s.slice(0),r.unshift(i.charAt(0)),t.push(r)}),t};var pOt=[[0,65535]],gOt="[\u0300-\u036F\xB7\u02BE\u02BC]",iP,pnt,mOt=3,S5={},hnt={"/":"\u2044\u2215",0:"\u07C0",a:"\u2C65\u0250\u0251",aa:"\uA733",ae:"\xE6\u01FD\u01E3",ao:"\uA735",au:"\uA737",av:"\uA739\uA73B",ay:"\uA73D",b:"\u0180\u0253\u0183",c:"\uA73F\u0188\u023C\u2184",d:"\u0111\u0257\u0256\u1D05\u018C\uABB7\u0501\u0266",e:"\u025B\u01DD\u1D07\u0247",f:"\uA77C\u0192",g:"\u01E5\u0260\uA7A1\u1D79\uA77F\u0262",h:"\u0127\u2C68\u2C76\u0265",i:"\u0268\u0131",j:"\u0249\u0237",k:"\u0199\u2C6A\uA741\uA743\uA745\uA7A3",l:"\u0142\u019A\u026B\u2C61\uA749\uA747\uA781\u026D",m:"\u0271\u026F\u03FB",n:"\uA7A5\u019E\u0272\uA791\u1D0E\u043B\u0509",o:"\xF8\u01FF\u0254\u0275\uA74B\uA74D\u1D11",oe:"\u0153",oi:"\u01A3",oo:"\uA74F",ou:"\u0223",p:"\u01A5\u1D7D\uA751\uA753\uA755\u03C1",q:"\uA757\uA759\u024B",r:"\u024D\u027D\uA75B\uA7A7\uA783",s:"\xDF\u023F\uA7A9\uA785\u0282",t:"\u0167\u01AD\u0288\u2C66\uA787",th:"\xFE",tz:"\uA729",u:"\u0289",v:"\u028B\uA75F\u028C",vy:"\uA761",w:"\u2C73",y:"\u01B4\u024F\u1EFF",z:"\u01B6\u0225\u0240\u2C6C\uA763",hv:"\u0195"};for(let i in hnt){let t=hnt[i]||"";for(let e=0;e<t.length;e++){let n=t.substring(e,e+1);S5[n]=i}}var bOt=new RegExp(Object.keys(S5).join("|")+"|"+gOt,"gu"),vOt=i=>{iP===void 0&&(iP=_Ot(i||pOt))},dnt=(i,t="NFKD")=>i.normalize(t),rS=i=>Array.from(i).reduce((t,e)=>t+yOt(e),""),yOt=i=>(i=dnt(i).toLowerCase().replace(bOt,t=>S5[t]||""),dnt(i,"NFC"));function*xOt(i){for(let[t,e]of i)for(let n=t;n<=e;n++){let s=String.fromCharCode(n),r=rS(s);r!=s.toLowerCase()&&(r.length>mOt||r.length!=0&&(yield{folded:r,composed:s,code_point:n}))}}var wOt=i=>{let t={},e=(n,s)=>{let r=t[n]||new Set,o=new RegExp("^"+w5(r)+"$","iu");s.match(o)||(r.add(hf(s)),t[n]=r)};for(let n of xOt(i))e(n.folded,n.folded),e(n.folded,n.composed);return t},_Ot=i=>{let t=wOt(i),e={},n=[];for(let r in t){let o=t[r];o&&(e[r]=w5(o)),r.length>1&&n.push(hf(r))}n.sort((r,o)=>o.length-r.length);let s=sS(n);return pnt=new RegExp("^"+s,"u"),e},SOt=(i,t=1)=>{let e=0;return i=i.map(n=>(iP[n]&&(e+=n.length),iP[n]||n)),e>=t?x5(i):""},COt=(i,t=1)=>(t=Math.max(t,i.length-1),sS(_5(i).map(e=>SOt(e,t)))),fnt=(i,t=!0)=>{let e=i.length>1?1:0;return sS(i.map(n=>{let s=[],r=t?n.length():n.length()-1;for(let o=0;o<r;o++)s.push(COt(n.substrs[o]||"",e));return x5(s)}))},MOt=(i,t)=>{for(let e of t){if(e.start!=i.start||e.end!=i.end||e.substrs.join("")!==i.substrs.join(""))continue;let n=i.parts,s=o=>{for(let a of n){if(a.start===o.start&&a.substr===o.substr)return!1;if(!(o.length==1||a.length==1)&&(o.start<a.start&&o.end>a.start||a.start<o.start&&a.end>o.start))return!0}return!1};if(!(e.parts.filter(s).length>0))return!0}return!1},sP=class i{parts;substrs;start;end;constructor(){this.parts=[],this.substrs=[],this.start=0,this.end=0}add(t){t&&(this.parts.push(t),this.substrs.push(t.substr),this.start=Math.min(t.start,this.start),this.end=Math.max(t.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(t,e){let n=new i,s=JSON.parse(JSON.stringify(this.parts)),r=s.pop();for(let l of s)n.add(l);let o=e.substr.substring(0,t-r.start),a=o.length;return n.add({start:r.start,end:r.start+a,length:a,substr:o}),n}},gnt=i=>{vOt(),i=rS(i);let t="",e=[new sP];for(let n=0;n<i.length;n++){let r=i.substring(n).match(pnt),o=i.substring(n,n+1),a=r?r[0]:null,l=[],c=new Set;for(let u of e){let h=u.last();if(!h||h.length==1||h.end<=n)if(a){let d=a.length;u.add({start:n,end:n+d,length:d,substr:a}),c.add("1")}else u.add({start:n,end:n+1,length:1,substr:o}),c.add("2");else if(a){let d=u.clone(n,h),p=a.length;d.add({start:n,end:n+p,length:p,substr:a}),l.push(d)}else c.add("3")}if(l.length>0){l=l.sort((u,h)=>u.length()-h.length());for(let u of l)MOt(u,e)||e.push(u);continue}if(n>0&&c.size==1&&!c.has("3")){t+=fnt(e,!1);let u=new sP,h=e[0];h&&u.add(h.last()),e=[u]}}return t+=fnt(e,!0),t};var mnt=(i,t)=>{if(i)return i[t]},bnt=(i,t)=>{if(i){for(var e,n=t.split(".");(e=n.shift())&&(i=i[e]););return i}},rP=(i,t,e)=>{var n,s;return!i||(i=i+"",t.regex==null)||(s=i.search(t.regex),s===-1)?0:(n=t.string.length/i.length,s===0&&(n+=.5),n*e)},oP=(i,t)=>{var e=i[t];if(typeof e=="function")return e;e&&!Array.isArray(e)&&(i[t]=[e])},oS=(i,t)=>{if(Array.isArray(i))i.forEach(t);else for(var e in i)i.hasOwnProperty(e)&&t(i[e],e)},vnt=(i,t)=>typeof i=="number"&&typeof t=="number"?i>t?1:i<t?-1:0:(i=rS(i+"").toLowerCase(),t=rS(t+"").toLowerCase(),i>t?1:t>i?-1:0);var aP=class{items;settings;constructor(t,e){this.items=t,this.settings=e||{diacritics:!0}}tokenize(t,e,n){if(!t||!t.length)return[];let s=[],r=t.split(/\s+/);var o;return n&&(o=new RegExp("^("+Object.keys(n).map(hf).join("|")+"):(.*)$")),r.forEach(a=>{let l,c=null,u=null;o&&(l=a.match(o))&&(c=l[1],a=l[2]),a.length>0&&(this.settings.diacritics?u=gnt(a)||null:u=hf(a),u&&e&&(u="\\b"+u)),s.push({string:a,regex:u?new RegExp(u,"iu"):null,field:c})}),s}getScoreFunction(t,e){var n=this.prepareSearch(t,e);return this._getScoreFunction(n)}_getScoreFunction(t){let e=t.tokens,n=e.length;if(!n)return function(){return 0};let s=t.options.fields,r=t.weights,o=s.length,a=t.getAttrFn;if(!o)return function(){return 1};let l=(function(){return o===1?function(c,u){let h=s[0].field;return rP(a(u,h),c,r[h]||1)}:function(c,u){var h=0;if(c.field){let d=a(u,c.field);!c.regex&&d?h+=1/o:h+=rP(d,c,1)}else oS(r,(d,p)=>{h+=rP(a(u,p),c,d)});return h/o}})();return n===1?function(c){return l(e[0],c)}:t.options.conjunction==="and"?function(c){var u,h=0;for(let d of e){if(u=l(d,c),u<=0)return 0;h+=u}return h/n}:function(c){var u=0;return oS(e,h=>{u+=l(h,c)}),u/n}}getSortFunction(t,e){var n=this.prepareSearch(t,e);return this._getSortFunction(n)}_getSortFunction(t){var e,n=[];let s=this,r=t.options,o=!t.query&&r.sort_empty?r.sort_empty:r.sort;if(typeof o=="function")return o.bind(this);let a=function(c,u){return c==="$score"?u.score:t.getAttrFn(s.items[u.id],c)};if(o)for(let c of o)(t.query||c.field!=="$score")&&n.push(c);if(t.query){e=!0;for(let c of n)if(c.field==="$score"){e=!1;break}e&&n.unshift({field:"$score",direction:"desc"})}else n=n.filter(c=>c.field!=="$score");return n.length?function(c,u){var h,d;for(let p of n)if(d=p.field,h=(p.direction==="desc"?-1:1)*vnt(a(d,c),a(d,u)),h)return h;return 0}:null}prepareSearch(t,e){let n={};var s=Object.assign({},e);if(oP(s,"sort"),oP(s,"sort_empty"),s.fields){oP(s,"fields");let r=[];s.fields.forEach(o=>{typeof o=="string"&&(o={field:o,weight:1}),r.push(o),n[o.field]="weight"in o?o.weight:1}),s.fields=r}return{options:s,query:t.toLowerCase().trim(),tokens:this.tokenize(t,s.respect_word_boundaries,n),total:0,items:[],weights:n,getAttrFn:s.nesting?bnt:mnt}}search(t,e){var n=this,s,r;r=this.prepareSearch(t,e),e=r.options,t=r.query;let o=e.score||n._getScoreFunction(r);t.length?oS(n.items,(l,c)=>{s=o(l),(e.filter===!1||s>0)&&r.items.push({score:s,id:c})}):oS(n.items,(l,c)=>{r.items.push({score:1,id:c})});let a=n._getSortFunction(r);return a&&r.items.sort(a),r.total=r.items.length,typeof e.limit=="number"&&(r.items=r.items.slice(0,e.limit)),r}};var Ca=i=>typeof i>"u"||i===null?null:aS(i),aS=i=>typeof i=="boolean"?i?"1":"0":i+"",lP=i=>(i+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),ynt=(i,t)=>t>0?window.setTimeout(i,t):(i.call(null),null),xnt=(i,t)=>{var e;return function(n,s){var r=this;e&&(r.loading=Math.max(r.loading-1,0),clearTimeout(e)),e=setTimeout(function(){e=null,r.loadedSearches[n]=!0,i.call(r,n,s)},t)}},C5=(i,t,e)=>{var n,s=i.trigger,r={};i.trigger=function(){var o=arguments[0];if(t.indexOf(o)!==-1)r[o]=arguments;else return s.apply(i,arguments)},e.apply(i,[]),i.trigger=s;for(n of t)n in r&&s.apply(i,r[n])},wnt=i=>({start:i.selectionStart||0,length:(i.selectionEnd||0)-(i.selectionStart||0)}),Fs=(i,t=!1)=>{i&&(i.preventDefault(),t&&i.stopPropagation())},Ao=(i,t,e,n)=>{i.addEventListener(t,e,n)},df=(i,t)=>{if(!t||!t[i])return!1;var e=(t.altKey?1:0)+(t.ctrlKey?1:0)+(t.shiftKey?1:0)+(t.metaKey?1:0);return e===1},cP=(i,t)=>{let e=i.getAttribute("id");return e||(i.setAttribute("id",t),t)},M5=i=>i.replace(/[\\"']/g,"\\$&"),ff=(i,t)=>{t&&i.append(t)},br=(i,t)=>{if(Array.isArray(i))i.forEach(t);else for(var e in i)i.hasOwnProperty(e)&&t(i[e],e)};var Cc=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(T5(i)){var t=document.createElement("template");return t.innerHTML=i.trim(),t.content.firstChild}return document.querySelector(i)},T5=i=>typeof i=="string"&&i.indexOf("<")>-1,_nt=i=>i.replace(/['"\\]/g,"\\$&"),uP=(i,t)=>{var e=document.createEvent("HTMLEvents");e.initEvent(t,!0,!1),i.dispatchEvent(e)},lS=(i,t)=>{Object.assign(i.style,t)},Ma=(i,...t)=>{var e=Snt(t);i=Cnt(i),i.map(n=>{e.map(s=>{n.classList.add(s)})})},Sh=(i,...t)=>{var e=Snt(t);i=Cnt(i),i.map(n=>{e.map(s=>{n.classList.remove(s)})})},Snt=i=>{var t=[];return br(i,e=>{typeof e=="string"&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},Cnt=i=>(Array.isArray(i)||(i=[i]),i),hP=(i,t,e)=>{if(!(e&&!e.contains(i)))for(;i&&i.matches;){if(i.matches(t))return i;i=i.parentNode}},A5=(i,t=0)=>t>0?i[i.length-1]:i[0],Mnt=i=>Object.keys(i).length===0,E5=(i,t)=>{if(!i)return-1;t=t||i.nodeName;for(var e=0;i=i.previousElementSibling;)i.matches(t)&&e++;return e},ws=(i,t)=>{br(t,(e,n)=>{e==null?i.removeAttribute(n):i.setAttribute(n,""+e)})},cS=(i,t)=>{i.parentNode&&i.parentNode.replaceChild(t,i)};var Tnt=(i,t)=>{if(t===null)return;if(typeof t=="string"){if(!t.length)return;t=new RegExp(t,"i")}let e=r=>{var o=r.data.match(t);if(o&&r.data.length>0){var a=document.createElement("span");a.className="highlight";var l=r.splitText(o.index);l.splitText(o[0].length);var c=l.cloneNode(!0);return a.appendChild(c),cS(l,a),1}return 0},n=r=>{r.nodeType===1&&r.childNodes&&!/(script|style)/i.test(r.tagName)&&(r.className!=="highlight"||r.tagName!=="SPAN")&&Array.from(r.childNodes).forEach(o=>{s(o)})},s=r=>r.nodeType===3?e(r):(n(r),0);s(i)},Ant=i=>{var t=i.querySelectorAll("span.highlight");Array.prototype.forEach.call(t,function(e){var n=e.parentNode;n.replaceChild(e.firstChild,e),n.normalize()})};var TOt=typeof navigator>"u"?!1:/Mac/.test(navigator.userAgent),uS=TOt?"metaKey":"ctrlKey";var k5={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,clearAfterSelect:!1,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,refreshThrottle:300,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'<input type="text" autocomplete="off" size="1" />',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(i){return i.length>0},render:{}};function dP(i,t){var e=Object.assign({},k5,t),n=e.dataAttr,s=e.labelField,r=e.valueField,o=e.disabledField,a=e.optgroupField,l=e.optgroupLabelField,c=e.optgroupValueField,u=i.tagName.toLowerCase(),h=i.getAttribute("placeholder")||i.getAttribute("data-placeholder");if(!h&&!e.allowEmptyOption){let y=i.querySelector('option[value=""]');y&&(h=y.textContent)}var d={placeholder:h,options:[],optgroups:[],items:[],maxItems:null},p=()=>{var y,x=d.options,w={},M=1;let A=0;var C=O=>{var I=Object.assign({},O.dataset),U=n&&I[n];return typeof U=="string"&&U.length&&(I=Object.assign(I,JSON.parse(U))),I},R=(O,I)=>{var U=Ca(O.value);if(U!=null&&!(!U&&!e.allowEmptyOption)){if(w.hasOwnProperty(U)){if(I){var V=w[U][a];V?Array.isArray(V)?V.push(I):w[U][a]=[V,I]:w[U][a]=I}}else{var q=C(O);q[s]=q[s]||O.textContent,q[r]=q[r]||U,q[o]=q[o]||O.disabled,q[a]=q[a]||I,q.$option=O,q.$order=q.$order||++A,w[U]=q,x.push(q)}O.selected&&d.items.push(U)}},k=O=>{var I,U;U=C(O),U[l]=U[l]||O.getAttribute("label")||"",U[c]=U[c]||M++,U[o]=U[o]||O.disabled,U.$order=U.$order||++A,d.optgroups.push(U),I=U[c],br(O.children,V=>{R(V,I)})};d.maxItems=i.hasAttribute("multiple")?null:1,br(i.children,O=>{y=O.tagName.toLowerCase(),y==="optgroup"?k(O):y==="option"&&R(O)})},g=()=>{var y,x;let w=i.getAttribute(n);if(w)d.options=JSON.parse(w),br(d.options,A=>{d.items.push(A[r])});else{var M=(x=(y=i?.value)===null||y===void 0?void 0:y.trim())!==null&&x!==void 0?x:"";if(!e.allowEmptyOption&&!M.length)return;let A=M.split(e.delimiter);br(A,C=>{let R={};R[s]=C,R[r]=C,d.options.push(R)}),d.items=A}};return u==="select"?p():g(),Object.assign({},k5,d,t)}var Pnt=0,Pr=class extends y5(iS){constructor(t,e){super(),this.order=0,this.isOpen=!1,this.isDisabled=!1,this.isReadOnly=!1,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.isDropdownContentStale=!0,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.refreshTimeout=null,Pnt++;var n,s=Cc(t);if(s.tomselect)throw new Error("Tom Select already initialized on this element");s.tomselect=this;var r=window.getComputedStyle&&window.getComputedStyle(s,null);n=r.getPropertyValue("direction");let o=dP(s,e);this.settings=o,this.input=s,this.tabIndex=s.tabIndex||0,this.is_select_tag=s.tagName.toLowerCase()==="select",this.rtl=/rtl/i.test(n),this.inputId=cP(s,"tomselect-"+Pnt),this.isRequired=s.required,this.sifter=new aP(this.options,{diacritics:o.diacritics}),o.mode=o.mode||(o.maxItems===1?"single":"multi"),typeof o.hideSelected!="boolean"&&(o.hideSelected=o.mode==="multi"),typeof o.hidePlaceholder!="boolean"&&(o.hidePlaceholder=o.mode!=="multi");var a=o.createFilter;typeof a!="function"&&(typeof a=="string"&&(a=new RegExp(a)),a instanceof RegExp?o.createFilter=x=>a.test(x):o.createFilter=x=>this.settings.duplicates||!this.options[x]),this.initializePlugins(o.plugins),this.setupCallbacks(),this.setupTemplates();let l=Cc("<div>"),c=Cc("<div>"),u=this._render("dropdown"),h=Cc('<div role="listbox" tabindex="-1">'),d=this.input.getAttribute("class")||"",p=o.mode;var g;if(Ma(l,o.wrapperClass,d,p),Ma(c,o.controlClass),ff(l,c),Ma(u,o.dropdownClass,p),o.copyClassesToDropdown&&Ma(u,d),Ma(h,o.dropdownContentClass),ff(u,h),Cc(o.dropdownParent||l).appendChild(u),T5(o.controlInput)){g=Cc(o.controlInput);var y=["autocorrect","autocapitalize","autocomplete","spellcheck","aria-label"];br(y,x=>{s.getAttribute(x)&&ws(g,{[x]:s.getAttribute(x)})}),g.tabIndex=-1,c.appendChild(g),this.focus_node=g}else o.controlInput?(g=Cc(o.controlInput),this.focus_node=g):(g=Cc("<input/>"),this.focus_node=c);this.wrapper=l,this.dropdown=u,this.dropdown_content=h,this.control=c,this.control_input=g,this.setup()}setup(){let t=this,e=t.settings,n=t.control_input,s=t.dropdown,r=t.dropdown_content,o=t.wrapper,a=t.control,l=t.input,c=t.focus_node,u={passive:!0},h=t.inputId+"-ts-dropdown";ws(r,{id:h}),ws(c,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":h});let d=cP(c,t.inputId+"-ts-control"),p="label[for='"+_nt(t.inputId)+"']",g=document.querySelector(p),y=t.focus.bind(t);if(g){Ao(g,"click",y),ws(g,{for:d});let A=cP(g,t.inputId+"-ts-label");ws(c,{"aria-labelledby":A}),ws(r,{"aria-labelledby":A})}if(o.style.width=l.style.width,o.style.minWidth=l.style.minWidth,o.style.maxWidth=l.style.maxWidth,t.plugins.names.length){let A="plugin-"+t.plugins.names.join(" plugin-");Ma([o,s],A)}(e.maxItems===null||e.maxItems>1)&&t.is_select_tag&&ws(l,{multiple:"multiple"}),e.placeholder&&ws(n,{placeholder:e.placeholder}),!e.splitOn&&e.delimiter&&(e.splitOn=new RegExp("\\s*"+hf(e.delimiter)+"+\\s*")),e.load&&e.loadThrottle&&(e.load=xnt(e.load,e.loadThrottle)),Ao(s,"mousemove",()=>{t.ignoreHover=!1}),Ao(s,"mouseenter",A=>{var C=hP(A.target,"[data-selectable]",s);C&&t.onOptionHover(A,C)},{capture:!0}),Ao(s,"click",A=>{let C=hP(A.target,"[data-selectable]");C&&(t.onOptionSelect(A,C),Fs(A,!0))}),Ao(a,"click",A=>{var C=hP(A.target,"[data-ts-item]",a);if(C&&t.onItemSelect(A,C)){Fs(A,!0);return}n.value==""&&(t.onClick(),Fs(A,!0))}),Ao(c,"keydown",A=>t.onKeyDown(A)),Ao(n,"keypress",A=>t.onKeyPress(A)),Ao(n,"input",A=>t.onInput(A)),Ao(c,"blur",A=>t.onBlur(A)),Ao(c,"focus",A=>t.onFocus(A)),Ao(n,"paste",A=>t.onPaste(A));let x=A=>{let C=A.composedPath()[0];if(!o.contains(C)&&!s.contains(C)){t.isFocused&&t.blur(),t.inputState();return}C==n&&t.isOpen?A.stopPropagation():Fs(A,!0)},w=()=>{t.isOpen&&t.positionDropdown()},M=()=>{t.isValid&&(t.isValid=!1,t.isInvalid=!0,t.refreshState())};Ao(l,"invalid",M),Ao(document,"mousedown",x),Ao(window,"scroll",w,u),Ao(window,"resize",w,u),this._destroy=()=>{l.removeEventListener("invalid",M),document.removeEventListener("mousedown",x),window.removeEventListener("scroll",w),window.removeEventListener("resize",w),g&&g.removeEventListener("click",y)},this.revertSettings={innerHTML:l.innerHTML,tabIndex:l.tabIndex},l.tabIndex=-1,l.insertAdjacentElement("afterend",t.wrapper),t.sync(!1),e.items=[],delete e.optgroups,delete e.options,t.refreshItems(),t.close(!1),t.inputState(),t.isSetup=!0,t.on("change",this.onChange),Ma(l,"tomselected","ts-hidden-accessible"),t.trigger("initialize"),e.preload===!0&&t.preload()}setupOptions(t=[],e=[]){this.addOptions(t),br(e,n=>{this.registerOptionGroup(n)})}setupTemplates(){var t=this,e=t.settings.labelField,n=t.settings.optgroupLabelField,s={optgroup:r=>{let o=document.createElement("div");return o.className="optgroup",o.appendChild(r.options),o},optgroup_header:(r,o)=>'<div class="optgroup-header">'+o(r[n])+"</div>",option:(r,o)=>"<div>"+o(r[e])+"</div>",item:(r,o)=>"<div>
8223"+o(r[e])+"</div>",option_create:(r,o)=>'<div class="create">Add <strong>'+o(r.input)+"</strong>&hellip;</div>",no_results:()=>'<div class="no-results">No results found</div>',loading:()=>'<div class="spinner"></div>',not_loading:()=>{},dropdown:()=>"<div></div>"};t.settings.render=Object.assign({},s,t.settings.render)}setupCallbacks(){var t,e,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(t in n)e=this.settings[n[t]],e&&this.on(t,e)}sync(t=!0){let e=this,n=t?dP(e.input,{delimiter:e.settings.delimiter,allowEmptyOption:e.settings.allowEmptyOption}):e.settings;e.setupOptions(n.options,n.optgroups),e.setValue(n.items||[],!0),e.input.disabled?e.disable():e.input.readOnly?e.setReadOnly(!0):e.enable(),e.lastQuery=null}onClick(){var t=this;if(t.activeItems.length>0){t.clearActiveItems(),t.focus();return}t.isFocused&&t.isOpen?t.blur():t.focus()}onMouseDown(){}onChange(){uP(this.input,"input"),uP(this.input,"change")}onPaste(t){var e=this;if(e.isInputHidden||e.isLocked){Fs(t);return}e.settings.splitOn&&setTimeout(()=>{var n=e.inputValue();if(n.match(e.settings.splitOn)){var s=n.trim().split(e.settings.splitOn);br(s,r=>{Ca(r)&&(this.options[r]?e.addItem(r):e.createItem(r))})}},0)}onKeyPress(t){var e=this;if(e.isLocked){Fs(t);return}var n=String.fromCharCode(t.keyCode||t.which);if(e.settings.create&&e.settings.mode==="multi"&&n===e.settings.delimiter){e.createItem(),Fs(t);return}}onKeyDown(t){var e=this;if(e.ignoreHover=!0,e.isLocked){t.keyCode!==9&&Fs(t);return}switch(t.keyCode){case 65:if(df(uS,t)&&e.control_input.value==""){Fs(t),e.selectAll();return}break;case 27:e.isOpen&&(Fs(t,!0),e.close()),e.clearActiveItems();return;case 40:if(!e.isOpen&&e.hasOptions)e.open();else if(e.activeOption){let n=e.getAdjacent(e.activeOption,1);n&&e.setActiveOption(n)}Fs(t);return;case 38:if(e.activeOption){let n=e.getAdjacent(e.activeOption,-1);n&&e.setActiveOption(n)}Fs(t);return;case 13:e.canSelect(e.activeOption)?(e.onOptionSelect(t,e.activeOption),Fs(t)):e.settings.create&&e.createItem()?Fs(t):document.activeElement==e.control_input&&e.isOpen&&Fs(t);return;case 37:e.advanceSelection(-1,t);return;case 39:e.advanceSelection(1,t);return;case 9:e.settings.selectOnTab&&(e.canSelect(e.activeOption)?(e.onOptionSelect(t,e.activeOption),Fs(t)):e.settings.create&&e.createItem()&&Fs(t));return;case 8:case 46:e.deleteSelection(t);return}e.isInputHidden&&!df(uS,t)&&Fs(t)}onInput(t){if(this.isLocked)return;let e=this.inputValue();if(this.lastValue!==e){if(this.lastValue=e,e==""){this._onInput();return}this.refreshTimeout&&window.clearTimeout(this.refreshTimeout),this.refreshTimeout=ynt(()=>{this.refreshTimeout=null,this._onInput()},this.settings.refreshThrottle)}}_onInput(){let t=this.lastValue;this.settings.shouldLoad.call(this,t)&&this.load(t),this.refreshOptions(),this.trigger("type",t)}onOptionHover(t,e){this.ignoreHover||this.setActiveOption(e,!1)}onFocus(t){var e=this,n=e.isFocused;if(e.isDisabled||e.isReadOnly){e.blur(),Fs(t);return}e.ignoreFocus||(e.isFocused=!0,e.settings.preload==="focus"&&e.preload(),n||e.trigger("focus"),e.activeItems.length||(e.inputState(),e.refreshOptions(!!e.settings.openOnFocus)),e.refreshState())}onBlur(t){if(document.hasFocus()!==!1){var e=this;if(e.isFocused){e.isFocused=!1,e.ignoreFocus=!1;var n=()=>{e.close(),e.setActiveItem(),e.setCaret(e.items.length),e.trigger("blur")};e.settings.create&&e.settings.createOnBlur?e.createItem(null,n):n()}}}onOptionSelect(t,e){var n,s=this;e.parentElement&&e.parentElement.matches("[data-disabled]")||(e.classList.contains("create")?s.createItem(null,()=>{s.settings.closeAfterSelect?s.close():s.settings.clearAfterSelect&&s.setTextboxValue()}):(n=e.dataset.value,typeof n<"u"&&(s.isDropdownContentStale=s.settings.hideSelected,s.addItem(n),s.settings.closeAfterSelect?s.close():s.settings.clearAfterSelect&&s.setTextboxValue(),!s.settings.hideSelected&&t.type&&/click/.test(t.type)&&s.setActiveOption(e))))}canSelect(t){return!!(this.isOpen&&t&&this.dropdown_content.contains(t))}onItemSelect(t,e){var n=this;return!n.isLocked&&n.settings.mode==="multi"?(Fs(t),n.setActiveItem(e,t),!0):!1}canLoad(t){return!(!this.settings.load||this.loadedSearches.hasOwnProperty(t))}load(t){let e=this;if(!e.canLoad(t))return;Ma(e.wrapper,e.settings.loadingClass),e.loading++;let n=e.loadCallback.bind(e);e.settings.load.call(e,t,n)}loadCallback(t,e){let n=this;n.loading=Math.max(n.loading-1,0),n.isDropdownContentStale=!0,n.clearActiveOption(),n.setupOptions(t,e),n.refreshOptions(n.isFocused&&!n.isInputHidden),n.loading||Sh(n.wrapper,n.settings.loadingClass),n.trigger("load",t,e)}preload(){var t=this.wrapper.classList;t.contains("preloaded")||(t.add("preloaded"),this.load(""))}setTextboxValue(t=""){var e=this.control_input,n=e.value!==t;n&&(e.value=t,uP(e,"update"),this.lastValue=t)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(t,e){var n=e?[]:["change"];C5(this,n,()=>{this.clear(e),this.addItems(t,e)})}setMaxItems(t){t===0&&(t=null),this.settings.maxItems=t,this.refreshState()}setActiveItem(t,e){var n=this,s,r,o,a,l,c;if(n.settings.mode!=="single"){if(!t){n.clearActiveItems(),n.isFocused&&n.inputState();return}if(s=e&&e.type.toLowerCase(),s==="click"&&df("shiftKey",e)&&n.activeItems.length){for(c=n.getLastActive(),o=Array.prototype.indexOf.call(n.control.children,c),a=Array.prototype.indexOf.call(n.control.children,t),o>a&&(l=o,o=a,a=l),r=o;r<=a;r++)t=n.control.children[r],n.activeItems.indexOf(t)===-1&&n.setActiveItem
vendor: 5,354 bytes, line 8223
8223Class(t);Fs(e)}else s==="click"&&df(uS,e)||s==="keydown"&&df("shiftKey",e)?t.classList.contains("active")?n.removeActiveItem(t):n.setActiveItemClass(t):(n.clearActiveItems(),n.setActiveItemClass(t));n.inputState(),n.isFocused||n.focus()}}setActiveItemClass(t){let e=this,n=e.control.querySelector(".last-active");n&&Sh(n,"last-active"),Ma(t,"active last-active"),e.trigger("item_select",t),e.activeItems.indexOf(t)==-1&&e.activeItems.push(t)}removeActiveItem(t){var e=this.activeItems.indexOf(t);this.activeItems.splice(e,1),Sh(t,"active")}clearActiveItems(){Sh(this.activeItems,"active"),this.activeItems=[]}setActiveOption(t,e=!0){t!==this.activeOption&&(this.clearActiveOption(),t&&(this.activeOption=t,ws(this.focus_node,{"aria-activedescendant":t.getAttribute("id")}),ws(t,{"aria-selected":"true"}),Ma(t,"active"),e&&this.scrollToOption(t)))}scrollToOption(t,e){if(!t)return;let n=this.dropdown_content,s=n.clientHeight,r=n.scrollTop||0,o=t.offsetHeight,a=t.getBoundingClientRect().top-n.getBoundingClientRect().top+r;a+o>s+r?this.scroll(a-s+o,e):a<r&&this.scroll(a,e)}scroll(t,e){let n=this.dropdown_content;e&&(n.style.scrollBehavior=e),n.scrollTop=t,n.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(Sh(this.activeOption,"active"),ws(this.activeOption,{"aria-selected":null})),this.activeOption=null,ws(this.focus_node,{"aria-activedescendant":null})}selectAll(){let t=this;if(t.settings.mode==="single")return;let e=t.controlChildren();e.length&&(t.inputState(),t.close(),t.activeItems=e,br(e,n=>{t.setActiveItemClass(n)}))}inputState(){var t=this;t.control.contains(t.control_input)&&(ws(t.control_input,{placeholder:t.settings.placeholder}),t.activeItems.length>0||!t.isFocused&&t.settings.hidePlaceholder&&t.items.length>0?(t.setTextboxValue(),t.isInputHidden=!0):(t.settings.hidePlaceholder&&t.items.length>0&&ws(t.control_input,{placeholder:""}),t.isInputHidden=!1),t.wrapper.classList.toggle("input-hidden",t.isInputHidden))}inputValue(){return this.control_input.value.trim()}focus(){var t=this;if(t.isDisabled||t.isReadOnly)return;t.ignoreFocus=!0;let e=this.control_input.offsetWidth?this.control_input:this.focus_node;e.focus(),setTimeout(()=>{t.ignoreFocus=!1,e.getRootNode().activeElement===e&&this.onFocus()},0)}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(t){return this.sifter.getScoreFunction(t,this.getSearchOptions())}getSearchOptions(){var t=this.settings,e=t.sortField;return typeof t.sortField=="string"&&(e=[{field:t.sortField}]),{fields:t.searchField,conjunction:t.searchConjunction,sort:e,nesting:t.nesting}}search(t){var e,n,s=this,r=this.getSearchOptions();if(s.settings.score&&(n=s.settings.score.call(s,t),typeof n!="function"))throw new Error('Tom Select "score" setting must be a function that returns a function');return s.isDropdownContentStale||t!==s.lastQuery?(s.lastQuery=t,/(.)\1{15,}/.test(t)&&(t=""),e=s.sifter.search(t,Object.assign(r,{score:n})),s.currentResults=e):e=Object.assign({},s.currentResults),s.settings.hideSelected&&(e.items=e.items.filter(o=>{let a=Ca(o.id);return!(a!==null&&s.items.indexOf(a)!==-1)})),e}refreshOptions(t=!0){var e,n,s,r,o,a,l,c,u,h;let d={},p=[];var g=this,y=g.inputValue();let x=y===g.lastQuery||y==""&&g.lastQuery==null;var w=g.search(y),M=null,A=g.settings.shouldOpen||!1,C=g.dropdown_content;x&&(M=g.activeOption,M&&(u=M.closest("[data-group]"))),r=w.items.length,typeof g.settings.maxOptions=="number"&&(r=Math.min(r,g.settings.maxOptions)),r>0&&(A=!0);let R=(I,U)=>{let V=d[I];if(V!==void 0){let X=p[V];if(X!==void 0)return[V,X.fragment]}let q=document.createDocumentFragment();return V=p.length,p.push({fragment:q,order:U,optgroup:I}),[V,q]};for(e=0;e<r;e++){let I=w.items[e];if(!I)continue;let U=I.id,V=g.options[U];if(V===void 0)continue;let q=aS(U),X=g.getOption(q,!0);for(g.settings.hideSelected||X.classList.toggle("selected",g.items.includes(q)),o=V[g.settings.optgroupField]||"",a=Array.isArray(o)?o:[o],n=0,s=a&&a.length;n<s;n++){o=a[n];let j=V.$order,W=g.optgroups[o];if(W===void 0&&typeof g.settings.optionGroupRegister=="function"){var k;(k=g.settings.optionGroupRegister.apply(g,[o]))&&g.registerOptionGroup(k)}W=g.optgroups[o],W===void 0?o="":j=W.$order;let[_,at]=R(o,j);n>0&&(X=X.cloneNode(!0),ws(X,{id:V.$id+"-clone-"+n,"aria-selected":null}),X.classList.add("ts-cloned"),Sh(X,"active"),g.activeOption&&g.activeOption.dataset.value==U&&u&&u.dataset.group===o.toString()&&(M=X)),at.appendChild(X),o!=""&&(d[o]=_)}}g.settings.lockOptgroupOrder&&p.sort((I,U)=>I.order-U.order),l=document.createDocumentFragment(),br(p,I=>{let U=I.fragment,V=I.optgroup;if(!U||!U.children.length)return;let q=g.optgroups[V];if(q!==void 0){let X=document.createDocumentFragment(),j=g.render("optgroup_header",q);ff(X,j),ff(X,U);let W=g.render("optgroup",{group:q,options:X});ff(l,W)}else ff(l,U)}),C.innerHTML="",ff(C,l),g.isDropdownContentStale=!1,g.settings.highlight&&(Ant(C),w.query.length&&w.tokens.length&&br(w.tokens,I=>{Tnt(C,I.regex)}));var O=I=>{let U=g.render(I,{input:y});return U&&(A=!0,C.insertBefore(U,C.firstChild)),U};if(g.loading?O("loading"):g.settings.shouldLoad.call(g,y)?w.items.length===0&&O("no_results"):O("not_loading"),c=g.canCreate(y),c&&(h=O("option_create")),g.hasOptions=w.items.length>0||c,A){if(w.items.length>0){if(!M&&g.settings.mode==="single"&&g.items[0]!=null&&(M=g.getOption(g.items[0])),!C.contains(M)
vendor: 20,178 bytes, line 8223
8223){let I=0;h&&!g.settings.addPrecedence&&(I=1),M=g.selectable()[I]}}else h&&(M=h);t&&!g.isOpen&&(g.open(),g.scrollToOption(M,"auto")),g.setActiveOption(M)}else g.clearActiveOption(),t&&g.isOpen&&g.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(t,e=!1){let n=this;if(Array.isArray(t))return n.addOptions(t,e),!1;let s=Ca(t[n.settings.valueField]);return s===null||n.options.hasOwnProperty(s)?(n.updateOption(t[n.settings.valueField],t),!1):(t.$order=t.$order||++n.order,t.$id=n.inputId+"-opt-"+t.$order,n.options[s]=t,n.isDropdownContentStale=!0,e&&(n.userOptions[s]=e,n.trigger("option_add",s,t)),s)}addOptions(t,e=!1){br(t,n=>{this.addOption(n,e)})}registerOption(t){return this.addOption(t)}registerOptionGroup(t){var e=Ca(t[this.settings.optgroupValueField]);return e===null?!1:(t.$order=t.$order||++this.order,this.optgroups[e]=t,e)}addOptionGroup(t,e){var n;e[this.settings.optgroupValueField]=t,(n=this.registerOptionGroup(e))&&this.trigger("optgroup_add",n,e)}removeOptionGroup(t){this.optgroups.hasOwnProperty(t)&&(delete this.optgroups[t],this.clearCache(),this.trigger("optgroup_remove",t))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(t,e){let n=this;var s,r;let o=Ca(t),a=Ca(e[n.settings.valueField]);if(o===null)return;let l=n.options[o];if(l==null)return;if(typeof a!="string")throw new Error("Value must be set in option data");let c=n.getOption(o),u=n.getItem(o);if(e.$order=e.$order||l.$order,delete n.options[o],n.uncacheValue(a),n.options[a]=e,c){if(n.dropdown_content.contains(c)){let h=n._render("option",e);cS(c,h),n.activeOption===c&&n.setActiveOption(h)}c.remove()}u&&(r=n.items.indexOf(o),r!==-1&&n.items.splice(r,1,a),s=n._render("item",e),u.classList.contains("active")&&Ma(s,"active"),cS(u,s)),n.isDropdownContentStale=!0}removeOption(t,e){let n=this;t=aS(t),n.uncacheValue(t),delete n.userOptions[t],delete n.options[t],n.isDropdownContentStale=!0,n.trigger("option_remove",t),n.removeItem(t,e)}clearOptions(t){let e=(t||this.clearFilter).bind(this);this.loadedSearches={},this.userOptions={},this.clearCache();let n={};br(this.options,(s,r)=>{e(s,r)&&(n[r]=s)}),this.options=this.sifter.items=n,this.isDropdownContentStale=!0,this.trigger("option_clear")}clearFilter(t,e){return this.items.indexOf(e)>=0}getOption(t,e=!1){let n=Ca(t);if(n===null)return null;let s=this.options[n];if(s!=null){if(s.$div)return s.$div;if(e)return this._render("option",s)}return null}getAdjacent(t,e,n="option"){var s=this,r;if(!t)return null;n=="item"?r=s.controlChildren():r=s.dropdown_content.querySelectorAll("[data-selectable]");for(let o=0;o<r.length;o++)if(r[o]==t)return e>0?r[o+1]:r[o-1];return null}getItem(t){if(typeof t=="object")return t;var e=Ca(t);return e!==null?this.control.querySelector(`[data-value="${M5(e)}"]`):null}addItems(t,e){var n=this,s=Array.isArray(t)?t:[t];s=s.filter(o=>n.items.indexOf(o)===-1);let r=s[s.length-1];s.forEach(o=>{n.isPending=o!==r,n.addItem(o,e)})}addItem(t,e){var n=e?[]:["change","dropdown_close"];C5(this,n,()=>{var s,r;let o=this,a=o.settings.mode,l=Ca(t);if(!(l&&o.items.indexOf(l)!==-1&&(a==="single"&&o.close(),a==="single"||!o.settings.duplicates))&&!(l===null||!o.options.hasOwnProperty(l))&&(a==="single"&&o.clear(e),!(a==="multi"&&o.isFull()))){if(s=o._render("item",o.options[l]),o.control.contains(s)&&(s=s.cloneNode(!0)),r=o.isFull(),o.items.splice(o.caretPos,0,l),o.insertAtCaret(s),o.isSetup){if(!o.isPending&&o.settings.hideSelected){let c=o.getOption(l),u=o.getAdjacent(c,1);u&&o.setActiveOption(u)}o.settings.clearAfterSelect&&o.setTextboxValue(),!o.isPending&&!o.settings.closeAfterSelect&&o.refreshOptions(o.isFocused&&a!=="single"),o.settings.closeAfterSelect!=!1&&o.isFull()?o.close():o.isPending||o.positionDropdown(),o.trigger("item_add",l,s),o.isPending||o.updateOriginalInput({silent:e})}(!o.isPending||!r&&o.isFull())&&(o.inputState(),o.refreshState())}})}removeItem(t=null,e){let n=this;if(t=n.getItem(t),!t)return;var s,r;let o=t.dataset.value;s=E5(t),t.remove(),t.classList.contains("active")&&(r=n.activeItems.indexOf(t),n.activeItems.splice(r,1),Sh(t,"active")),n.items.splice(s,1),n.isDropdownContentStale=!0,!n.settings.persist&&n.userOptions.hasOwnProperty(o)&&n.removeOption(o,e),s<n.caretPos&&n.setCaret(n.caretPos-1),n.updateOriginalInput({silent:e}),n.refreshState(),n.positionDropdown(),n.trigger("item_remove",o,t)}createItem(t=null,e=()=>{}){arguments.length===3&&(e=arguments[2]),typeof e!="function"&&(e=()=>{});var n=this,s=n.caretPos,r;if(t=t||n.inputValue(),!n.canCreate(t))return Ca(t)&&this.options[t]&&n.addItem(t),e(),!1;n.lock();var o=!1,a=l=>{if(n.unlock(),!l||typeof l!="object")return e();var c=Ca(l[n.settings.valueField]);if(typeof c!="string")return e();n.setTextboxValue(),n.addOption(l,!0),n.setCaret(s),n.addItem(c),e(l),o=!0};return typeof n.settings.create=="function"?r=n.settings.create.call(this,t,a):r={[n.settings.labelField]:t,[n.settings.valueField]:t},o||a(r),!0}refreshItems(){var t=this;t.isDropdownContentStale=!0,t.isSetup&&t.addItems(t.items),t.updateOriginalInput(),t.refreshState()}refreshState(){let t=this;t.refreshValidityState();let e=t.isFull(),n=t.isLocked;t.wrapper.classList.toggle("rtl",t.rtl);let s=t.wrapper.classList;s.toggle("focus",t.isFocused),s.toggle("disabled",t.isDisabled),s.toggle("readonly",t.isReadOnly),s.toggle("required",t.isRequired),s.toggle("invalid",!t.isValid),s.toggle("locked",n),s.toggle("full",e),s.toggle("input-active",t.isFocused&&!t.isInputHidden),s.toggle("dropdown-active",t.isOpen),s.toggle("has-options",Mnt(t.options)),s.toggle("has-items",t.items.length>0)}refreshValidityState(){var t=this;t.input.validity&&(t.isValid=t.input.validity.valid,t.isInvalid=!t.isValid)}isFull(){return this.settings.maxItems!==null&&this.items.length>=this.settings.maxItems}updateOriginalInput(t={}){let e=this;var n,s;let r=e.input.querySelector('option[value=""]');if(e.is_select_tag){let l=function(c,u,h){return c||(c=Cc('<option value="'+lP(u)+'">'+lP(h)+"</option>")),c!=r&&e.input.append(c),o.push(c),(c!=r||a>0||e.settings.mode=="multi")&&(c.selected=!0),c},o=[],a=e.input.querySelectorAll("option:checked").length;e.input.querySelectorAll("option:checked").forEach(c=>{c.selected=!1}),e.items.length==0&&e.settings.mode=="single"?l(r,"",""):e.items.forEach(c=>{if(n=e.options[c],s=n[e.settings.labelField]||"",o.includes(n.$option)){let u=e.input.querySelector(`option[value="${M5(c)}"]:not(:checked)`);l(u,c,s)}else n.$option=l(n.$option,c,s)})}else e.input.value=e.getValue();e.isSetup&&(t.silent||e.trigger("change",e.getValue()))}open(){var t=this;t.isLocked||t.isOpen||t.settings.mode==="multi"&&t.isFull()||(t.isOpen=!0,ws(t.focus_node,{"aria-expanded":"true"}),t.refreshState(),lS(t.dropdown,{visibility:"hidden",display:"block"}),t.positionDropdown(),lS(t.dropdown,{visibility:"visible",display:"block"}),t.focus(),t.trigger("dropdown_open",t.dropdown))}close(t=!0){var e=this,n=e.isOpen;t&&(e.setTextboxValue(),e.settings.mode==="single"&&e.items.length&&e.inputState()),e.isOpen=!1,ws(e.focus_node,{"aria-expanded":"false"}),lS(e.dropdown,{display:"none"}),e.settings.hideSelected&&e.clearActiveOption(),e.refreshState(),n&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if(this.settings.dropdownParent==="body"){var t=this.control,e=t.getBoundingClientRect(),n=t.offsetHeight+e.top+window.scrollY,s=e.left+window.scrollX;lS(this.dropdown,{width:e.width+"px",top:n+"px",left:s+"px"})}}clear(t){var e=this;if(e.items.length){var n=e.controlChildren();br(n,s=>{e.removeItem(s,!0)}),e.inputState(),t||e.updateOriginalInput(),e.trigger("clear")}}insertAtCaret(t){let e=this,n=e.caretPos,s=e.control;s.insertBefore(t,s.children[n]||null),e.setCaret(n+1)}deleteSelection(t){var e,n,s,r,o=this;e=t&&t.keyCode===8?-1:1,n=wnt(o.control_input);let a=[];if(o.activeItems.length)r=A5(o.activeItems,e),s=E5(r),e>0&&s++,br(o.activeItems,l=>a.push(l));else if((o.isFocused||o.settings.mode==="single")&&o.items.length){let l=o.controlChildren(),c;e<0&&n.start===0&&n.length===0?c=l[o.caretPos-1]:e>0&&n.start===o.inputValue().length&&(c=l[o.caretPos]),c!==void 0&&a.push(c)}if(!o.shouldDelete(a,t))return!1;for(Fs(t,!0),typeof s<"u"&&o.setCaret(s);a.length;)o.removeItem(a.pop());return o.inputState(),o.positionDropdown(),o.refreshOptions(!1),!0}shouldDelete(t,e){let n=t.map(s=>s.dataset.value);return!(!n.length||typeof this.settings.onDelete=="function"&&this.settings.onDelete.call(this,n,e)===!1)}advanceSelection(t,e){var n,s,r=this;r.rtl&&(t*=-1),!r.inputValue().length&&(df(uS,e)||df("shiftKey",e)?(n=r.getLastActive(t),n?n.classList.contains("active")?s=r.getAdjacent(n,t,"item"):s=n:t>0?s=r.control_input.nextElementSibling:s=r.control_input.previousElementSibling,s&&(s.classList.contains("active")&&r.removeActiveItem(n),r.setActiveItemClass(s))):r.moveCaret(t))}moveCaret(t){}getLastActive(t){let e=this.control.querySelector(".last-active");if(e)return e;var n=this.control.querySelectorAll(".active");if(n)return A5(n,t)}setCaret(t){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.setLocked(!0)}unlock(){this.setLocked(!1)}setLocked(t=this.isReadOnly||this.isDisabled){this.isLocked=t,this.refreshState()}disable(){this.setDisabled(!0),this.close()}enable(){this.setDisabled(!1)}setDisabled(t){this.focus_node.tabIndex=t?-1:this.tabIndex,this.isDisabled=t,this.input.disabled=t,this.control_input.disabled=t,this.setLocked()}setReadOnly(t){this.isReadOnly=t,this.input.readOnly=t,this.control_input.readOnly=t,this.setLocked()}destroy(){var t=this,e=t.revertSettings;t.trigger("destroy"),t.off(),t.wrapper.remove(),t.dropdown.remove(),t.input.innerHTML=e.innerHTML,t.input.tabIndex=e.tabIndex,Sh(t.input,"tomselected","ts-hidden-accessible"),t._destroy(),delete t.input.tomselect}render(t,e){var n,s;let r=this;if(typeof this.settings.render[t]!="function"||(s=r.settings.render[t].call(this,e,lP),!s))return null;if(s=Cc(s),t==="option"||t==="option_create"?e[r.settings.disabledField]?ws(s,{"aria-disabled":"true"}):ws(s,{"data-selectable":""}):t==="optgroup"&&(n=e.group[r.settings.optgroupValueField],ws(s,{"data-group":n}),e.group[r.settings.disabledField]&&ws(s,{"data-disabled":""})),t==="option"||t==="item"){let o=aS(e[r.settings.valueField]);ws(s,{"data-value":o}),t==="item"?(Ma(s,r.settings.itemClass),ws(s,{"data-ts-item":""})):(Ma(s,r.settings.optionClass),ws(s,{role:"option",id:e.$id}),e.$div=s,r.options[o]=e)}return s}_render(t,e){let n=this.render(t,e);if(n==null)throw"HTMLElement expected";return n}clearCache(){br(this.options,t=>{t.$div&&(t.$div.remove(),delete t.$div)})}uncacheValue(t){let e=this.getOption(t);e&&e.remove()}canCreate(t){return this.settings.create&&t.length>0&&this.settings.createFilter.call(this,t)}hook(t,e,n){var s=this,r=s[e];s[e]=function(){var o,a;return t==="after"&&(o=r.apply(s,arguments)),a=n.apply(s,arguments),t==="instead"?a:(t==="before"&&(o=r.apply(s,arguments)),o)}}};var NOt=(i,t,e,n)=>{i.addEventListener(t,e,n)};function Rnt(){NOt(this.input,"change",()=>{this.sync()})}var BOt=i=>typeof i>"u"||i===null?null:FOt(i),FOt=i=>typeof i=="boolean"?i?"1":"0":i+"",Dnt=(i,t=!1)=>{i&&(i.preventDefault(),t&&i.stopPropagation())},UOt=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(zOt(i)){var t=document.createElement("template");return t.innerHTML=i.trim(),t.content.firstChild}return document.querySelector(i)},zOt=i=>typeof i=="string"&&i.indexOf("<")>-1;function Lnt(i){var t=this,e=t.onOptionSelect;t.settings.hideSelected=!1;let n=Object.assign({className:"tomselect-checkbox",checkedClassNames:void 0,uncheckedClassNames:void 0},i);var s=function(a,l){l?(a.checked=!0,n.uncheckedClassNames&&a.classList.remove(...n.uncheckedClassNames),n.checkedClassNames&&a.classList.add(...n.checkedClassNames)):(a.checked=!1,n.checkedClassNames&&a.classList.remove(...n.checkedClassNames),n.uncheckedClassNames&&a.classList.add(...n.uncheckedClassNames))},r=function(a){setTimeout(()=>{var l=a.querySelector("input."+n.className);l instanceof HTMLInputElement&&s(l,a.classList.contains("selected"))},1)};t.hook("after","setupTemplates",()=>{var o=t.settings.render.option;t.settings.render.option=(a,l)=>{var c=UOt(o.call(t,a,l)),u=document.createElement("input");n.className&&u.classList.add(n.className),u.addEventListener("click",function(d){Dnt(d)}),u.type="checkbox";let h=BOt(a[t.settings.valueField]);return s(u,!!(h&&t.items.indexOf(h)>-1)),c.prepend(u),c}}),t.on("item_remove",o=>{var a=t.getOption(o);a&&(a.classList.remove("selected"),r(a))}),t.on("item_add",o=>{var a=t.getOption(o);a&&r(a)}),t.hook("instead","onOptionSelect",(o,a)=>{if(a.classList.contains("selected")){a.classList.remove("selected"),t.removeItem(a.dataset.value),t.refreshOptions(),Dnt(o,!0);return}e.call(t,o,a),r(a)})}var VOt=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(HOt(i)){var t=document.createElement("template");return t.innerHTML=i.trim(),t.content.firstChild}return document.querySelector(i)},HOt=i=>typeof i=="string"&&i.indexOf("<")>-1;function Int(i){let t=this,e=Object.assign({className:"clear-button",title:"Clear All",role:"button",tabindex:0,html:n=>`<div class="${n.className}" title="${n.title}" role="${n.role}" tabindex="${n.tabindex}">&times;</div>`},i);t.on("initialize",()=>{var n=VOt(e.html(e));n.addEventListener("click",s=>{t.isLocked||(t.clear(),t.settings.mode==="single"&&t.settings.allowEmptyOption&&t.addItem(""),t.refreshOptions(!1),s.preventDefault(),s.stopPropagation())}),t.control.appendChild(n)})}var jOt=(i,t=!1)=>{i&&(i.preventDefault(),t&&i.stopPropagation())},Tv=(i,t,e,n)=>{i.addEventListener(t,e,n)},WOt=(i,t)=>{if(Array.isArray(i))i.forEach(t);else for(var e in i)i.hasOwnProperty(e)&&t(i[e],e)},$Ot=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(GOt(i)){var t=document.createElement("template");return t.innerHTML=i.trim(),t.content.firstChild}return document.querySelector(i)},GOt=i=>typeof i=="string"&&i.indexOf("<")>-1,qOt=(i,t)=>{WOt(t,(e,n)=>{e==null?i.removeAttribute(n):i.setAttribute(n,""+e)})},YOt=(i,t)=>{var e;(e=i.parentNode)==null||e.insertBefore(t,i.nextSibling)},XOt=(i,t)=>{var e;(e=i.parentNode)==null||e.insertBefore(t,i)},KOt=(i,t)=>{do{var e;if(t=(e=t)==null?void 0:e.previousElementSibling,i==t)return!0}while(t&&t.previousElementSibling);return!1};function Ont(){var i=this;if(i.settings.mode!=="multi")return;var t=i.lock,e=i.unlock;let n=!0,s;i.hook("after","setupTemplates",()=>{var r=i.settings.render.item;i.settings.render.item=(o,a)=>{let l=$Ot(r.call(i,o,a));qOt(l,{draggable:"true"});let c=y=>{n||jOt(y),y.stopPropagation()},u=y=>{s=l,setTimeout(()=>{l.classList.add("ts-dragging")},0)},h=y=>{y.preventDefault(),l.classList.add("ts-drag-over"),p(l,s)},d=()=>{l.classList.remove("ts-drag-over")},p=(y,x)=>{x!==void 0&&(KOt(x,l)?YOt(y,x):XOt(y,x))},g=()=>{var y;document.querySelectorAll(".ts-drag-over").forEach(w=>w.classList.remove("ts-drag-over")),(y=s)==null||y.classList.remove("ts-dragging"),s=void 0;var x=[];i.control.querySelectorAll("[data-value]").forEach(w=>{if(w.dataset.value){let M=w.dataset.value;M&&x.push(M)}}),i.setValue(x)};return Tv(l,"mousedown",c),Tv(l,"dragstart",u),Tv(l,"dragenter",h),Tv(l,"dragover",h),Tv(l,"dragleave",d),Tv(l,"dragend",g),l}}),i.hook("instead","lock",()=>(n=!1,t.call(i))),i.hook("instead","unlock",()=>(n=!0,e.call(i)))}var JOt=(i,t=!1)=>{i&&(i.preventDefault(),t&&i.stopPropagation())},ZOt=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(QOt(i)){var t=document.createElement("template");return t.innerHTML=i.trim(),t.content.firstChild}return document.querySelector(i)},QOt=i=>typeof i=="string"&&i.indexOf("<")>-1;function Nnt(i){let t=this,e=Object.assign({title:"Untitled",headerClass:"dropdown-header",titleRowClass:"dropdown-header-title",labelClass:"dropdown-header-label",closeClass:"dropdown-header-close",html:n=>'<div class="'+n.headerClass+'"><div class="'+n.titleRowClass+'"><span class="'+n.labelClass+'">'+n.title+'</span><a class="'+n.closeClass+'">&times;</a></div></div>'},i);t.on("initialize",()=>{var n=ZOt(e.html(e)),s=n.querySelector("."+e.closeClass);s&&s.addEventListener("click",r=>{JOt(r,!0),t.close()}),t.dropdown.insertBefore(n,t.dropdown.firstChild)})}var tNt=(i,t)=>{if(Array.isArray(i))i.forEach(t);else for(var e in i)i.hasOwnProperty(e)&&t(i[e],e)},eNt=(i,...t)=>{var e=nNt(t);i=iNt(i),i.map(n=>{e.map(s=>{n.classList.remove(s)})})},nNt=i=>{var t=[];return tNt(i,e=>{typeof e=="string"&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},iNt=i=>(Array.isArray(i)||(i=[i]),i),sNt=(i,t)=>{if(!i)return-1;t=t||i.nodeName;for(var e=0;i=i.previousElementSibling;)i.matches(t)&&e++;return e};function Bnt(){var i=this;i.hook("instead","setCaret",t=>{i.settings.mode==="single"||!i.control.contains(i.control_input)?t=i.items.length:(t=Math.max(0,Math.min(i.items.length,t)),t!=i.caretPos&&!i.isPending&&i.controlChildren().forEach((e,n)=>{n<t?i.control_input.insertAdjacentElement("beforebegin",e):i.control.appendChild(e)})),i.caretPos=t}),i.hook("instead","moveCaret",t=>{if(!i.isFocused)return;let e=i.getLastActive(t);if(e){let n=sNt(e);i.setCaret(t>0?n+1:n),i.setActiveItem(),eNt(e,"last-active")}else i.setCaret(i.caretPos+t)})}var rNt=(i,t=!1)=>{i&&(i.preventDefault(),t&&i.stopPropagation())},oNt=(i,t,e,n)=>{i.addEventListener(t,e,n)},aNt=(i,t)=>{if(Array.isArray(i))i.forEach(t);else for(var e in i)i.hasOwnProperty(e)&&t(i[e],e)},Fnt=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(lNt(i)){var t=document.createElement("template");return t.innerHTML=i.trim(),t.content.firstChild}return document.querySelector(i)},lNt=i=>typeof i=="string"&&i.indexOf("<")>-1,cNt=(i,...t)=>{var e=uNt(t);i=hNt(i),i.map(n=>{e.map(s=>{n.classList.add(s)})})},uNt=i=>{var t=[];return aNt(i,e=>{typeof e=="string"&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},hNt=i=>(Array.isArray(i)||(i=[i]),i);function Unt(){let i=this;i.settings.shouldOpen=!0,i.hook("before","setup",()=>{var t;i.focus_node=i.control,cNt(i.control_input,"dropdown-input");let e=Fnt('<div class="dropdown-input-wrap">');e.append(i.control_input),i.dropdown.insertBefore(e,i.dropdown.firstChild);let n=Fnt('<input class="items-placeholder" tabindex="-1" />');n.placeholder=i.settings.placeholder||"",i.control.append(n);let s=(t=i.input)==null?void 0:t.getAttribute("aria-label");s&&n.setAttribute("aria-label",s)}),i.on("initialize",()=>{i.control_input.addEventListener("keydown",e=>{switch(e.keyCode){case 27:i.isOpen&&(rNt(e,!0),i.close()),i.clearActiveItems();return;case 9:i.focus_node.tabIndex=-1;break}return i.onKeyDown.call(i,e)}),i.on("blur",()=>{i.focus_node.tabIndex=i.isDisabled?-1:i.tabIndex}),i.on("dropdown_open",()=>{i.control_input.focus()});let t=i.onBlur;i.hook("instead","onBlur",e=>{if(!(e&&e.relatedTarget==i.control_input))return t.call(i)}),oNt(i.control_input,"blur",()=>i.onBlur()),i.hook("before","close",()=>{i.isOpen&&i.focus_node.focus({preventScroll:!0})})})}var fP=(i,t,e,n)=>{i.addEventListener(t,e,n)};function znt(){var i=this;i.on("initialize",()=>{var t=document.createElement("span"),e=i.control_input;t.style.cssText="position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; ",i.wrapper.appendChild(t);var n=["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"];for(let r of n)t.style[r]=e.style[r];var s=()=>{t.textContent=e.value,e.style.width=t.clientWidth+"px"};s(),i.on("update item_add item_remove",s),fP(e,"input",s),fP(e,"keyup",s),fP(e,"blur",s),fP(e,"update",s)})}function Vnt(){var i=this,t=i.deleteSelection;this.hook("instead","deleteSelection",e=>i.activeItems.length?t.call(i,e):!1)}function Hnt(){this.hook("instead","setActiveItem",()=>{}),this.hook("instead","selectAll",()=>{})}var dNt=(i,t,e)=>{for(;i&&i.matches;){if(i.matches(t))return i;i=i.parentNode}},fNt=(i,t)=>{if(!i)return-1;t=t||i.nodeName;for(var e=0;i=i.previousElementSibling;)i.matches(t)&&e++;return e};function jnt(){var i=this,t=i.onKeyDown;i.hook("instead","onKeyDown",e=>{var n,s,r,o;
8223if(!i.isOpen||!(e.keyCode===37||e.keyCode===39))return t.call(i,e);i.ignoreHover=!0,o=dNt(i.activeOption,"[data-group]"),n=fNt(i.activeOption,"[data-selectable]"),o&&(e.keyCode===37?o=o.previousSibling:o=o.nextSibling,o&&(r=o.querySelectorAll("[data-selectable]"),s=r[Math.min(r.length-1,n)],s&&i.setActiveOption(s)))})}var Wnt=(i,t=!1)=>{i&&(i.preventDefault(),t&&i.stopPropagation())},$nt=(i,t,e,n)=>{i.addEventListener(t,e,n)},Gnt=i=>{if(i.jquery)return i[0];if(i instanceof HTMLElement)return i;if(pNt(i)){var t=document.createElement("template");return t.innerHTML=i.trim(),t.content.firstChild}return document.querySelector(i)},pNt=i=>typeof i=="string"&&i.indexOf("<")>-1;function qnt(i){let t=this,e=Object.assign({label:"\xD7",title:"Remove",className:"remove",tabindex:-1,role:"button",html:n=>{var s;let r=document.createElement("div");return r.className=n.className||"",r.title=n.title||"",r.setAttribute("role",n.role||"button"),r.tabIndex=(s=n.tabindex)!=null?s:-1,r.textContent=n.label||"",r}},i);t.hook("after","setupTemplates",()=>{var n=t.settings.render.item;t.settings.render.item=(s,r)=>{var o=Gnt(n.call(t,s,r)),a=Gnt(e.html(e));return o.appendChild(a),$nt(a,"mousedown",l=>{Wnt(l,!0)}),$nt(a,"click",l=>{t.isLocked||(Wnt(l,!0),!t.isLocked&&t.shouldDelete([o],l)&&(t.removeItem(o),t.refreshOptions(!1),t.inputState()))}),o}})}function Ynt(i){let t=this,e=Object.assign({text:n=>n[t.settings.labelField]},i);t.on("item_remove",function(n){if(t.isFocused&&t.control_input.value.trim()===""){var s=t.options[n];s&&t.setTextboxValue(e.text.call(t,s))}})}var gNt=(i,t)=>{if(Array.isArray(i))i.forEach(t);else for(var e in i)i.hasOwnProperty(e)&&t(i[e],e)},mNt=(i,...t)=>{var e=bNt(t);i=vNt(i),i.map(n=>{e.map(s=>{n.classList.add(s)})})},bNt=i=>{var t=[];return gNt(i,e=>{typeof e=="string"&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},vNt=i=>(Array.isArray(i)||(i=[i]),i);function Xnt(){let i=this,t=i.canLoad,e=i.clearActiveOption,n=i.loadCallback;var s={},r,o=!1,a,l=[],c=!1,u,h=[],d=[];if(i.settings.shouldLoadMore||(i.settings.shouldLoadMore=()=>{if(r.clientHeight/(r.scrollHeight-r.scrollTop)>.9)return!0;if(i.activeOption){var w=i.selectable(),M=Array.from(w).indexOf(i.activeOption);if(M>=w.length-2)return!0}return!1}),!i.settings.firstUrl)throw"virtual_scroll plugin requires a firstUrl() method";i.settings.sortField=[{field:"$order"},{field:"$score"}];let p=x=>i.settings.maxOptions!==null&&typeof i.settings.maxOptions=="number"&&r.children.length>=i.settings.maxOptions?!1:!!(x in s&&s[x]),g=(x,w)=>i.items.indexOf(w)>=0||l.indexOf(w)>=0;i.setNextUrl=(x,w)=>{s[x]=w},i.getUrl=x=>{if(x in s){let w=s[x];return s[x]=!1,w}return i.clearPagination(),i.settings.firstUrl.call(i,x)},i.clearPagination=()=>{s={}},i.hook("instead","clearActiveOption",()=>{if(!o)return e.call(i)}),i.hook("instead","canLoad",x=>x in s?p(x):t.call(i,x)),i.hook("instead","loadCallback",(x,w)=>{if(o){if(a){let M=x[0];M!==void 0&&(a.dataset.value=M[i.settings.valueField])}}else{let M=i.lastValue!==""?(A,C)=>i.items.indexOf(C)>=0||d.indexOf(C)>=0:g;i.clearOptions(M)}n.call(i,x,w),!o&&!c&&(c=!0,i.lastValue===""&&(l=Object.keys(i.options),u=s[""],h=Object.values(i.options))),o=!1}),i.hook("before","refreshOptions",()=>{i.activeOption&&i.activeOption.getAttribute("role")!=="option"&&i.setActiveOption(i.activeOption.previousElementSibling)}),i.hook("after","refreshOptions",()=>{let x=i.lastValue;var w;p(x)?(w=i.render("loading_more",{query:x}),w&&(w.setAttribute("data-selectable",""),a=w)):x in s&&!r.querySelector(".no-results")&&(w=i.render("no_more_results",{query:x})),w&&(mNt(w,i.settings.optionClass),r.append(w))});let y=()=>{c&&(i.addOptions(h),i.clearOptions(g),u&&(s[""]=u))};i.on("type",x=>{x===""&&(y(),i.refreshOptions(!1))}),i.on("dropdown_close",y),i.on("initialize",()=>{d=Object.keys(i.options),l=Object.keys(i.options),r=i.dropdown_content,i.settings.render=Object.assign({},{loading_more:()=>'<div class="loading-more-results">Loading more results ... </div>',no_more_results:()=>'<div class="no-more-results">No more results</div>'},i.settings.render),r.addEventListener("scroll",()=>{i.settings.shouldLoadMore.call(i)&&p(i.lastValue)&&(o||(o=!0,i.load.call(i,i.lastValue)))})})}Pr.define("change_listener",Rnt);Pr.define("checkbox_options",Lnt);Pr.define("clear_button",Int);Pr.define("drag_drop",Ont);Pr.define("dropdown_header",Nnt);Pr.define("caret_position",Bnt);Pr.define("dropdown_input",Unt);Pr.define("input_autogrow",znt);Pr.define("no_backspace_delete",Vnt);Pr.define("no_active_items",Hnt);Pr.define("optgroup_columns",jnt);Pr.define("remove_button",qnt);Pr.define("restore_on_backspace",Ynt);Pr.define("virtual_scroll",Xnt);var Knt=Pr;var P5=class extends le{static values={url:String,valueField:{type:String,default:"value"},labelField:{type:String,default:"label"},submitOnChange:!1};connect(){let i={};this.hasUrlValue&&(i.valueField=this.valueFieldValue,i.labelField=this.labelFieldValue,i.searchField=this.labelFieldValue,i.load=this.load.bind(this)),this.submitOnChangeValue&&(i.onChange=this.submitOnChange.bind(this)),this.select=new Knt(this.element,i)}disconnect(){this.select.destroy()}async load(i,t){let e=await nS(`${this.urlValue}?query=${i}`);if(e.ok){let n=await e.json;t(n)}else t()}submitOnChange(i){i&&(this.element.form.requestSubmit(),this.select.clear(!0))}};var L5={};Le(L5,{default:()=>D5});var D5=class extends le{static targets=["instructions","progressBar","progressText","testButton","testButtonText","testSpinner","testResult","testResultContent","steps","tokenInput","jenkinsTokenInput","repoUrlInput","unrealTemplate","unityTemplate","templateList","deployButtonText","deploySpinner","deployResults","testJobName"];static values={platform:String};connect(){this.completedSteps=new Set}completeStep(i){let t=parseInt(i.currentTarget.dataset.step);this.completedSteps.add(t);let e=this.element.querySelector(`[data-step="${t}"]`);e.classList.add("completed"),e.classList.remove("opacity-50");let n=this.element.querySelector(`[data-step="${t+1}"]`);n&&(n.classList.remove("opacity-50"),n.querySelector("button[data-action*='completeStep']")?.removeAttribute("disabled")),this.updateProgress(),this.completedSteps.size===this.getTotalSteps()&&(this.testButtonTarget.removeAttribute("disabled"),this.testButtonTextTarget.textContent="Test Connection")}updateProgress(){let i=this.getTotalSteps(),t=this.completedSteps.size,e=Math.round(t/i*100);this.progressBarTarget.style.width=`${e}%`,this.progressTextTarget.textContent=`${e}%`}getTotalSteps(){return this.element.querySelectorAll(".setup-step").length}async copyToClipboard(i){let t=i.currentTarget.dataset.content;try{await navigator.clipboard.writeText(t);let e=i.currentTarget.innerHTML;i.currentTarget.innerHTML=`
8224        <svg class="w-5 h-5" style="color: var(--bs-ok);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8225          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
8226        </svg>
8227      `,setTimeout(()=>{i.currentTarget.innerHTML=e},2e3)}catch(e){console.error("Failed to copy:",e)}}validateToken(i){let t=i.target.value;if(this.platformValue==="github"?t.startsWith("ghp_"):t.length>10){i.target.style.borderColor="",i.target.style.borderColor="var(--bs-ok)";let n=this.element.querySelector("[data-step='3'] button[data-action*='completeStep']");n&&n.removeAttribute("disabled")}else i.target.style.borderColor="",i.target.style.borderColor="var(--bs-err)"}updateTemplateSelection(){let i=this.hasUnrealTemplateTarget&&this.unrealTemplateTarget.checked,t=this.hasUnityTemplateTarget&&this.unityTemplateTarget.checked;if(i||t){this.element.querySelector("[data-step='3'] button[data-action*='completeStep']")?.removeAttribute("disabled");let e=[];i&&e.push("\u2713 Unreal Engine 5 Build Pipeline"),t&&e.push("\u2713 Unity Build Pipeline"),this.templateListTarget.innerHTML=e.map(n=>`<div class="text-sm" style="color: var(--bs-fg-soft);">${n}</div>`).join(""),this.deployButtonTextTarget.textContent=`Deploy ${e.length} Pipeline${e.length>
82271?"s":""}`,this.element.querySelector("[data-action*='deployJenkinsTemplates']")?.removeAttribute("disabled")}else this.deployButtonTextTarget.textContent="Select templates above to continue",this.element.querySelector("[data-action*='deployJenkinsTemplates']")?.setAttribute("disabled","disabled")}async testConnection(){this.testButtonTarget.setAttribute("disabled","disabled"),this.testButtonTextTarget.classList.add("hidden"),this.testSpinnerTarget.classList.remove("hidden"),this.testResultTarget.classList.add("hidden");try{let i=this.element.dataset.projectId||window.location.pathname.match(/projects\/(\d+)/)?.[1],t=this.element.dataset.integrationId,e=`/projects/${i}/integrations/${t}/setup_helper_test`,n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content,Accept:"application/json"},body:JSON.stringify({token:this.hasTokenInputTarget?this.tokenInputTarget.value:this.hasJenkinsTokenInputTarget?this.jenkinsTokenInputTarget.value:null,repository_url:this.hasRepoUrlInputTarget?this.repoUrlInputTarget.value:null})}),s=await n.text();console.log("Setup test raw response:",s),console.log("Setup test response status:",n.status);let r;try{r=JSON.parse(s)}catch(o){console.error("Setup test JSON parse error:",o),console.error("Setup test response text:",s),this.showTestError("Server returned non-JSON response. Check console for details.");return}if(this.testResultTarget.classList.remove("hidden"),r.success){this.testResultContentTarget.className="p-4 rounded-lg",this.testResultContentTarget.style.cssText="background: var(--bs-ok-soft); border: 1px solid var(--bs-ok-soft);";let o="";if(r.triggers)if(r.triggers.found)o=`
8228              <div class="mt-3 p-3 rounded" style="background: var(--bs-info-soft); border: 1px solid var(--bs-info-soft);">
8229                <div class="flex items-center mb-2">
8230                  <svg class="w-4 h-4 mr-2" style="color: var(--bs-info);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8231                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
8232                  </svg>
8233                  <span class="text-sm font-medium" style="color: var(--bs-info);">Jenkins Triggers Found (${r.triggers.count})</span>
8234                </div>
8235                <div class="text-xs font-mono whitespace-pre-wrap" style="color: var(--bs-fg-soft);">${r.triggers.details}</div>
8236              </div>
8237            `;else{let c=r.triggers.error?` (${r.triggers.error})`:"",u=r.triggers.total_triggers>0?` (${r.triggers.total_triggers} total triggers found)`:"";o=`
8238              <div class="mt-3 p-3 bg-warn-soft dark:bg-warn/20 border border-warn-soft dark:border-warn rounded">
8239                <div class="flex items-center">
8240                  <svg class="w-4 h-4 text-warn dark:text-warn mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8241                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"/>
8242                  </svg>
8243                  <span class="text-sm text-warn dark:text-warn-soft">No Jenkins triggers found${c}${u}</span>
8244                </div>
8245              </div>
8246            `}let a="";if(r.jenkins_setup){let c=r.jenkins_setup,u=c.jenkins_integration_exists?"\u2705":"\u274C",h=c.trigger_configured?"\u2705":"\u26A0\uFE0F",d=`
8247            <div class="mt-3 p-4 rounded-lg" style="background: var(--bs-bg-panel-2); border: 1px solid var(--bs-line);">
8248              <h4 class="text-sm font-semibold mb-3" style="color: var(--bs-fg);">Jenkins Build Triggers</h4>
8249              
8250              <div class="space-y-2 text-sm">
8251                <div class="flex items-center">
8252                  <span class="mr-2">${u}</span>
8253                  <span class="" style="color: var(--bs-fg-soft);">
8254                    Jenkins Integration: ${c.jenkins_integration_exists?"Connected":"Not Found"}
8255                  </span>
8256                </div>
8257                
8258                <div class="flex items-center">
8259                  <span class="mr-2">${h}</span>
8260                  <span class="" style="color: var(--bs-fg-soft);">
8261                    Build Trigger: ${c.trigger_configured?"Configured":"Not Configured"}
8262                  </span>
8263                </div>
8264              </div>
8265          `;c.jenkins_integration_exists?c.trigger_configured?d+=`
8266              <div class="mt-3 p-3 rounded" style="background: var(--bs-ok-soft); border: 1px solid var(--bs-ok-soft);">
8267                <div class="flex items-center">
8268                  <svg class="w-4 h-4 mr-2" style="color: var(--bs-ok);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8269                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
8270                  </svg>
8271                  <span class="text-sm" style="color: var(--bs-ok);">Jenkins triggers are properly configured!</span>
8272                </div>
8273                ${c.existing_trigger?`
8274                  <div class="mt-2 text-xs font-mono" style="color: var(--bs-fg-soft);">
8275                    ${c.existing_trigger.name}: ${c.existing_trigger.command}
8276                  </div>
8277                `:""}
8278              </div>
8279            `:d+=`
8280              <div class="mt-3">
8281                <h5 class="text-sm font-medium mb-2" style="color: var(--bs-fg);">Setup Instructions:</h5>
8282                
8283                <div class="space-y-3">
8284                  <div>
8285                    <label class="block text-xs font-medium mb-1" style="color: var(--bs-fg-soft);">Step 1: Edit Perforce Triggers</label>
8286                    <div class="flex items-center space-x-2">
8287                      <code class="flex-1 px-2 py-1 rounded text-xs font-mono" style="background: var(--bs-bg-panel-2); color: var(--bs-fg);">p4 triggers</code>
8288                    </div>
8289                  </div>
8290                  
8291                  <div>
8292                    <label class="block text-xs font-medium mb-1" style="color: var(--bs-fg-soft);">Step 2: Add This Line to the Triggers Section</label>
8293                    <div class="flex items-center space-x-2">
8294                      <code class="flex-1 px-2 py-1 rounded text-xs font-mono text-wrap break-all" style="background: var(--bs-bg-panel-2); color: var(--bs-fg);">${c.trigger_command}</code>
8295                      <button class="px-2 py-1 bs-btn bs-btn-primary copy-trigger-cmd"
8296                              data-command="${c.trigger_command}">
8297                        Copy
8298                      </button>
8299                    </div>
8300                  </div>
8301                  
8302                  <div>
8303                    <label class="block text-xs font-medium mb-1" style="color: var(--bs-fg-soft);">Step 3: Save and Verify</label>
8304                    <div class="flex items-center space-x-2">
8305                      <code class="flex-1 px-2 py-1 rounded text-xs font-mono" style="background: var(--bs-bg-panel-2); color: var(--bs-fg);">p4 triggers -o</code>
8306                    </div>
8307                    <p class="text-xs mt-1" style="color: var(--bs-fg-mute);">Look for: ${c.recommended_setup.trigger_name} trigger in the output</p>
8308                  </div>
8309                </div>
8310              </div>
8311            `:d+=`
8312              <div class="mt-3 p-3 bg-warn-soft dark:bg-warn/20 border border-warn-soft dark:border-warn rounded">
8313                <div class="flex items-center">
8314                  <svg class="w-4 h-4 text-warn dark:text-warn mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8315                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"/>
8316                  </svg>
8317                  <span class="text-sm text-warn dark:text-warn-soft">Set up Jenkins integration first to enable build triggers</span>
8318                </div>
8319              </div>
8320            `,d+="</div>",a=d}this.testResultContentTarget.innerHTML=`
8321          <div class="flex items-start space-x-3">
8322            <svg class="w-5 h-5 mt-0.5" style="color: var(--bs-ok);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8323              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
8324            </svg>
8325            <div class="flex-1">
8326              <p class="font-medium" style="color: var(--bs-ok);">Connection successful!</p>
8327              <p class="text-sm mt-1" style="color: var(--bs-fg-soft);">${r.message}</p>
8328              ${o}
8329              ${a}
8330            </div>
8331          </div>
8332        `;let l=this.testResultContentTarget.querySelector(".copy-trigger-cmd");l&&(l.onclick=c=>{let u=c.target.dataset.command;navigator.clipboard.writeText(u),c.target.textContent="Copied!",setTimeout(()=>c.target.textContent="Copy",1500)})}else this.testResultContentTarget.className="p-4 rounded-lg",this.testResultContentTarget.style.cssText="background: var(--bs-err-soft); border: 1px solid var(--bs-err-soft);",this.testResultContentTarget.innerHTML=`
8333          <div class="flex items-start space-x-3">
8334            <svg class="w-5 h-5 mt-0.5" style="color: var(--bs-err);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8335              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
8336            </svg>
8337            <div>
8338              <p class="font-medium" style="color: var(--bs-err);">Connection failed</p>
8339              <p class="text-sm mt-1" style="color: var(--bs-fg-soft);">${r.error}</p>
8340            </div>
8341          </div>
8342        `}catch(i){console.error("Test failed:",i),this.testResultTarget.classList.remove("hidden"),this.testResultContentTarget.className="p-4 rounded-lg",this.testResultContentTarget.style.cssText="background: var(--bs-err-soft); border: 1px solid var(--bs-err-soft);",this.testResultContentTarget.innerHTML=`
8343        <p class="" style="color: var(--bs-err);">Network error: ${i.message}</p>
8344      `}finally{this.testButtonTarget.removeAttribute("disabled"),this.testButtonTextTarget.classList.remove("hidden"),this.testSpinnerTarget.classList.add("hidden")}}async testJenkinsJob(){let i=this.hasTestJobNameTarget?this.testJobNameTarget.value.trim():"";if(!i){this.showTestError("Please enter a job name to test");return}this.testButtonTarget.setAttribute("disabled","disabled"),this.testButtonTextTarget.classList.add("hidden"),this.testSpinnerTarget.classList.remove("hidden"),this.testResultTarget.classList.add("hidden");try{let t=this.element.dataset.projectId||window.location.pathname.match(/projects\/(\d+)/)?.[1],e=this.element.dataset.integrationId,n=`/projects/${t}/integrations/${e}/test_jenkins_job`,s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content,Accept:"application/json"},body:JSON.stringify({job_name:i})}),r=await s.text();console.log("Raw response:",r),console.log("Response status:",s.status);let o;try{o=JSON.parse(r)}catch(a){console.error("JSON parse error:",a),console.error("Response text:",r),this.showTestError("Server returned non-JSON response. Check console for details.");return}this.testResultTarget.classList.remove("hidden"),o.success?(this.testResultContentTarget.className="p-4 rounded-lg",this.testResultContentTarget.style.cssText="background: var(--bs-ok-soft); border: 1px solid var(--bs-ok-soft);",this.testResultContentTarget.innerHTML=`
8345          <div class="flex items-start space-x-3">
8346            <svg class="w-5 h-5 mt-0.5" style="color: var(--bs-ok);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8347              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
8348            </svg>
8349            <div class="flex-1">
8350              <p class="font-medium" style="color: var(--bs-ok);">Job configured correctly!</p>
8351              <div class="mt-2 space-y-1 text-sm" style="color: var(--bs-fg-soft);">
8352                <div>\u2022 Job "${i}" exists in Jenkins</div>
8353                ${o.webhook_configured?"<div>\u2022 ButterStack webhook is properly configured</div>":'<div class="text-warn">\u2022 Webhook not configured (job may have been created manually)</div>'}
8354                ${o.job_url?`<div>\u2022 <a href="${o.job_url}" target="_blank" class="underline hover:no-underline">View job in Jenkins \u2192</a></div>`:""}
8355              </div>
8356            </div>
8357          </div>
8358        `):(this.testResultContentTarget.className="p-4 rounded-lg",this.testResultContentTarget.style.cssText="background: var(--bs-err-soft); border: 1px solid var(--bs-err-soft);",this.testResultContentTarget.innerHTML=`
8359          <div class="flex items-start space-x-3">
8360            <svg class="w-5 h-5 mt-0.5" style="color: var(--bs-err);" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8361              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
8362            </svg>
8363            <div>
8364              <p class="font-medium" style="color: var(--bs-err);">Job test failed</p>
8365              <p class="text-sm mt-1" style="color: var(--bs-fg-soft);">${o.error}</p>
8366              ${o.suggestions?`<div class="mt-2 text-sm" style="color: var(--bs-err);"><strong>Suggestions:</strong><ul class="list-disc list-inside mt-1">${o.suggestions.map(a=>`<li>${a}</li>`).join("")}</ul></div>`:""}
8367            </div>
8368          </div>
8369        `)}catch(t){console.error("Jenkins job test failed:",t),this.showTestError(`Network error: ${t.message}`)}finally{this.testButtonTarget.removeAttribute("disabled"),this.testButtonTextTarget.classList.remove("hidden"),this.testSpinnerTarget.classList.add("hidden")}}showTestError(i){this.testResultTarget.classList.remove("hidden"),this.testResultContentTarget.className="p-4 rounded-lg",this.testResultContentTarget.style.cssText="background: var(--bs-err-soft); border: 1px solid var(--bs-err-soft);",this.testResultContentTarget.innerHTML=`
8370      <p class="" style="color: var(--bs-err);">${i}</p>
8371    `}async deployJenkinsTemplates(){this.deployButtonTextTarget.classList.add("hidden"),this.deploySpinnerTarget.classList.remove("hidden");let i=[];this.unrealTemplateTarget?.checked&&i.push("unreal"),this.unityTemplateTarget?.checked&&i.push("unity");try{let t=this.element.dataset.projectId||window.location.pathname.match(/projects\/(\d+)/)?.[1],e=this.element.dataset.integrationId,s=await(await fetch(`/
8371projects/${t}/integrations/${e}/deploy_templates`,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content},body:JSON.stringify({templates:i})})).json();this.deployResultsTarget.classList.remove("hidden"),this.deployResultsTarget.innerHTML=s.jobs.map(r=>`
8372        <div class="p-3 rounded-lg" style="background: ${r.success?"var(--bs-ok-soft)":"var(--bs-err-soft)"};">
8373          <div class="flex items-center justify-between">
8374            <span class="text-sm font-medium" style="color: ${r.success?"var(--bs-ok)":"var(--bs-err)"};">
8375              ${r.name}
8376            </span>
8377            <span class="text-xs" style="color: ${r.success?"var(--bs-ok)":"var(--bs-err)"};">
8378              ${r.success?"Created":"Failed"}
8379            </span>
8380          </div>
8381          ${r.url?`<a href="${r.url}" target="_blank" class="text-xs hover:underline" style="color: var(--bs-accent);">View in Jenkins \u2192</a>`:""}
8382        </div>
8383      `).join(""),this.element.querySelector("[data-step='4'] button[data-action*='completeStep']")?.removeAttribute("disabled")}catch(t){console.error("Deploy failed:",t),this.deployResultsTarget.classList.remove("hidden"),this.deployResultsTarget.innerHTML=`
8384        <div class="p-3 rounded-lg" style="background: var(--bs-err-soft);">
8385          <p style="color: var(--bs-err);">Deployment failed: ${t.message}</p>
8386        </div>
8387      `}finally{this.deployButtonTextTarget.classList.remove("hidden"),this.deploySpinnerTarget.classList.add("hidden")}}};var O5={};Le(O5,{default:()=>I5});var I5=class extends le{static targets=["container","modal"];connect(){this.boundKeyHandler=this.handleKeydown.bind(this)}disconnect(){document.removeEventListener("keydown",this.boundKeyHandler)}open(){this.hasModalTarget&&this.modalTarget.classList.remove("hidden"),document.body.classList.add("overflow-hidden"),document.addEventListener("keydown",this.boundKeyHandler);let i=this.element.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');i.length>0&&i[0].focus()}close(){this.hasModalTarget&&this.modalTarget.classList.add("hidden"),document.body.classList.remove("overflow-hidden"),document.removeEventListener("keydown",this.boundKeyHandler)}handleKeydown(i){i.key==="Escape"&&this.close()}clickOutside(i){i.target===i.currentTarget&&this.close()}};var B5={};Le(B5,{default:()=>N5});var N5=class extends le{connect(){console.log("Simple file upload controller connected!"),this.initializeFileUpload()}initializeFileUpload(){let i=document.getElementById("asset_file"),t=document.getElementById("upload-area"),e=document.getElementById("preview-area");if(!i||!t||!e){console.log("File upload elements not found");return}console.log("File upload elements found, setting up listeners"),i.addEventListener("change",n=>{if(console.log("File selected!"),n.target.files.length>0){let s=n.target.files[0];console.log("Processing file:",s.name),this.processFile(s)}}).drop.forEach(n=>{t.addEventListener(n,this.preventDefaults,!1)}),t.addEventListener("drop",n=>{let s=n.dataTransfer.files;s.length>0&&(i.files=s,this.processFile(s[0]))},!1)}preventDefaults(i){i.preventDefault(),i.stopPropagation()}processFile(i){console.log("Processing file:",i.name);let t=document.getElementById("upload-area"),e=document.getElementById("preview-area");if(t&&e){t.classList.add("hidden"),e.classList.remove("hidden");let n=document.getElementById("file-name"),s=document.getElementById("file-size");n&&(n.textContent=i.name),s&&(s.textContent=this.formatFileSize(i.size));let r=document.getElementById("upload-submit-btn");r&&(r.disabled=!1,r.classList.remove("opacity-50","cursor-not-allowed")),console.log("File preview updated successfully")}}formatFileSize(i){if(i===0)return"0 Bytes";let t=1024,e=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(i)/Math.log(t));return parseFloat((i/Math.pow(t,n)).toFixed(2))+" "+e[n]}};var U5={};Le(U5,{default:()=>F5});var F5=class extends le{static values={data:{type:Array,default:[]}};connect(){this.dataValue.length>0&&this.renderChart()}disconnect(){this.chart&&this.chart.destroy()}renderChart(){let i=this.element.querySelector("canvas");if(!i)return;let t=i.getContext("2d"),e=this.dataValue;this.chart=new Chart(t,{type:"line",data:{labels:e.map(n=>n.timestamp),datasets:[{label:"Players",data:e.map(n=>n.player_count),borderColor:"rgb(99, 102, 241)",backgroundColor:"rgba(99, 102, 241, 0.1)",borderWidth:2,tension:.4,fill:!0,pointRadius:0,pointHoverRadius:4}]},options:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{dis
8387play:!1},tooltip:{callbacks:{label:function(n){return`${n.parsed.y.toLocaleString()} players`}}}},scales:{x:{display:!0,grid:{display:!1},ticks:{maxTicksLimit:6,font:{size:10},color:"#94a3b8"}},y:{display:!0,beginAtZero:!0,grid:{color:"rgba(148, 163, 184, 0.1)"},ticks:{maxTicksLimit:4,font:{size:10},color:"#94a3b8",callback:function(n){return n>=1e3?(n/1e3).toFixed(0)+"k":n}}}},interaction:{intersect:!1,mode:"index"}}})}};var V5={};Le(V5,{default:()=>z5});var z5=class extends le{static values={url:String};static targets=["button","buttonText","result"];async verify(i){i.preventDefault(),this.buttonTarget.disabled=!0,this.buttonTextTarget.textContent="Verifying...";try{let e=await(await fetch(this.urlValue,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]')?.content||""}})).json();e.success?this.showSuccess(e):this.showError(e.error||"Verification failed")}catch(t){this.showError("Network error: "+t.message)}finally{this.buttonTarget.disabled=!1,this.buttonTextTarget.textContent="Verify Key"}}showSuccess(i){let t="";i.branches&&i.branches.length>0&&(t=`
8388        <div style="margin-top: 8px;">
8389          <span style="font-size: 12px; font-weight: 500; color: var(--bs-fg-soft);">Available branches:</span>
8390          <ul style="margin: 4px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--bs-fg-mute);">
8391            ${i.branches.map(e=>{let n=e.buildid?`Build ${e.buildid}${e.description?` (${e.description})`:""}`:"No build";return`<li style="margin-left: 16px;">\u2022 <span style="font-family: var(--bs-font-mono);">${e.name}</span>: ${n}</li>`}).join("")}
8392          </ul>
8393        </div>
8394      `),this.resultTarget.innerHTML=`
8395      <div style="padding: 12px; border-radius: var(--bs-r-md); background: var(--bs-ok-soft); border: 1px solid var(--bs-ok-soft);">
8396        <div style="display: flex; align-items: center; gap: 8px;">
8397          <svg style="width: 16px; height: 16px; color: var(--bs-ok); flex-shrink: 0;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8398            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
8399          </svg>
8400          <span style="font-size: 13px; font-weight: 500; color: var(--bs-ok);">${i.message}</span>
8401        </div>
8402        ${t}
8403      </div>
8404    `}showError(i){this.resultTarget.innerHTML=`
8405      <div style="padding: 12px; border-radius: var(--bs-r-md); background: var(--bs-err-soft); border: 1px solid var(--bs-err-soft);">
8406        <div style="display: flex; align-items: center; gap: 8px;">
8407          <svg style="width: 16px; height: 16px; color: var(--bs-err); flex-shrink: 0;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8408            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
8409          </svg>
8410          <span style="font-size: 13px; font-weight: 500; color: var(--bs-err);">${i}</span>
8411        </div>
8412      </div>
8413    `}};var j5={};Le(j5,{default:()=>H5});var H5=class extends le{static targets=["progress"];connect(){this.updateProgress=this.updateProgress.bind(this),window.addEventListener("scroll",this.updateProgress,{passive:!0}),window.addEventListener("resize",this.updateProgress,{passive:!0}),this.updateProgress()}disconnect(){window.removeEventListener("scroll",this.updateProgress),window.removeEventListener("resize",this.updateProgress)}updateProgress(){if(!this.hasProgressTarget)return;let i=window.pageYOffset||document.documentElement.scrollTop,t=document.documentElement.scrollHeight-window.innerHeight,e=t>0?Math.min(i/t*100,100):0;this.progressTarget.style.width=e+"%"}};var $5={};Le($5,{default:()=>W5});var W5=class extends le{static values={publicKey:String,clientSecret:String};async connect(){this.stripe=Stripe(this.publicKeyValue),this.checkout=await this.stripe.initEmbeddedCheckout({clientSecret:this.clientSecretValue}),this.checkout.mount(this.element)}disconnect(){this.checkout.destroy()}};var q5={};Le(q5,{default:()=>G5});var G5=class extends le{static targets=["addressElement","paymentElement","error","form","default"];static values={default:{type:Boolean,default:!0},publicKey:String,clientSecret:String,returnUrl:String,name:String};connect(){console.log(this.returnUrl),this.initializePaymentElement()}initializePaymentElement(){this.stripe=Stripe(this.publicKeyValue),this.elements=this.stripe.elements({appearance:{theme:this.theme,variables:{fontSizeBase:"14px"}},clientSecret:this.clientSecretValue}),this.paymentElement=this.elements.create("payment"),this.paymentElement.mount(this.paymentElementTarget),this.hasAddressElementTarget&&(this.addressElement=this.elements.create("address",{mode:"billing",defaultValues:{name:this.nameValue}}),this.addressElement.mount(this.addressElementTarget))}changed(i){this.errorTarget.textContent=i.error?.message||""}defaultChanged(i){this.defaultValue=i.currentTarget.checked}async submit(i){i.preventDefault();let t={elements:this.elements,confirmParams:{return_url:this.returnUrlValue}};if(this.clientSecretValue.startsWith("pi_")){let{error:e}=await this.stripe.confirmPayment(t);this.showError(e)}else{let{error:e}=await this.stripe.confirmSetup(t);this.showError(e)}}showError(i){this.errorTarget.textContent=i.message}get theme(){return document.documentElement.classList.contains("dark")?"night":"stripe"}};var X5={};Le(X5,{default:()=>Y5});var Y5=class extends le{static targets=["button","label"];static values={label:{type:String,default:"Starting\u2026"}};busy(i){let t=this.hasButtonTarget?this.buttonTarget:this.element.querySelector("button, input[type=submit]");if(t){if(t.disabled){i.preventDefault();return}t.disabled=!0,t.setAttribute("aria-busy","true"),this.hasLabelTarget&&(this.labelTarget.textContent=this.labelValue)}}};var J5={};Le(J5,{default:()=>K5});var K5=class extends le{static targets=["modal","title","description","status","assignee","priority","taskType","dueDate","updated","editButton","externalLinkContainer","externalLink","externalLinkText","taskReference","copyButton"];connect(){this.boundKeyHandler=this.handleKeydown.bind(this)}disconnect(){document.removeEventListener("keydown",this.boundKeyHandler)}show(i){this.open(i)}open(i){let t=i.currentTarget,e=t.dataset.taskId,n=t.dataset.taskTitle,s=t.dataset.taskDescription,r=t.dataset.taskDescriptionHtml,o=t.dataset.taskPriority,a=t.dataset.taskType,l=t.dataset.taskState,c=t.dataset.taskAssignee,u=t.dataset.taskDueDate,h=t.dataset.taskUpdated,d=t.dataset.taskSource,p=t.dataset.taskExternalUrl,g=t.dataset.taskJiraKey;if((d==="jira"||d==="external")&&g?this.titleTarget.textContent=g:d==="local"&&e?this.titleTarget.innerHTML=`${this.escapeHtml(n)} <span class="ml-2 text-sm font-normal opacity-80">#${this.escapeHtml(e)}</span>`:this.titleTarget.textContent=n,r)this.descriptionTarget.innerHTML=r;else if(s){let w=s.split(`
8414`).map(M=>this.escapeHtml(M.trim())).filter(M=>M.length>0).join("<br>");this.descriptionTarget.innerHTML=w}else this.descriptionTarget.textContent="";this.assigneeTarget.textContent=c,this.hasPriorityTarget&&(this.priorityTarget.textContent=this.humanize(o)||"Medium"),this.hasTaskTypeTarget&&(this.taskTypeTarget.textContent=this.humanize(a)||"Chore"),this.dueDateTarget.textContent=u,this.updatedTarget.textContent=this.formatTimestamp(h),this.updateStatus(l),p&&p!==""?(this.externalLinkContainerTarget.classList.remove("hidden"),this.externalLinkTarget.href=p,d==="jira"||d==="external"?this.externalLinkTextTarget.textContent="View External Link":this.externalLinkTextTarget.textContent="View External Link"):this.externalLinkContainerTarget.classList.add("hidden");let y="";(d==="jira"||d==="external")&&g?y=`#${g}`:d==="local"&&e&&(y=`task:${e}`),this.hasTaskReferenceTarget&&y&&(this.taskReferenceTarget.textContent=y),this.hasCopyButtonTarget&&y&&this.copyButtonTarget.setAttribute("data-clipboard-text",y),this.currentTaskId=e,this.currentTaskSource=d,d==="local"&&!e.toString().startsWith("jira-")?this.editButtonTarget.classList.remove("hidden"):this.editButtonTarget.classList.add("hidden"),this.modalTarget.classList.remove("hidden"),document.body.classList.add("overflow-hidden"),document.addEventListener("keydown",this.boundKeyHandler);let x=this.modalTarget.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not
8414([tabindex="-1"])');x.length>0&&x[0].focus()}close(){this.modalTarget.classList.add("hidden"),document.body.classList.remove("overflow-hidden"),document.removeEventListener("keydown",this.boundKeyHandler)}handleKeydown(i){i.key==="Escape"&&this.close()}clickOutside(i){i.target===i.currentTarget&&this.close()}edit(){if(this.currentTaskId){this.close();let t=`/projects/${window.location.pathname.split("/")[2]}/tasks/${this.currentTaskId}/edit`;window.location.href=t}}updateStatus(i){let t={to_do:"bs-pill-neutral",in_progress:"bs-pill-warn",blocked:"bs-pill-err",completed:"bs-pill-ok"},e={to_do:"To Do",in_progress:"In Progress",blocked:"Blocked",completed:"Completed"},n=t[i]||t.to_do;this.statusTarget.className=`bs-pill ${n}`,this.statusTarget.textContent=e[i]||(i?i.replace("_"," ").replace(/\b\w/g,s=>s.toUpperCase()):"To Do")}humanize(i){return i?i.toString().replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()):""}escapeHtml(i){if(!i)return"";let t=document.createElement("div");return t.textContent=i,t.innerHTML}formatTimestamp(i){if(!i||i==="Unknown")return"Unknown";try{let t;if(i instanceof Date?t=i:t=new Date(i),isNaN(t.getTime()))return i;let n=Math.floor((new Date-t)/1e3);if(n<60)return"just now";if(n<3600){let s=Math.floor(n/60);return`${s} minute${s!==1?"s":""} ago`}else if(n<86400){let s=Math.floor(n/3600);return`${s} hour${s!==1?"s":""} ago`}else if(n<2592e3){let s=Math.floor(n/86400);return`${s} day${s!==1?"s":""} ago`}else return t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return i}}};var Q5={};Le(Q5,{default:()=>Z5});var Z5=class extends le{static targets=["tabContent","matrixContainer"];connect(){if(new URLSearchParams(window.location.search).get("tab")==="invitations"){this.currentTab="invitations";let e=this.element.querySelector('[data-tab="invitations"]');e&&e.click()}else this.currentTab="overview"}switchTab(i){let t=i.currentTarget.dataset.tab;this.element.querySelectorAll(".tab-button").forEach(n=>{n.classList.remove("active"),n.style.borderColor="transparent",n.style.color="var(--bs-fg-mute)"}),i.currentTarget.classList.add("active"),i.currentTarget.style.borderColor="var(--bs-accent)",i.currentTarget.style.color="var(--bs-accent)",this.element.querySelectorAll(".tab-content").forEach(n=>{n.classList.add("hidden")});let e=this.element.querySelector(`#tab-${t}`);e&&e.classList.remove("hidden"),this.currentTab=t,t==="matrix"&&!this.matrixLoaded&&this.loadProjectMatrix()}async loadProjectMatrix(){try{console.log("Loading project matrix...");let i=await fetch("/settings/team/matrix",{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}});if(console.log("Matrix response status:",i.status),!i.ok){let e=await i.text();throw console.error("Matrix load error:",e),new Error(`Failed to load matrix: ${i.status}`)}let t=await i.json();console.log("Matrix data received:",t),this.renderProjectMatrix(t),this.matrixLoaded=!0}catch(i){console.error("Error loading project matrix:",i),this.showError("Failed to load project access matrix: "+i.message);let t=this.element.querySelector("#matrix-container");t&&(t.innerHTML=`
8415          <div style="text-align: center; padding: 32px 0;">
8416            <p style="color: var(--bs-err); margin: 0;">Failed to load project access matrix.</p>
8417            <button style="margin-top: 8px; background: transparent; border: 0; color: var(--bs-accent); cursor: pointer; text-decoration: underline;" onclick="location.reload()">Reload Page</button>
8418          </div>
8419        `)}}renderProjectMatrix(i){let t=this.element.querySelector("#matrix-container");if(!t){console.error("Matrix container not found");return}console.log("Rendering matrix with data:",i);let{users:e,projects:n,access_matrix:s}=i,r=`
8420      <table class="bs-table" style="min-width: 100%;">
8421        <thead>
8422          <tr>
8423            <th scope="col" style="text-align: left; text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; position: sticky; left: 0; background: var(--bs-bg-panel-2); z-index: 1;">
8424              Team Member
8425            </th>
8426    `;n.forEach(o=>{r+=`
8427        <th scope="col" style="text-align: center; text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; min-width: 128px;">
8428          <div style="transform: rotate(-45deg); transform-origin: center; white-space: nowrap;">
8429            ${this.escapeHtml(o.name)}
8430          </div>
8431        </th>
8432      `}),r+=`
8433          </tr>
8434        </thead>
8435        <tbody>
8436    `,e.forEach(o=>{r+=`
8437        <tr data-user-id="${o.id}">
8438          <td style="white-space: nowrap; position: sticky; left: 0; background: var(--bs-bg-panel); z-index: 1;">
8439            <div style="font-size: 13px; font-weight: 500; color: var(--bs-fg);">${this.escapeHtml(o.name)}</div>
8440            <div style="font-size: 13px; color: var(--bs-fg-mute);">${this.escapeHtml(o.email)}</div>
8441          </td>
8442      `,n.forEach(a=>{let l=s[o.id]?.[a.id],c=l&&l.active,u=l?.role||"member";r+=`
8443          <td style="text-align: center;">
8444            <div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
8445              <input type="checkbox"
8446                     class="project-access-checkbox"
8447                     style="width: 16px; height: 16px; accent-color: var(--bs-accent);"
8448                     data-user-id="${o.id}"
8449                     data-project-id="${a.id}"
8450                     ${c?"checked":""}>
8451              <select class="role-select bs-input bs-select ${c?"":"hidden"}"
8452                      style="font-size: 12px; padding: 4px 8px; width: auto;"
8453                      data-user-id="${o.id}"
8454                      data-project-id="${a.id}">
8455                <option value="viewer" ${u==="viewer"?"selected":""}>Viewer</option>
8456                <option value="member" ${u==="member"?"selected":""}>Member</option>
8457                <option value="admin" ${u==="admin"?"selected":""}>Admin</option>
8458                <option value="owner" ${u==="owner"?"selected":""}>Owner</option>
8459              </select>
8460            </div>
8461          </td>
8462        `}),r+="</tr>"}),r+=`
8463        </tbody>
8464      </table>
8465    `,t.innerHTML=r,this.attachMatrixEventListeners()}attachMatrixEventListeners(){this.element.querySelectorAll(".project-access-checkbox").forEach(i=>{i.addEventListener("change",t=>{let e=this.element.querySelector(`select[data-user-id="${t.target.dataset.userId}"][data-project-id="${t.target.dataset.projectId}"]`);e&&(t.target.checked?e.classList.remove("hidden"):e.classList.add("hidden")),this.markMatrixChanged()})}),this.element.querySelectorAll(".role-select").forEach(i=>{i.addEventListener("change",()=>{this.markMatrixChanged()})})}markMatrixChanged(){this.matrixChanged=!0;let i=document.getElementById("save-matrix-button");i&&(i.textContent="Save Changes *")}selectAllProjects(){this.element.querySelectorAll(".project-access-checkbox").forEach(i=>{i.checked=!0,i.dispatchEvent(new Event("change"))})}clearAllProjects(){this.element.querySelectorAll(".project-access-checkbox").forEach(i=>{i.checked=!1,i.dispatchEvent(new Event("change"))})}async saveMatrixChanges(){if(!this.matrixChanged)return;let i=[];this.element.querySelectorAll(".project-access-checkbox").forEach(e=>{let n=e.dataset.userId,s=e.dataset.projectId,r=e.checked,a=this.element.querySelector(`select[data-user-id="${n}"][data-project-id="${s}"]`)?.value||"member";i.push({user_id:n,project_id:s,action:r?"add":"remove",role:a})});let t={};i.forEach(e=>{t[e.user_id]||(t[e.user_id]=[]),t[e.user_id].push({project_id:e.project_id,action:e.action,role:e.role})});try{for(let[n,s]of Object.entries(t))await this.saveUserProjectChanges(n,s);this.showSuccess("Project access updated successfully"),this.matrixChanged=!1;let e=document.getElementById("save-matrix-button");e&&(e.textContent="Save Changes")}catch(e){console.error("Error saving matrix changes:",e),this.showError("Failed to save project access changes")}}async saveUserProjectChanges(i,t){let e=await fetch("/settings/team/assign_projects",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content,Accept:"application/json"},body:JSON.stringify({user_id:i,assignments:t})});if(!e.ok){let n=await e.json();throw new Error(n.error||"Failed to save changes")}return e.json()}editProjectAccess(i){let t=i.currentTarget.dataset.userId;this.switchToTab("matrix"),setTimeout(()=>{let e=this.element.querySelector(`[data-user-id="${t}"]`);e&&(e.scrollIntoView({behavior:"smooth",block:"center"}),e.style.background="var(--bs-accent-soft)",setTimeout(()=>{e.style.background=""},3e3))},500)}async removeUser(i){let t=i.currentTarget.dataset.userId,e=i.currentTarget.dataset.userName;if(confirm(`Are you sure you want to remove ${e} from the account? This will remove them from all projects.`))try{if((await fetch(`/settings/team/${t}/remove_user`,{method:"DELETE",headers:{"X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content}})).ok)window.location.reload();else throw new Error("Failed to remove user")}catch(n){console.error("Error removing user:",n),this.showError("Failed to remove user from account")}}openBulkInvite(){let i=document.getElementById("bulk-invite-modal");i&&(i.classList.remove("hidden"),this.setupBulkInviteModal())}closeBulkInviteModal(){let i=document.getElementById("bulk-invite-modal");i&&(i.classList.add("hidden"),this.resetBulkInviteModal())}setupBulkInviteModal(){document.querySelectorAll(".bulk-project-checkbox").forEach(i=>
8465{i.addEventListener("change",t=>{let e=t.target.dataset.projectId,n=document.querySelector(`.bulk-project-role[data-project-id="${e}"]`);n&&(n.disabled=!t.target.checked,t.target.checked?n.classList.remove("opacity-50"):n.classList.add("opacity-50"))})})}resetBulkInviteModal(){document.querySelectorAll(".bulk-project-checkbox").forEach(t=>{t.checked=!1}),document.querySelectorAll(".bulk-project-role").forEach(t=>{t.disabled=!0,t.classList.add("opacity-50"),t.value="member"});let i=document.getElementById("bulk-invitation-rows");i&&(i.innerHTML=`
8466        <div class="bulk-invitation-row flex items-center space-x-3">
8467          <input type="text" 
8468                 class="invitation-name flex-1 form-input text-sm"
8469                 placeholder="Full Name"
8470                 required>
8471          <input type="email" 
8472                 class="invitation-email flex-1 form-input text-sm"
8473                 placeholder="[email protected]"
8474                 required>
8475          <button type="button"
8476                  style="background: transparent; border: 0; color: var(--bs-err); cursor: pointer; padding: 0; display: inline-flex;"
8477                  data-action="click->team-management#removeInvitationRow">
8478            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8479              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
8480            </svg>
8481          </button>
8482        </div>
8483      `)}addInvitationRow(){let i=document.getElementById("bulk-invitation-rows");if(i){let t=document.createElement("div");t.className="bulk-invitation-row flex items-center space-x-3",t.innerHTML=`
8484        <input type="text" 
8485               class="invitation-name flex-1 form-input text-sm"
8486               placeholder="Full Name"
8487               required>
8488        <input type="email" 
8489               class="invitation-email flex-1 form-input text-sm"
8490               placeholder="[email protected]"
8491               required>
8492        <button type="button"
8493                style="background: transparent; border: 0; color: var(--bs-err); cursor: pointer; padding: 0; display: inline-flex;"
8494                data-action="click->team-management#removeInvitationRow">
8495          <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8496            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
8497          </svg>
8498        </button>
8499      `,i.appendChild(t)}}removeInvitationRow(i){let t=i.currentTarget.closest(".bulk-invitation-row"),e=document.getElementById("bulk-invitation-rows");t&&e&&e.children.length>1&&t.remove()}async sendBulkInvitations(){let i=[],t=[],e={};if(document.querySelectorAll(".bulk-project-checkbox:checked").forEach(n=>{let s=n.dataset.projectId,r=document.querySelector(`.bulk-project-role[data-project-id="${s}"]`);t.push(parseInt(s)),e[s]=r?r.value:"member"}),document.querySelectorAll(".bulk-invitation-row").forEach(n=>{let s=n.querySelector(".invitation-name"),r=n.querySelector(".invitation-email");s.value.trim()&&r.value.trim()&&i.push({name:s.value.trim(),email:r.value.trim()})}),i.length===0){this.showError("Please add at least one team member to invite");return}try{let n=await fetch("/settings/team/bulk_invite",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content,Accept:"application/json"},body:JSON.stringify({invitations:i,default_project_ids:t,default_roles:e})}),s=await n.json();if(n.ok)this.showSuccess(s.message),this.closeBulkInviteModal(),setTimeout(()=>{window.location.reload()},1e3);else if(s.errors&&s.errors.length>0){let r=s.errors.map(o=>`${o.email}: ${o.errors.join(", ")}`).join(`
8500`);this.showError(`Some invitations failed:
8501${r}`)}else this.showError(s.message||"Failed to send invitations")}catch(n){console.error("Error sending bulk invitations:",n),this.showError("Failed to send invitations")}}editInvitationDefaults(i){let t=i.currentTarget.dataset.invitationId,e=i.currentTarget.closest("[data-invitation-id]");if(!e)return;let n=e.querySelector("td")?.querySelectorAll("div")||[],s=n[0]?.textContent.trim()||"",r=n[1]?.textContent.trim()||"";this.currentEditingInvitationId=t,this.openEditInvitationModal(s,r,e)}openEditInvitationModal(i,t,e){let n=document.getElementById("edit-invitation-modal");if(!n)return;let s=n.querySelector("#edit-invitation-user");s&&(s.innerHTML=`<strong>${this.escapeHtml(i)}</strong><br><span style="color: var(--bs-fg-mute);">${this.escapeHtml(t)}
8501</span>`),n.querySelectorAll(".edit-project-checkbox").forEach(o=>{o.checked=!1}),n.querySelectorAll(".edit-project-role").forEach(o=>{o.disabled=!0,o.classList.add("opacity-50"),o.value="member"}),e.querySelectorAll(".inline-flex.items-center").forEach(o=>{let l=o.textContent.trim().match(/^(.+)\s+\((\w+)\)$/);if(l){let c=l[1],u=l[2],h=n.querySelector(`.edit-project-checkbox[data-project-name="${c}"]`);if(h){h.checked=!0;let d=h.dataset.projectId,p=n.querySelector(`.edit-project-role[data-project-id="${d}"]`);p&&(p.disabled=!1,p.classList.remove("opacity-50"),p.value=u.toLowerCase())}}}),this.setupEditInvitationModal(),n.classList.remove("hidden")}closeEditInvitationModal(){let i=document.getElementById("edit-invitation-modal");i&&(i.classList.add("hidden"),this.currentEditingInvitationId=null)}setupEditInvitationModal(){document.querySelectorAll(".edit-project-checkbox").forEach(i=>{let t=i.editListener;t&&i.removeEventListener("change",t);let e=n=>{let s=n.target.dataset.projectId,r=document.querySelector(`.edit-project-role[data-project-id="${s}"]`);r&&(r.disabled=!n.target.checked,n.target.checked?r.classList.remove("opacity-50"):r.classList.add("opacity-50"))};i.editListener=e,i.addEventListener("change",e)})}async saveInvitationDefaults(){if(!this.currentEditingInvitationId)return;let i=[],t={};document.querySelectorAll(".edit-project-checkbox:checked").forEach(e=>{let n=e.dataset.projectId,s=document.querySelector(`.edit-project-role[data-project-id="${n}"]`);i.push(parseInt(n)),t[n]=s?s.value:"member"});try{let e=await fetch(`/settings/team/${this.currentEditingInvitationId}/update_invitation_defaults`,{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content,Accept:"application/json"},body:JSON.stringify({invitation_id:this.currentEditingInvitationId,project_ids:i,project_roles:t})}),n=await e.json();e.ok?(this.showSuccess(n.message),this.closeEditInvitationModal(),setTimeout(()=>{window.location.reload()},1e3)):this.showError(n.error||"Failed to update invitation defaults")}catch(e){console.error("Error saving invitation defaults:",e),this.showError("Failed to update invitation defaults")}}switchToTab(i){let t=this.element.querySelector(`[data-tab="${i}"]`);t&&t.click()}showSuccess(i){this.showNotification(i,"success")}showError(i){this.showNotification(i,"error")}showInfo(i){this.showNotification(i,"info")}showNotification(i,t){let e=t==="success"?"var(--bs-ok)":t==="error"?"var(--bs-err)":"var(--bs-info)",n=document.createElement("div");n.style.cssText=`
8502      position: fixed; top: 16px; right: 16px; z-index: 50;
8503      padding: 14px 16px; border-radius: var(--bs-r-md);
8504      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
8505      background: ${e}; color: #fff; font-size: 13px;
8506    `,n.textContent=i,document.body.appendChild(n),setTimeout(()=>{n.remove()},5e3)}escapeHtml(i){if(!i)return"";let t=document.createElement("div");return t.textContent=i,t.innerHTML}};var eV={};Le(eV,{default:()=>tV});var tV=class extends le{connect(){alert("TEST CONTROLLER CONNECTED!"),console.log("Test controller is working!")}};var iV={};Le(iV,{default:()=>nV});var nV=class extends le{connect(){this.updateTheme()}toggle(){let t=(document.body.getAttribute("data-theme")||document.documentElement.getAttribute("data-theme")||"dark")==="dark"?"light":"dark";this.applyTheme(t),localStorage.setItem("bs-theme",t),this.updateUserPreference(t)}updateTheme(){let i=localStorage.getItem("bs-theme");i||(i=document.body.getAttribute("data-theme")||document.documentElement.getAttribute("data-theme")||"dark"),this.applyTheme(i)}applyTheme(i){document.documentElement.setAttribute("data-theme",i),document.body.setAttribute("data-theme",i)}updateUserPreference(i){fetch("/users/theme",{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content},body:JSON.stringify({user:{theme:i==="dark"?"dark":"light"}})}).catch(console.error)}};var rV={};Le(rV,{default:()=>sV}
8506);var sV=class extends le{static targets=["tab","content"];static values={default:String};connect(){console.log("ToggleTabsController connected"),console.log("Tab targets found:",this.tabTargets.length),console.log("Content targets found:",this.contentTargets.length);let i=this.hasDefaultValue?this.defaultValue:"invite";console.log("Default tab:",i),this.showTab(i)}switchTab(i){console.log("switchTab called"),i.preventDefault();let t=i.currentTarget.dataset.tab;console.log("Switching to tab:",t),this.showTab(t)}showTab(i){console.log("showTab called with:",i),this.contentTargets.forEach(e=>{console.log("Hiding content:",e.dataset.tab),e.classList.add("hidden")});let t=this.contentTargets.find(e=>e.dataset.tab===i);t?(console.log("Showing content:",t.dataset.tab),t.classList.remove("hidden")):console.log("No content found for tab:",i),this.tabTargets.forEach(e=>{e.dataset.tab===i?(e.style.background="var(--bs-bg-panel)",e.style.color="var(--bs-fg)",e.style.boxShadow="0 1px 2px rgba(0, 0, 0, 0.08)"):(e.style.background="transparent",e.style.color="var(--bs-fg-mute)",e.style.boxShadow="none")})}};var aV={};Le(aV,{default:()=>oV});var oV=class extends le{static values={content:String};connect(){let i={};this.hasContentValue&&(i.content=this.contentValue),this.tippy=V0(this.element,i)}disconnect(){this.tippy.destroy()}};var cV={};Le(cV,{default:()=>lV});var lV=class extends le{static targets=["modal"];connect(){this.dirty=!1}hideModal(){this.element.parentElement.removeAttribute("src"),this.modalTarget.remove()}markDirty(){this.dirty=!0}maybeClose(){this.dirty&&!confirm("Discard unsaved changes?")||this.hideModal()}submitEnd(i){i.detail.success&&(this.dirty=!1,this.hideModal())}closeWithKeyboard(i){i.code==="Escape"&&this.maybeClose()}closeBackground(i){i&&this.modalTarget.contains(i.target)||this.hideModal()}};var hV={};Le(hV,{default:()=>uV});var uV=class extends le{signOut(i){this._isTurboNativeApp&&(i.preventDefault(),i.stopImmediatePropagation(),window.TurboNativeBridge.postMessage("signOut"))}deleteAccount(i){this._isTurboNativeApp&&(i.preventDefault(),i.stopImmediatePropagation(),window.TurboNativeBridge.postMessage("deleteAccount"))}get _isTurboNativeApp(){return navigator.userAgent.indexOf("Turbo Native")!==-1}};var fV={};Le(fV,{default:()=>dV});var dV=class extends le{static values={integrationId:Number,projectId:Number,integrationType:String};setupWebhook(i){i.preventDefault();let t=i.currentTarget,e=t.innerHTML;if(this.integrationTypeValue==="perforce"){this.showPerforceInstructions(t);return}if(this.integrationTypeValue==="jenkins"){this.showJenkinsInstructions(t);return}t.disabled=!0,t.innerHTML=`
8507      <svg class="animate-spin w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8508        <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
8509        <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
8510      </svg>
8511      Setting up webhook...
8512    `,fetch(`/projects/${this.projectIdValue}/integrations/${this.integrationIdValue}/setup_webhook`,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content,Accept:"application/json"}}).then(n=>n.json()).then(n=>{n.success?(this.showNotification("Webhook configured successfully!","success"),setTimeout(()=>{window.location.reload()},1e3)):n.status==="warning"?(this.showNotification(n.error||"Webhook created but not verified","warning"),t.disabled=!1,t.innerHTML=e):(this.showNotification(n.error||"Failed to configure webhook","error"),t.disabled=!1,t.innerHTML=e)}).catch(n=>{console.error("Error:",n),this.showNotification("An error occurred while setting up the webhook","error"),t.disabled=!1,t.innerHTML=e})}removeWebhook(i){if(i.preventDefault(),!confirm("Are you sure you want to remove the webhook? ButterStack will no longer receive real-time updates from Jira."))return;let t=i.currentTarget,e=t.innerHTML;t.disabled=!0,t.innerHTML=`
8513      <svg class="animate-spin w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8514        <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
8515        <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
8516      </svg>
8517      Removing webhook...
8518    `,fetch(`/projects/${this.projectIdValue}/integrations/${this.integrationIdValue}/remove_webhook`,{method:"DELETE",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content,Accept:"application/json"}}).then(n=>n.json()).then(n=>{n.success?(this.showNotification("Webhook removed successfully","success"),setTimeout(()=>{window.location.reload()},1e3)):(this.showNotification(n.error||"Failed to remove webhook","error"),t.disabled=!1,t.innerHTML=e)}).catch(n=>{console.error("Error:",n),this.showNotification("An error occurred while removing the webhook","error"),t.disabled=!1,t.innerHTML=e})}showNotification(i,t="info"){let e=t==="success"?"var(--bs-ok)":t==="error"?"var(--bs-err)":t==="warning"?"var(--bs-warn)":"var(--bs-info)",n=document.createElement("div");n.style.cssText=`
8519      position: fixed; top: 16px; right: 16px; z-index: 50;
8520      padding: 14px 20px; border-radius: var(--bs-r-md);
8521      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
8522      background: ${e}; color: #fff; font-size: 13px;
8523      transform: translateX(100%); transition: transform 300ms ease;
8524    `,n.innerHTML=`
8525      <div style="display: flex; align-items: center; gap: 16px;">
8526        <span>${i}</span>
8527        <button style="background: transparent; border: 0; color: #fff; opacity: 0.75; cursor: pointer; padding: 0; display: inline-flex;" onclick="this.parentElement.parentElement.remove()">
8528          <svg style="width: 16px; height: 16px;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8529            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
8530          </svg>
8531        </button>
8532      </div>
8533    `,document.body.appendChild(n),setTimeout(()=>{n.style.transform="translateX(0)"},10),setTimeout(()=>{n.style.transform="translateX(100%)",setTimeout(()=>n.remove(),300)},5e3)}showPerforceInstructions(i){fetch(`/projects/${this.projectIdValue}/integrations/${this.integrationIdValue}/setup_webhook`,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content,Accept:"application/json"}}).then(t=>t.json()).then(t=>{t.success&&t.webhook&&t.webhook.instructions?this.showInstructionsModal(t.webhook.instructions):this.showNotification("Failed to get trigger instructions","error")}).catch(t=>{console.error("Error:",t),this.showNotification("Failed to get trigger instructions","error")})}showJenkinsInstructions(i){fetch(`/projects/${this.projectIdValue}/integrations/${this.integrationIdValue}/setup_webhook`,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('[name="csrf-token"]').content,Accept:"application/json"}}).then(t=>t.json()).then(t=>{t.success&&t.webhook?this.showJenkinsInstructionsModal(t.webhook):this.showNotification("Failed to get Jenkins webhook instructions","error")}).catch(t=>{console.error("Error:",t),this.showNotification("Failed to get Jenkins webhook instructions","error")})}showJenkinsInstructionsModal(i){let t=document.createElement("div");t.style.cssText="position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); z-index: 50; overflow-y: auto;",t.addEventListener("click",r=>{r.target===t&&t.remove()});let e=r=>{r.key==="Escape"&&(t.remove(),document.removeEventListener("keydown",e))};document.addEventListener("keydown",e);let n=document.createElement("div");n.className="flex items-center justify-center min-h-screen p-4";let s=document.createElement("div");s.className="bs-card",s.style.cssText="max-width: 56rem; width: 100%; margin: 32px auto; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);",s.addEventListener("click",r=>r.stopPropagation()),s.innerHTML=`
8534      <div class="p-4 rounded-t-lg" style="border-bottom: 1px solid var(--bs-line); background: linear-gradient(to right, var(--bs-warn), var(--bs-warn));">
8535        <div class="flex items-center justify-between">
8536          <div class="flex items-center">
8537            <div class="bg-white/20 backdrop-blur rounded-lg p-2 mr-3">
8538              <svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8539                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2-2v2m8 0V6a2 2 0 012 2v6a2 2 0 01-2 2H8a2 2 0 01-2-2V8a2 2 0 012-2
8539V6"/>
8540              </svg>
8541            </div>
8542            <div>
8543              <h3 class="text-xl font-bold text-white">Jenkins Webhook Setup</h3>
8544              <p class="text-sm" style="color: rgba(255,255,255,0.85);">Configure Jenkins to send build notifications to ButterStack</p>
8545            </div>
8546          </div>
8547          <button class="text-white/80 hover:text-white transition-colors close-modal">
8548            <svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8549              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
8550            </svg>
8551          </button>
8552        </div>
8553      </div>
8554      
8555      <div class="p-6 max-h-[calc(90vh-8rem)] overflow-y-auto">
8556        <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
8557          <!-- Setup Steps -->
8558          <div>
8559            <h4 class="text-lg font-semibold mb-4" style="color: var(--bs-fg);">Setup Steps</h4>
8560            
8561            ${i.setup_steps.map((r,o)=>`
8562              <div class="mb-4 p-3 rounded-lg" style="border: 1px solid var(--bs-line);">
8563                <div class="flex items-start">
8564                  <div class="w-6 h-6 rounded-full flex items-center justify-center text-sm font-medium mr-3 mt-0.5" style="background: var(--bs-warn-soft); color: var(--bs-warn);">
8565                    ${o+1}
8566                  </div>
8567                  <p class="text-sm" style="color: var(--bs-fg-soft);">${r}</p>
8568                </div>
8569              </div>
8570            `).join("")}
8571          </div>
8572          
8573          <!-- CLI Commands -->
8574          <div>
8575            <h4 class="text-lg font-semibold mb-4" style="color: var(--bs-fg);">Jenkins CLI Commands</h4>
8576            
8577            <div class="rounded-lg p-4" style="background: var(--bs-bg-panel-2); border: 1px solid var(--bs-line);">
8578              <pre class="text-xs font-mono overflow-x-auto whitespace-pre-wrap" style="color: var(--bs-fg);">${i.jenkins_cli_commands.join(`
8579`)}</pre>
8580              
8581              <div class="mt-3 flex space-x-2">
8582                <button class="bs-btn bs-btn-ghost copy-cli-commands">
8583                  Copy Commands
8584                </button>
8585              </div>
8586            </div>
8587          </div>
8588        </div>
8589        
8590        <!-- Webhook URL Section -->
8591        <div class="mt-6 rounded-lg p-4" style="background: var(--bs-info-soft); border: 1px solid var(--bs-info-soft);">
8592          <h4 class="text-sm font-medium mb-2" style="color: var(--bs-info);">Webhook URL:</h4>
8593          <div class="flex items-center space-x-2">
8594            <code class="flex-1 px-3 py-2 rounded text-sm break-all" style="background: var(--bs-bg-panel-2); color: var(--bs-fg); border: 1px solid var(--bs-line);">
8595              ${i.webhook_url}
8596            </code>
8597            <button class="bs-btn bs-btn-primary copy-webhook-url">
8598              Copy
8599            </button>
8600          </div>
8601          <p class="text-xs mt-2" style="color: var(--bs-fg-soft);">
8602            Use this URL in your Jenkins job's post-build actions or webhook trigger configurations
8603          </p>
8604        </div>
8605        
8606        <!-- Additional Info -->
8607        <div class="mt-6 bg-warn-soft dark:bg-warn/20 border border-warn-soft dark:border-warn rounded-lg p-4">
8608          <div class="flex">
8609            <svg class="h-5 w-5 text-warn mt-0.5 mr-2" fill="currentColor" viewBox="0 0 20 20">
8610              <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
8611            </svg>
8612            <div>
8613              <h4 class="text-sm font-medium text-warn dark:text-warn-soft">Pro Tips</h4>
8614              <ul class="mt-2 text-sm text-warn dark:text-warn space-y-1">
8615                <li>\u2022 Install the "HTTP Request Plugin" or "Notification Plugin" in Jenkins for webhook support</li>
8616                <li>\u2022 Use the "Generic Webhook Trigger Plugin" for advanced webhook configurations</li>
8617                <li>\u2022 Test your webhook by triggering a manual build and checking ButterStack for notifications</li>
8618                <li>\u2022 Configure build parameters to pass commit information to ButterStack</li>
8619              </ul>
8620            </div>
8621          </div>
8622        </div>
8623      </div>
8624      
8625      <div class="p-4 flex justify-end" style="border-top: 1px solid var(--bs-line);">
8626        <button class="bs-btn bs-btn-ghost close-modal">
8627          Close
8628        </button>
8629      </div>
8630    `,s.querySelector(".copy-webhook-url").onclick=()=>{navigator.clipboard.writeText(i.webhook_url);let r=s.querySelector(".copy-webhook-url");r.textContent="Copied!",setTimeout(()=>r.textContent="Copy",1e3)}
8630,s.querySelector(".copy-cli-commands").onclick=()=>{navigator.clipboard.writeText(i.jenkins_cli_commands.join(`
8631`));let r=s.querySelector(".copy-cli-commands");r.textContent="Copied!",setTimeout(()=>r.textContent="Copy Commands",1e3)},s.querySelectorAll(".close-modal").forEach(r=>{r.onclick=()=>{t.remove(),document.removeEventListener("keydown",e)}}),n.appendChild(s),t.appendChild(n),document.body.appendChild(t)}showInstructionsModal(i){let t=document.createElement("div");t.style.cssText="position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); z-index: 50; overflow-y: auto;",t.addEventListener("click",c=>{c.target===t&&t.remove()});let e=c=>{c.key==="Escape"&&(t.remove(),document.removeEventListener("keydown",e))};document.addEventListener("keydown",e);let n=document.createElement("div");n.className="flex items-center justify-center min-h-screen p-4";let s=document.createElement("div");s.className="bs-card",s.style.cssText="max-width: 48rem; width: 100%; margin: 32px auto; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);",s.addEventListener("click",c=>c.stopPropagation());let r=document.createElement("div");r.className="p-4 sticky top-0 rounded-t-lg",r.style.cssText="border-bottom: 1px solid var(--bs-line); background: var(--bs-bg-panel);",r.innerHTML=`
8632      <div class="flex items-center justify-between">
8633        <h3 class="text-lg font-semibold" style="color: var(--bs-fg);">Perforce Trigger Setup</h3>
8634        <button class="close-modal" style="background: transparent; border: 0; color: var(--bs-fg-mute); cursor: pointer; padding: 0; display: inline-flex;">
8635          <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8636            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
8637          </svg>
8638        </button>
8639      </div>
8640    `;let o=document.createElement("div");o.className="p-4 max-h-[calc(90vh-8rem)] overflow-y-auto",i.steps.forEach((c,u)=>{let h=document.createElement("div");h.className='mb-4 p-3 rounded-lg" style="border: 1px solid var(--bs-line);';let d=document.createElement("div");if(d.className="flex items-center mb-2",d.innerHTML=`
8641        <div class="w-6 h-6 rounded-full flex items-center justify-center text-sm font-medium mr-3" style="background: var(--bs-info-soft); color: var(--bs-info);">
8642          ${c.step}
8643        </div>
8644        <h4 class="text-sm font-medium" style="color: var(--bs-fg);">${c.title}</h4>
8645      `,h.appendChild(d),c.description){let p=document.createElement("p");p.className="text-sm mb-2 ml-9",p.style.color="var(--bs-fg-soft)",p.textContent=c.description,h.appendChild(p)}if(c.code){let p=document.createElement("div");p.className="ml-9";let g=document.createElement("div");g.className="p-3 rounded text-sm font-mono overflow-x-auto",g.style.cssText="background: var(--bs-bg-panel-2); color: var(--bs-fg);",g.textContent=c.code,p.appendChild(g);let y=document.createElement("button");y.className="bs-btn bs-btn-ghost",y.style.marginTop="8px",y.textContent="Copy Command",y.onclick=()=>{navigator.clipboard.writeText(c.code),y.textContent="Copied!",setTimeout(()=>y.textContent="Copy Command",1e3)},p.appendChild(y),h.appendChild(p)}o.appendChild(h)});let a=document.createElement("div");a.className="rounded-lg p-3",a.style.cssText="background: var(--bs-info-soft); border: 1px solid var(--bs-info-soft);",a.innerHTML=`
8646      <h4 class="text-sm font-medium mb-2" style="color: var(--bs-info);">Webhook URL:</h4>
8647      <div class="p-2 rounded text-xs font-mono break-all" data-testid="perforce-webhook-url" style="background: var(--bs-bg-panel-2); color: var(--bs-fg);">
8648        ${i.webhook_url}
8649      </div>
8650    `;let l=document.createElement("button");if(l.className="bs-btn bs-btn-primary",l.style.marginTop="8px",l.textContent="Copy URL",l.onclick=()=>{navigator.clipboard.writeText(i.webhook_url),l.textContent="Copied!",setTimeout(()=>l.textContent="Copy URL",1e3)}
8650,a.appendChild(l),o.appendChild(a),i.webhook_script){let c=document.createElement("div");c.className="mt-6";let u=document.createElement("h3");u.className="text-lg font-semibold mb-3",u.style.color="var(--bs-fg)",u.textContent="Webhook Script (perforce-webhook.sh)",c.appendChild(u);let h=document.createElement("div");h.className='rounded-lg p-4" style="background: var(--bs-bg-panel-2); border: 1px solid var(--bs-line);';let d=document.createElement("pre");d.className='text-xs font-mono overflow-x-auto whitespace-pre-wrap" style="color: var(--bs-fg);',d.style.maxHeight="300px",d.style.overflowY="auto",d.textContent=i.webhook_script,h.appendChild(d);let p=document.createElement("div");p.className="mt-3 flex space-x-2";let g=document.createElement("button");g.className="bs-btn bs-btn-ghost",g.textContent="Copy Script",g.onclick=()=>{navigator.clipboard.writeText(i.webhook_script),g.textContent="Copied!",setTimeout(()=>g.textContent="Copy Script",1e3)},p.appendChild(g);let y=document.createElement("button");y.className="bs-btn bs-btn-primary",y.textContent="Download as .txt",y.onclick=()=>{let x=new Blob([i.webhook_script],{type:"text/plain"}),w=window.URL.createObjectURL(x),M=document.createElement("a");M.href=w,M.download="perforce-webhook.txt",document.body.appendChild(M),M.click(),document.body.removeChild(M),window.URL.revokeObjectURL(w)},p.appendChild(y),h.appendChild(p),c.appendChild(h),o.appendChild(c)}s.appendChild(r),s.appendChild(o),s.querySelector(".close-modal").onclick=()=>{t.remove(),document.removeEventListener("keydown",e)},n.appendChild(s),t.appendChild(n),document.body.appendChild(t)}};var yNt=[{name:"accounts",module:FL,filename:"accounts_controller.js"},{name:"analytics",module:zL,filename:"analytics_controller.js"},{name:"asset-lineage",module:FN,filename:"asset_lineage_controller.js"},{name:"asset-lineage-modal",module:zN,filename:"asset_lineage_modal_controller.js"},{name:"asset-preview",module:HN,filename:"asset_preview_controller.js"},{name:"audio-player",module:WN,filename:"audio_player_controller.js"},{name:"autofill-prevention",module:GN,filename:"autofill_prevention_controller.js"},{name:"autogrow",module:YN,filename:"autogrow_controller.js"},{name:"batch-analysis",module:KN,filename:"batch_analysis_controller.js"},{name:"bridge--form",module:t3,filename:"bridge/form_controller.js"},{name:"bulk",module:n3,filename:"bulk_controller.js"},{name:"chart",module:s3,filename:"chart_controller.js"},{name:"clipboard",module:E3,filename:"clipboard_controller.js"},{name:"command-palette",module:aB,filename:"command_palette_controller.js"},{name:"confetti",module:cB,filename:"confetti_controller.js"},{name:"confirm-submit",module:hB,filename:"confirm_submit_controller.js"},{name:"connection-test",module:fB,filename:"connection_test_controller.js"},{name:"connector-token-modal",module:gB,filename:"connector_token_modal_controller.js"},{name:"copy-button",module:bB,filename:"copy_button_controller.js"},{name:"default-project-access",module:yB,filename:"default_project_access_controller.js"},{name:"demo-analytics",module:wB,filename:"demo_analytics_controller.js"},{name:"demo-tooltip",module:SB,filename:"demo_tooltip_controller.js"},{name:"depot-selector",module:MB,filename:"depot_selector_controller.js"},{name:"depot-tree",module:AB,filename:"depot_tree_controller.js"},{name:"dirty-form",module:kB,filename:"dirty_form_controller.js"},{name:"dropdown",module:RB,filename:"dropdown_controller.js"},{name:"email-capture",module:LB,filename:"email_capture_controller.js"},{name:"file-upload",module:OB,filename:"file_upload_controller.js"},{name:"flash-toast",module:BB,filename:"flash_toast_controller.js"},{name:"git-replay",module:UB,filename:"git_replay_controller.js"},{name:"identity-onboarding",module:VB,filename:"identity_onboarding_controller.js"},{name:"integration-form",module:jB,filename:"integration_form_controller.js"},{name:"jenkins-credentials",module:$B,filename:"jenkins_credentials_controller.js"},{name:"jenkins-job-creator",module:qB,filename:"jenkins_job_creator_controller.js"},{name:"jenkins-trigger-setup",module:XB,filename:"jenkins_trigger_setup_controller.js"},{name:"job-selector",module:JB,filename:"job_selector_controller.js"},{name:"lightbox",module:QB,filename:"lightbox_controller.js"},{name:"manifest-json",module:eF,filename:"manifest_json_controller.js"},{name:"mentions",module:s4,filename:"mentions_controller.js"},{name:"mobile-nav",module:o4,filename:"mobile_nav_controller.js"},{name:"model-viewer",module:e5,filename:"model_viewer_controller.js"},{name:"multiple-existing-users",module:i5,filename:"multiple_existing_users_controller.js"},{name:"multiple-invitations",module:r5,filename:"multiple_invitations_controller.js"},{name:"notifications",module:a5,filename:"notifications_controller.js"},{name:"onboarding-form",module:c5,filename:"onboarding_form_controller.js"},{name:"onboarding-step",module:h5,filename:"onboarding_step_controller.js"},{name:"perforce-typeahead",module:f5,filename:"perforce_typeahead_controller.js"},{name:"pricing",module:g5,filename:"pricing_controller.js"},{name:"select",module:R5,filename:"select_controller.js"},{name:"setup-helper",module:L5,filename:"setup_helper_controller.js"},{name:"setup-modal",module:O5,filename:"setup_modal_controller.js"},{name:"simple-file-upload",module:B5,filename:"simple_file_upload_controller.js"},{name:"steam-player-chart",module:U5,filename:"steam_player_chart_controller.js"},{name:"steam-publisher-key",module:V5,filename:"steam_publisher_key_controller.js"},{name:"story-scroll",module:j5,filename:"story_scroll_controller.js"},{name:"stripe--embedded-checkout",module:$5,filename:"stripe/embedded_checkout_controller.js"},{name:"stripe--payment-element",module:q5,filename:"stripe/payment_element_c
8650ontroller.js"},{name:"submit-busy",module:X5,filename:"submit_busy_controller.js"},{name:"task-modal",module:J5,filename:"task_modal_controller.js"},{name:"team-management",module:Q5,filename:"team_management_controller.js"},{name:"test",module:eV,filename:"test_controller.js"},{name:"theme",module:iV,filename:"theme_controller.js"},{name:"toggle-tabs",module:rV,filename:"toggle_tabs_controller.js"},{name:"tooltip",module:aV,filename:"tooltip_controller.js"},{name:"turbo-modal",module:cV,filename:"turbo_modal_controller.js"},{name:"turbo-native--sign-out",module:hV,filename:"turbo_native/sign_out_controller.js"},{name:"webhook-setup",module:fV,filename:"webhook_setup_controller.js"}],Jnt=yNt;var xNt=Object.defineProperty,wNt=(i,t,e)=>t in i?xNt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Rr=(i,t,e)=>wNt(i,typeof t!="symbol"?t+"":t,e);async function gV(i,t,e={}){t?await tit(i,e):await eit(i,e)}async function tit(i,t={}){let{transitionClasses:e,fromClasses:n,toClasses:s,toggleClass:r}=nit("Enter",i,t);return iit(i,{firstFrame(){i.classList.add(...e.split(" ")),i.classList.add(...n.split(" ")),i.classList.remove(...s.split(" ")),i.classList.remove(...r.split(" "))},secondFrame(){i.classList.remove(...n.split(" ")),i.classList.add(...s.split(" "))},ending(){i.classList.remove(...e.split(" "))}})}async function eit(i,t={}){let{transitionClasses:e,fromClasses:n,toClasses:s,toggleClass:r}=nit("Leave",i,t);return iit(i,{firstFrame(){i.classList.add(...n.split(" ")),i.classList.remove(...s.split(" ")),i.classList.add(...e.split(" "))},secondFrame(){i.classList.remove(...n.split(" ")),i.classList.add(...s.split(" "))},ending(){i.classList.remove(...e.split(" ")),i.classList.add(...r.split(" "))}})}function nit(i,t,e){return{transitionClasses:t.dataset[`transition${i}`]||e[i.toLowerCase()]||i.toLowerCase(),fromClasses:t.dataset[`transition${i}From`]||e[`${i.toLowerCase()}From`]||`${i.toLowerCase()}-from`,toClasses:t.dataset[`transition${i}To`]||e[`${i.toLowerCase()}To`]||`${i.toLowerCase()}-to`,toggleClass:t.dataset.toggleClass||e.toggleClass||e.toggle||"hidden"}}function _Nt(i){i._stimulus_transition={timeout:null,interrupted:!1}}function SNt(i){i._stimulus_transition&&i._stimulus_transition.interrupt&&i._stimulus_transition.interrupt()}function iit(i,t){i._stimulus_transition&&SNt(i);let e,n,s;return _Nt(i),i._stimulus_transition.cleanup=()=>{n||t.firstFrame(),s||t.secondFrame(),t.ending(),i._stimulus_transition=null},i._stimulus_transition.interrupt=()=>{e=!0,i._stimulus_transition.timeout&&clearTimeout(i._stimulus_transition.timeout),i._stimulus_transition.cleanup()},new Promise(r=>{e||requestAnimationFrame(()=>{e||(t.firstFrame(),n=!0,requestAnimationFrame(()=>{e||(t.secondFrame(),s=!0,i._stimulus_transition&&(i._stimulus_transition.timeout=setTimeout(()=>{if(e){r();return}i._stimulus_transition.cleanup(),r()},CNt(i))))}))})})}function CNt(i){let t=Number(getComputedStyle(i).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,e=Number(getComputedStyle(i).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;return t===0&&(t=Number(getComputedStyle(i).animationDuration.replace("s",""))*1e3),t+e}var MNt=class extends le{connect(){setTimeout(()=>{tit(this.element)},this.showDelayValue),this.hasDismissAfterValue&&setTimeout(()=>{this.close()},this.dismissAfterValue)}close(){eit(this.element).then(()=>{this.element.remove()})}};Rr(MNt,"values",{dismissAfter:Number,showDelay:{type:Number,default:0}});var Znt=class extends le{connect(){this.timeout=null}save(){clearTimeout(this.timeout),this.timeout=setTimeout(()=>{this.statusTarget.textContent=this.submittingTextValue,this.formTarget.requestSubmit()},this.submitDurationValue)}success(){this.setStatus(this.successTextValue)}error(){this.setStatus(this.errorTextValue)}setStatus(i){this.statusTarget.textContent=i,this.timeout=setTimeout(()=>{this.statusTarget.textContent=""},this.statusDurationValue)}};Rr(Znt,"targets",["form","status"]),Rr(Znt,"values",{submitDuration:{type:Number,default:1e3},statusDuration:{type:Number,default:2e3},submittingText:{type:String,default:"Saving..."},successText:{type:String,default:"Saved!"},errorText:{type:String,default:"Unable to save."}});var Qnt=class extends le{update(){this.preview=this.colorTarget.value}set preview(i){this.previewTarget.style[this.styleValue]=i;let t=this._getContrastYIQ(i);this.styleValue==="color"?this.previewTarget.style.backgroundColor=t:this.previewTarget.style.color=t}_getContrastYIQ(i){i=i.replace("#","");let t=128,e=parseInt(i.substr(0,2),16),n=parseInt(i.substr(2,2),16),s=parseInt(i.substr(4,2),16);return(e*299+n*587+s*114)/1e3>=t?"#000":"#fff"}};Rr(Qnt,"targets",["preview","color"]),Rr(Qnt,"values",{style:{type:String,default:"backgroundColor"}});var pV=class extends le{connect(){this.boundBeforeCache=this.beforeCache.bind(this),document.addEventListener("turbo:before-cache",this.boundBeforeCache)}disconnect(){document.removeEventListener("turbo:before-cache",this.boundBeforeCache)}openValueChanged(){gV(this.menuTarget,this.openValue,this.transitionOptions),this.openValue===!0&&this.hasMenuItemTarget&&this.menuItemTargets[0].focus()}show(){this.openValue=!0}close(){this.openValue=!1}hide(i){this.closeOnClickOutsideValue&&i.target.nodeType&&this.element.contains(i.target)===!1&&this.openValue&&(this.openValue=!1),this.closeOnEscapeValue&&i.key==="Escape"&&this.openValue&&(this.openValue=!1)}toggle(){this.openValue=!this.openValue}nextItem(i){i.preventDefault(),this.menuItemTargets[this.nextIndex].focus()}previousItem(i){i.preventDefault(),this.menuItemTargets[this.previousIndex].focus()}get currentItemIndex(){return this.menuItemTargets.indexOf(document.activeElement)}get nextIndex(){return Math.min(this.currentItemIndex+1,this.menuItemTargets.length-1)}get previousIndex(){return Math.max(this.currentItemIndex-1,0)}get transitionOptions(){return{enter:this.hasEnterClass?this.enterClasses.join(" "):"transition ease-out duration-100",enterFrom:this.hasEnterFromClass?this.enterFromClasses.join(" "):"transform opacity-0 scale-95",enterTo:this.hasEnterToClass?this.enterToClasses.join(" "):"transform opacity-100 scale-100",leave:this.hasLeaveClass?this.leaveClasses.join(" "):"transition ease-in duration-75",leaveFrom:this.hasLeaveFromClass?this.leaveFromClasses.join(" "):"transform opacity-100 scale-100",leaveTo:this.hasLeaveToClass?this.leaveToClasses.join(" "):"transform opacity-0 scale-95",toggleClass:this.hasToggleClass?this.toggleClasses.join(" "):"hidden"}}beforeCache(){this.openValue=!1,this.hasMenuTarget&&this.menuTarget.classList.add(this.transitionOptions.toggleClass)}};Rr(pV,"targets",["menu","button","menuItem"]),Rr(pV,"values",{open:{type:Boolean,default:!1},closeOnEscape:{type:Boolean,default:!0},closeOnClickOutside:{type:Boolean,default:!0}}),Rr(pV,"classes",["enter","enterFrom","enterTo","leave","leaveFrom","leaveTo","toggle"]);var pP=class extends le{connect(){this.openValue&&this.open(),this.boundBeforeCache=this.beforeCache.bind(this),document.addEventListener("turbo:before-cache",this.boundBeforeCache)}disconnect(){document.removeEventListener("turbo:before-cache",this.boundBeforeCache)}open(){this.dialogTarget.showModal()}close(){this.dialogTarget.setAttribute("closing",""),Promise.all(this.dialogTarget.getAnimations().map(i=>i.finished)).then(()=>{this.dialogTarget.removeAttribute("closing"),this.dialogTarget.close()})}backdropClose(i){i.target.nodeName==="DIALOG"&&(window.getSelection().toString().length>0||this.close())}
8650show(){this.dialogTarget.show()}hide(){this.close()}beforeCache(){this.hasDialogTarget&&this.close()}};Rr(pP,"targets",["dialog"]),Rr(pP,"values",{open:Boolean});var gP=class extends le{openValueChanged(){gV(this.contentTarget,this.openValue),this.shouldAutoDismiss&&this.scheduleDismissal()}show(i){this.shouldAutoDismiss&&this.scheduleDismissal(),this.openValue=!0}hide(){this.openValue=!1}toggle(){this.openValue=!this.openValue}get shouldAutoDismiss(){return this.openValue&&this.hasDismissAfterValue}scheduleDismissal(){this.hasDismissAfterValue&&(this.cancelDismissal(),this.timeoutId=setTimeout(()=>{this.hide(),this.timeoutId=void 0},this.dismissAfterValue))}cancelDismissal(){typeof this.timeoutId=="number"&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)}};Rr(gP,"targets",["content"]),Rr(gP,"values",{dismissAfter:Number,open:{type:Boolean,default:!1}});var mP=class extends le{connect(){this.openValue&&this.open(),this.boundBeforeCache=this.beforeCache,document.addEventListener("turbo:before-cache",this.boundBeforeCache)}disconnect(){document.removeEventListener("turbo:before-cache",this.boundBeforeCache)}open(){this.dialogTarget.showModal()}close(){this.dialogTarget.setAttribute("closing",""),Promise.all(this.dialogTarget.getAnimations().map(i=>i.finished)).then(()=>{this.dialogTarget.removeAttribute("closing"),this.dialogTarget.close()})}backdropClose(i){i.target.nodeName==="DIALOG"&&(window.getSelection().toString().length>0||this.close())}show(){this.open()}hide(){this.close()}beforeCache(){this.hasDialogTarget&&this.close()}};Rr(mP,"targets",["dialog"]),Rr(mP,"values",{open:Boolean});var hS=class extends le{initialize(){this.updateAnchorValue&&this.anchor&&(this.indexValue=this.tabTargets.findIndex(i=>i.id===this.anchor))}connect(){this.showTab()}change(i){i.currentTarget.tagName==="SELECT"?this.indexValue=i.currentTarget.selectedIndex:i.currentTarget.dataset.index?this.indexValue=i.currentTarget.dataset.index:i.currentTarget.dataset.id?this.indexValue=this.tabTargets.findIndex(t=>t.id==i.currentTarget.dataset.id):this.indexValue=this.tabTargets.indexOf(i.currentTarget)}nextTab(){this.indexValue=Math.min(this.indexValue+1,this.tabsCount-1)}previousTab(){this.indexValue=Math.max(this.indexValue-1,0)}firstTab(){this.indexValue=0}lastTab(){this.indexValue=this.tabsCount-1}indexValueChanged(){if(this.showTab(),this.dispatch("tab-change",{target:this.tabTargets[this.indexValue],detail:{activeIndex:this.indexValue}}),this.updateAnchorValue){let i=this.tabTargets[this.indexValue].id;if(this.scrollToAnchorValue)location.hash=i;else{let t=window.location.href.split("#")[0]+"#"+i;typeof Turbo<"u"?Turbo.navigator.history.replace(new URL(t)):history.replaceState({},document.title,t)}}}showTab(){this.panelTargets.forEach((i,t)=>{let e=this.tabTargets[t];t===this.indexValue?(i.classList.remove("hidden"),e.ariaSelected="true",e.dataset.active=!0,this.hasInactiveTabClass&&e?.classList?.remove(...this.inactiveTabClasses),this.hasActiveTabClass&&e?.classList?.add(...this.activeTabClasses)):(i.classList.add("hidden"),e.ariaSelected=null,delete e.dataset.active,this.hasActiveTabClass&&e?.classList?.remove(...this.activeTabClasses),this.hasInactiveTabClass&&e?.classList?.add(...this.inactiveTabClasses))}),this.hasSelectTarget&&(this.selectTarget.selectedIndex=this.indexValue),this.scrollActiveTabIntoViewValue&&this.scrollToActiveTab()}scrollToActiveTab(){let i=this.element.querySelector("[aria-selected]");i&&i.scrollIntoView({inline:"center"})}get tabsCount(){return this.tabTargets.length}get anchor(){return document.URL.split("#").length>1?document.URL.split("#")[1]:null}};Rr(hS,"classes",["activeTab","inactiveTab"]),Rr(hS,"targets",["tab","panel","select"]),Rr(hS,"values",{index:0,updateAnchor:Boolean,scrollToAnchor:Boolean,scrollActiveTabIntoView:Boolean});var bP=class extends le{toggle(i){this.openValue=!this.openValue,this.animate()}toggleInput(i){this.openValue=i.target.checked,this.animate()}hide(){this.openValue=!1,this.animate()}show(){this.openValue=!0,this.animate()}animate(){this.toggleableTargets.forEach(i=>{gV(i,this.openValue)})}};Rr(bP,"targets",["toggleable"]),Rr(bP,"values",{open:{type:Boolean,default:!1}});var vP=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],pf={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(i){return typeof console<"u"&&console.warn(i)},getWeek:function(i){var t=new Date(i.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var e=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-e.getTime())/864e5-3+(e.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewB
8650ox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1};var yP={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(i){var t=i%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},xP=yP;var Eo=function(i,t){return t===void 0&&(t=2),("000"+i).slice(t*-1)},Ta=function(i){return i===!0?1:0};function mV(i,t){var e;return function(){var n=this,s=arguments;clearTimeout(e),e=setTimeout(function(){return i.apply(n,s)},t)}}var wP=function(i){return i instanceof Array?i:[i]};function ko(i,t,e){if(e===!0)return i.classList.add(t);i.classList.remove(t)}function Oi(i,t,e){var n=window.document.createElement(i);return t=t||"",e=e||"",n.className=t,e!==void 0&&(n.textContent=e),n}function dS(i){for(;i.firstChild;)i.removeChild(i.firstChild)}function bV(i,t){if(t(i))return i;if(i.parentNode)return bV(i.parentNode,t)}function fS(i,t){var e=Oi("div","numInputWrapper"),n=Oi("input","numInput "+i),s=Oi("span","arrowUp"),r=Oi("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?n.type="number":(n.type="text",n.pattern="\\d*"),t!==void 0)for(var o in t)n.setAttribute(o,t[o]);return e.appendChild(n),e.appendChild(s),e.appendChild(r),e}function Aa(i){try{if(typeof i.composedPath=="function"){var t=i.composedPath();return t[0]}return i.target}catch{return i.target}}var vV=function(){},pS=function(i,t,e){return e.months[t?"shorthand":"longhand"][i]},sit={D:vV,F:function(i,t,e){i.setMonth(e.months.longhand.indexOf(t))},G:function(i,t){i.setHours((i.getHours()>=12?12:0)+parseFloat(t))},H:function(i,t){i.setHours(parseFloat(t))},J:function(i,t){i.setDate(parseFloat(t))},K:function(i,t,e){i.setHours(i.getHours()%12+12*Ta(new RegExp(e.amPM[1],"i").test(t)))},M:function(i,t,e){i.setMonth(e.months.shorthand.indexOf(t))},S:function(i,t){i.setSeconds(parseFloat(t))},U:function(i,t){return new Date(parseFloat(t)*1e3)},W:function(i,t,e){var n=parseInt(t),s=new Date(i.getFullYear(),0,2+(n-1)*7,0,0,0,0);return s.setDate(s.getDate()-s.getDay()+e.firstDayOfWeek),s},Y:function(i,t){i.setFullYear(parseFloat(t))},Z:function(i,t){return new Date(t)},d:function(i,t){i.setDate(parseFloat(t))},h:function(i,t){i.setHours((i.getHours()>=12?12:0)+parseFloat(t))},i:function(i,t){i.setMinutes(parseFloat(t))},j:function(i,t){i.setDate(parseFloat(t))},l:vV,m:function(i,t){i.setMonth(parseFloat(t)-1)},n:function(i,t){i.setMonth(parseFloat(t)-1)},s:function(i,t){i.setSeconds(parseFloat(t))},u:function(i,t){return new Date(parseFloat(t))},w:vV,y:function(i,t){i.setFullYear(2e3+parseFloat(t))}},Ch={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},Av={Z:function(i){return i.toISOString()},D:function(i,t,e){return t.weekdays.shorthand[Av.w(i,t,e)]},F:function(i,t,e){return pS(Av.n(i,t,e)-1,!1,t)},G:function(i,t,e){return Eo(Av.h(i,t,e))},H:function(i){return Eo(i.getHours())},J:function(i,t){return t.ordinal!==void 0?i.getDate()+t.ordinal(i.getDate()):i.getDate()},K:function(i,t){return t.amPM[Ta(i.getHours()>11)]},M:function(i,t){return pS(i.getMonth(),!0,t)}
vendor: 12,148 bytes, line 8650
8650,S:function(i){return Eo(i.getSeconds())},U:function(i){return i.getTime()/1e3},W:function(i,t,e){return e.getWeek(i)},Y:function(i){return Eo(i.getFullYear(),4)},d:function(i){return Eo(i.getDate())},h:function(i){return i.getHours()%12?i.getHours()%12:12},i:function(i){return Eo(i.getMinutes())},j:function(i){return i.getDate()},l:function(i,t){return t.weekdays.longhand[i.getDay()]},m:function(i){return Eo(i.getMonth()+1)},n:function(i){return i.getMonth()+1},s:function(i){return i.getSeconds()},u:function(i){return i.getTime()},w:function(i){return i.getDay()},y:function(i){return String(i.getFullYear()).substring(2)}};var yV=function(i){var t=i.config,e=t===void 0?pf:t,n=i.l10n,s=n===void 0?yP:n,r=i.isMobile,o=r===void 0?!1:r;return function(a,l,c){var u=c||s;return e.formatDate!==void 0&&!o?e.formatDate(a,l,u):l.split("").map(function(h,d,p){return Av[h]&&p[d-1]!=="\\"?Av[h](a,u,e):h!=="\\"?h:""}).join("")}},_P=function(i){var t=i.config,e=t===void 0?pf:t,n=i.l10n,s=n===void 0?yP:n;return function(r,o,a,l){if(!(r!==0&&!r)){var c=l||s,u,h=r;if(r instanceof Date)u=new Date(r.getTime());else if(typeof r!="string"&&r.toFixed!==void 0)u=new Date(r);else if(typeof r=="string"){var d=o||(e||pf).dateFormat,p=String(r).trim();if(p==="today")u=new Date,a=!0;else if(e&&e.parseDate)u=e.parseDate(r,d);else if(/Z$/.test(p)||/GMT$/.test(p))u=new Date(r);else{for(var g=void 0,y=[],x=0,w=0,M="";x<d.length;x++){var A=d[x],C=A==="\\",R=d[x-1]==="\\"||C;if(Ch[A]&&!R){M+=Ch[A];var k=new RegExp(M).exec(r);k&&(g=!0)&&y[A!=="Y"?"push":"unshift"]({fn:sit[A],val:k[++w]})}else C||(M+=".")}u=!e||!e.noCalendar?new Date(new Date().getFullYear(),0,1,0,0,0,0):new Date(new Date().setHours(0,0,0,0)),y.forEach(function(O){var I=O.fn,U=O.val;return u=I(u,U,c)||u}),u=g?u:void 0}}if(!(u instanceof Date&&!isNaN(u.getTime()))){e.errorHandler(new Error("Invalid date provided: "+h));return}return a===!0&&u.setHours(0,0,0,0),u}}};function Ea(i,t,e){return e===void 0&&(e=!0),e!==!1?new Date(i.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):i.getTime()-t.getTime()}var rit=function(i,t,e){return i>Math.min(t,e)&&i<Math.max(t,e)},SP=function(i,t,e){return i*3600+t*60+e},oit=function(i){var t=Math.floor(i/3600),e=(i-t*3600)/60;return[t,e,i-t*3600-e*60]},ait={DAY:864e5};function CP(i){var t=i.defaultHour,e=i.defaultMinute,n=i.defaultSeconds;if(i.minDate!==void 0){var s=i.minDate.getHours(),r=i.minDate.getMinutes(),o=i.minDate.getSeconds();t<s&&(t=s),t===s&&e<r&&(e=r),t===s&&e===r&&n<o&&(n=i.minDate.getSeconds())}if(i.maxDate!==void 0){var a=i.maxDate.getHours(),l=i.maxDate.getMinutes();t=Math.min(t,a),t===a&&(e=Math.min(l,e)),t===a&&e===l&&(n=i.maxDate.getSeconds())}return{hours:t,minutes:e,seconds:n}}typeof Object.assign!="function"&&(Object.assign=function(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];if(!i)throw TypeError("Cannot convert undefined or null to object");for(var n=function(a){a&&Object.keys(a).forEach(function(l){return i[l]=a[l]})},s=0,r=t;s<r.length;s++){var o=r[s];n(o)}return i});var Po=function(){return Po=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},Po.apply(this,arguments)},lit=function(){for(var i=0,t=0,e=arguments.length;t<e;t++)i+=arguments[t].length;for(var n=Array(i),s=0,t=0;t<e;t++)for(var r=arguments[t],o=0,a=r.length;o<a;o++,s++)n[s]=r[o];return n},TNt=300;function ANt(i,t){var e={config:Po(Po({},pf),vr.defaultConfig),l10n:xP};e.parseDate=_P({config:e.config,l10n:e.l10n}),e._handlers=[],e.pluginElements=[],e.loadedPlugins=[],e._bind=y,e._setHoursFromDate=d,e._positionCalendar=we,e.changeMonth=yt,e.changeYear=Bt,e.clear=kt,e.close=Wt,e.onMouseOver=zt,e._createElement=Oi,e.createDay=k,e.destroy=jt,e.isEnabled=Gt,e.jumpToDate=M,e.updateValue=Re,e.open=it,e.redraw=en,e.set=mt,e.setDate=Vt,e.toggle=_t;function n(){e.utils={getDaysInMonth:function(J,lt){return J===void 0&&(J=e.currentMonth),lt===void 0&&(lt=e.currentYear),J===1&&(lt%4===0&&lt%100!==0||lt%400===0)?29:e.l10n.daysInMonth[J]}}}function s(){e.element=e.input=i,e.isOpen=!1,ft(),ve(),Se(),Nt(),n(),e.isMobile||R(),w(),(e.selectedDates.length||e.config.noCalendar)&&(e.config.enableTime&&d(e.config.noCalendar?e.latestSelectedDateObj:void 0),Re(!1)),a();var J=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!e.isMobile&&J&&we(),Zt("onReady")}function r(){var J;return((J=e.calendarContainer)===null||J===void 0?void 0:J.getRootNode()).activeElement||document.activeElement}function o(J){return J.bind(e)}function a(){var J=e.config;J.weekNumbers===!1&&J.showMonths===1||J.noCalendar!==!0&&window.requestAnimationFrame(function(){if(e.calendarContainer!==void 0&&(e.calendarContainer.style.visibility="hidden",e.calendarContainer.style.display="block"),e.daysContainer!==void 0){var lt=(e.days.offsetWidth+1)*J.showMonths;e.daysContainer.style.width=lt+"px",e.calendarContainer.style.width=lt+(e.weekWrapper!==void 0?e.weekWrapper.offsetWidth:0)+"px",e.calendarContainer.style.removeProperty("visibility"),e.calendarContainer.style.removeProperty("display")}})}function l(J){if(e.selectedDates.length===0){var lt=e.config.minDate===void 0||Ea(new Date,e.config.minDate)>=0?new Date:new Date(e.config.minDate.getTime()),xt=CP(e.config);lt.setHours(xt.hours,xt.minutes,xt.seconds,lt.getMilliseconds()),e.selectedDates=[lt],e.latestSelectedDateObj=lt}J!==void 0&&J.type!=="blur"&&Ee(J);var At=e._input.value;h(),Re(),e._input.value!==At&&e._debouncedChange()}function c(J,lt){return J%12+12*Ta(lt===e.l10n.amPM[1])}function u(J){switch(J%24){case 0:case 12:return 12;default:return J%12}}function h(){if(!(e.hourElement===void 0||e.minuteElement===void 0)){var J=(parseInt(e.hourElement.value.slice(-2),10)||0)%24,lt=(parseInt(e.minuteElement.value,10)||0)%60,xt=e.secondElement!==void 0?(parseInt(e.secondElement.value,10)||0)%60:0;e.amPM!==void 0&&(J=c(J,e.amPM.textContent));var At=e.config.minTime!==void 0||e.config.minDate&&e.minDateHasTime&&e.latestSelectedDateObj&&Ea(e.latestSelectedDateObj,e.config.minDate,!0)===0,st=e.config.maxTime!==void 0||e.config.maxDate&&e.maxDateHasTime&&e.latestSelectedDateObj&&Ea(e.latestSelectedDateObj,e.config.maxDate,!0)===0;if(e.config.maxTime!==void 0&&e.config.minTime!==void 0&&e.config.minTime>e.config.maxTime){var rt=SP(e.config.minTime.getHours(),e.config.minTime.getMinutes(),e.config.minTime.getSeconds()),Tt=SP(e.config.maxTime.getHours(),e.config.maxTime.getMinutes(),e.config.maxTime.getSeconds()),Dt=SP(J,lt,xt);if(Dt>Tt&&Dt<rt){var he=oit(rt);J=he[0],lt=he[1],xt=he[2]}}else{if(st){var se=e.config.maxTime!==void 0?e.config.maxTime:e.config.maxDate;J=Math.min(J,se.getHours()),J===se.getHours()&&(lt=Math.min(lt,se.getMinutes())),lt===se.getMinutes()&&(xt=Math.min(xt,se.getSeconds()))}if(At){var ye=e.config.minTime!==void 0?e.config.minTime:e.config.minDate;J=Math.max(J,ye.getHours()),J===ye.getHours()&&lt<ye.getMinutes()&&(lt=ye.getMinutes()),lt===ye.getMinutes()&&(xt=Math.max(xt,ye.getSeconds()))}}p(J,lt,xt)}}function d(J){var lt=J||e.latestSelectedDateObj;lt&&lt instanceof Date&&p(lt.getHours(),lt.getMinutes(),lt.getSeconds())}function p(J,lt,xt){e.latestSelectedDateObj!==void 0&&e.latestSelectedDateObj.setHours(J%24,lt,xt||0,0),!(!e.hourElement||!e.minuteElement||e.isMobile)&&(e.hourElement.value=Eo(e.config.time_24hr?J:(12+J)%12+12*Ta(J%12===0)),e.minuteElement.value=Eo(lt),e.amPM!==void 0&&(e.amPM.textContent=e.l10n.amPM[Ta(J>=12)]),e.secondElement!==void 0&&(e.secondElement.value=Eo(xt)))}function g(J){var lt=Aa(J),xt=parseInt(lt.value)+(J.delta||0);(xt/1e3>1||J.key==="Enter"&&!/[^\d]/.test(xt.toString()))&&Bt(xt)}function y(J,lt,xt,At){if(lt instanceof Array)return lt.forEach(function(st){return y(J,st,xt,At)});if(J instanceof Array)return J.forEach(function(st){return y(st,lt,xt,At)});J.addEventListener(lt,xt,At),e._handlers.push({remove:function(){return J.removeEventListener(lt,xt,At)}})}function x(){Zt("onChange")}function w(){if(e.config.wrap&&["open","close","toggle","clear"].forEach(function(xt){Array.prototype.forEach.call(e.element.querySelectorAll("[data-"+xt+"]"),function(At){return y(At,"click",e[xt])})}),e.isMobile){ie();return}var J=mV(St,50);if(e._debouncedChange=mV(x,TNt),e.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&y(e.daysContainer,"mouseover",function(xt){e.config.mode==="range"&&zt(Aa(xt))}),y(e._input,"keydown",Ut),e.calendarContainer!==void 0&&y(e.calendarContainer,"keydown",Ut),!e.config.inline&&!e.config.static&&y(window,"resize",J),window.ontouchstart!==void 0?y(window.document,"touchstart",ee):y(window.document,"mousedown",ee),y(window.document,"focus",ee,{capture:!0}),e.config.clickOpens===!0&&(y(e._input,"focus",e.open),y(e._input,"click",e.open)),e.daysContainer!==void 0&&(y(e.monthNav,"click",Ft),y(e.monthNav,["keyup","increment"],g),y(e.daysContainer,"click",Cn)),e.timeContainer!==void 0&&e.minuteElement!==void 0&&e.hourElement!==void 0){var lt=function(xt){return Aa(xt).select()};y(e.timeContainer,["increment"],l),y(e.timeContainer,"blur",l,{capture:!0}),y(e.timeContainer,"click",A),y([e.hourElement,e.minuteElement],["focus","click"],lt),e.secondElement!==void 0&&y(e.secondElement,"focus",function(){return e.secondElement&&e.secondElement.select()}),e.amPM!==void 0&&y(e.amPM,"click",function(xt){l(xt)})}e.config.allowInput&&y(e._input,"blur",xe)}function M(J,lt){var xt=J!==void 0?e.parseDate(J):e.latestSelectedDateObj||(e.config.minDate&&e.config.minDate>e.now?e.config.minDate:e.config.maxDate&&e.config.maxDate<e.now?e.config.maxDate:e.now),At=e.currentYear,st=e.currentMonth;try{xt!==void 0&&(e.currentYear=xt.getFullYear(),e.currentMonth=xt.getMonth())}catch(rt){rt.message="Invalid date supplied: "+xt,e.config.errorHandler(rt)}lt&&e.currentYear!==At&&(Zt("onYearChange"),j()),lt&&(e.currentYear!==At||e.currentMonth!==st)&&Zt("onMonthChange"),e.redraw()}function A(J){var lt=Aa(J);~lt.className.indexOf("arrow")&&C(J,lt.classList.contains("arrowUp")?1:-1)}function C(J,lt,xt){var At=J&&Aa(J),st=xt||At&&At.parentNode&&At.parentNode.firstChild,rt=fe("increment");rt.delta=lt,st&&st.dispatchEvent(rt)}function R(){var J=window.document.createDocumentFragment();if(e.calendarContainer=Oi("div","flatpickr-calendar"),e.calendarContainer.tabIndex=-1,!e.config.noCalendar){if(J.appendChild(at()),e.innerContainer=Oi("div","flatpickr-innerContainer"),e.config.weekNumbers){var lt=vt(),xt=lt.weekWrapper,At=lt.weekNumbers;e.innerContainer.appendChild(xt),e.weekNumbers=At,e.weekWrapper=xt}e.rContainer=Oi("div","flatpickr-rContainer"),e.rContainer.appendChild(pt()),e.daysContainer||(e.daysContainer=Oi("div","flatpickr-days"),e.daysContainer.tabIndex=-1),X(),e.rContainer.appendChild(e.daysContainer),e.innerContainer.appendChild(e.rContainer),J.appendChild(e.innerContainer)}e.config.enableTime&&J.appendChild(ct()),ko(e.calendarContainer,"rangeMode",e.config.mode==="range"),ko(e.calendarContainer,"animate",e.config.animate===!0),ko(e.calendarContainer,"multiMonth",e.config.showMonths>1),e.calendarContainer.appendChild(J);var st=e.config.appendTo!==void 0&&e.config.appendTo.nodeType!==void 0;if((e.config.inline||e.config.static)&&(e.calendarContainer.classList.add(e.config.inline?"inline":"static"),e.config.inline&&(!st&&e.element.parentNode?e.element.parentNode.insertBefore(e.calendarContainer,e._input.nextSibling):e.config.appendTo!==void 0&&e.config.appendTo.appendChild(e.calendarContainer)),e.config.static)){var rt=Oi("div","flatpickr-wrapper");e.element.parentNode&&e.element.parentNode.insertBefore(rt,e.element),rt.appendChild(e.element),e.altInput&&rt.appendChild(e.altInput),rt.appendChild(e.calendarContainer)}!e.config.static&&!e.config.inline&&(e.config.appendTo!==void 0?e.config.appendTo:window.document.body).appendChild(e.calendarContainer)}function k(J,lt,xt,At){var st=Gt(lt,!0),rt=Oi("span",J,lt.getDate().toString());return rt.dateObj=lt,rt.$i=At,rt.setAttribute("aria-label",e.formatDate(lt,e.config.ariaDateFormat)),J.indexOf("hidden")===-1&&Ea(lt,e.now)===0&&(e.todayDateElem=rt,rt.classList.add("today"),rt.setAttribute("aria-current","date")),st?(rt.tabIndex=-1,
vendor: 8,375 bytes, line 8650
8650ce(lt)&&(rt.classList.add("selected"),e.selectedDateElem=rt,e.config.mode==="range"&&(ko(rt,"startRange",e.selectedDates[0]&&Ea(lt,e.selectedDates[0],!0)===0),ko(rt,"endRange",e.selectedDates[1]&&Ea(lt,e.selectedDates[1],!0)===0),J==="nextMonthDay"&&rt.classList.add("inRange")))):rt.classList.add("flatpickr-disabled"),e.config.mode==="range"&&pe(lt)&&!ce(lt)&&rt.classList.add("inRange"),e.weekNumbers&&e.config.showMonths===1&&J!=="prevMonthDay"&&At%7===6&&e.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+e.config.getWeek(lt)+"</span>"),Zt("onDayCreate",rt),rt}function O(J){J.focus(),e.config.mode==="range"&&zt(J)}function I(J){for(var lt=J>0?0:e.config.showMonths-1,xt=J>0?e.config.showMonths:-1,At=lt;At!=xt;At+=J)for(var st=e.daysContainer.children[At],rt=J>0?0:st.children.length-1,Tt=J>0?st.children.length:-1,Dt=rt;Dt!=Tt;Dt+=J){var he=st.children[Dt];if(he.className.indexOf("hidden")===-1&&Gt(he.dateObj))return he}}function U(J,lt){for(var xt=J.className.indexOf("Month")===-1?J.dateObj.getMonth():e.currentMonth,At=lt>0?e.config.showMonths:-1,st=lt>0?1:-1,rt=xt-e.currentMonth;rt!=At;rt+=st)for(var Tt=e.daysContainer.children[rt],Dt=xt-e.currentMonth===rt?J.$i+lt:lt<0?Tt.children.length-1:0,he=Tt.children.length,se=Dt;se>=0&&se<he&&se!=(lt>0?he:-1);se+=st){var ye=Tt.children[se];if(ye.className.indexOf("hidden")===-1&&Gt(ye.dateObj)&&Math.abs(J.$i-se)>=Math.abs(lt))return O(ye)}e.changeMonth(st),V(I(st),0)}function V(J,lt){var xt=r(),At=Qt(xt||document.body),st=J!==void 0?J:At?xt:e.selectedDateElem!==void 0&&Qt(e.selectedDateElem)?e.selectedDateElem:e.todayDateElem!==void 0&&Qt(e.todayDateElem)?e.todayDateElem:I(lt>0?1:-1);st===void 0?e._input.focus():At?U(st,lt):O(st)}function q(J,lt){for(var xt=(new Date(J,lt,1).getDay()-e.l10n.firstDayOfWeek+7)%7,At=e.utils.getDaysInMonth((lt-1+12)%12,J),st=e.utils.getDaysInMonth(lt,J),rt=window.document.createDocumentFragment(),Tt=e.config.showMonths>1,Dt=Tt?"prevMonthDay hidden":"prevMonthDay",he=Tt?"nextMonthDay hidden":"nextMonthDay",se=At+1-xt,ye=0;se<=At;se++,ye++)rt.appendChild(k("flatpickr-day "+Dt,new Date(J,lt-1,se),se,ye));for(se=1;se<=st;se++,ye++)rt.appendChild(k("flatpickr-day",new Date(J,lt,se),se,ye));for(var be=st+1;be<=42-xt&&(e.config.showMonths===1||ye%7!==0);be++,ye++)rt.appendChild(k("flatpickr-day "+he,new Date(J,lt+1,be%st),be,ye));var fn=Oi("div","dayContainer");return fn.appendChild(rt),fn}function X(){if(e.daysContainer!==void 0){dS(e.daysContainer),e.weekNumbers&&dS(e.weekNumbers);for(var J=document.createDocumentFragment(),lt=0;lt<e.config.showMonths;lt++){var xt=new Date(e.currentYear,e.currentMonth,1);xt.setMonth(e.currentMonth+lt),J.appendChild(q(xt.getFullYear(),xt.getMonth()))}e.daysContainer.appendChild(J),e.days=e.daysContainer.firstChild,e.config.mode==="range"&&e.selectedDates.length===1&&zt()}}function j(){if(!(e.config.showMonths>1||e.config.monthSelectorType!=="dropdown")){var J=function(At){return e.config.minDate!==void 0&&e.currentYear===e.config.minDate.getFullYear()&&At<e.config.minDate.getMonth()?!1:!(e.config.maxDate!==void 0&&e.currentYear===e.config.maxDate.getFullYear()&&At>e.config.maxDate.getMonth())};e.monthsDropdownContainer.tabIndex=-1,e.monthsDropdownContainer.innerHTML="";for(var lt=0;lt<12;lt++)if(J(lt)){var xt=Oi("option","flatpickr-monthDropdown-month");xt.value=new Date(e.currentYear,lt).getMonth().toString(),xt.textContent=pS(lt,e.config.shorthandCurrentMonth,e.l10n),xt.tabIndex=-1,e.currentMonth===lt&&(xt.selected=!0),e.monthsDropdownContainer.appendChild(xt)}}}function W(){var J=Oi("div","flatpickr-month"),lt=window.document.createDocumentFragment(),xt;e.config.showMonths>1||e.config.monthSelectorType==="static"?xt=Oi("span","cur-month"):(e.monthsDropdownContainer=Oi("select","flatpickr-monthDropdown-months"),e.monthsDropdownContainer.setAttribute("aria-label",e.l10n.monthAriaLabel),y(e.monthsDropdownContainer,"change",function(Tt){var Dt=Aa(Tt),he=parseInt(Dt.value,10);e.changeMonth(he-e.currentMonth),Zt("onMonthChange")}),j(),xt=e.monthsDropdownContainer);var At=fS("cur-year",{tabindex:"-1"}),st=At.getElementsByTagName("input")[0];st.setAttribute("aria-label",e.l10n.yearAriaLabel),e.config.minDate&&st.setAttribute("min",e.config.minDate.getFullYear().toString()),e.config.maxDate&&(st.setAttribute("max",e.config.maxDate.getFullYear().toString()),st.disabled=!!e.config.minDate&&e.config.minDate.getFullYear()===e.config.maxDate.getFullYear());var rt=Oi("div","flatpickr-current-month");return rt.appendChild(xt),rt.appendChild(At),lt.appendChild(rt),J.appendChild(lt),{container:J,yearElement:st,monthElement:xt}}function _(){dS(e.monthNav),e.monthNav.appendChild(e.prevMonthNav),e.config.showMonths&&(e.yearElements=[],e.monthElements=[]);for(var J=e.config.showMonths;J--;){var lt=W();e.yearElements.push(lt.yearElement),e.monthElements.push(lt.monthElement),e.monthNav.appendChild(lt.container)}e.monthNav.appendChild(e.nextMonthNav)}function at(){return e.monthNav=Oi("div","flatpickr-months"),e.yearElements=[],e.monthElements=[],e.prevMonthNav=Oi("span","flatpickr-prev-month"),e.prevMonthNav.innerHTML=e.config.prevArrow,e.nextMonthNav=Oi("span","flatpickr-next-month"),e.nextMonthNav.innerHTML=e.config.nextArrow,_(),Object.defineProperty(e,"_hidePrevMonthArrow",{get:function(){return e.__hidePrevMonthArrow},set:function(J){e.__hidePrevMonthArrow!==J&&(ko(e.prevMonthNav,"flatpickr-disabled",J),e.__hidePrevMonthArrow=J)}}),Object.defineProperty(e,"_hideNextMonthArrow",{get:function(){return e.__hideNextMonthArrow},set:function(J){e.__hideNextMonthArrow!==J&&(ko(e.nextMonthNav,"flatpickr-disabled",J),e.__hideNextMonthArrow=J)}}),e.currentYearElement=e.yearElements[0],Fe(),e.monthNav}function ct(){e.calendarContainer.classList.add("hasTime"),e.config.noCalendar&&e.calendarContainer.classList.add("noCalendar");var J=CP(e.config);e.timeContainer=Oi("div","flatpickr-time"),e.timeContainer.tabIndex=-1;var lt=Oi("span","flatpickr-time-separator",":"),xt=fS("flatpickr-hour",{"aria-label":e.l10n.hourAriaLabel});e.hourElement=xt.getElementsByTagName("input")[0];var At=fS("flatpickr-minute",{"aria-label":e.l10n.minuteAriaLabel});if(e.minuteElement=At.getElementsByTagName("input")[0],e.hourElement.tabIndex=e.minuteElement.tabIndex=-1,e.hourElement.value=Eo(e.latestSelectedDateObj?e.latestSelectedDateObj.getHours():e.config.time_24hr?J.hours:u(J.hours)),e.minuteElement.value=Eo(e.latestSelectedDateObj?e.latestSelectedDateObj.getMinutes():J.minutes),e.hourElement.setAttribute("step",e.config.hourIncrement.toString()),e.minuteElement.setAttribute("step",e.config.minuteIncrement.toString()),e.hourElement.setAttribute("min",e.config.time_24hr?"0":"1"),e.hourElement.setAttribute("max",e.config.time_24hr?"23":"12"),e.hourElement.setAttribute("maxlength","2"),e.minuteElement.setAttribute("min","0"),e.minuteElement.setAttribute("max","59"),e.minuteElement.setAttribute("maxlength","2"),e.timeContainer.appendChild(xt),e.timeContainer.appendChild(lt),e.timeContainer.appendChild(At),e.config.time_24hr&&e.timeContainer.classList.add("time24hr"),e.config.enableSeconds){e.timeContainer.classList.add("hasSeconds");var st=fS("flatpickr-second");e.secondElement=st.getElementsByTagName("input")[0],e.secondElement.value=Eo(e.latestSelectedDateObj?e.latestSelectedDateObj.getSeconds():J.seconds),e.secondElement.setAttribute("step",e.minuteElement.getAttribute("step")),e.secondElement.setAttribute("min","0"),e.secondElement.setAttribute("max","59"),e.secondElement.setAttribute("maxlength","2"),e.timeContainer.appendChild(Oi("span","flatpickr-time-separator",":")),e.timeContainer.appendChild(st)}return e.config.time_24hr||(e.amPM=Oi("span","flatpickr-am-pm",e.l10n.amPM[Ta((e.latestSelectedDateObj?e.hourElement.value:e.config.defaultHour)>11)]),e.amPM.title=e.l10n.toggleTitle,e.amPM.tabIndex=-1,e.timeContainer.appendChild(e.amPM)),e.timeContainer}function pt(){e.weekdayContainer?dS(e.weekdayContainer):e.weekdayContainer=Oi("div","flatpickr-weekdays");for(var J=e.config.showMonths;J--;){var lt=Oi("div","flatpickr-weekdaycontainer");e.weekdayContainer.appendChild(lt)}return Et(),e.weekdayContainer}function Et(){if(e.weekdayContainer){var J=e.l10n.firstDayOfWeek,lt=lit(e.l10n.weekdays.shorthand);J>0&&J<lt.length&&(lt=lit(lt.splice(J,lt.length),lt.splice(0,J)));for(var xt=e.config.showMonths;xt--;)e.weekdayContainer.children[xt].innerHTML=`
8651      <span class='flatpickr-weekday'>
8652        `+lt.join("</span><span class='flatpickr-weekday'>")+`
8653      </span>
8654      `}}function vt(){e.calendarContainer.classList.add("hasWeeks");var J=Oi("div","flatpickr-weekwrapper");J.appendChild(Oi("span","flatpickr-weekday",e.l10n.weekAbbreviation));var lt=Oi("div","flatpickr-weeks");return J.appendChild(lt),{weekWrapper:J,weekNumbers:lt}}function yt(J,lt){lt===void 0&&(lt=!0);var xt=lt?J:J-e.currentMonth;xt<0&&e._hidePrevMonthArrow===!0||xt>0&&e._hideNextMonthArrow===!0||(e.currentMonth+=xt,(e.currentMonth<0||e.currentMonth>11)&&(e.currentYear+=e.currentMonth>11?1:-1,e.currentMonth=(e.currentMonth+12)%12,Zt("onYearChange"),j()),X(),Zt("onMonthChange"),Fe())}function kt(J,lt){if(J===void 0&&(J=!0),lt===void 0&&(lt=!0),e.input.value="",e.altInput!==void 0&&(e.altInput.value=""),e.mobileInput!==void 0&&(e.mobileInput.value=""),e.selectedDates=[],e.latestSelectedDateObj=void 0,lt===!0&&(e.currentYear=e._initialDate.getFullYear(),e.currentMonth=e._initialDate.getMonth()),e.config.enableTime===!0){var xt=CP(e.config),At=xt.hours,st=xt.minutes,rt=xt.seconds;p(At,st,rt)}e.redraw(),J&&Zt("onChange")}function Wt(){e.isOpen=!1,e.isMobile||(e.calendarContainer!==void 0&&e.calendarContainer.classList.remove("open"),e._input!==void 0&&e._input.classList.remove("active")),Zt("onClose")}function jt(){e.config!==void 0&&Zt("onDestroy");for(var J=e._handlers.length;J--;)e._handlers[J].remove();if(e._handlers=[],e.mobileInput)e.mobileInput.parentNode&&e.mobileInput.parentNode.removeChild(e.mobileInput),e.mobileInput=void 0;else if(e.calendarContainer&&e.calendarContainer.parentNode)if(e.config.static&&e.calendarContainer.parentNode){var lt=e.calendarContainer.parentNode;if(lt.lastChild&&lt.removeChild(lt.lastChild),lt.parentNode){for(;lt.firstChild;)lt.parentNode.insertBefore(lt.firstChild,lt);lt.parentNode.removeChild(lt)}}else e.calendarContainer.parentNode.removeChild(e.calendarContainer);e.altInput&&(e.input.type="text",e.altInput.parentNode&&e.altInput.parentNode.removeChild(e.altInput),delete e.altInput),e.input&&(e.input.type=e.input._type,e.input.classList.remove("flatpickr-input"),e.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(xt){try{delete e[xt]}catch{}})}function ae(J){return e.calendarContainer.contains(J)}function ee(J){if(e.isOpen&&!e.config.inline){var lt=Aa(J),xt=ae(lt),At=lt===e.input||lt===e.altInput||e.element.contains(lt)||J.path&&J.path.indexOf&&(~J.path.indexOf(e.input)||~J.path.indexOf(e.altInput)),st=!At&&!xt&&!ae(J.relatedTarget),rt=!e.config.ignoredFocusElements.some(function(Tt){return Tt.contains(lt)});st&&rt&&(e.config.allowInput&&e.setDate(e._input.value,!1,e.config.altInput?e.config.altFormat:e.config.dateFormat),e.timeContainer!==void 0&&e.minuteElement!==void 0&&e.hourElement!==void 0&&e.input.value!==""&&e.input.value!==void 0&&l(),e.close(),e.config&&e.config.mode==="range"&&e.selectedDates.length===1&&e.clear(!1))}}function Bt(J){if(!(!J||e.config.minDate&&J<e.config.minDate.getFullYear()||e.config.maxDate&&J>e.config.maxDate.getFullYear())){var lt=J,xt=e.currentYear!==lt;e.currentYear=lt||e.currentYear,e.config.maxDate&&e.currentYear===e.config.maxDate.getFullYear()?e.currentMonth=Math.min(e.config.maxDate.getMonth(),e.currentMonth):e.config.minDate&&e.currentYear===e.config.minDate.getFullYear()&&(e.currentMonth=Math.max(e.config.minDate.getMonth(),e.currentMonth)),xt&&(e.redraw(),Zt("onYearChange"),j())}}function Gt(J,lt){var xt;lt===void 0&&(lt=!0);var At=e.parseDate(J,void 0,lt);
vendor: 3,358 bytes, line 8654
8654if(e.config.minDate&&At&&Ea(At,e.config.minDate,lt!==void 0?lt:!e.minDateHasTime)<0||e.config.maxDate&&At&&Ea(At,e.config.maxDate,lt!==void 0?lt:!e.maxDateHasTime)>0)return!1;if(!e.config.enable&&e.config.disable.length===0)return!0;if(At===void 0)return!1;for(var st=!!e.config.enable,rt=(xt=e.config.enable)!==null&&xt!==void 0?xt:e.config.disable,Tt=0,Dt=void 0;Tt<rt.length;Tt++){if(Dt=rt[Tt],typeof Dt=="function"&&Dt(At))return st;if(Dt instanceof Date&&At!==void 0&&Dt.getTime()===At.getTime())return st;if(typeof Dt=="string"){var he=e.parseDate(Dt,void 0,!0);return he&&he.getTime()===At.getTime()?st:!st}else if(typeof Dt=="object"&&At!==void 0&&Dt.from&&Dt.to&&At.getTime()>=Dt.from.getTime()&&At.getTime()<=Dt.to.getTime())return st}return!st}function Qt(J){return e.daysContainer!==void 0?J.className.indexOf("hidden")===-1&&J.className.indexOf("flatpickr-disabled")===-1&&e.daysContainer.contains(J):!1}function xe(J){var lt=J.target===e._input,xt=e._input.value.trimEnd()!==je();lt&&xt&&!(J.relatedTarget&&ae(J.relatedTarget))&&e.setDate(e._input.value,!0,J.target===e.altInput?e.config.altFormat:e.config.dateFormat)}function Ut(J){var lt=Aa(J),xt=e.config.wrap?i.contains(lt):lt===e._input,At=e.config.allowInput,st=e.isOpen&&(!At||!xt),rt=e.config.inline&&xt&&!At;if(J.keyCode===13&&xt){if(At)return e.setDate(e._input.value,!0,lt===e.altInput?e.config.altFormat:e.config.dateFormat),e.close(),lt.blur();e.open()}else if(ae(lt)||st||rt){var Tt=!!e.timeContainer&&e.timeContainer.contains(lt);switch(J.keyCode){case 13:Tt?(J.preventDefault(),l(),It()):Cn(J);break;case 27:J.preventDefault(),It();break;case 8:case 46:xt&&!e.config.allowInput&&(J.preventDefault(),e.clear());break;case 37:case 39:if(!Tt&&!xt){J.preventDefault();var Dt=r();if(e.daysContainer!==void 0&&(At===!1||Dt&&Qt(Dt))){var he=J.keyCode===39?1:-1;J.ctrlKey?(J.stopPropagation(),yt(he),V(I(1),0)):V(void 0,he)}}else e.hourElement&&e.hourElement.focus();break;case 38:case 40:J.preventDefault();var se=J.keyCode===40?1:-1;e.daysContainer&&lt.$i!==void 0||lt===e.input||lt===e.altInput?J.ctrlKey?(J.stopPropagation(),Bt(e.currentYear-se),V(I(1),0)):Tt||V(void 0,se*7):lt===e.currentYearElement?Bt(e.currentYear-se):e.config.enableTime&&(!Tt&&e.hourElement&&e.hourElement.focus(),l(J),e._debouncedChange());break;case 9:if(Tt){var ye=[e.hourElement,e.minuteElement,e.secondElement,e.amPM].concat(e.pluginElements).filter(function(qe){return qe}),be=ye.indexOf(lt);if(be!==-1){var fn=ye[be+(J.shiftKey?-1:1)];J.preventDefault(),(fn||e._input).focus()}}else!e.config.noCalendar&&e.daysContainer&&e.daysContainer.contains(lt)&&J.shiftKey&&(J.preventDefault(),e._input.focus());break;default:break}}if(e.amPM!==void 0&&lt===e.amPM)switch(J.key){case e.l10n.amPM[0].charAt(0):case e.l10n.amPM[0].charAt(0).toLowerCase():e.amPM.textContent=e.l10n.amPM[0],h(),Re();break;case e.l10n.amPM[1].charAt(0):case e.l10n.amPM[1].charAt(0).toLowerCase():e.amPM.textContent=e.l10n.amPM[1],h(),Re();break}(xt||ae(lt))&&Zt("onKeyDown",J)}function zt(J,lt){if(lt===void 0&&(lt="flatpickr-day"),!(e.selectedDates.length!==1||J&&(!J.classList.contains(lt)||J.classList.contains("flatpickr-disabled")))){for(var xt=J?J.dateObj.getTime():e.days.firstElementChild.dateObj.getTime(),At=e.parseDate(e.selectedDates[0],void 0,!0).getTime(),st=Math.min(xt,e.selectedDates[0].getTime()),rt=Math.max(xt,e.
vendor: 9,702 bytes, line 8654
8654selectedDates[0].getTime()),Tt=!1,Dt=0,he=0,se=st;se<rt;se+=ait.DAY)Gt(new Date(se),!0)||(Tt=Tt||se>st&&se<rt,se<At&&(!Dt||se>Dt)?Dt=se:se>At&&(!he||se<he)&&(he=se));var ye=Array.from(e.rContainer.querySelectorAll("*:nth-child(-n+"+e.config.showMonths+") > ."+lt));ye.forEach(function(be){var fn=be.dateObj,qe=fn.getTime(),xn=Dt>0&&qe<Dt||he>0&&qe>he;if(xn){be.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(vn){be.classList.remove(vn)});return}else if(Tt&&!xn)return;["startRange","inRange","endRange","notAllowed"].forEach(function(vn){be.classList.remove(vn)}),J!==void 0&&(J.classList.add(xt<=e.selectedDates[0].getTime()?"startRange":"endRange"),At<xt&&qe===At?be.classList.add("startRange"):At>xt&&qe===At&&be.classList.add("endRange"),qe>=Dt&&(he===0||qe<=he)&&rit(qe,At,xt)&&be.classList.add("inRange"))})}}function St(){e.isOpen&&!e.config.static&&!e.config.inline&&we()}function it(J,lt){if(lt===void 0&&(lt=e._positionElement),e.isMobile===!0){if(J){J.preventDefault();var xt=Aa(J);xt&&xt.blur()}e.mobileInput!==void 0&&(e.mobileInput.focus(),e.mobileInput.click()),Zt("onOpen");return}else if(e._input.disabled||e.config.inline)return;var At=e.isOpen;e.isOpen=!0,At||(e.calendarContainer.classList.add("open"),e._input.classList.add("active"),Zt("onOpen"),we(lt)),e.config.enableTime===!0&&e.config.noCalendar===!0&&e.config.allowInput===!1&&(J===void 0||!e.timeContainer.contains(J.relatedTarget))&&setTimeout(function(){return e.hourElement.select()},50)}function gt(J){return function(lt){var xt=e.config["_"+J+"Date"]=e.parseDate(lt,e.config.dateFormat),At=e.config["_"+(J==="min"?"max":"min")+"Date"];xt!==void 0&&(e[J==="min"?"minDateHasTime":"maxDateHasTime"]=xt.getHours()>0||xt.getMinutes()>0||xt.getSeconds()>0),e.selectedDates&&(e.selectedDates=e.selectedDates.filter(function(st){return Gt(st)}),!e.selectedDates.length&&J==="min"&&d(xt),Re()),e.daysContainer&&(en(),xt!==void 0?e.currentYearElement[J]=xt.getFullYear().toString():e.currentYearElement.removeAttribute(J),e.currentYearElement.disabled=!!At&&xt!==void 0&&At.getFullYear()===xt.getFullYear())}}function ft(){var J=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],lt=Po(Po({},JSON.parse(JSON.stringify(i.dataset||{}))),t),xt={};e.config.parseDate=lt.parseDate,e.config.formatDate=lt.formatDate,Object.defineProperty(e.config,"enable",{get:function(){return e.config._enable},set:function(ye){e.config._enable=te(ye)}}),Object.defineProperty(e.config,"disable",{get:function(){return e.config._disable},set:function(ye){e.config._disable=te(ye)}});var At=lt.mode==="time";if(!lt.dateFormat&&(lt.enableTime||At)){var st=vr.defaultConfig.dateFormat||pf.dateFormat;xt.dateFormat=lt.noCalendar||At?"H:i"+(lt.enableSeconds?":S":""):st+" H:i"+(lt.enableSeconds?":S":"")}if(lt.altInput&&(lt.enableTime||At)&&!lt.altFormat){var rt=vr.defaultConfig.altFormat||pf.altFormat;xt.altFormat=lt.noCalendar||At?"h:i"+(lt.enableSeconds?":S K":" K"):rt+(" h:i"+(lt.enableSeconds?":S":"")+" K")}Object.defineProperty(e.config,"minDate",{get:function(){return e.config._minDate},set:gt("min")}),Object.defineProperty(e.config,"maxDate",{get:function(){return e.config._maxDate},set:gt("max")});var Tt=function(ye){return function(be){e.config[ye==="min"?"_minTime":"_maxTime"]=e.parseDate(be,"H:i:S")}};Object.defineProperty(e.config,"minTime",{get:function(){return e.config._minTime},set:Tt("min")}),Object.defineProperty(e.config,"maxTime",{get:function(){return e.config._maxTime},set:Tt("max")}),lt.mode==="time"&&(e.config.noCalendar=!0,e.config.enableTime=!0),Object.assign(e.config,xt,lt);for(var Dt=0;Dt<J.length;Dt++)e.config[J[Dt]]=e.config[J[Dt]]===!0||e.config[J[Dt]]==="true";vP.filter(function(ye){return e.config[ye]!==void 0}).forEach(function(ye){e.config[ye]=wP(e.config[ye]||[]).map(o)}),e.isMobile=!e.config.disableMobile&&!e.config.inline&&e.config.mode==="single"&&!e.config.disable.length&&!e.config.enable&&!e.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(var Dt=0;Dt<e.config.plugins.length;Dt++){var he=e.config.plugins[Dt](e)||{};for(var se in he)vP.indexOf(se)>-1?e.config[se]=wP(he[se]).map(o).concat(e.config[se]):typeof lt[se]>"u"&&(e.config[se]=he[se])}lt.altInputClass||(e.config.altInputClass=de().className+" "+e.config.altInputClass),Zt("onParseConfig")}function de(){return e.config.wrap?i.querySelector("[data-input]"):i}function ve(){typeof e.config.locale!="object"&&typeof vr.l10ns[e.config.locale]>"u"&&e.config.errorHandler(new Error("flatpickr: invalid locale "+e.config.locale)),e.l10n=Po(Po({},vr.l10ns.default),typeof e.config.locale=="object"?e.config.locale:e.config.locale!=="default"?vr.l10ns[e.config.locale]:void 0),Ch.D="("+e.l10n.weekdays.shorthand.join("|")+")",Ch.l="("+e.l10n.weekdays.longhand.join("|")+")",Ch.M="("+e.l10n.months.shorthand.join("|")+")",Ch.F="("+e.l10n.months.longhand.join("|")+")",Ch.K="("+e.l10n.amPM[0]+"|"+e.l10n.amPM[1]+"|"+e.l10n.amPM[0].toLowerCase()+"|"+e.l10n.amPM[1].toLowerCase()+")";var J=Po(Po({},t),JSON.parse(JSON.stringify(i.dataset||{})));J.time_24hr===void 0&&vr.defaultConfig.time_24hr===void 0&&(e.config.time_24hr=e.l10n.time_24hr),e.formatDate=yV(e),e.parseDate=_P({config:e.config,l10n:e.l10n})}function we(J){if(typeof e.config.position=="function")return void e.config.position(e,J);if(e.calendarContainer!==void 0){Zt("onPreCalendarPosition");var lt=J||e._positionElement,xt=Array.prototype.reduce.call(e.calendarContainer.children,(function(Ie,En){return Ie+En.offsetHeight}),0),At=e.calendarContainer.offsetWidth,st=e.config.position.split(" "),rt=st[0],Tt=st.length>1?st[1]:null,Dt=lt.getBoundingClientRect(),he=window.innerHeight-Dt.bottom,se=rt==="above"||rt!=="below"&&he<xt&&Dt.top>xt,ye=window.pageYOffset+Dt.top+(se?-xt-2:lt.offsetHeight+2);if(ko(e.calendarContainer,"arrowTop",!se),ko(e.calendarContainer,"arrowBottom",se),!e.config.inline){var be=window.pageXOffset+Dt.left,fn=!1,qe=!1;Tt==="center"?(be-=(At-Dt.width)/2,fn=!0):Tt==="right"&&(be-=At-Dt.width,qe=!0),ko(e.calendarContainer,"arrowLeft",!fn&&!qe),ko(e.calendarContainer,"arrowCenter",fn),ko(e.calendarContainer,"arrowRight",qe);var xn=window.document.body.offsetWidth-(window.pageXOffset+Dt.right),vn=be+At>window.document.body.offsetWidth,jn=xn+At>window.document.body.offsetWidth;if(ko(e.calendarContainer,"rightMost",vn),!e.config.static)if(e.calendarContainer.style.top=ye+"px",!vn)e.calendarContainer.style.left=be+"px",e.calendarContainer.style.right="auto";else if(!jn)e.calendarContainer.style.left="auto",e.calendarContainer.style.right=xn+"px";else{var Fn=Ae();if(Fn===void 0)return;var si=window.document.body.offsetWidth,Ti=Math.max(0,si/2-At/2),Yi=".flatpickr-calendar.centerMost:before",_s=".flatpickr-calendar.centerMost:after",Pt=Fn.cssRules.length,ze="{left:"+Dt.left+"px;right:auto;}";ko(e.calendarContainer,"rightMost",!1),ko(e.calendarContainer,"centerMost",!0),Fn.insertRule(Yi+","+_s+ze,Pt),e.calendarContainer.style.left=Ti+"px",e.calendarContainer.style.right="auto"}}}}function Ae(){for(var J=null,lt=0;lt<document.styleSheets.length;lt++){var xt=document.styleSheets[lt];if(xt.cssRules){try{xt.cssRules}catch{continue}J=xt;break}}return J??Ue()}function Ue(){var J=document.createElement("style");return document.head.appendChild(J),J.sheet}function en(){e.config.noCalendar||e.isMobile||(j(),Fe(),X())}function It(){e._input.focus(),window.navigator.userAgent.indexOf("MSIE")!==-1||navigator.msMaxTouchPoints!==void 0?setTimeout(e.close,0):e.close()}function Cn(J){J.preventDefault(),J.stopPropagation();var lt=function(ye){return ye.classList&&ye.classList.contains("flatpickr-day")&&!ye.classList.contains("flatpickr-disabled")&&!ye.classList.contains("notAllowed")},xt=bV(Aa(J),lt);if(xt!==void 0){var At=xt,st=e.latestSelectedDateObj=new Date(At.dateObj.getTime()),rt=(st.getMonth()<e.currentMonth||st.getMonth()>e.currentMonth+e.config.showMonths-1)&&e.config.mode!=="range";if(e.selectedDateElem=At,e.config.mode==="single")e.selectedDates=[st];else if(e.config.mode==="multiple"){var Tt=ce(st);Tt?e.selectedDates.splice(parseInt(Tt),1):e.selectedDates.push(st)}else e.config.mode==="range"&&(e.selectedDates.length===2&&e.clear(!1,!1),e.latestSelectedDateObj=st,e.selectedDates.push(st),Ea(st,e.selectedDates[0],!0)!==0&&e.selectedDates.sort(function(ye,be){return ye.getTime()-be.getTime()}));if(h(),rt){var Dt=e.currentYear!==st.getFullYear();e.currentYear=st.getFullYear(),e.currentMonth=st.getMonth(),Dt&&(Zt("onYearChange"),j()),Zt("onMonthChange")}if(Fe(),X(),Re(),!rt&&e.config.mode!=="range"&&e.config.showMonths===1?O(At):e.selectedDateElem!==void 0&&e.hourElement===void 0&&e.selectedDateElem&&e.selectedDateElem.focus(),e.hourElement!==void 0&&e.hourElement!==void 0&&e.hourElement.focus(),e.config.closeOnSelect){var he=e.config.mode==="single"&&!e.config.enableTime,se=e.config.mode==="range"&&e.selectedDates.length===2&&!e.config.enableTime;(he||se)&&It()}x()}}var mn={locale:[ve,Et],showMonths:[_,a,pt],minDate:[M],maxDate:[M],positionElement:[Me],clickOpens:[function(){e.config.clickOpens===!0?(y(e._input,"focus",e.open),y(e._input,"click",e.open)):(e._input.removeEventListener("focus",e.open),e._input.removeEventListener("click",e.open))}]};function mt(J,lt){if(J!==null&&typeof J=="object"){Object.assign(e.config,J);for(var xt in J)mn[xt]!==void 0&&mn[xt].forEach(function(At){return At()})}else e.config[J]=lt,mn[J]!==void 0?mn[J].forEach(function(At){return At()}):vP.indexOf(J)>-1&&(e.config[J]=wP(lt));e.redraw(),Re(!0)}function K(J,lt){var xt=[];
vendor: 9,491 bytes, line 8654
8654if(J instanceof Array)xt=J.map(function(At){return e.parseDate(At,lt)});else if(J instanceof Date||typeof J=="number")xt=[e.parseDate(J,lt)];else if(typeof J=="string")switch(e.config.mode){case"single":case"time":xt=[e.parseDate(J,lt)];break;case"multiple":xt=J.split(e.config.conjunction).map(function(At){return e.parseDate(At,lt)});break;case"range":xt=J.split(e.l10n.rangeSeparator).map(function(At){return e.parseDate(At,lt)});break;default:break}else e.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(J)));e.selectedDates=e.config.allowInvalidPreload?xt:xt.filter(function(At){return At instanceof Date&&Gt(At,!1)}),e.config.mode==="range"&&e.selectedDates.sort(function(At,st){return At.getTime()-st.getTime()})}function Vt(J,lt,xt){if(lt===void 0&&(lt=!1),xt===void 0&&(xt=e.config.dateFormat),J!==0&&!J||J instanceof Array&&J.length===0)return e.clear(lt);K(J,xt),e.latestSelectedDateObj=e.selectedDates[e.selectedDates.length-1],e.redraw(),M(void 0,lt),d(),e.selectedDates.length===0&&e.clear(!1),Re(lt),lt&&Zt("onChange")}function te(J){return J.slice().map(function(lt){return typeof lt=="string"||typeof lt=="number"||lt instanceof Date?e.parseDate(lt,void 0,!0):lt&&typeof lt=="object"&&lt.from&&lt.to?{from:e.parseDate(lt.from,void 0),to:e.parseDate(lt.to,void 0)}:lt}).filter(function(lt){return lt})}function Nt(){e.selectedDates=[],e.now=e.parseDate(e.config.now)||new Date;var J=e.config.defaultDate||((e.input.nodeName==="INPUT"||e.input.nodeName==="TEXTAREA")&&e.input.placeholder&&e.input.value===e.input.placeholder?null:e.input.value);J&&K(J,e.config.dateFormat),e._initialDate=e.selectedDates.length>0?e.selectedDates[0]:e.config.minDate&&e.config.minDate.getTime()>e.now.getTime()?e.config.minDate:e.config.maxDate&&e.config.maxDate.getTime()<e.now.getTime()?e.config.maxDate:e.now,e.currentYear=e._initialDate.getFullYear(),e.currentMonth=e._initialDate.getMonth(),e.selectedDates.length>0&&(e.latestSelectedDateObj=e.selectedDates[0]),e.config.minTime!==void 0&&(e.config.minTime=e.parseDate(e.config.minTime,"H:i")),e.config.maxTime!==void 0&&(e.config.maxTime=e.parseDate(e.config.maxTime,"H:i")),e.minDateHasTime=!!e.config.minDate&&(e.config.minDate.getHours()>0||e.config.minDate.getMinutes()>0||e.config.minDate.getSeconds()>0),e.maxDateHasTime=!!e.config.maxDate&&(e.config.maxDate.getHours()>0||e.config.maxDate.getMinutes()>0||e.config.maxDate.getSeconds()>0)}function Se(){if(e.input=de(),!e.input){e.config.errorHandler(new Error("Invalid input element specified"));return}e.input._type=e.input.type,e.input.type="text",e.input.classList.add("flatpickr-input"),e._input=e.input,e.config.altInput&&(e.altInput=Oi(e.input.nodeName,e.config.altInputClass),e._input=e.altInput,e.altInput.placeholder=e.input.placeholder,e.altInput.disabled=e.input.disabled,e.altInput.required=e.input.required,e.altInput.tabIndex=e.input.tabIndex,e.altInput.type="text",e.input.setAttribute("type","hidden"),!e.config.static&&e.input.parentNode&&e.input.parentNode.insertBefore(e.altInput,e.input.nextSibling)),e.config.allowInput||e._input.setAttribute("readonly","readonly"),Me()}function Me(){e._positionElement=e.config.positionElement||e._input}function ie(){var J=e.config.enableTime?e.config.noCalendar?"time":"datetime-local":"date";e.mobileInput=Oi("input",e.input.className+" flatpickr-mobile"),e.mobileInput.tabIndex=1,e.mobileInput.type=J,e.mobileInput.disabled=e.input.disabled,e.mobileInput.required=e.input.required,e.mobileInput.placeholder=e.input.placeholder,e.mobileFormatStr=J==="datetime-local"?"Y-m-d\\TH:i:S":J==="date"?"Y-m-d":"H:i:S",e.selectedDates.length>0&&(e.mobileInput.defaultValue=e.mobileInput.value=e.formatDate(e.selectedDates[0],e.mobileFormatStr)),e.config.minDate&&(e.mobileInput.min=e.formatDate(e.config.minDate,"Y-m-d")),e.config.maxDate&&(e.mobileInput.max=e.formatDate(e.config.maxDate,"Y-m-d")),e.input.getAttribute("step")&&(e.mobileInput.step=String(e.input.getAttribute("step"))),e.input.type="hidden",e.altInput!==void 0&&(e.altInput.type="hidden");try{e.input.parentNode&&e.input.parentNode.insertBefore(e.mobileInput,e.input.nextSibling)}catch{}y(e.mobileInput,"change",function(lt){e.setDate(Aa(lt).value,!1,e.mobileFormatStr),Zt("onChange"),Zt("onClose")})}function _t(J){if(e.isOpen===!0)return e.close();e.open(J)}function Zt(J,lt){if(e.config!==void 0){var xt=e.config[J];if(xt!==void 0&&xt.length>0)for(var At=0;xt[At]&&At<xt.length;At++)xt[At](e.selectedDates,e.input.value,e,lt);J==="onChange"&&(e.input.dispatchEvent(fe("change")),e.input.dispatchEvent(fe("input")))}}function fe(J){var lt=document.createEvent("Event");return lt.initEvent(J,!0,!0),lt}function ce(J){for(var lt=0;lt<e.selectedDates.length;lt++){var xt=e.selectedDates[lt];if(xt instanceof Date&&Ea(xt,J)===0)return""+lt}return!1}function pe(J){return e.config.mode!=="range"||e.selectedDates.length<2?!1:Ea(J,e.selectedDates[0])>=0&&Ea(J,e.selectedDates[1])<=0}function Fe(){e.config.noCalendar||e.isMobile||!e.monthNav||(e.yearElements.forEach(function(J,lt){var xt=new Date(e.currentYear,e.currentMonth,1);xt.setMonth(e.currentMonth+lt),e.config.showMonths>1||e.config.monthSelectorType==="static"?e.monthElements[lt].textContent=pS(xt.getMonth(),e.config.shorthandCurrentMonth,e.l10n)+" ":e.monthsDropdownContainer.value=xt.getMonth().toString(),J.value=xt.getFullYear().toString()}),e._hidePrevMonthArrow=e.config.minDate!==void 0&&(e.currentYear===e.config.minDate.getFullYear()?e.currentMonth<=e.config.minDate.getMonth():e.currentYear<e.config.minDate.getFullYear()),e._hideNextMonthArrow=e.config.maxDate!==void 0&&(e.currentYear===e.config.maxDate.getFullYear()?e.currentMonth+1>e.config.maxDate.getMonth():e.currentYear>e.config.maxDate.getFullYear()))}function je(J){var lt=J||(e.config.altInput?e.config.altFormat:e.config.dateFormat);return e.selectedDates.map(function(xt){return e.formatDate(xt,lt)}).filter(function(xt,At,st){return e.config.mode!=="range"||e.config.enableTime||st.indexOf(xt)===At}).join(e.config.mode!=="range"?e.config.conjunction:e.l10n.rangeSeparator)}function Re(J){J===void 0&&(J=!0),e.mobileInput!==void 0&&e.mobileFormatStr&&(e.mobileInput.value=e.latestSelectedDateObj!==void 0?e.formatDate(e.latestSelectedDateObj,e.mobileFormatStr):""),e.input.value=je(e.config.dateFormat),e.altInput!==void 0&&(e.altInput.value=je(e.config.altFormat)),J!==!1&&Zt("onValueUpdate")}function Ft(J){var lt=Aa(J),xt=e.prevMonthNav.contains(lt),At=e.nextMonthNav.contains(lt);xt||At?yt(xt?-1:1):e.yearElements.indexOf(lt)>=0?lt.select():lt.classList.contains("arrowUp")?e.changeYear(e.currentYear+1):lt.classList.contains("arrowDown")&&e.changeYear(e.currentYear-1)}function Ee(J){J.preventDefault();var lt=J.type==="keydown",xt=Aa(J),At=xt;e.amPM!==void 0&&xt===e.amPM&&(e.amPM.textContent=e.l10n.amPM[Ta(e.amPM.textContent===e.l10n.amPM[0])]);var st=parseFloat(At.getAttribute("min")),rt=parseFloat(At.getAttribute("max")),Tt=parseFloat(At.getAttribute("step")),Dt=parseInt(At.value,10),he=J.delta||(lt?J.which===38?1:-1:0),se=Dt+Tt*he;if(typeof At.value<"u"&&At.value.length===2){var ye=At===e.hourElement,be=At===e.minuteElement;se<st?(se=rt+se+Ta(!ye)+(Ta(ye)&&Ta(!e.amPM)),be&&C(void 0,-1,e.hourElement)):se>rt&&(se=At===e.hourElement?se-rt-Ta(!e.amPM):st,be&&C(void 0,1,e.hourElement)),e.amPM&&ye&&(Tt===1?se+Dt===23:Math.abs(se-Dt)>Tt)&&(e.amPM.textContent=e.l10n.amPM[Ta(e.amPM.textContent===e.l10n.amPM[0])]),At.value=Eo(se)}}return s(),e}function Ev(i,t){for(var e=Array.prototype.slice.call(i).filter(function(o){return o instanceof HTMLElement}),n=[],s=0;s<e.length;s++){var r=e[s];try{if(r.getAttribute("data-fp-omit")!==null)continue;r._flatpickr!==void 0&&(r._flatpickr.destroy(),r._flatpickr=void 0),r._flatpickr=ANt(r,t||{}),n.push(r._flatpickr)}catch(o){console.error(o)}}return n.length===1?n[0]:n}typeof HTMLElement<"u"&&typeof HTMLCollection<"u"&&typeof NodeList<"u"&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(i){return Ev(this,i)},HTMLElement.prototype.flatpickr=function(i){return Ev([this],i)});var vr=function(i,t){return typeof i=="string"?Ev(window.document.querySelectorAll(i),t):i instanceof Node?Ev([i],t):Ev(i,t)};vr.defaultConfig={};vr.l10ns={en:Po({},xP),default:Po({},xP)};vr.localize=function(i){vr.l10ns.default=Po(Po({},vr.l10ns.default),i)};vr.setDefaults=function(i){vr.defaultConfig=Po(Po({},vr.defaultConfig),i)};vr.parseDate=_P({});vr.formatDate=yV({});vr.compareDates=Ea;typeof jQuery<"u"&&typeof jQuery.fn<"u"&&(jQuery.fn.flatpickr=function(i){return Ev(this,i)});Date.prototype.fp_incr=function(i){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof i=="string"?parseInt(i,10):i))};typeof window<"u"&&(window.flatpickr=vr);var cit=vr;function ENt(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}function uit(i,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,n.key,n)}}function kNt(i,t,e){return t&&uit(i.prototype,t),e&&uit(i,e),i}function git(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function hit(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),e.push.apply(e,n)}return e}function PNt(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};
8654t%2?hit(Object(e),!0).forEach(function(n){git(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):hit(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function RNt(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),t&&xV(i,t)}function MP(i){return MP=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},MP(i)}function xV(i,t){return xV=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},xV(i,t)}function DNt(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function LNt(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function INt(i,t){return t&&(typeof t=="object"||typeof t=="function")?t:LNt(i)}function ONt(i){return function(){var t=MP(i),e;if(DNt()){var n=MP(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return INt(this,e)}}function NNt(i){return i.replace(/(?:[_-])([a-z0-9])/g,(t,e)=>e.toUpperCase())}function wV(i){return i.charAt(0).toUpperCase()+i.slice(1)}function BNt(i){return i.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`)}function mit(i,t){let e=bit(i);return Array.from(e.reduce((n,s)=>(UNt(s,t).forEach(r=>n.add(r)),n),new Set))}function FNt(i,t){return bit(i).reduce((n,s)=>(n.push(...zNt(s,t)),n),[])}function bit(i){let t=[];for(;i;)t.push(i),i=Object.getPrototypeOf(i);return t.reverse()}function UNt(i,t){let e=i[t];return Array.isArray(e)?e:[]}function zNt(i,t){let e=i[t];return e?Object.keys(e).map(n=>[n,e[n]]):[]}var Y1e=(()=>{function i(e){function n(){return Reflect.construct(e,arguments,new.target)}return n.prototype=Object.create(e.prototype,{constructor:{value:n}}),Reflect.setPrototypeOf(n,e),n}function t(){let n=i(function(){this.a.call(this)});return n.prototype.a=function(){},new n}try{return t(),i}catch{return n=>class extends n{}}})();function VNt(i){return mit(i,"classes").reduce((e,n)=>Object.assign(e,HNt(n)),{})}function HNt(i){return{[`${i}Class`]:{get(){let{classes:t}=this;if(t.has(i))return t.get(i);{let e=t.getAttributeName(i);throw new Error(`Missing attribute "${e}"`)}}},[`${i}Classes`]:{get(){return this.classes.getAll(i)}},[`has${wV(i)}Class`]:{get(){return this.classes.has(i)}}}}function jNt(i){return mit(i,"targets").reduce((e,n)=>Object.assign(e,WNt(n)),{})}function WNt(i){return{[`${i}Target`]:{get(){let t=this.targets.find(i);if(t)return t;throw new Error(`Missing target element "${i}" for "${this.identifier}" controller`)}},[`${i}Targets`]:{get(){return this.targets.findAll(i)}},[`has${wV(i)}Target`]:{get(){return this.targets.has(i)}}}}function $Nt(i){let t=FNt(i,"values"),e={valueDescriptorMap:{get(){return t.reduce((n,s)=>{let r=vit(s),o=this.data.getAttributeNameForKey(r.key);return Object.assign(n,{[o]:r})},{})}}};return t.reduce((n,s)=>Object.assign(n,GNt(s)),e)}function GNt(i){let t=vit(i),{key:e,name:n,reader:s,writer:r}=t;return{[n]:{get(){let o=this.data.get(e);return o!==null?s(o):t.defaultValue},set(o){o===void 0?this.data.delete(e):this.data.set(e,r(o))}},[`has${wV(n)}`]:{get(){return this.data.has(e)||t.hasCustomDefaultValue}}}}function vit([i,t]){return KNt(i,t)}function _V(i){switch(i){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function SV(i){switch(typeof i){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(i))return"array";if(Object.prototype.toString.call(i)==="[object Object]")return"object"}function qNt(i){let t=_V(i.type);if(t){let e=SV(i.default);if(t!==e)throw new Error(`Type "${t}" must match the type of the default value. Given default value: "${i.default}" as "${e}"`);return t}}function YNt(i){let t=qNt(i),e=SV(i),n=_V(i),s=t||e||n;if(s)return s;throw new Error(`Unknown value type "${i}"`)}function XNt(i){let t=_V(i);if(t)return JNt[t];let e=i.default;return e!==void 0?e:i}function KNt(i,t){let e=`${BNt(i)}-value`,n=YNt(t);return{type:n,key:e,name:NNt(e),get defaultValue(){return XNt(t)}
8654,get hasCustomDefaultValue(){return SV(t)!==void 0},reader:ZNt[n],writer:dit[n]||dit.default}}var JNt={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},ZNt={array(i){let t=JSON.parse(i);if(!Array.isArray(t))throw new TypeError("Expected array");return t},boolean(i){return!(i=="0"||i=="false")},number(i){return Number(i)},object(i){let t=JSON.parse(i);if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError("Expected object");return t},string(i){return i}},dit={default:QNt,array:fit,object:fit};function fit(i){return JSON.stringify(i)}function QNt(i){return`${i}`}var kv=class{constructor(t){this.context=t}static get shouldLoad(){return!0}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:n={},prefix:s=this.identifier,bubbles:r=!0,cancelable:o=!0}={}){let a=s?`${s}:${t}`:t,l=new CustomEvent(a,{detail:n,bubbles:r,cancelable:o});return e.dispatchEvent(l),l}};kv.blessings=[VNt,jNt,$Nt];kv.targets=[];kv.values={};var t3t=i=>i.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),e3t=i=>i.charAt(0).toUpperCase()+i.slice(1),n3t=["allowInput","altInput","animate","clickOpens","closeOnSelect","disableMobile","enableSeconds","enableTime","inline","noCalendar","shorthandCurrentMonth","static","time_24hr","weekNumbers","wrap"],i3t=["altInputClass","conjunction","mode","nextArrow","position","prevArrow","monthSelectorType"],s3t=["defaultHour","defaultMinute","defaultSeconds","hourIncrement","minuteIncrement","showMonths"],r3t=["disable","enable","disableDaysOfWeek","enableDaysOfWeek"],o3t=["defaultDate"],a3t=["maxDate","minDate","maxTime","minTime","now"],l3t=["altFormat","ariaDateFormat","dateFormat"],pit={string:i3t,boolean:n3t,date:a3t,array:r3t,number:s3t,arrayOrString:o3t},c3t=["change","open","close","monthChange","yearChange","ready","valueUpdate","dayCreate"],u3t=["calendarContainer","currentYearElement","days","daysContainer","input","nextMonthNav","monthNav","prevMonthNav","rContainer","selectedDateElem","todayDateElem","weekdayContainer"],yit={"%Y":"Y","%y":"y","%C":"Y","%m":"m","%-m":"n","%_m":"n","%B":"F","%^B":"F","%b":"M","%^b":"M","%h":"M","%^h":"M","%d":"d","%-d":"j","%e":"j","%H":"H","%k":"H","%I":"h","%l":"h","%-l":"h","%P":"K","%p":"K","%M":"i","%S":"S","%A":"l","%a":"D","%w":"w"},h3t=new RegExp(Object.keys(yit).join("|").replace(new RegExp("\\^","g"),"\\^"),"g"),d3t=i=>i.replace(h3t,t=>yit[t]),xit=(function(i){RNt(e,i);var t=ONt(e);function e(){return ENt(this,e),t.apply(this,arguments)}return kNt(e,[{key:"initialize",value:function(){this.config={}}},{key:"connect",value:function(){this._initializeEvents(),this._initializeOptions(),this._initializeDateFormats(),this.fp=cit(this.flatpickrElement,PNt({},this.config)),this._initializeElements()}},{key:"disconnect",value:function(){let s=this.inputTarget.value;this.fp.destroy(),this.inputTarget.value=s}},{key:"_initializeEvents",value:function(){c3t.forEach(s=>{if(this[s]){let r=`on${e3t(s)}`;this.config[r]=this[s].bind(this)}})}},{key:"_initializeOptions",value:function(){Object.keys(pit).forEach(s=>{pit[s].forEach(o=>{let a=t3t(o);this.data.has(a)&&(this.config[o]=this[`_${s}`](a))})}),this._handleDaysOfWeek()}},{key:"_handleDaysOfWeek",value:function(){this.config.disableDaysOfWeek&&(this.config.disableDaysOfWeek=this._validateDaysOfWeek(this.config.disableDaysOfWeek),this.config.disable=[...this.config.disable||[],this._disable.bind(this)]),this.config.enableDaysOfWeek&&(this.config.enableDaysOfWeek=this._validateDaysOfWeek(this.config.enableDaysOfWeek),this.config.enable=[...this.config.enable||[],this._enable.bind(this)])}},{key:"_validateDaysOfWeek",value:function(s){return Array.isArray(s)?s.map(r=>parseInt(r)):(console.error("days of week must be a valid array"),[])}},{key:"_disable",value:function(s){return this.config.disableDaysOfWeek.includes(s.getDay())}},{key:"_enable",value:function(s){return this.config.enableDaysOfWeek.includes(s.getDay())}},{key:"_initializeDateFormats",value:function(){l3t.forEach(s=>{this.data.has(s)&&(this.config[s]=d3t(this.data.get(s)))})}},{key:"_initializeElements",value:function(){u3t.forEach(s=>{this[`${s}Target`]=this.fp[s]})}},{key:"_string",value:function(s){return this.data.get(s)}},{key:"_date",value:function(s){return this.data.get(s)}},{key:"_boolean",value:function(s){return!(this.data.get(s)=="0"||this.data.get(s)=="false")}},{key:"_array",value:function(s){return JSON.parse(this.data.get(s))}},{key:"_number",value:function(s){return parseInt(this.data.get(s))}},{key:"_arrayOrString",value:function(s){let r=this.data.get(s);try{return JSON.parse(r)}catch{return r}}},{key:"flatpickrElement",get:function(){return this.hasInstanceTarget&&this.instanceTarget||this.element}}]),e})(kv);git(xit,"targets",["instance"]);var wit=xit;Jnt.forEach(i=>
8654{let t=i.name.split("/"),n=t[t.length-1].replace("_controller","").replace(/_/g,"-");Vc.register(n,i.module.default)});Vc.register("modal",pP);Vc.register("tabs",hS);Vc.register("popover",gP);Vc.register("toggle",bP);Vc.register("slideover",mP);Vc.register("flatpickr",wit);var Cit={exports:{}};(function(i,t){(function(e){i.exports=e()})((function(e){var n=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function s(w,M){var A=w[0],C=w[1],R=w[2],k=w[3];A+=(C&R|~C&k)+M[0]-680876936|0,A=(A<<7|A>>>25)+C|0,k+=(A&C|~A&R)+M[1]-389564586|0,k=(k<<12|k>>>20)+A|0,R+=(k&A|~k&C)+M[2]+606105819|0,R=(R<<17|R>>>15)+k|0,C+=(R&k|~R&A)+M[3]-1044525330|0,C=(C<<22|C>>>10)+R|0,A+=(C&R|~C&k)+M[4]-176418897|0,A=(A<<7|A>>>25)+C|0,k+=(A&C|~A&R)+M[5]+1200080426|0,k=(k<<12|k>>>20)+A|0,R+=(k&A|~k&C)+M[6]-1473231341|0,R=(R<<17|R>>>15)+k|0,C+=(R&k|~R&A)+M[7]-45705983|0,C=(C<<22|C>>>10)+R|0,A+=(C&R|~C&k)+M[8]+1770035416|0,A=(A<<7|A>>>25)+C|0,k+=(A&C|~A&R)+M[9]-1958414417|0,k=(k<<12|k>>>20)+A|0,R+=(k&A|~k&C)+M[10]-42063|0,R=(R<<17|R>>>15)+k|0,C+=(R&k|~R&A)+M[11]-1990404162|0,C=(C<<22|C>>>10)+R|0,A+=(C&R|~C&k)+M[12]+1804603682|0,A=(A<<7|A>>>25)+C|0,k+=(A&C|~A&R)+M[13]-40341101|0,k=(k<<12|k>>>20)+A|0,R+=(k&A|~k&C)+M[14]-1502002290|0,R=(R<<17|R>>>15)+k|0,C+=(R&k|~R&A)+M[15]+1236535329|0,C=(C<<22|C>>>10)+R|0,A+=(C&k|R&~k)+M[1]-165796510|0,A=(A<<5|A>>>27)+C|0,k+=(A&R|C&~R)+M[6]-1069501632|0,k=(k<<9|k>>>23)+A|0,R+=(k&C|A&~C)+M[11]+643717713|0,R=(R<<14|R>>>18)+k|0,C+=(R&A|k&~A)+M[0]-373897302|0,C=(C<<20|C>>>12)+R|0,A+=(C&k|R&~k)+M[5]-701558691|0,A=(A<<5|A>>>27)+C|0,k+=(A&R|C&~R)+M[10]+38016083|0,k=(k<<9|k>>>23)+A|0,R+=(k&C|A&~C)+M[15]-660478335|0,R=(R<<14|R>>>18)+k|0,C+=(R&A|k&~A)+M[4]-405537848|0,C=(C<<20|C>>>12)+R|0,A+=(C&k|R&~k)+M[9]+568446438|0,A=(A<<5|A>>>27)+C|0,k+=(A&R|C&~R)+M[14]-1019803690|0,k=(k<<9|k>>>23)+A|0,R+=(k&C|A&~C)+M[3]-187363961|0,R=(R<<14|R>>>18)+k|0,C+=(R&A|k&~A)+M[8]+1163531501|0,C=(C<<20|C>>>12)+R|0,A+=(C&k|R&~k)+M[13]-1444681467|0,A=(A<<5|A>>>27)+C|0,k+=(A&R|C&~R)+M[2]-51403784|0,k=(k<<9|k>>>23)+A|0,R+=(k&C|A&~C)+M[7]+1735328473|0,R=(R<<14|R>>>18)+k|0,C+=(R&A|k&~A)+M[12]-1926607734|0,C=(C<<20|C>>>12)+R|0,A+=(C^R^k)+M[5]-378558|0,A=(A<<4|A>>>28)+C|0,k+=(A^C^R)+M[8]-2022574463|0,k=(k<<11|k>>>21)+A|0,R+=(k^A^C)+M[11]+1839030562|0,R=(R<<16|R>>>16)+k|0,C+=(R^k^A)+M[14]-35309556|0,C=(C<<23|C>>>9)+R|0,A+=(C^R^k)+M[1]-1530992060|0,A=(A<<4|A>>>28)+C|0,k+=(A^C^R)+M[4]+1272893353|0,k=(k<<11|k>>>21)+A|0,R+=(k^A^C)+M[7]-155497632|0,R=(R<<16|R>>>16)+k|0,C+=(R^k^A)+M[10]-1094730640|0,C=(C<<23|C>>>9)+R|0,A+=(C^R^k)+M[13]+681279174|0,A=(A<<4|A>>>28)+C|0,k+=(A^C^R)+M[0]-358537222|0,k=(k<<11|k>>>21)+A|0,R+=(k^A^C)+M[3]-722521979|0,R=(R<<16|R>>>16)+k|0,C+=(R^k^A)+M[6]+76029189|0,C=(C<<23|C>>>9)+R|0,A+=(C^R^k)+M[9]-640364487|0,A=(A<<4|A>>>28)+C|0,k+=(A^C^R)+M[12]-421815835|0,k=(k<<11|k>>>21)+A|0,R+=(k^A^C)+M[15]+530742520|0,R=(R<<16|R>>>16)+k|0,C+=(R^k^A)+M[2]-995338651|0,C=(C<<23|C>>>9)+R|0,A+=(R^(C|~k))+M[0]-198630844|0,A=(A<<6|A>>>26)+C|0,k+=(C^(A|~R))+M[7]+1126891415|0,k=(k<<10|k>>>22)+A|0,R+=(A^(k|~C))+M[14]-1416354905|0,R=(R<<15|R>>>17)+k|0,C+=(k^(R|~A))+M[5]-57434055|0,C=(C<<21|C>>>11)+R|0,A+=(R^(C|~k))+M[12]+1700485571|0,A=(A<<6|A>>>26)+C|0,k+=(C^(A|~R))+M[3]-1894986606|0,k=(k<<10|k>>>22)+A|0,R+=(A^(k|~C))+M[10]-1051523|0,R=(R<<15|R>>>17)+k|0,C+=(k^(R|~A))+M[1]-2054922799|0,C=(C<<21|C>>>11)+R|0,A+=(R^(C|~k))+M[8]+1873313359|0,A=(A<<6|A>>>26)+C|0,k+=(C^(A|~R))+M[15]-30611744|0,k=(k<<10|k>>>22)+A|0,R+=(A^(k|~C))+M[6]-1560198380|0,R=(R<<15|R>>>17)+k|0,C+=(k^(R|~A))+M[13]+1309151649|0,C=(C<<21|C>>>11)+R|0,A+=(R^(C|~k))+M[4]-145523070|0,A=(A<<6|A>>>26)+C|0,k+=(C^(A|~R))+M[11]-1120210379|0,k=(k<<10|k>>>22)+A|0,R+=(A^(k|~C))+M[2]+718787259|0,R=(R<<15|R>>>17)+k|0,C+=(k^(R|~A))+M[9]-343485551|0,C=(C<<21|C>>>11)+R|0,w[0]=A+w[0]|0,w[1]=C+w[1]|0,w[2]=R+w[2]|0,w[3]=k+w[3]|0}function r(w){var M=[],A;for(A=0;A<64;A+=4)M[A>>2]=w.charCodeAt(A)+(w.charCodeAt(A+1)<<8)+(w.charCodeAt(A+2)<<16)+(w.charCodeAt(A+3)<<24);return M}function o(w){var M=[],A;for(A=0;A<64;A+=4)M[A>>2]=w[A]+(w[A+1]<<8)+(w[A+2]<<16)+(w[A+3]<<24);return M}function a(w){var M=w.length,A=[1732584193,-271733879,-1732584194,271733878],C,R,k,O,I,U;for(C=64;C<=M;C+=64)s(A,r(w.substring(C-64,C)));for(w=w.substring(C-64),R=w.length,k=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C=0;C<R;C+=1)k[C>>2]|=w.charCodeAt(C)<<(C%4<<3);if(k[C>>2]|=128<<(C%4<<3),C>55)for(s(A,k),C=0;C<16;C+=1)k[C]=0;return O=M*8,O=O.toString(16).match(/(.*?)(.{0,8})$/),I=parseInt(O[2],16),U=parseInt(O[1],16)||0,k[14]=I,k[15]=U,s(A,k),A}function l(w){var M=w.length,A=[1732584193,-271733879,-1732584194,271733878],C,R,k,O,I,U;for(C=64;C<=M;C+=64)s(A,o(w.subarray(C-64,C)));for(w=C-64<M?w.subarray(C-64):new Uint8Array(0),R=w.length,k=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C=0;C<R;C+=1)k[C>>2]|=w[C]<<(C%4<<3);if(k[C>>2]|=128<<(C%4<<3),C>55)for(s(A,k),C=0;C<16;C+=1)k[C]=0;return O=M*8,O=O.toString(16).match(/(.*?)(.{0,8})$/),I=parseInt(O[2],16),U=parseInt(O[1],16)||0,k[14]=I,k[15]=U,s(A,k),A}function c(w){var M="",A;for(A=0;A<4;A+=1)M+=n[w>>A*8+4&15]+n[w>>A*8&15];return M}function u(w){var M;for(M=0;M<w.length;M+=1)w[M]=c(w[M]);return w.join("")}u(a("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function w(M,A){return M=M|0||0,M<0?Math.max(M+A,0):Math.min(M,A)}ArrayBuffer.prototype.slice=function(M,A){var C=this.byteLength,R=w(M,C),k=C,O,I,U,V;return A!==e&&(k=w(A,C)),R>k?new ArrayBuffer(0):(O=k-R,I=new ArrayBuffer(O),U=new Uint8Array(I),V=new Uint8Array(this,R,O),U.set(V),I)}})();function h(w){return/[\u0080-\uFFFF]/.test(w)&&(w=unescape(encodeURIComponent(w))),w}function d(w,M){var A=w.length,C=new ArrayBuffer(A),R=new Uint8Array(C),k;for(k=0;k<A;k+=1)R[k]=w.charCodeAt(k);return M?R:C}function p(w){return String.fromCharCode.apply(null,new Uint8Array(w))}function g(w,M,A){var C=new Uint8Array(w.byteLength+M.byteLength);return C.set(new Uint8Array(w)),C.set(new Uint8Array(M),w.byteLength),A?C:C.buffer}function y(w){var M=[],A=w.length,C;for(C=0;C<A-1;C+=2)M.push(parseInt(w.substr(C,2),16));return String.fromCharCode.apply(String,M)}function x(){this.reset()}return x.prototype.append=function(w){return this.appendBinary(h(w)),this},x.prototype.appendBinary=function(w){this._buff+=w,this._length+=w.length;var M=this._buff.length,A;for(A=64;A<=M;A+=64)s(this._hash,r(this._buff.substring(A-64,A)));return this._buff=this._buff.substring(A-64),this},x.prototype.end=function(w){var M=this._buff,A=M.length,C,R=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],k;for(C=0;C<A;C+=1)R[C>>
86542]|=M.charCodeAt(C)<<(C%4<<3);return this._finish(R,A),k=u(this._hash),w&&(k=y(k)),this.reset(),k},x.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},x.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},x.prototype.setState=function(w){return this._buff=w.buff,this._length=w.length,this._hash=w.hash,this},x.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},x.prototype._finish=function(w,M){var A=M,C,R,k;if(w[A>>2]|=128<<(A%4<<3),A>55)for(s(this._hash,w),A=0;A<16;A+=1)w[A]=0;C=this._length*8,C=C.toString(16).match(/(.*?)(.{0,8})$/),R=parseInt(C[2],16),k=parseInt(C[1],16)||0,w[14]=R,w[15]=k,s(this._hash,w)},x.hash=function(w,M){return x.hashBinary(h(w),M)},x.hashBinary=function(w,M){var A=a(w),C=u(A);return M?y(C):C},x.ArrayBuffer=function(){this.reset()},x.ArrayBuffer.prototype.append=function(w){var M=g(this._buff.buffer,w,!0),A=M.length,C;for(this._length+=w.byteLength,C=64;C<=A;C+=64)s(this._hash,o(M.subarray(C-64,C)));return this._buff=C-64<A?new Uint8Array(M.buffer.slice(C-64)):new Uint8Array(0),this},x.ArrayBuffer.prototype.end=function(w){var M=this._buff,A=M.length,C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],R,k;for(R=0;R<A;R+=1)C[R>>2]|=M[R]<<(R%4<<3);return this._finish(C,A),k=u(this._hash),w&&(k=y(k)),this.reset(),k},x.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},x.ArrayBuffer.prototype.getState=function(){var w=x.prototype.getState.call(this);return w.buff=p(w.buff),w},x.ArrayBuffer.prototype.setState=function(w){return w.buff=d(w.buff,!0),x.prototype.setState.call(this,w)},x.ArrayBuffer.prototype.destroy=x.prototype.destroy,x.ArrayBuffer.prototype._finish=x.prototype._finish,x.ArrayBuffer.hash=function(w,M){var A=l(new Uint8Array(w)),C=u(A);return M?y(C):C},x}))})(Cit);var f3t=Cit.exports,p3t=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice,MV=class i{static create(t,e){new i(t).create(e)}constructor(t){this.file=t,this.chunkSize=2097152,this.chunkCount=Math.ceil(this.file.size/this.chunkSize),this.chunkIndex=0}create(t){this.callback=t,this.md5Buffer=new f3t.ArrayBuffer,this.fileReader=new FileReader,this.fileReader.addEventListener("load",(e=>this.fileReaderDidLoad(e))),this.fileReader.addEventListener("error",(e=>this.fileReaderDidError(e))),this.readNextChunk()}fileReaderDidLoad(t){if(this.md5Buffer.append(t.target.result),!this.readNextChunk()){let e=this.md
86545Buffer.end(!0),n=btoa(e);this.callback(null,n)}}fileReaderDidError(t){this.callback(`Error reading ${this.file.name}`)}readNextChunk(){if(this.chunkIndex<this.chunkCount||this.chunkIndex==0&&this.chunkCount==0){let t=this.chunkIndex*this.chunkSize,e=Math.min(t+this.chunkSize,this.file.size),n=p3t.call(this.file,t,e);return this.fileReader.readAsArrayBuffer(n),this.chunkIndex++,!0}else return!1}};function g3t(i){let t=Mit(document.head,`meta[name="${i}"]`);if(t)return t.getAttribute("content")}function m3t(i,t){typeof i=="string"&&(t=i,i=document);let e=i.querySelectorAll(t);return Tit(e)}function Mit(i,t){return typeof i=="string"&&(t=i,i=document),i.querySelector(t)}function DV(i,t,e={}){let{disabled:n}=i,{bubbles:s,cancelable:r,detail:o}=e,a=document.createEvent("Event");a.initEvent(t,s||!0,r||!0),a.detail=o||{};try{i.disabled=!1,i.dispatchEvent(a)}finally{i.disabled=n}return a}function Tit(i){return Array.isArray(i)?i:Array.from?Array.from(i):[].slice.call(i)}var TV=class{constructor(t,e,n,s={}){this.file=t,this.attributes={filename:t.name,content_type:t.type||"application/octet-stream",byte_size:t.size,checksum:e},this.xhr=new XMLHttpRequest,this.xhr.open("POST",n,!0),this.xhr.responseType="json",this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.setRequestHeader("Accept","application/json"),this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(s).forEach((o=>{this.xhr.setRequestHeader(o,s[o])}));let r=g3t("csrf-token");r!=null&&this.xhr.setRequestHeader("X-CSRF-Token",r),this.xhr.addEventListener("load",(o=>this.requestDidLoad(o))),this.xhr.addEventListener("error",(o=>this.requestDidError(o)))}get status(){return this.xhr.status}get response(){let{responseType:t,response:e}=this.xhr;return t=="json"?e:JSON.parse(e)}create(t){this.callback=t,this.xhr.send(JSON.stringify({blob:this.attributes}))}requestDidLoad(t){if(this.status>=200&&this.status<300){let{response:e}=this,{direct_upload:n}=e;delete e.direct_upload,this.attributes=e,this.directUploadData=n,this.callback(null,this.toJSON())}else this.requestDidError(t)}requestDidError(t){this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`)}toJSON(){let t={};for(let e in this.attributes)t[e]=this.attributes[e];return t}},AV=class{constructor(t){this.blob=t,this.file=t.file;let{url:e,headers:n}=t.directUploadData;this.xhr=new XMLHttpRequest,this.xhr.open("PUT",e,!0),this.xhr.responseType="text";for(let s in n)this.xhr.setRequestHeader(s,n[s]);this.xhr.addEventListener("load",(s=>this.requestDidLoad(s))),this.xhr.addEventListener("error",(s=>this.requestDidError(s)))}create(t){this.callback=t,this.xhr.send(this.file.slice())}requestDidLoad(t){let{status:e,response:n}=this.xhr;e>=200&&e<300?this.callback(null,n):this.requestDidError(t)}requestDidError(t){this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`)}},b3t=0,TP=class{constructor(t,e,n,s={}){this.id=++b3t,this.file=t,this.url=e,this.delegate=n,this.customHeaders=s}create(t){MV.create(this.file,((e,n)=>{if(e){t(e);return}let s=new TV(this.file,n,this.url,this.customHeaders);_it(this.delegate,"directUploadWillCreateBlobWithXHR",s.xhr),s.create((r=>{if(r)t(r);else{let o=new AV(s);_it(this.delegate,"directUploadWillStoreFileWithXHR",o.xhr),o.create((a=>{a?t(a):t(null,s.toJSON())}))}}))}))}};function _it(i,t,...e){if(i&&typeof i[t]=="function")return i[t](...e)}var EV=class{constructor(t,e){this.input=t,this.file=e,this.directUpload=new TP(this.file,this.url,this),this.dispatch("initialize")}start(t){let e=document.createElement("input");e.type="hidden",e.name=this.input.name,this.input.insertAdjacentElement("beforebegin",e),this.dispatch("start"),this.directUpload.create(((n,s)=>{n?(e.parentNode.removeChild(e),this.dispatchError(n)):e.value=s.signed_id,this.dispatch("end"),t(n)}))}uploadRequestDidProgress(t){let e=t.loaded/t.total*90;e&&this.dispatch("progress",{progress:e})}get url(){return this.input.getAttribute("data-direct-upload-url")}dispatch(t,e={}){return e.file=this.file,e.id=this.directUpload.id,DV(this.input,`direct-upload:${t}`,{detail:e})}dispatchError(t){this.dispatch("error",{error:t}).defaultPrevented||alert(t)}directUploadWillCreateBlobWithXHR(t){this.dispatch("before-blob-request",{xhr:t})}directUploadWillStoreFileWithXHR(t){this.dispatch("before-storage-request",{xhr:t}),t.upload.addEventListener("progress",(e=>this.uploadRequestDidProgress(e))),t.upload.addEventListener("loadend",(()=>{this.simulateResponseProgress(t)}))}simulateResponseProgress(t){let e=90,n=Date.now(),s=()=>{let r=Date.now()-n,o=this.estimateResponseTime();e=90+Math.min(r/o,1)*9,this.dispatch("progress",{progress:e}),t.readyState!==XMLHttpRequest.DONE&&e<99&&requestAnimationFrame(s)};t.addEventListener("loadend",(()=>{this.dispatch("progress",{progress:100})})),requestAnimationFrame(s)}estimateResponseTime(){let t=this.file.size,e=1024*1024;return t<e?1e3:t<10*e?2e3:3e3+t/e*50}},v3t="input[type=file][data-direct-upload-url]:not([disabled])",kV=class{constructor(t){this.form=t,this.inputs=m3t(t,v3t).filter((e=>e.files.length))}start(t){let e=this.createDirectUploadControllers(),n=()=>{let s=e.shift();s?s.start((r=>{r?(t(r),this.dispatch("end")):n()})):(t(),this.dispatch("end"))};this.dispatch("start"),n()}createDirectUploadControllers(){let t=[];
8654return this.inputs.forEach((e=>{Tit(e.files).forEach((n=>{let s=new EV(e,n);t.push(s)}))})),t}dispatch(t,e={}){return DV(this.form,`direct-uploads:${t}`,{detail:e})}},CV="data-direct-uploads-processing",PV=new WeakMap,Sit=!1;function y3t(){Sit||(Sit=!0,document.addEventListener("click",x3t,!0),document.addEventListener("submit",w3t,!0),document.addEventListener("ajax:before",_3t))}function x3t(i){let t=i.target.closest("button, input");t&&t.type==="submit"&&t.form&&PV.set(t.form,t)}function w3t(i){Ait(i)}function _3t(i){i.target.tagName=="FORM"&&Ait(i)}function Ait(i){let t=i.target;if(t.hasAttribute(CV)){i.preventDefault();return}let e=new kV(t),{inputs:n}=e;n.length&&(i.preventDefault(),t.setAttribute(CV,""),n.forEach(C3t),e.start((s=>{t.removeAttribute(CV),s?n.forEach(M3t):S3t(t)})))}function S3t(i){let t=PV.get(i)||Mit(i,"input[type=submit], button[type=submit]");if(t){let{disabled:e}=t;t.disabled=!1,t.focus(),t.click(),t.disabled=e}else t=document.createElement("input"),t.type="submit",t.style.display="none",i.appendChild(t),t.click(),i.removeChild(t);PV.delete(i)}function C3t(i){i.disabled=!0}function M3t(i){i.disabled=!1}function T3t(){window.ActiveStorage&&y3t()}setTimeout(T3t,1);var RV=class{constructor(t,e,n=t.file){this.attachment=t,this.element=e,this.directUpload=new TP(n,this.directUploadUrl,this),this.file=n}start(){return new Promise(((t,e)=>{this.directUpload.create(((n,s)=>this.directUploadDidComplete(n,s,t,e))),this.dispatch("start")}))}directUploadWillStoreFileWithXHR(t){t.upload.addEventListener("progress",(e=>{let n=e.loaded/e.total*90;n&&this.dispatch("progress",{progress:n})})),t.upload.addEventListener("loadend",(()=>{this.simulateResponseProgress(t)}))}simulateResponseProgress(t){let e=90,n=Date.now(),s=()=>{let r=Date.now()-n,o=this.estimateResponseTime();e=90+Math.min(r/o,1)*9,this.dispatch("progress",{progress:e}),t.readyState!==XMLHttpRequest.DONE&&e<99&&requestAnimationFrame(s)};t.addEventListener("loadend",(()=>{this.dispatch("progress",{progress:100})})),requestAnimationFrame(s)}estimateResponseTime(){let t=this.file.size,e=1024*1024;return t<e?1e3:t<10*e?2e3:3e3+t/e*50}directUploadDidComplete(t,e,n,s){t?this.dispatchError(t,s):(n({sgid:e.attachable_sgid,url:this.createBlobUrl(e.signed_id,e.filename)}),this.dispatch("end"))}createBlobUrl(t,e){return this.blobUrlTemplate.replace(":signed_id",t).replace(":filename",encodeURIComponent(e))}dispatch(t,e={}){return e.attachment=this.attachment,DV(this.element,`direct-upload:${t}`,{detail:e})}dispatchError(t,e){this.dispatch("error",{error:t}).defaultPrevented||e(t)}get directUploadUrl(){return this.element.dataset.directUploadUrl}get blobUrlTemplate(){return this.element.dataset.blobUrlTemplate}};addEventListener("trix-attachment-add",(i=>{let{attachment:t,target:e}=i;if(t.file){let n=new RV(t,e,t.file),s=r=>t.setUploadProgress(r.detail.progress);e.addEventListener("direct-upload:progress",s),n.start().then((r=>t.setAttributes(r))).catch((r=>alert(r))).finally((()=>e.removeEventListener("direct-upload:progress",s)))}}));ng.config.textAttributes.inlineCode={tagName:"code",inheritable:!0};var LV=class{constructor(t){this.patterns=void 0,this.element=t,this.editor=t.editor,this.toolbar=t.toolbarElement,this.injectHTML(),this.hrefElement=this.toolbar.querySelector("[data-trix-input][name='href']"),this.embedContainerElement=this.toolbar.querySelector("[data-behavior='embed_container']"),this.embedElement=this.toolbar.querySelector("[data-behavior='embed_url']"),this.reset(),this.installEventHandlers()}injectHTML(){this.toolbar.querySelector('[data-trix-dialog="href"]').insertAdjacentHTML("beforeend",`
8655        <div data-behavior="embed_container">
8656          <div class="link_to_embed link_to_embed--new">
8657            Would you like to embed media from this site?
8658            <input class="btn btn-tertiary btn-small btn-outline" type="button" data-behavior="embed_url" value="Yes, embed it">
8659          </div>
8660        </div>
8661    `)}installEventHandlers(){this.hrefElement.addEventListener("input",this.didInput.bind(this)),this.hrefElement.addEventListener("focusin",this.didInput.bind(this)),this.embedElement.addEventListener("click",this.embed.bind(this))}didInput(t){let e=t.target.value.trim();this.patterns===void 0?this.loadPatterns(e):this.match(e)?this.fetch(e):this.reset()}async loadPatterns(t){let e=await nS("/action_text/embeds/patterns.json",{responseKind:"json"});if(e.ok){let n=await e.json;this.patterns=n.map(s=>new RegExp(s.source,s.options)),this.match(t)&&this.fetch(t)}}match(t){return this.patterns.some(e=>e.test(t))}async fetch(t){let e=await b5(`/action_text/embeds?id=${encodeURIComponent(t)}`,{responseKind:"json"});e.ok?this.showEmbed(await e.json):this.reset()}embed(t){if(this.currentEmbed==null)return;let e=new ng.Attachment(this.currentEmbed);this.editor.insertAttachment(e),this.element.focus()}showEmbed(t){this.currentEmbed=t,this.embedContainerElement.style.display="block"}reset(){this.embedContainerElement.style.display="none",this.currentEmbed=null}},IV=class{constructor(t){this.element=t,this.editor=t.editor,this.toolbar=t.toolbarElement,this.installEventHandlers()}installEventHandlers(){let t=this.toolbar.querySelector("[data-trix-attribute=code]"),e=t.cloneNode(!0);e.hidden=!0,e.dataset.trixAttribute="inlineCode",t.insertAdjacentElement("afterend",e),this.element.addEventListener("trix-selection-change",n=>{let s=this.getCodeFormattingType();t.hidden=s=="inline",e.hidden=s=="block"})}
8661getCodeFormattingType(){if(this.editor.attributeIsActive("code"))return"block";if(this.editor.attributeIsActive("inlineCode"))return"inline";let t=this.editor.getSelectedRange();if(t[0]==t[1])return"block";let e=this.editor.getSelectedDocument().toString().trim();return/\n/.test(e)?"block":"inline"}};document.addEventListener("trix-initialize",function(i){new LV(i.target),new IV(i.target)});var v_e=il(Eit()),y_e=il(kit()),x_e=il(Pit());function Vg(){document.querySelectorAll("[data-relative-time]").forEach(t=>{let e=t.getAttribute("data-timestamp");if(e)try{let n=new Date(e);if(isNaN(n.getTime()))return;let r=Math.floor((new Date-n)/1e3),o;if(r<60)o="Just now";else if(r<3600)o="within the hour";else if(r<86400){let a=Math.floor(r/3600);o=`${a} hour${a!==1?"s":""} ago`}else if(r<2592e3){let a=Math.floor(r/86400);o=`${a} day${a!==1?"s":""} ago`}else if(r<31536e3){let a=Math.floor(r/2592e3);o=`${a} month${a!==1?"s":""} ago`}else{let a=Math.floor(r/31536e3);o=`${a} year${a!==1?"s":""} ago`}t.textContent=o}catch(n){console.error("Error updating relative time:",n)}})}document.addEventListener("DOMContentLoaded",Vg);document.addEventListener("turbo:load",Vg);document.addEventListener("turbo:frame-load",Vg);document.addEventListener("turbo:render",Vg);document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Vg):setTimeout(Vg,100);setInterval(Vg,6e4);function AP(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)n!=="__proto__"&&(i[n]=e[n])}return i}var k3t={read:function(i){return i[0]==='"'&&(i=i.slice(1,-1)),i.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(i){return encodeURIComponent(i).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function OV(i,t){function e(s,r,o){if(!(typeof document>"u")){o=AP({},t,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var l in o)o[l]&&(a+="; "+l,o[l]!==!0&&(a+="="+o[l].split(";")[0]));return document.cookie=s+"="+i.write(r,s)+a}}function n(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var r=document.cookie?document.cookie.split("; "):[],o={},a=0;a<r.length;a++){var l=r[a].split("="),c=l.slice(1).join("=");try{var u=decodeURIComponent(l[0]);if(u in o||(o[u]=i.read(c,u)),s===u)break}catch{}}return s?o[s]:o}}return Object.create({set:e,get:n,remove:function(s,r){e(s,"",AP({},r,{expires:-1}))},withAttributes:function(s){return OV(this.converter,AP({},this.attributes,s))},withConverter:function(s){return OV(AP({},this.converter,s),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(i)}})}var Rit=OV(k3t,{path:"/"});var NV=il(Iit());function P3t(){let i=window.Intl;try{window.Intl=void 0;let t=NV.default.determine().name();return window.Intl=i,t}catch{return NV.default.determine().name()}}document.addEventListener("turbo:load",()=>{Rit.set("browser_time_zone",P3t(),{expires:365,path:"/",secure:!0,sameSite:"strict"})});var BV=class{static toggleNavBar(){let t=new CustomEvent("toggle-nav-bar");window.dispatchEvent(t)}static setNotificationCount(t,e=t){this.postMessage("showNotificationBadge",{icon:t,tab:e})}static postMessage(t,e={}){window.webkit?.messageHandlers?.nativeApp?.postMessage({name:t,...e}),window.nativeApp?.postMessage(JSON.stringify({name:t,...e}))}};window.TurboNativeBridge=BV;$h.remove_later=function(){setTimeout(()=>{this.targetElements.forEach(i=>i.remove())},this.getAttribute("after"))};$h.reset_form=function(){this.targetElements.forEach(i=>i.reset())};$h.scroll_to=function(){this.targetElements.forEach(i=>i.scrollIntoView({behavior:"smooth"}))};$h.redirect=function(){Turbo.visit(this.target)};var z_e=il(FV()),V_e=il(VV()),H_e=il(WV()),j_e=il(Bit());var Ya=i=>{let t=0,e=0,n=0;return i.length===4?(t=`0x${i[1]}${i[1]}`,e=`0x${i[2]}${i[2]}`,n=`0x${i[3]}${i[3]}`):i.length===7&&(t=`0x${i[1]}${i[2]}`,e=`0x${i[3]}${i[4]}`,n=`0x${i[5]}${i[6]}`),`${+t},${+e},${+n}`},Pl=i=>Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumSignificantDigits:3,notation:"compact"}).format(i);Chart.defaults.font.family='"Inter", sans-serif';Chart.defaults.font.weight="500";Chart.defaults.plugins.tooltip.borderWidth=1;Chart.defaults.plugins.tooltip.displayColors=!1;Chart.defaults.plugins.tooltip.mode="nearest";Chart.defaults.plugins.tooltip.intersect=!1;Chart.defaults.plugins.tooltip.position="nearest";Chart.defaults.plugins.tooltip.caretSize=0;Chart.defaults.plugins.tooltip.caretPadding=20;Chart.defaults.plugins.tooltip.cornerRadius=4;Chart.defaults.plugins.tooltip.padding=8;Chart.register({id:"chartAreaPlugin",beforeDraw:i=>{if(i.config.options.chartArea&&i.config.options.chartArea.backgroundColor){let t=i.canvas.getContext("2d"),{chartArea:e}=i;t.save(),t.fillStyle=i.config.options.chartArea.backgroundColor,t.fillRect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.restore(
8661)}}});var I3t=()=>{let i=document.getElementById("dashboard-card-01");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#f8fafc",dark:`rgba(${Ya("#0F172A")}, 0.24)`},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023"],datasets:[{data:[732,610,610,504,504,504,349,349,504,342,504,610,391,192,154,273,191,191,126,263,349,252,423,622,470,532],fill:!0,backgroundColor:`rgba(${Ya("#3b82f6")}, 0.08)`,borderColor:"#6366f1",borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroundColor:"#6366f1",pointHoverBackgroundColor:"#6366f1",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20},{data:[532,532,532,404,404,314,314,314,314,314,234,314,234,234,314,314,314,388,314,202,202,202,202,314,720,642],borderColor:`rgba(${Ya("#64748B")}, 0.25)`,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:`rgba(${Ya("#64748B")}, 0.25)`,clip:20}]},options:{chartArea:{backgroundColor:t?e.dark:e.light},layout:{padding:20},scales:{y:{display:!1,beginAtZero:!0},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month"},display:!1}},plugins:{tooltip:{callbacks:{title:()=>!1,label:a=>Pl(a.parsed.y)},bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light},legend:{display:!1}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.chartArea.backgroundColor=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.chartArea.backgroundColor=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};I3t();var O3t=()=>{let i=document.getElementById("dashboard-card-02");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#f8fafc",dark:`rgba(${Ya("#0F172A")}, 0.24)`},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023"],datasets:[{data:[622,622,426,471,365,365,238,324,288,206,324,324,500,409,409,273,232,273,500,570,767,808,685,767,685,685],fill:!0,backgroundColor:`rgba(${Ya("#3b82f6")}, 0.08)`,borderColor:"#6366f1",borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#6366f1",pointHoverBackgroundColor:"#6366f1",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20},{data:[732,610,610,504,504,504,349,349,504,342,504,610,391,192,154,273,191,191,126,263,349,252,423,622,470,532],borderColor:`rgba(${Ya("#64748B")}, 0.25)`,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroundColor:`rgba(${Ya("#64748B")}, 0.25)`,clip:20}]},options:{chartArea:{backgroundColor:t?e.dark:e.light},layout:{padding:20},scales:{y:{display:!1,beginAtZero:!0},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month"},display:!1}},plugins:{tooltip:{callbacks:{title:()=>!1,label:a=>Pl(a.parsed.y)},bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light},legend:{display:!1}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.chartArea.backgroundColor=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.chartArea.backgroundColor=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};O3t();var N3t=()=>{let i=document.getElementById("dashboard-card-03");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#f8fafc",dark:`rgba(${Ya("#0F172A")}, 0.24)`},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023"],datasets:[{data:[540,466,540,466,385,432,334,334,289,289,200,289,222,289,289,403,554,304,289,270,134,270,829,344,388,364],fill:!0,backgroundColor:`rgba(${Ya("#3b82f6")}, 0.08)`,borderColor:"#6366f1",borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#6366f1",pointHoverBackgroundColor:"#6366f1",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20},{data:[689,562,477,477,477,477,458,314,430,378,430,498,642,350,145,145,354,260,188,188,300,300,282,364,660,554],borderColor:`rgba(${Ya("#64748B")}, 0.25)`,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroundColor:`rgba(${Ya("#64748B")}, 0.25)`,clip:20}]},options:{chartArea:{backgroundColor:t?e.dark:e.light},layout:{padding:20},scales:{y:{display:!1,beginAtZero:!0},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month"},display:!1}},plugins:{tooltip:{callbacks:{title:()=>!1,label:a=>Pl(a.parsed.y)},bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light},legend:{display:!1}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.chartArea.backgroundColor=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.chartArea.backgroundColor=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};N3t();var B3t=()=>{let i=document.getElementById("dashboard-card-04");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"},a=new Chart(i,{type:"bar",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021"],datasets:[{label:"Direct",data:[800,1600,900,1300,1950,1700],backgroundColor:"#60a5fa",hoverBackgroundColor:"#3b82f6",barPercentage:.66,categoryPercentage:.66},{label:"Indirect",data:[4900,2600,5350,4800,5200,4800],backgroundColor:"#6366f1",hoverBackgroundColor:"#4f46e5",barPercentage:.66,categoryPercentage:.66}]},options:{layout:{padding:{top:12,bottom:16,left:20,right:20}},scales:{y:{border:{display:!1},ticks:{maxTicksLimit:5,callback:l=>Pl(l),color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month",displayFormats:{month:"MMM YY"}},border:{display:!1},grid:{display:!1},ticks:{color:t?e.dark:e.light}}},plugins:{legend:{display:!1},htmlLegend:{containerID:"dashboard-card-04-legend"},tooltip:{callbacks:{title:()=>!1,label:l=>Pl(l.parsed.y)},bodyColor:t?s.dark:s.light,backgroundColor:t?r.dark:r.light,borderColor:t?o.dark:o.light}},interaction:{intersect:!1,mode:"nearest"},animation:{duration:200},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(l,c,u){let d=document.getElementById(u.containerID).querySelector("ul");if(!d)return;for(;d.firstChild;)d.firstChild.remove();l.options.plugins.legend.labels.generateLabels(l).forEach(g=>{let y=document.createElement("li");y.style.marginRight="16px";let x=document.createElement("button");x.style.display="inline-flex",x.style.alignItems="center",x.style.opacity=g.hidden?".3":"",x.onclick=()=>{l.setDatasetVisibility(g.datasetIndex,!l.isDatasetVisible(g.datasetIndex)),l.update()};let w=document.createElement("span");w.style.display="block",w.style.width="12px",w.style.height="12px",w.style.borderRadius="9999px",w.style.marginRight="8px",w.style.borderWidth="3px",w.style.borderColor=g.fillStyle,w.style.pointerEvents="none";let M=document.createElement("span");M.style.display="flex",M.style.alignItems="center";let A=document.createElement("span");A.style.color="var(--bs-fg)",A.style.fontSize="1.88rem",A.style.lineHeight="1.33",A.style.fontWeight="700",A.style.marginRight="8px",A.style.pointerEvents="none";let C=document.createElement("span");C.style.color="var(--bs-fg-mute)",C.style.fontSize="0.875rem",C.style.lineHeight="1.5715";let R=l.data.datasets[g.datasetIndex].data.reduce((I,U)=>I+U,0),k=document.createTextNode(Pl(R)),O=document.createTextNode(g.text);A.appendChild(k),C.appendChild(O),y.appendChild(x),x.appendChild(w),x.appendChild(M),M.appendChild(A),M.appendChild(C),d.appendChild(y)})}}]});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.scales.x.ticks.color=e.dark,a.options.scales.y.ticks.color=e.dark,a.options.scales.y.grid.color=n.dark,a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.scales.x.ticks.color=e.light,a.options.scales.y.ticks.color=e.light,a.options.scales.y.grid.color=n.light,a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})};B3t();var F3t=()=>{let i=document.getElementById("dashboard-card-05");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#1e293b",dark:"#f1f5f9"},o={light:"#ffffff",dark:"#334155"},a={light:"#e2e8f0",dark:"#475569"},l=[57.81,57.75,55.48,54.28,53.14,52.25,51.04,52.49,55.49,56.87,53.73,56.42,58.06,55.62,58.16,55.22,58.67,60.18,61.31,63.25,65.91,64.44,65.97,62.27,60.96,59.34,55.07,59.85,53.79,51.92,50.95,49.65,48.09,49.81,47.85,49.52,50.21,52.22,54.42,53.42,50.91,58.52,53.37,57.58,59.09,59.36,58.71,59.42,55.93,57.71,50.62,56.28,57.37,53.08,55.94,55.82,53.94,52.65,50.25],u=(()=>{let C=new Date,R=[];return l.forEach((k,O)=>{R.push(new Date(C-2e3-O*2e3))}),R})(),h=35,d=0,p=l.slice(0,h),g=u.slice(0,h).reverse(),y=new Chart(i,{type:"line",data:{labels:g,datasets:[{data:p,fill:!0,backgroundColor:`rgba(${Ya("#3b82f6")}, 0.08)`,borderColor:"#6366f1",borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#6366f1",pointHoverBackgroundColor:"#6366f1",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{layout:{padding:20},scales:{y:{border:{display:!1},suggestedMin:30,suggestedMax:80,ticks:{maxTicksLimit:5,callback:C=>Pl(C),color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}},x:{type:"time",time:{parser:"hh:mm:ss",unit:"second",tooltipFormat:"MMM DD, H:mm:ss a",displayFormats:{second:"H:mm:ss"}},border:{display:!1},grid:{display:!1},ticks:{autoSkipPadding:48,maxRotation:0,color:t?e.dark:e.light}}},plugins:{legend:{display:!1},tooltip:{titleFont:{weight:"600"},callbacks:{label:C=>Pl(C.parsed.y)},titleColor:t?s.dark:s.light,bodyColor:t?r.dark:r.light,backgroundColor:t?o.dark:o.light,borderColor:t?a.dark:a.light}},interaction:{intersect:!1,mode:"nearest"},animation:!1,maintainAspectRatio:!1}}),x=document.getElementById("dashboard-card-05-value"),w=document.getElementById("dashboard-card-05-deviation"),M=(C=NaN,R)=>{let{datasets:k}=y.data;if(y.data.labels.shift(),y.data.labels.push(new Date),k[0].data.shift(),k[0].data.push(C),y.update(0),!x)return;let O=(C-R)/R*100;x.innerHTML=C,w&&(O<0?w.style.backgroundColor="#f59e0b":w.style.backgroundColor="#10b981",w.innerHTML=`${O>0?"+":""}${O.toFixed(2)}%`)},A=()=>{d+=1,d+h-1<l.length?M(l[d+h-1],l[d+h-2]):(d=0,h=1,M(l[d+h-1],l[l.length-1])),setTimeout(A,2e3)};A(),document.addEventListener("darkMode",C=>{let{mode:R}=C.detail;R==="on"?(y.options.scales.x.ticks.color=e.dark,y.options.scales.y.ticks.color=e.dark,y.options.scales.y.grid.color=n.dark,y.options.plugins.tooltip.titleColor=s.dark,y.options.plugins.tooltip.bodyColor=r.dark,y.options.plugins.tooltip.backgroundColor=o.dark,y.options.plugins.tooltip.borderColor=a.dark):(y.options.scales.x.ticks.color=e.light,y.options.scales.y.ticks.color=e.light,y.options.scales.y.grid.color=n.light,y.options.plugins.tooltip.titleColor=s.light,y.options.plugins.tooltip.bodyColor=r.light,y.options.plugins.tooltip.backgroundColor=o.light,y.options.plugins.tooltip.borderColor=a.light),y.update("none")})};F3t();var U3t=()=>{let i=document.getElementById("dashboard-card-06");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#1e293b",dark:"#f1f5f9"},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"doughnut",data:{labels:["United States","Italy","Other"],datasets:[{label:"Top Countries",data:[35,30,35],backgroundColor:["#6366f1","#60a5fa","#3730a3"],hoverBackgroundColor:["#4f46e5","#3b82f6","#312e81"],borderWidth:0}]},options:{cutout:"80%",layout:{padding:24},plugins:{legend:{display:!1},htmlLegend:{containerID:"dashboard-card-06-legend"},tooltip:{titleColor:t?e.dark:e.light,bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light}},interaction:{intersect:!1,mode:"nearest"},animation:{duration:200},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(a,l,c){let h=document.getElementById(c.containerID).querySelector("ul");if(!h)return;for(;h.firstChild;)h.firstChild.remove();a.options.plugins.legend.labels.generateLabels(a).forEach(p=>{let g=document.createElement("li");g.style.margin="4px";let y=document.createElement("button");y.style.cssText="font-size: 11px; padding: 4px 8px; background: var(--bs-bg-panel); color: var(--bs-fg-mute); border: 1px solid var(--bs-line); border-radius: var(--bs-r-sm); cursor: pointer;",y.style.opacity=p.hidden?".3":"",y.onclick=()=>{a.toggleDataVisibility(p.index,!p.index),a.update()};let x=document.createElement("span");x.style.display="block",x.style.width="8px",x.style.height="8px",x.style.backgroundColor=p.fillStyle,x.style.borderRadius="2px",x.style.marginRight="4px",x.style.pointerEvents="none";let w=document.createElement("span");w.style.display="flex",w.style.alignItems="center";let M=document.createTextNode(p.text);w.appendChild(M),g.appendChild(y),y.appendChild(x),y.appendChild(w),h.appendChild(g)})}}]});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.plugins.tooltip.titleColor=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.plugins.tooltip.titleColor=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};U3t();var z3t=()=>{let i=document.getElementById("dashboard-card-08");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"},a=new Chart(i,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023"],datasets:[{label:"Current",data:[73,64,73,69,104,104,164,164,120,120,120,148,142,104,122,110,104,152,166,233,268,252,284,284,333,323],borderColor:"#6366f1",fill:!1,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#6366f1",pointHoverBackgroundColor:"#6366f1",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20},{label:"Previous",data:[184,86,42,378,42,243,38,120,0,0,42,0,84,0,276,0,124,42,124,88,88,215,156,88,124,64],borderColor:"#60a5fa",fill:!1,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroundColor:"#60a5fa",pointHoverBackgroundColor:"#60a5fa",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20},{label:"Average",data:[122,170,192,86,102,124,115,115,56,104,0,72,208,186,223,188,114,162,200,150,118,118,76,122,230,268],borderColor:"#10b981",fill:!1,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroundColor:"#10b981",pointHoverBackgroundColor:"#10b981",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{layout:{padding:20},scales:{y:{beginAtZero:!0,border:{display:!1},ticks:{maxTicksLimit:5,callback:l=>Pl(l),color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month",displayFormats:{month:"MMM YY"}},border:{display:!1},grid:{display:!1},ticks:{autoSkipPadding:48,maxRotation:0,color:t?e.dark:e.light}}},plugins:{legend:{display:!1},htmlLegend:{containerID:"dashboard-card-08-legend"},tooltip:{callbacks:{title:()=>!1,label:l=>Pl(l.parsed.y)},bodyColor:t?s.dark:s.light,backgroundColor:t?r.dark:r.light,borderColor:t?o.dark:o.light}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(l,c,u){let d=document.getElementById(u.containerID).querySelector("ul");if(!d)return;for(;d.firstChild;)d.firstChild.remove();l.options.plugins.legend.labels.generateLabels(l).slice(0,2).forEach(g=>{let y=document.createElement("li");y.style.marginLeft="12px";let x=document.createElement("button");x.style.display="inline-flex",x.style.alignItems="center",x.style.opacity=g.hidden?".3":"",x.onclick=()=>{l.setDatasetVisibility(g.datasetIndex,!l.isDatasetVisible(g.datasetIndex)),l.update()};let w=document.createElement("span");w.style.display="block",w.style.width="12px",w.style.height="12px",w.style.borderRadius="9999px",w.style.marginRight="8px",w.style.borderWidth="3px",w.style.borderColor=l.data.datasets[g.datasetIndex].borderColor,w.style.pointerEvents="none";let M=document.createElement("span");M.style.color="var(--bs-fg-mute)",M.style.fontSize="0.875rem",M.style.lineHeight="1.5715";let A=document.createTextNode(g.text);M.appendChild(A),y.appendChild(x),x.appendChild(w),x.appendChild(M),d.appendChild(y)})}}]});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.scales.x.ticks.color=e.dark,a.options.scales.y.ticks.color=e.dark,a.options.scales.y.grid.color=n.dark,a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.scales.x.ticks.color=e.light,a.options.scales.y.ticks.color=e.light,a.options.scales.y.grid.color=n.light,a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})};z3t();var V3t=()=>{let i=document.getElementById("dashboard-card-09");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"},a=new Chart(i,{type:"bar",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021"],datasets:[{label:"Stack 1",data:[6200,9200,6600,8800,5200,9200],backgroundColor:"#6366f1",hoverBackgroundColor:"#4f46e5",barPercentage:.66,categoryPercentage:.66},{label:"Stack 2",data:[-4e3,-2600,-5350,-4e3,-7500,-2e3],backgroundColor:"#c7d2fe",hoverBackgroundColor:"#a5b4fc",barPercentage:.66,categoryPercentage:.66}]},options:{layout:{padding:{top:12,bottom:16,left:20,right:20}},scales:{y:{stacked:!0,border:{display:!1},beginAtZero:!0,ticks:{maxTicksLimit:5,callback:l=>Pl(l),color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}},x:{stacked:!0,type:"time",time:{parser:"MM-DD-YYYY",unit:"month",displayFormats:{month:"MMM YY"}},border:{display:!1},grid:{display:!1}
8661,ticks:{autoSkipPadding:48,maxRotation:0,color:t?e.dark:e.light}}},plugins:{legend:{display:!1},tooltip:{callbacks:{title:()=>!1,label:l=>Pl(l.parsed.y)},bodyColor:t?s.dark:s.light,backgroundColor:t?r.dark:r.light,borderColor:t?o.dark:o.light}},interaction:{intersect:!1,mode:"nearest"},animation:{duration:200},maintainAspectRatio:!1}});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.scales.x.ticks.color=e.dark,a.options.scales.y.ticks.color=e.dark,a.options.scales.y.grid.color=n.dark,a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.scales.x.ticks.color=e.light,a.options.scales.y.ticks.color=e.light,a.options.scales.y.grid.color=n.light,a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})};V3t();var Rl=i=>{let t=0,e=0,n=0;return i.length===4?(t=`0x${i[1]}${i[1]}`,e=`0x${i[2]}${i[2]}`,n=`0x${i[3]}${i[3]}`):i.length===7&&(t=`0x${i[1]}${i[2]}`,e=`0x${i[3]}${i[4]}`,n=`0x${i[5]}${i[6]}`),`${+t},${+e},${+n}`},Hg=i=>Intl.NumberFormat("en-US",{maximumSignificantDigits:3,notation:"compact"}).format(i);Chart.defaults.font.family='"Inter", sans-serif';Chart.defaults.font.weight="500";Chart.defaults.plugins.tooltip.borderWidth=1;Chart.defaults.plugins.tooltip.displayColors=!1;Chart.defaults.plugins.tooltip.mode="nearest";Chart.defaults.plugins.tooltip.intersect=!1;Chart.defaults.plugins.tooltip.position="nearest";Chart.defaults.plugins.tooltip.caretSize=0;Chart.defaults.plugins.tooltip.caretPadding=20;Chart.defaults.plugins.tooltip.cornerRadius=4;Chart.defaults.plugins.tooltip.padding=8;Chart.register({id:"chartAreaPlugin",beforeDraw:i=>{if(i.config.options.chartArea&&i.config.options.chartArea.backgroundColor){let t=i.canvas.getContext("2d"),{chartArea:e}=i;t.save(),t.fillStyle=i.config.options.chartArea.backgroundColor,t.fillRect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.restore()}}});var H3t=()=>{let i=document.getElementById("analytics-card-01");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"},a=new Chart(i,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023"],datasets:[{label:"Current",data:[5e3,8700,7500,12e3,11e3,9500,10500,1e4,15e3,9e3,1e4,7e3,22e3,7200,9800,9e3,1e4,8e3,15e3,12e3,11e3,13e3,11e3,15e3,17e3,18e3],fill:!0,backgroundColor:`rgba(${Rl("#3b82f6")}, 0.08)`,borderColor:"#6366f1",borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#6366f1",pointHoverBackgroundColor:"#6366f1",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20},{label:"Previous",data:[8e3,5e3,6500,5e3,6500,12e3,8e3,9e3,8e3,8e3,12500,1e4,1e4,12e3,11e3,16e3,12e3,1e4,1e4,14e3,9e3,1e4,15e3,12500,14e3,11e3],borderColor:`rgba(${Rl("#64748B")}, 0.25)`,fill:!1,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroundColor:`rgba(${Rl("#64748B")}, 0.25)`,pointHoverBackgroundColor:`rgba(${Rl("#64748B")}, 0.25)`,pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{layout:{padding:20},scales:{y:{beginAtZero:!0,border:{display:!1},ticks:{callback:l=>Hg(l),color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month",displayFormats:{month:"MMM YY"}},border:{display:!1},grid:{display:!1},ticks:{autoSkipPadding:48,maxRotation:0,color:t?e.dark:e.light}}},plugins:{legend:{display:!1},tooltip:{callbacks:{title:()=>!1,label:l=>Hg(l.parsed.y)},bodyColor:t?s.dark:s.light,backgroundColor:t?r.dark:r.light,borderColor:t?o.dark:o.light}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.scales.x.ticks.color=e.dark,a.options.scales.y.ticks.color=e.dark,a.options.scales.y.grid.color=n.dark,a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.scales.x.ticks.color=e.light,a.options.scales.y.ticks.color=e.light,a.options.scales.y.grid.color=n.light,a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})};H3t();var j3t=()=>{let i=document.getElementById("analytics-card-02");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#f8fafc",dark:`rgba(${Rl("#0F172A")}, 0.24)`},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023"],datasets:[{data:[732,610,610,504,504,504,349,349,504,342,504,610,391,192,154,273,191,191,126,263,349,252,423,622,470,532],fill:!0,backgroundColor:`rgba(${Rl("#3b82f6")}, 0.08)`,borderColor:"#6366f1",borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#6366f1",pointHoverBackgroundColor:"#6366f1",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{chartArea:{backgroundColor:t?e.dark:e.light},layout:{padding:{left:20,right:20}},scales:{y:{display:!1,beginAtZero:!0},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month"},display:!1}},plugins:{tooltip:{callbacks:{title:()=>!1,label:a=>Hg(a.parsed.y)},bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light},legend:{display:!1}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.chartArea.backgroundColor=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.chartArea.backgroundColor=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};j3t();var W3t=()=>{let i=document.getElementById("analytics-card-03");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"},a=new Chart(i,{type:"bar",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021"],datasets:[{label:"Direct",data:[5e3,4e3,4e3,3800,5200,5100],backgroundColor:"#4338ca",hoverBackgroundColor:"#3730a3",barPercentage:.66,categoryPercentage:.66},{label:"Referral",data:[2500,2600,4e3,4e3,4800,3500],backgroundColor:"#6366f1",hoverBackgroundColor:"#4f46e5",barPercentage:.66,categoryPercentage:.66},{label:"Organic Search",data:[2300,2e3,3100,2700,1300,2600],backgroundColor:"#a5b4fc",hoverBackgroundColor:"#818cf8",barPercentage:.66,categoryPercentage:.66},{label:"Social",data:[4800,4200,4800,1800,3300,3500],backgroundColor:"#e0e7ff",hoverBackgroundColor:"#c7d2fe",barPercentage:.66,categoryPercentage:.66}]},options:{layout:{padding:{top:12,bottom:16,left:20,right:20}},scales:{y:{stacked:!0,border:{display:!1},beginAtZero:!0,ticks:{maxTicksLimit:5,callback:l=>Hg(l),color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}},x:{stacked:!0,type:"time",time:{parser:"MM-DD-YYYY",unit:"month",displayFormats:{month:"MMM"}},border:{display:!1},grid:{display:!1},ticks:{autoSkipPadding:48,maxRotation:0,color:t?e.dark:e.light}}},plugins:{legend:{display:!1},htmlLegend:{containerID:"analytics-card-03-legend"},tooltip:{callbacks:{title:()=>!1,label:l=>Hg(l.parsed.y)},bodyColor:t?s.dark:s.light,backgroundColor:t?r.dark:r.light,borderColor:t?o.dark:o.light}},interaction:{intersect:!1,mode:"nearest"},animation:{duration:200},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(l,c,u){let d=document.getElementById(u.containerID).querySelector("ul");if(!d)return;for(;d.firstChild;)d.firstChild.remove();l.options.plugins.legend.labels.generateLabels(l).forEach(g=>{let y=document.createElement("li");y.style.marginRight="12px";let x=document.createElement("button");x.style.display="inline-flex",x.style.alignItems="center",x.style.opacity=g.hidden?".3":"",x.onclick=()=>{l.setDatasetVisibility(g.datasetIndex,!l.isDatasetVisible(g.datasetIndex)),l.update()};let w=document.createElement("span");w.style.display="block",w.style.width="12px",w.style.height="12px",w.style.borderRadius="9999px",w.style.marginRight="8px",w.style.borderWidth="3px",w.style.borderColor=g.fillStyle,w.style.pointerEvents="none";let M=document.createElement("span");M.style.color="var(--bs-fg-mute)",M.style.fontSize="0.875rem",M.style.lineHeight="1.5715";let A=document.createTextNode(g.text);M.appendChild(A),y.appendChild(x),x.appendChild(w),x.appendChild(M),d.appendChild(y)})}}]});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.scales.x.ticks.color=e.dark,a.options.scales.y.ticks.color=e.dark,a.options.scales.y.grid.color=n.dark,a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.scales.x.ticks.color=e.light,a.options.scales.y.ticks.color=e.light,a.options.scales.y.grid.color=n.light,a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})};W3t();var $3t=()=>{let i=document.getElementById("analytics-card-04");
8661if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"},a=new Chart(i,{type:"bar",data:{labels:["02-01-2021","03-01-2021","04-01-2021","05-01-2021"],datasets:[{label:"New Visitors",data:[8e3,3800,5350,7800],backgroundColor:"#6366f1",hoverBackgroundColor:"#4f46e5",categoryPercentage:.66},{label:"Returning Visitors",data:[4e3,6500,2200,5800],backgroundColor:"#38bdf8",hoverBackgroundColor:"#0ea5e9",categoryPercentage:.66}]},options:{indexAxis:"y",layout:{padding:{top:12,bottom:16,left:20,right:20}},scales:{y:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month",displayFormats:{month:"MMM"}},border:{display:!1},grid:{display:!1},ticks:{color:t?e.dark:e.light}},x:{border:{display:!1},ticks:{maxTicksLimit:3,align:"end",callback:l=>Hg(l),color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}}},plugins:{legend:{display:!1},htmlLegend:{containerID:"analytics-card-04-legend"},tooltip:{callbacks:{title:()=>!1,label:l=>Hg(l.parsed.x)},bodyColor:t?s.dark:s.light,backgroundColor:t?r.dark:r.light,borderColor:t?o.dark:o.light}},interaction:{intersect:!1,mode:"nearest"},animation:{duration:200},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(l,c,u){let d=document.getElementById(u.containerID).querySelector("ul");if(!d)return;for(;d.firstChild;)d.firstChild.remove();l.options.plugins.legend.labels.generateLabels(l).forEach(g=>{let y=document.createElement("li");y.style.marginRight="16px";let x=document.createElement("button");x.style.display="inline-flex",x.style.alignItems="center",x.style.opacity=g.hidden?".3":"",x.onclick=()=>{l.setDatasetVisibility(g.datasetIndex,!l.isDatasetVisible(g.datasetIndex)),l.update()};let w=document.createElement("span");w.style.display="block",w.style.width="12px",w.style.height="12px",w.style.borderRadius="9999px",w.style.marginRight="8px",w.style.borderWidth="3px",w.style.borderColor=g.fillStyle,w.style.pointerEvents="none";let M=document.createElement("span");M.style.color="var(--bs-fg-mute)",M.style.fontSize="0.875rem",M.style.lineHeight="1.5715";let A=document.createTextNode(g.text);M.appendChild(A),y.appendChild(x),x.appendChild(w),x.appendChild(M),d.appendChild(y)})}}]});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.scales.x.ticks.color=e.dark,a.options.scales.x.grid.color=n.dark,a.options.scales.y.ticks.color=e.dark,a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.scales.x.ticks.color=e.light,a.options.scales.x.grid.color=n.light,a.options.scales.y.ticks.color=e.light,a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})};$3t();var G3t=()=>{let i=document.getElementById("analytics-card-08");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#1e293b",dark:"#f1f5f9"},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"doughnut",data:{labels:["Desktop","Mobile","Tablet"],datasets:[{label:"Sessions By Device",data:[12,50,38],backgroundColor:["#6366f1","#38bdf8","#3730a3"],hoverBackgroundColor:["#4f46e5","#0ea5e9","#312e81"],borderWidth:0}]},options:{cutout:"80%",layout:{padding:24},plugins:{legend:{display:!1},htmlLegend:{containerID:"analytics-card-08-legend"},tooltip:{titleColor:t?e.dark:e.light,bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light}},interaction:{intersect:!1,mode:"nearest"},animation:{duration:200},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(a,l,c){let h=document.getElementById(c.containerID).querySelector("ul");if(!h)return;for(;h.firstChild;)h.firstChild.remove();a.options.plugins.legend.labels.generateLabels(a).forEach(p=>{let g=document.createElement("li");g.style.margin="4px";let y=document.createElement("button");y.style.cssText="font-size: 11px; padding: 4px 8px; background: var(--bs-bg-panel); color: var(--bs-fg-mute); border: 1px solid var(--bs-line); border-radius: var(--bs-r-sm); cursor: pointer;",y.style.opacity=p.hidden?".3":"",y.onclick=()=>{a.toggleDataVisibility(p.index,!p.index),a.update()};let x=document.createElement("span");x.style.display="block",x.style.width="8px",x.style.height="8px",x.style.backgroundColor=p.fillStyle,x.style.borderRadius="2px",x.style.marginRight="4px",x.style.pointerEvents="none";let w=document.createElement("span");w.style.display="flex",w.style.alignItems="center";let M=document.createTextNode(p.text);w.appendChild(M),g.appendChild(y),y.appendChild(x),y.appendChild(w),h.appendChild(g)})}}]});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.plugins.tooltip.titleColor=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.plugins.tooltip.titleColor=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};G3t();var q3t=()=>{let i=document.getElementById("analytics-card-09");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#1e293b",dark:"#f1f5f9"},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"doughnut",data:{labels:["<18","18-24","24-36",">35"],datasets:[{label:"Visit By Age Category",data:[30,50,5,15],backgroundColor:["#6366f1","#38bdf8","#f43f5e","#10b981"],hoverBackgroun
8661dColor:["#4f46e5","#0ea5e9","#e11d48","#059669"],borderWidth:0}]},options:{cutout:"80%",layout:{padding:24},plugins:{legend:{display:!1},htmlLegend:{containerID:"analytics-card-09-legend"},tooltip:{titleColor:t?e.dark:e.light,bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light}},interaction:{intersect:!1,mode:"nearest"},animation:{duration:200},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(a,l,c){let h=document.getElementById(c.containerID).querySelector("ul");if(!h)return;for(;h.firstChild;)h.firstChild.remove();a.options.plugins.legend.labels.generateLabels(a).forEach(p=>{let g=document.createElement("li");g.style.margin="4px";let y=document.createElement("button");y.style.cssText="font-size: 11px; padding: 4px 8px; background: var(--bs-bg-panel); color: var(--bs-fg-mute); border: 1px solid var(--bs-line); border-radius: var(--bs-r-sm); cursor: pointer;",y.style.opacity=p.hidden?".3":"",y.onclick=()=>{a.toggleDataVisibility(p.index,!p.index),a.update()};let x=document.createElement("span");x.style.display="block",x.style.width="8px",x.style.height="8px",x.style.backgroundColor=p.fillStyle,x.style.borderRadius="2px",x.style.marginRight="4px",x.style.pointerEvents="none";let w=document.createElement("span");w.style.display="flex",w.style.alignItems="center";let M=document.createTextNode(p.text);w.appendChild(M),g.appendChild(y),y.appendChild(x),y.appendChild(w),h.appendChild(g)})}}]});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.plugins.tooltip.titleColor=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.plugins.tooltip.titleColor=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};q3t();var Y3t=()=>{let i=document.getElementById("analytics-card-10");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#f1f5f9",dark:"#334155"},n={light:"#94a3b8",dark:"#64748B"},s={light:"#ffffff",dark:"#1e293b"},r={light:"#1e293b",dark:"#f1f5f9"},o={light:"#1e293b",dark:"#f1f5f9"},a={light:"#ffffff",dark:"#334155"},l={light:"#e2e8f0",dark:"#475569"},c=new Chart(i,{type:"polarArea",data:{labels:["Males","Females","Unknown"],datasets:[{label:"Sessions By Gender",data:[500,326,242],backgroundColor:[`rgba(${Rl("#6366f1")}, 0.8)`,`rgba(${Rl("#38bdf8")}, 0.8)`,`rgba(${Rl("#10b981")}, 0.8)`],hoverBackgroundColor:[`rgba(${Rl("#4f46e5")}, 0.8)`,`rgba(${Rl("#0ea5e9")}, 0.8)`,`rgba(${Rl("#059669")}, 0.8)`],borderWidth:0}]},options:{layout:{padding:24},scales:{r:{grid:{color:t?e.dark:e.light},ticks:{color:t?n.dark:n.light,backdropColor:t?s.dark:s.light}}},plugins:{legend:{display:!1},htmlLegend:{containerID:"analytics-card-10-legend"},tooltip:{titleColor:t?r.dark:r.light,bodyColor:t?o.dark:o.light,backgroundColor:t?a.dark:a.light,borderColor:t?l.dark:l.light}},interaction:{intersect:!1,mode:"nearest"},animation:{duration:200},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(u,h,d){let g=document.getElementById(d.containerID).querySelector("ul");if(!g)return;for(;g.firstChild;)g.firstChild.remove();u.options.plugins.legend.labels.generateLabels(u).forEach(x=>{let w=document.createElement("li");w.style.margin="4px";let M=document.createElement("button");M.style.cssText="font-size: 11px; padding: 4px 8px; background: var(--bs-bg-panel); color: var(--bs-fg-mute); border: 1px solid var(--bs-line); border-radius: var(--bs-r-sm); cursor: pointer;",M.style.opacity=x.hidden?".3":"",M.onclick=()=>{u.toggleDataVisibility(x.index,!x.index),u.update()};let A=document.createElement("span");A.style.display="block",A.style.width="8px",A.style.height="8px",A.style.backgroundColor=x.fillStyle,A.style.borderRadius="2px",A.style.marginRight="4px",A.style.pointerEvents="none";let C=document.createElement("span");C.style.display="flex",C.style.alignItems="center";let R=document.createTextNode(x.text);C.appendChild(R),w.appendChild(M),M.appendChild(A),M.appendChild(C),g.appendChild(w)})}}]});document.addEventListener("darkMode",u=>{let{mode:h}=u.detail;h==="on"?(c.options.scales.r.grid.color=e.dark,c.options.scales.r.ticks.
8661color=n.dark,c.options.scales.r.ticks.backdropColor=s.dark,c.options.plugins.tooltip.titleColor=r.dark,c.options.plugins.tooltip.bodyColor=o.dark,c.options.plugins.tooltip.backgroundColor=a.dark,c.options.plugins.tooltip.borderColor=l.dark):(c.options.scales.r.grid.color=e.light,c.options.scales.r.ticks.color=n.light,c.options.scales.r.ticks.backdropColor=s.light,c.options.plugins.tooltip.titleColor=r.light,c.options.plugins.tooltip.bodyColor=o.light,c.options.plugins.tooltip.backgroundColor=a.light,c.options.plugins.tooltip.borderColor=l.light),c.update("none")})};Y3t();var Xa=i=>{let t=0,e=0,n=0;return i.length===4?(t=`0x${i[1]}${i[1]}`,e=`0x${i[2]}${i[2]}`,n=`0x${i[3]}${i[3]}`):i.length===7&&(t=`0x${i[1]}${i[2]}`,e=`0x${i[3]}${i[4]}`,n=`0x${i[5]}${i[6]}`),`${+t},${+e},${+n}`},Ka=i=>Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumSignificantDigits:3,notation:"compact"}).format(i);Chart.defaults.font.family='"Inter", sans-serif';Chart.defaults.font.weight="500";Chart.defaults.plugins.tooltip.borderWidth=1;Chart.defaults.plugins.tooltip.displayColors=!1;Chart.defaults.plugins.tooltip.mode="nearest";Chart.defaults.plugins.tooltip.intersect=!1;Chart.defaults.plugins.tooltip.position="nearest";Chart.defaults.plugins.tooltip.caretSize=0;Chart.defaults.plugins.tooltip.caretPadding=20;Chart.defaults.plugins.tooltip.cornerRadius=4;Chart.defaults.plugins.tooltip.padding=8;var X3t=()=>{let i=document.getElementById("fintech-card-01");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"},a=new Chart(i,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023","02-01-2023","03-01-2023","04-01-2023","05-01-2023","06-01-2023","07-01-2023","08-01-2023","09-01-2023","10-01-2023","11-01-2023","12-01-2023","01-01-2024","02-01-2024","03-01-2024","04-01-2024"],datasets:[{label:"Mosaic Portfolio",data:[0,2.5,2.5,4,2.5,3.8,5,9,7.5,11,14,15,17,15,14,9,15,26,16,18,15,20,18,19,19,24,29,26,39,27,35,32,29,35,36,34,39,36,41,41,48],borderColor:"#6366f1",fill:!0,backgroundColor:`rgba(${Xa("#3b82f6")}, 0.08)`,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#6366f1",pointHoverBackgroundColor:"#6366f1",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20},{label:"Expected Return",data:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],borderColor:"#fbbf24",borderDash:[4,4],fill:!1,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroundColor:"#fbbf24",pointHoverBackgroundColor:"#fbbf24",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20},{label:"Competitors",data:[.7,3.5,4.5,3.5,4.2,4.6,6,7,6,6,11,13,14,18,17,15,13,16,20,21,24,22,20,22,25,18,21,23,24,32,28,29,35,37,42,32,32,33,33,37,32],borderColor:`rgba(${Xa("#64748B")}, 0.25)`,fill:!1,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroundColor:`rgba(${Xa("#64748B")}, 0.25)`,pointHoverBackgroundColor:`rgba(${Xa("#64748B")}, 0.25)`,pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{layout:{padding:20},scales:{y:{beginAtZero:!0,border:{display:!1},ticks:{maxTicksLimit:7,callback:l=>`${l}%`,color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month",displayFormats:{month:"MMM YY"}},border:{display:!1},grid:{display:!1},ticks:{autoSkipPadding:48,maxRotation:0,color:t?e.dark:e.light}}},plugins:{legend:{display:!1},htmlLegend:{containerID:"fintech-card-01-legend"},tooltip:{callbacks:{title:()=>!1,label:l=>`${l.parsed.y}%`},bodyColor:t?s.dark:s.light,backgroundColor:t?r.dark:r.light,borderColor:t?o.dark:o.light}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(l,c,u){let d=document.getElementById(u.containerID).querySelector("ul");if(!d)return;for(;d.firstChild;)d.firstChild.remove();l.options.plugins.legend.labels.generateLabels(l).forEach(g=>{let y=document.createElement("li");y.style.marginLeft="12px";let x=document.createElement("button");x.style.display="inline-flex",x.style.alignItems="center",x.style.opacity=g.hidden?".3":"",x.onclick=()=>{l.setDatasetVisibility(g.datasetIndex,!l.isDatasetVisible(g.datasetIndex)),l.update()};let w=document.createElement("span");w.style.display="block",w.style.width="12px",w.style.height="12px",w.style.borderRadius="9999px",w.style.marginRight="8px",w.style.borderWidth="3px",w.style.borderColor=l.data.datasets[g.datasetIndex].borderColor,w.style.pointerEvents="none";let M=document.createElement("span");M.style.color="var(--bs-fg-mute)",M.style.fontSize="0.875rem",M.style.lineHeight="1.5715";let A=document.createTextNode(g.text);M.appendChild(A),y.appendChild(x),x.appendChild(w),x.appendChild(M),d.appendChild(y)})}}]});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.scales.x.ticks.color=e.dark,a.options.scales.y.ticks.color=e.dark,a.options.scales.y.grid.color=n.dark,a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.scales.x.ticks.color=e.light,a.options.scales.y.ticks.color=e.light,a.options.scales.y.grid.color=n.light,a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})};X3t();var K3t=()=>{let i=document.getElementById("fintech-card-03");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"},a=new Chart(i,{type:"bar",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021"],datasets:[{label:"Inflow",data:[800,2600,4e3,1200,3200,1700],backgroundColor:"#6366f1",hoverBackgroundColor:"#4f46e5",barPercentage:.66,categoryPercentage:.66},{label:"Outflow",data:[2800,1700,900,2900,1950,3100],backgroundColor:"#cbd5e1",hoverBackgroundColor:"#94a3b8",barPercentage:.66,categoryPercentage:.66}]},options:{layout:{padding:{top:12,bottom:16,left:20,right:20}},scales:{y:{border:{display:!1},ticks:{maxTicksLimit:5,callback:l=>Ka(l),color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month",displayFormats:{month:"MMM YY"}},border:{display:!1},grid:{display:!1},ticks:{color:t?e.dark:e.light}}}
8661,plugins:{legend:{display:!1},htmlLegend:{containerID:"fintech-card-03-legend"},tooltip:{callbacks:{title:()=>!1,label:l=>Ka(l.parsed.y)},bodyColor:t?s.dark:s.light,backgroundColor:t?r.dark:r.light,borderColor:t?o.dark:o.light}},interaction:{intersect:!1,mode:"nearest"},animation:{duration:200},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(l,c,u){let d=document.getElementById(u.containerID).querySelector("ul");if(!d)return;for(;d.firstChild;)d.firstChild.remove();l.options.plugins.legend.labels.generateLabels(l).forEach(g=>{let y=document.createElement("li");y.style.marginRight="16px";let x=document.createElement("button");x.style.display="inline-flex",x.style.alignItems="center",x.style.opacity=g.hidden?".3":"",x.onclick=()=>{l.setDatasetVisibility(g.datasetIndex,!l.isDatasetVisible(g.datasetIndex)),l.update()};let w=document.createElement("span");w.style.display="block",w.style.width="12px",w.style.height="12px",w.style.borderRadius="9999px",w.style.marginRight="8px",w.style.borderWidth="3px",w.style.borderColor=g.fillStyle,w.style.pointerEvents="none";let M=document.createElement("span");M.style.color="var(--bs-fg-mute)",M.style.fontSize="0.875rem",M.style.lineHeight="1.5715";let A=document.createTextNode(g.text);M.appendChild(A),y.appendChild(x),x.appendChild(w),x.appendChild(M),d.appendChild(y)})}}]});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.scales.x.ticks.color=e.dark,a.options.scales.y.ticks.color=e.dark,a.options.scales.y.grid.color=n.dark,a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.scales.x.ticks.color=e.light,a.options.scales.y.ticks.color=e.light,a.options.scales.y.grid.color=n.light,a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})};K3t();var Fit=["./images/company-icon-01.svg","./images/company-icon-02.svg","./images/company-icon-03.svg","./images/company-icon-04.svg"],Uit=[],J3t=()=>{let i=document.getElementById("fintech-card-04");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"},a=new Chart(i,{type:"bar",data:{labels:["02-01-2021","03-01-2021","04-01-2021","05-01-2021"],datasets:[{label:"Inflow",data:[4100,1900,2700,3900],backgroundColor:"#6366f1",hoverBackgroundColor:"#4f46e5",categoryPercentage:.66},{label:"Outflow",data:[2e3,1e3,1100,2600],backgroundColor:"#cbd5e1",hoverBackgroundColor:"#94a3b8",categoryPercentage:.66}]},options:{indexAxis:"y",layout:{padding:{top:12,bottom:16,left:72,right:20}},scales:{y:{border:{display:!1},grid:{display:!1,drawTicks:!1},ticks:{display:!1}},x:{border:{display:!1},ticks:{maxTicksLimit:3,align:"end",callback:l=>Ka(l),color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}}},plugins:{legend:{display:!1},htmlLegend:{containerID:"fintech-card-04-legend"},tooltip:{callbacks:{title:()=>!1,label:l=>Ka(l.parsed.x)},bodyColor:t?s.dark:s.light,backgroundColor:t?r.dark:r.light,borderColor:t?o.dark:o.light}},interaction:{intersect:!1,mode:"nearest"},animation:{duration:200},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(l,c,u){let d=document.getElementById(u.containerID).querySelector("ul");if(!d)return;for(;d.firstChild;)d.firstChild.remove();l.options.plugins.legend.labels.generateLabels(l).forEach(g=>{let y=document.createElement("li");y.style.marginRight="16px";let x=document.createElement("button");x.style.display="inline-flex",x.style.alignItems="center",x.style.opacity=g.hidden?".3":"",x.onclick=()=>{l.setDatasetVisibility(g.datasetIndex,!l.isDatasetVisible(g.datasetIndex)),l.update()};let w=document.createElement("span");w.style.display="block",w.style.width="12px",w.style.height="12px",w.style.borderRadius="9999px",w.style.marginRight="8px",w.style.borderWidth="3px",w.style.borderColor=g.fillStyle,w.style.pointerEvents="none";let M=document.createElement("span");M.style.color="var(--bs-fg-mute)",M.style.fontSize="0.875rem",M.style.lineHeight="1.5715";let A=document.createTextNode(g.text);M.appendChild(A),y.appendChild(x),x.appendChild(w),x.appendChild(M),d.appendChild(y)})},beforeInit(){Fit.forEach((l,c)=>{let u=new Image;u.src=Fit[c],Uit.push(u)})},beforeDraw(l){let c=l.scales.x,u=l.scales.y;u.ticks.forEach((h,d)=>{let p=u.getPixelForTick(d);l.ctx.drawImage(Uit[d],c.left-52,p-18)})}}]});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.scales.x.ticks.color=e.dark,a.options.scales.x.grid.color=n.dark,a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.scales.x.ticks.color=e.light,a.options.scales.x.grid.color=n.light,a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})};J3t();var Z3t=()=>{let i=document.getElementById("fintech-card-07");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"},a=new Chart(i,{type:"line",data:{labels:["09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023","02-01-2023","03-01-2023","04-01-2023"],datasets:[{label:"Mosaic Portfolio",data:[1500,2e3,1800,1900,1900,2400,2900,2600,3900,2700,3500,3200,2900,3500,3600,3400,3900,3600,4100,4100],borderColor:"#6366f1",fill:!0,backgroundColor:`rgba(${Xa("#3b82f6")}, 0.08)`,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#6366f1",pointHoverBackgroundColor:"#6366f1",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20},{label:"Expected Return",data:[2e3,2100,2200,2300,2400,2500,2600,2700,2800,2900,3e3,3100,3200,3300,3400,3500,3600,3700,3800,3900],borderColor:`rgba(${Xa("#64748B")}, 0.25)`,fill:!1,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroundColor:`rgba(${Xa("#64748B")}, 0.25)`,pointHoverBackgroundColor:`rgba(${Xa("#64748B")}, 0.25)`,pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{layout:{padding:{top:12,bottom:16,left:20,right:20}},scales:{y:{beginAtZero:!0,border:{display:!1},ticks:{maxTicksLimit:7,callback:l=>Ka(l),color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month",displayFormats:{month:"MMM YY"}},border:{display:!1},grid:{display:!1},ticks:{autoSkipPadding:48,maxRotation:0,color:t?e.dark:e.light}}},plugins:{tooltip:{callbacks:{title:()=>!1,label:l=>Ka(l.parsed.y)},bodyColor:t?s.dark:s.light,backgroundColor:t?r.dark:r.light,borderColor:t?o.dark:o.light},legend:{display:!1}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.scales.x.ticks.color=e.dark,a.options.scales.y.ticks.color=e.dark,a.options.scales.y.grid.color=n.dark,a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.scales.x.ticks.color=e.light,a.options.scales.y.ticks.color=e.light,a.options.scales.y.grid.color=n.light,a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})};Z3t();var Q3t=()=>{let i=document.getElementById("fintech-card-08");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#94a3b8",dark:"#64748B"},n={light:"#f1f5f9",dark:"#334155"},s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"},a=new Chart(i,{type:"line",data:{labels:["2010","Age 65"],datasets:[{label:"Growth 1",data:[0,35e5],borderColor:"#10b981",fill:!0,backgroundColor:`rgba(${Xa("#10b981")}, 0.08)`,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#10b981",pointHoverBackgroundColor:"#10b981",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20},{label:"Growth 2",data:[0,2e6],borderColor:"#a7f3d0",fill:!1,borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroundColor:"#a7f3d0",pointHoverBackgroundColor:"#a7f3d0",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{layout:{padding:{top:12,bottom:16,left:20,right:20}},scales:{y:{beginAtZero:!0,border:{display:!1},ticks:{maxTicksLimit:7,callback:l=>Ka(l),color:t?e.dark:e.light},grid:{color:t?n.dark:n.light}},x:{border:{display:!1},grid:{display:!1},ticks:{autoSkipPadding:48,maxRotation:0,align:"end",color:t?e.dark:e.light}}},plugins:{tooltip:{callbacks:{title:()=>!1,label:l=>Ka(l.parsed.y)},bodyColor:t?s.dark:s.light,backgroundColor:t?r.dark:r.light,borderColor:t?o.dark:o.light},legend:{display:!1}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.scales.x.ticks.color=e.dark,a.options.scales.y.ticks.color=e.dark,a.options.scales.y.grid.color=n.dark,a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.scales.x.ticks.color=e.light,a.options.scales.y.ticks.color=e.light,a.options.scales.y.grid.color=n.light,a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})};Q3t();var tBt=()=>{let i=document.getElementById("fintech-card-09");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#1e293b",dark:"#f1f5f9"},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"pie",data:{labels:["Cash","Commodities","Bonds","Stock"],datasets:[{label:"Sessions By Device",data:[12,13,10,65],backgroundColor:["#34d399","#fbbf24","#38bdf8","#6366f1"],hoverBackgroundColor:["#10b981","#f59e0b","#0ea5e9","#4f46e5"],borderWidth:0}]},options:{layout:{padding:{top:4,bottom:4,left:24,right:24}},plugins:{legend:{display:!1},htmlLegend:{containerID:"fintech-card-09-legend"},tooltip:{titleColor:t?e.dark:e.light,bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light}},interaction:{intersect:!1,mode:"nearest"},animation:{duration:200},maintainAspectRatio:!1},plugins:[{id:"htmlLegend",afterUpdate(a,l,c){let h=document.getElementById(c.containerID).querySelector("ul");if(!h)return;for(;h.firstChild;)h.firstChild.remove();a.options.plugins.legend.labels.generateLabels(a).forEach(p=>{let g=document.createElement("li");g.style.margin="6px";let y=document.createElement("button");y.style.display="inline-flex",y.style.alignItems="center",y.style.opacity=p.hidden?".3":"",y.onclick=()=>{a.toggleDataVisibility(p.index,!p.index),a.update()};let x=document.createElement("span");x.style.display="block",x.style.width="12px",x.style.height="12px",x.style.borderRadius="9999px",x.style.marginRight="6px",x.style.borderWidth="3px",x.style.borderColor=p.fillStyle,x.style.pointerEvents="none";let w=document.createElement("span");w.style.color="var(--bs-fg-mute)",w.style.fontSize="0.875rem",w.style.lineHeight="1.5715";let M=document.createTextNode(p.text);w.appendChild(M),g.appendChild(y),y.appendChild(x),y.appendChild(w),h.appendChild(g)})}}]});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.plugins.tooltip.titleColor=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.plugins.tooltip.titleColor=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};tBt();var eBt=()=>{let i=document.getElementById("fintech-card-10");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#f1f5f9",dark:"#334155"},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023"],datasets:[{data:[732,610,610,504,504,504,349,349,504,342,504,610,391,192,154,273,191,191,126,263,349,252,323,322,270,232],fill:!0,backgroundColor:`rgba(${Xa("#f43f5e")}, 0.08)`,borderColor:"#f43f5e",borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#f43f5e",pointHoverBackgroundColor:"#f43f5e",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{layout:{padding:{top:16,bottom:16,left:20,right:20}},scales:{y:{beginAtZero:!0,border:{display:!1},grid:{drawTicks:!1,color:t?e.dark:e.light},ticks:{maxTicksLimit:2,display:!1}},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month"},display:!1}},plugins:{tooltip:{callbacks:{title:()=>!1,label:a=>Ka(a.parsed.y)},bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light},legend:{display:!1}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.scales.y.grid.color=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.scales.y.grid.color=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};eBt();var nBt=()=>{let i=document.getElementById("fintech-card-11");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#f1f5f9",dark:"#334155"},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023"],datasets:[{data:[222,222,226,271,365,365,238,324,288,206,324,324,500,409,409,273,232,273,500,570,767,808,685,767,685,685],fill:!0,backgroundColor:`rgba(${Xa("#10b981")}, 0.08)`,borderColor:"#10b981",borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#10b981",pointHoverBackgroundColor:"#10b981",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{layout:{padding:{top:16,bottom:16,left:20,right:20}},scales:{y:{beginAtZero:!0,border:{display:!1},grid:{drawTicks:!1,color:t?e.dark:e.light},ticks:{maxTicksLimit:2,display:!1}},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month"},display:!1}},plugins:{tooltip:{callbacks:{title:()=>!1,label:a=>Ka(a.parsed.y)},bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light},legend:{display:!1}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.scales.y.grid.color=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.scales.y.grid.color=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};nBt();var iBt=()=>{let i=document.getElementById("fintech-card-12");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#f1f5f9",dark:"#334155"},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023"],datasets:[{data:[540,466,540,466,385,432,334,334,289,289,200,289,222,289,289,403,554,304,289,270,134,270,829,644,688,664],fill:!0,backgroundColor:`rgba(${Xa("#10b981")}, 0.08)`,borderColor:"#10b981",borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#10b981",pointHoverBackgroundColor:"#10b981",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{layout:{padding:{top:16,bottom:16,left:20,right:20}},scales:{y:{beginAtZero:!0,border:{display:!1},grid:{drawTicks:!1,color:t?e.dark:e.light},ticks:{maxTicksLimit:2,display:!1}},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month"},display:!1}},plugins:{tooltip:{callbacks:{title:()=>!1,label:a=>Ka(a.parsed.y)},bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light},legend:{display:!1}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.scales.y.grid.color=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.scales.y.grid.color=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};iBt();var sBt=()=>{let i=document.getElementById("fintech-card-13");if(!i)return;let t=localStorage.getItem("dark-mode")==="true",e={light:"#f1f5f9",dark:"#334155"},n={light:"#1e293b",dark:"#f1f5f9"},s={light:"#ffffff",dark:"#334155"},r={light:"#e2e8f0",dark:"#475569"},o=new Chart(i,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023"],datasets:[{data:[245,288,332,404,404,314,314,314,314,314,234,314,234,234,314,314,314,388,314,202,202,202,202,514,720,642],fill:!0,backgroundColor:`rgba(${Xa("#10b981")}, 0.08)`,borderColor:"#10b981",borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:"#10b981",pointHoverBackgroundColor:"#10b981",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{layout:{padding:{top:16,bottom:16,left:20,right:20}},scales:{y:{beginAtZero:!0,border:{display:!1},grid:{drawTicks:!1,color:t?e.dark:e.light},ticks:{maxTicksLimit:2,display:!1}},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month"},display:!1}},plugins:{tooltip:{callbacks:{title:()=>!1,label:a=>Ka(a.parsed.y)},bodyColor:t?n.dark:n.light,backgroundColor:t?s.dark:s.light,borderColor:t?r.dark:r.light},legend:{display:!1}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",a=>{let{mode:l}=a.detail;l==="on"?(o.options.scales.y.grid.color=e.dark,o.options.plugins.tooltip.bodyColor=n.dark,o.options.plugins.tooltip.backgroundColor=s.dark,o.options.plugins.tooltip.borderColor=r.dark):(o.options.scales.y.grid.color=e.light,o.options.plugins.tooltip.bodyColor=n.light,o.options.plugins.tooltip.backgroundColor=s.light,o.options.plugins.tooltip.borderColor=r.light),o.update("none")})};sBt();var rBt=()=>{[{selector:"fintech-card-14-a",data:[540,466,540,466,385,432,334,334,289,289,200,289,222,289,289,403,554,304,289,270,134,270,829,644,688,664],growth:!0},{selector:"fintech-card-14-b",data:[245,288,332,404,404,314,314,314,314,314,234,314,234,234,314,314,314,388,314,202,202,202,202,514,720,642],growth:!0},{selector:"fintech-card-14-c",data:[732,610,610,504,504,504,349,349,504,342,504,610,391,192,154,273,191,191,126,263,349,252,323,322,270,232],growth:!1},{selector:"fintech-card-14-d",data:[222,222,226,271,365,365,238,324,288,206,324,324,500,409,409,273,232,273,500,570,767,808,685,767,685,685],growth:!0},{selector:"fintech-card-14-e",data:[632,510,610,404,504,404,449,349,404,542,404,410,491,392,254,273,291,191,226,363,449,252,223,222,170,132],growth:!1}].forEach(t=>{let e=document.getElementById(t.selector),n=localStorage.getItem("dark-mode")==="true",s={light:"#1e293b",dark:"#f1f5f9"},r={light:"#ffffff",dark:"#334155"},o={light:"#e2e8f0",dark:"#475569"};if(!e)return;let a=new Chart(e,{type:"line",data:{labels:["12-01-2020","01-01-2021","02-01-2021","03-01-2021","04-01-2021","05-01-2021","06-01-2021","07-01-2021","08-01-2021","09-01-2021","10-01-2021","11-01-2021","12-01-2021","01-01-2022","02-01-2022","03-01-2022","04-01-2022","05-01-2022","06-01-2022","07-01-2022","08-01-2022","09-01-2022","10-01-2022","11-01-2022","12-01-2022","01-01-2023"],datasets:[{data:t.data,borderColor:t.growth?"#10b981":"#f43f5e",borderWidth:2,tension:0,pointRadius:0,pointHoverRadius:3,pointBackgroun
8661dColor:t.growth?"#10b981":"#f43f5e",pointHoverBackgroundColor:t.growth?"#10b981":"#f43f5e",pointBorderWidth:0,pointHoverBorderWidth:0,clip:20}]},options:{scales:{y:{display:!1,beginAtZero:!0},x:{type:"time",time:{parser:"MM-DD-YYYY",unit:"month"},display:!1}},plugins:{tooltip:{callbacks:{title:()=>!1,label:l=>Ka(l.parsed.y)},bodyColor:n?s.dark:s.light,backgroundColor:n?r.dark:r.light,borderColor:n?o.dark:o.light},legend:{display:!1}},interaction:{intersect:!1,mode:"nearest"},maintainAspectRatio:!1}});document.addEventListener("darkMode",l=>{let{mode:c}=l.detail;c==="on"?(a.options.plugins.tooltip.bodyColor=s.dark,a.options.plugins.tooltip.backgroundColor=r.dark,a.options.plugins.tooltip.borderColor=o.dark):(a.options.plugins.tooltip.bodyColor=s.light,a.options.plugins.tooltip.backgroundColor=r.light,a.options.plugins.tooltip.borderColor=o.light),a.update("none")})})};rBt();var q_e=il(zit());flatpickr(".datepicker",{mode:"range",static:!0,monthSelectorType:"static",dateFormat:"M j, Y",defaultDate:[new Date().setDate(new Date().getDate()-6),new Date],prevArrow:'<svg class="fill-current" width="7" height="11" viewB
8661ox="0 0 7 11"><path d="M5.4 10.8l1.4-1.4-4-4 4-4L5.4 0 0 5.4z" /></svg>',nextArrow:'<svg class="fill-current" width="7" height="11" viewBox="0 0 7 11"><path d="M1.4 10.8L0 9.4l4-4-4-4L1.4 0l5.4 5.4z" /></svg>',onReady:(i,t,e)=>{e.element.value=t.replace("to","-");let n=e.element.getAttribute("data-class");e.calendarContainer.classList.add(n)},onChange:(i,t,e)=>{e.element.value=t.replace("to","-")}});Hit().start();jit().start();Pm.register(...F8);window.Chart=Pm;FV();})();
8662/*!
8663 * Chart.js v4.3.0
8664 * https://www.chartjs.org
8665 * (c) 2023 Chart.js Contributors
8666 * Released under the MIT License
8667 */
8668/*!
8669 * @kurkle/color v0.3.2
8670 * https://github.com/kurkle/color#readme
8671 * (c) 2023 Jukka Kurkela
8672 * Released under the MIT License
8673 */
8674//! moment.js
8675//! version : 2.29.4
8676//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
8677//! license : MIT
8678//! momentjs.com
8679/*!
8680  * chartjs-adapter-moment v1.0.1
8681  * https://www.chartjs.org
8682  * (c) 2022 chartjs-adapter-moment Contributors
8683  * Released under the MIT license
8684  */
8685/* flatpickr v4.6.13,, @license MIT */
8686/*! Bundled license information:
8687
8688clipboard/dist/clipboard.js:
8689  (*!
8690   * clipboard.js v2.0.11
8691   * https://clipboardjs.com/
8692   *
8693   * Licensed MIT © Zeno Rocha
8694   *)
8695
8696@lit/reactive-element/css-tag.js:
8697  (**
8698   * @license
8699   * Copyright 2019 Google LLC
8700   * SPDX-License-Identifier: BSD-3-Clause
8701   *)
8702
8703@lit/reactive-element/reactive-element.js:
8704lit-html/lit-html.js:
8705lit-element/lit-element.js:
8706@lit/reactive-element/decorators/custom-element.js:
8707@lit/reactive-element/decorators/property.js:
8708@lit/reactive-element/decorators/state.js:
8709@lit/reactive-element/decorators/base.js:
8710@lit/reactive-element/decorators/event-options.js:
8711@lit/reactive-element/decorators/query.js:
8712@lit/reactive-element/decorators/query-all.js:
8713@lit/reactive-element/decorators/query-async.js:
8714@lit/reactive-element/decorators/query-assigned-nodes.js:
8715lit-html/directive.js:
8716lit-html/directives/repeat.js:
8717lit-html/async-directive.js:
8718lit-html/directives/unsafe-html.js:
8719  (**
8720   * @license
8721   * Copyright 2017 Google LLC
8722   * SPDX-License-Identifier: BSD-3-Clause
8723   *)
8724
8725@lit/reactive-element/decorators/query-assigned-elements.js:
8726  (**
8727   * @license
8728   * Copyright 2021 Google LLC
8729   * SPDX-License-Identifier: BSD-3-Clause
8730   *)
8731
8732lit-html/directive-helpers.js:
8733lit-html/directives/live.js:
8734lit-html/directives/ref.js:
8735  (**
8736   * @license
8737   * Copyright 2020 Google LLC
8738   * SPDX-License-Identifier: BSD-3-Clause
8739   *)
8740
8741lit-html/directives/class-map.js:
8742  (**
8743   * @license
8744   * Copyright 2018 Google LLC
8745   * SPDX-License-Identifier: BSD-3-Clause
8746   *)
8747
8748lit-html/is-server.js:
8749  (**
8750   * @license
8751   * Copyright 2022 Google LLC
8752   * SPDX-License-Identifier: BSD-3-Clause
8753   *)
8754
8755@material/mwc-icon/mwc-icon-host.css.js:
8756  (**
8757   * @license
8758   * Copyright 2021 Google LLC
8759   * SPDX-LIcense-Identifier: Apache-2.0
8760   *)
8761
8762@material/mwc-icon/mwc-icon.js:
8763  (**
8764   * @license
8765   * Copyright 2018 Google LLC
8766   * SPDX-License-Identifier: Apache-2.0
8767   *)
8768
8769three/build/three.core.js:
8770three/build/three.module.js:
8771  (**
8772   * @license
8773   * Copyright 2010-2026 Three.js Authors
8774   * SPDX-License-Identifier: MIT
8775   *)
8776
8777three/examples/jsm/libs/fflate.module.js:
8778  (*!
8779  fflate - fast JavaScript compression/decompression
8780  <https://101arrowz.github.io/fflate>
8781  Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
8782  version 0.8.2
8783  *)
8784
8785jstz/dist/jstz.js:
8786  (**
8787   * This script gives you the zone info key representing your device's time zone setting.
8788   *
8789   * @name jsTimezoneDetect
8790   * @version 1.0.6
8791   * @author Jon Nylander
8792   * @license MIT License - https://bitbucket.org/pellepim/jstimezonedetect/src/default/LICENCE.txt
8793   *
8794   * For usage and examples, visit:
8795   * http://pellepim.bitbucket.org/jstz/
8796   *
8797   * Copyright (c) Jon Nylander
8798   *)
8799
8800@hotwired/turbo/dist/turbo.es2017-esm.js:
8801  (*!
8802  Turbo 8.0.23
8803  Copyright © 2026 37signals LLC
8804   *)
8805
8806@kurkle/color/dist/color.esm.js:
8807  (*!
8808   * @kurkle/color v0.3.4
8809   * https://github.com/kurkle/color#readme
8810   * (c) 2024 Jukka Kurkela
8811   * Released under the MIT License
8812   *)
8813
8814chart.js/dist/chunks/helpers.dataset.js:
8815chart.js/dist/chart.js:
8816  (*!
8817   * Chart.js v4.5.1
8818   * https://www.chartjs.org
8819   * (c) 2025 Chart.js Contributors
8820   * Released under the MIT License
8821   *)
8822
8823lodash-es/lodash.js:
8824  (**
8825   * @license
8826   * Lodash (Custom Build) <https://lodash.com/>
8827   * Build: `lodash modularize exports="es" --repo lodash/lodash#4.18.1 -o ./`
8828   * Copyright OpenJS Foundation and other contributors <https://
8828openjsf.org/>
8829   * Released under MIT license <https://lodash.com/license>
8830   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
8831   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
8832   *)
8833
8834trix/dist/trix.esm.min.js:
8835  (*! @license DOMPurify 3.4.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.2/LICENSE *)
8836
8837js-cookie/dist/js.cookie.mjs:
8838  (*! js-cookie v3.0.8 | MIT *)
8839*/;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.