28 lines
186 KiB
JavaScript

/* !
* Tiny PowerPaste plugin
*
* Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc.
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
*
* Version: 8.3.0-112
*/
/*!
* This resource uses the code from the following libraries:
*
* ocamlnet
* Copyright (c) 2001-2006 Patrick Doane and Gerd Stolpmann
* https://gitlab.com/gerdstolpmann/lib-ocamlnet3
*
*
* specificity
* Copyright (c) 2022 Bramus Van Damme - https://www.bram.us/
* https://github.com/keeganstreet/specificity
*
* dompurify
* Copyright 2024 Dr.-Ing. Mario Heiderich, Cure53
* https://github.com/cure53/DOMPurify
*
*/
!function(){"use strict";const e=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&((e,t)=>{return n=e,!!t.prototype.isPrototypeOf(n)||e.constructor?.name===t.name;var n})(e,String)?"string":t})(t)===e,t=e=>t=>typeof t===e,n=e("string"),r=e("object"),o=e("array"),s=t("boolean"),a=e=>undefined===e;const i=e=>null==e,l=e=>!i(e),c=t("function"),u=t("number"),d=()=>{},m=(e,t)=>(...n)=>e(t.apply(null,n)),h=e=>()=>e,p=e=>e,f=(e,t)=>e===t;function g(e,...t){return(...n)=>{const r=t.concat(n);return e.apply(null,r)}}const v=e=>()=>{throw new Error(e)},y=e=>e(),b=h(!1),x=h(!0);class w{tag;value;static singletonNone=new w(!1);constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:w.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(e??"Called getOrDie on None")}static from(e){return l(e)?w.some(e):w.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}const k=Array.prototype.slice,S=Array.prototype.indexOf,C=Array.prototype.push,T=(e,t)=>((e,t)=>S.call(e,t))(e,t)>-1,I=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(t(e[n],n))return!0;return!1},E=(e,t)=>{const n=e.length,r=new Array(n);for(let o=0;o<n;o++){const n=e[o];r[o]=t(n,o)}return r},A=(e,t)=>{for(let n=0,r=e.length;n<r;n++)t(e[n],n)},O=(e,t)=>{const n=[],r=[];for(let o=0,s=e.length;o<s;o++){const s=e[o];(t(s,o)?n:r).push(s)}return{pass:n,fail:r}},L=(e,t)=>{const n=[];for(let r=0,o=e.length;r<o;r++){const o=e[r];t(o,r)&&n.push(o)}return n},_=(e,t,n)=>(A(e,((e,r)=>{n=t(n,e,r)})),n),P=(e,t)=>((e,t,n)=>{for(let r=0,o=e.length;r<o;r++){const o=e[r];if(t(o,r))return w.some(o);if(n(o,r))break}return w.none()})(e,t,b),N=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(t(e[n],n))return w.some(n);return w.none()},D=e=>{const t=[];for(let n=0,r=e.length;n<r;++n){if(!o(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);C.apply(t,e[n])}return t},R=(e,t)=>D(E(e,t)),M=(e,t)=>{for(let n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n))return!1;return!0},U=(e,t)=>{const n={};for(let r=0,o=e.length;r<o;r++){const o=e[r];n[String(o)]=t(o,r)}return n},F=(e,t)=>{const n=k.call(e,0);return n.sort(t),n},j=e=>(e=>0<e.length?w.some(e[0]):w.none())(e),z=(e,t)=>{for(let n=0;n<e.length;n++){const r=t(e[n],n);if(r.isSome())return r}return w.none()},$=Object.keys,H=Object.hasOwnProperty,B=(e,t)=>{const n=$(e);for(let r=0,o=n.length;r<o;r++){const o=n[r];t(e[o],o)}},W=(e,t)=>V(e,((e,n)=>({k:n,v:t(e,n)}))),V=(e,t)=>{const n={};return B(e,((e,r)=>{const o=t(e,r);n[o.k]=o.v})),n},G=(e,t)=>{const n={};var r;return((e,t,n,r)=>{B(e,((e,o)=>{(t(e,o)?n:r)(e,o)}))})(e,t,(r=n,(e,t)=>{r[t]=e}),d),n},q=e=>$(e).length,Y=(e,t)=>H.call(e,t),K=e=>{if(!o(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],n={};return A(e,((r,s)=>{const a=$(r);if(1!==a.length)throw new Error("one and only one name per case");const i=a[0],l=r[i];if(void 0!==n[i])throw new Error("duplicate key detected:"+i);if("cata"===i)throw new Error("cannot have a case named cata (sorry)");if(!o(l))throw new Error("case arguments must be an array");t.push(i),n[i]=(...n)=>{const r=n.length;if(r!==l.length)throw new Error("Wrong number of arguments to case "+i+". Expected "+l.length+" ("+l+"), got "+r);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[s].apply(null,n)},match:e=>{const r=$(e);if(t.length!==r.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+r.join(","));if(!M(t,(e=>T(r,e))))throw new Error("Not all branches were specified when using match. Specified: "+r.join(", ")+"\nRequired: "+t.join(", "));return e[i].apply(null,n)},log:e=>{console.log(e,{constructors:t,constructor:i,params:n})}}}})),n},X=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},J=e=>{let t=w.none(),n=[];const r=e=>{o()?s(e):n.push(e)},o=()=>t.isSome(),s=e=>{t.each((t=>{setTimeout((()=>{e(t)}),0)}))};return e((e=>{o()||(t=w.some(e),A(n,s),n=[])})),{get:r,map:e=>J((t=>{r((n=>{t(e(n))}))})),isReady:o}},Z={nu:J,pure:e=>J((t=>{t(e)}))},Q=e=>{setTimeout((()=>{throw e}),0)},ee=e=>{const t=t=>{e().then(t,Q)};return{map:t=>ee((()=>e().then(t))),bind:t=>ee((()=>e().then((e=>t(e).toPromise())))),anonBind:t=>ee((()=>e().then((()=>t.toPromise())))),toLazy:()=>Z.nu(t),toCached:()=>{let t=null;return ee((()=>(null===t&&(t=e()),t)))},toPromise:e,get:t}},te=e=>ee((()=>new Promise(e))),ne=e=>{const t=t=>t(e),n=h(e),r=()=>o,o={tag:!0,inner:e,fold:(t,n)=>n(e),isValue:x,isError:b,map:t=>oe.value(t(e)),mapError:r,bind:t,exists:t,forall:t,getOr:n,or:r,getOrThunk:n,orThunk:r,getOrDie:n,each:t=>{t(e)},toOptional:()=>w.some(e)};return o},re=e=>{const t=()=>n,n={tag:!1,inner:e,fold:(t,n)=>t(e),isValue:b,isError:x,map:t,mapError:t=>oe.error(t(e)),bind:t,exists:b,forall:x,getOr:p,or:p,getOrThunk:y,orThunk:y,getOrDie:v(String(e)),each:d,toOptional:w.none};return n},oe={value:ne,error:re,fromOption:(e,t)=>e.fold((()=>re(t)),ne)},se=e=>((e,t)=>t((t=>{const n=[];let r=0;0===e.length?t([]):A(e,((o,s)=>{o.get((o=>s=>{n[o]=s,r++,r>=e.length&&t(n)})(s))}))})))(e,te),ae="undefined"!=typeof window?window:Function("return this;")();let ie=0;const le=e=>{const t=(new Date).getTime(),n=Math.floor(window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295*1e9);return ie++,e+"_"+n+ie+String(t)},ce=(ue=(e,t)=>t,(...e)=>{if(0===e.length)throw new Error("Can't merge zero objects");const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const e in r)Y(r,e)&&(t[e]=ue(t[e],r[e]))}return t});var ue;const de=(e,t,n=f)=>e.exists((e=>n(e,t))),me=(e,t)=>e?w.some(t):w.none(),he=(e,t)=>(void 0!==e[t]&&null!==e[t]||(e[t]={}),e[t]),pe=(e,t)=>((e,t)=>{let n=void 0!==t?t:ae;for(let t=0;t<e.length;++t)n=he(n,e[t]);return n})(e.split("."),t);K([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const fe=()=>{const e=(e=>{const t=X(w.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(w.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(w.some(e))}}})(d);return{...e,on:t=>e.get().each(t)}},ge=K([{starts:["value","f"]},{pattern:["regex","f"]},{contains:["value","f"]},{exact:["value","f"]},{all:[]},{not:["stringMatch"]}]),ve=p,ye=(e,t)=>e.fold(((e,n)=>0===n(t).indexOf(n(e))),((e,n)=>e.test(n(t))),((e,n)=>n(t).indexOf(n(e))>=0),((e,n)=>n(t)===n(e)),x,(e=>!ye(e,t))),be={starts:ge.starts,pattern:ge.pattern,contains:ge.contains,exact:ge.exact,all:ge.all,not:ge.not,cata:(e,t,n,r,o,s,a)=>e.fold(t,n,r,o,s,a),matches:ye,caseSensitive:ve,caseInsensitive:e=>e.toLowerCase()},xe=(e,t,n)=>""===t||e.length>=t.length&&e.substr(n,n+t.length)===t,we=(e,t)=>Se(e,t)?((e,t)=>e.substring(t))(e,t.length):e,ke=(e,t,n=0,r)=>{const o=e.indexOf(t,n);return-1!==o&&(!!a(r)||o+t.length<=r)},Se=(e,t)=>xe(e,t,0),Ce=(e,t)=>xe(e,t,e.length-t.length),Te=(Ie=/^\s+|\s+$/g,e=>e.replace(Ie,""));var Ie;const Ee=e=>{let t,n=!1;return(...r)=>(n||(n=!0,t=e.apply(null,r)),t)},Ae=(e,t)=>{const{type:n,message:r}=t;e.notificationManager.open({type:n,text:r})},Oe=e=>{const t=(e=>{switch(e){case"error":return console.error;case"info":return console.info;case"warn":return console.warn;default:return console.log}})(e.type);t(e.message)},Le=(e,t)=>{const{protect:n,allowList:r=[],blockList:o=[]}=null!=e?e:{};let s;return s=l(n)?n:r.length>0||o.length>0||t,{protect:s,allowList:r,blockList:o}},_e=e=>{const{protect:t,allowList:n,blockList:r}=null!=e?e:{};return e=>{const o=e.toLowerCase();return n.length>0?!I(n,(e=>e.toLowerCase()===o)):r.length>0?I(r,(e=>e.toLowerCase()===o)):t}},Pe=e=>{const t=_e(e);return(e,n)=>{const r=((e,t)=>`${e}:${t}`)(n,e.toLowerCase());return t(r)}},Ne=(e,t,n,r)=>{const o=Reflect.get(e,"on"),s={protectedEventHandlers:[],cleanupScheduled:!1},a=(e,t)=>{r&&console.log(`[EventsProxy] ${e}`,t||"")},i=t=>{"invalid"===t&&s.protectedEventHandlers.length>0&&(a("Removing event handlers",s.protectedEventHandlers),A(s.protectedEventHandlers,(t=>{e.off(t.name,t.callback)})),s.protectedEventHandlers=[])},l=t.onStatusChange(i);return e.on("remove",l),(r,l,c)=>{a(`Adding event listener: ${r}`,{shouldProtect:n(r)});const u=((e,r)=>{const o=n(e),a=t.getStatus(),i=o&&"invalid"===a?d:r;return o&&s.protectedEventHandlers.push({name:e,callback:i}),i})(r,l);return s.cleanupScheduled||(s.cleanupScheduled=!0,window.setTimeout((()=>{i(t.getStatus()),s.cleanupScheduled=!1}),0)),Reflect.apply(o,e,[r,u,c])}},De=(e,t,n)=>r=>{const o="invalid"!==t.getStatus()&&l(n)?n(r):d,s=((e,t,n)=>{const r=e=>{"invalid"===e&&n.setEnabled(!1)},o=()=>r(t.getStatus());r(t.getStatus()),e.on("NodeChange",o);const s=t.onStatusChange(r);return()=>{e.off("NodeChange",o),s()}})(e,t,r);return e=>{null==o||o(e),s()}},Re=(e,t,n)=>(...r)=>{var o;return"invalid"===e.getStatus()?n:null!==(o=null==t?void 0:t(...r))&&void 0!==o?o:n},Me=(e,t)=>Re(e,t,Promise.resolve([])),Ue=(e,t)=>Re(e,t,[]),Fe=(e,t)=>Re(e,t,!1),je=(e,t,r,o)=>{const s=t=>{const{command:s,value:a}=t,i=w.from(a).filter(n).map((e=>e.toLowerCase())),l=s.toLowerCase()===o.toLowerCase(),c=i.exists((e=>r.has(e))),u=i.exists((t=>t===e.queryCommandValue(o)));l&&c&&!u&&t.preventDefault()},a=t.onStatusChange((t=>{if("invalid"===t){e.on("BeforeExecCommand",s);const t=()=>{const t=e.queryCommandValue(o);r.has(t.toLowerCase())&&e.execCommand(o,!1,t)};e.initialized?t():e.on("init",t)}}));e.on("remove",(()=>{a(),e.off("BeforeExecCommand",s)}))},ze=(e,t,r,o,s,a=!1)=>{const i=new Set,l=new Set,c=(e,t)=>{a&&console.log(`[UiProxy] ${e}`,t||"")};((e,t,n)=>{je(e,t,n,"ToggleView")})(e,r,i),((e,t,n)=>{je(e,t,n,"ToggleSidebar")})(e,r,l);const u=(t,n,a,i)=>{const l=s(t,a);return c(`${i}: ${t}`,{spec:n,context:o,shouldProtect:l}),l?{...n,onSetup:De(e,r,n.onSetup)}:n};return new Proxy(t,{get:(e,t,a)=>{const d=Reflect.get(e,t,a);if(!n(t))return d;switch(t){case"addButton":case"addGroupToolbarButton":case"addToggleButton":case"addMenuButton":case"addSplitButton":return(...n)=>{const[r,o,...s]=n,a=u(r,o,"button",String(t));return Reflect.apply(d,e,[r,a,...s])};case"addMenuItem":case"addToggleMenuItem":case"addNestedMenuItem":return(...n)=>{const[r,o,...s]=n,a=u(r,o,"menuitem",String(t));return Reflect.apply(d,e,[r,a,...s])};case"addAutocompleter":return(...n)=>{const[a,i,...l]=n,u=s(a,"autocompleter");if(c(`${String(t)}: ${a}`,{spec:i,context:o,shouldProtect:u}),u){const t={...i,fetch:Me(r,i.fetch)};return Reflect.apply(d,e,[a,t,...l])}return Reflect.apply(d,e,[a,i,...l])};case"addSidebar":return(...n)=>{const[r,a,...i]=n,u=s(r,"sidebar");if(c(`${String(t)}: ${r}`,{spec:a,context:o,shouldProtect:u}),u){l.add(r.toLowerCase());const t={...a};return Reflect.apply(d,e,[r,t,...i])}return Reflect.apply(d,e,[r,a,...i])};case"addView":return(...n)=>{const[r,a,...l]=n,u=s(r,"view");if(c(`${String(t)}: ${r}`,{spec:a,context:o,shouldProtect:u}),u){i.add(r.toLowerCase());const t={...a};return Reflect.apply(d,e,[r,t,...l])}return Reflect.apply(d,e,[r,a,...l])};case"addContextMenu":return(...n)=>{const[a,i,...l]=n,u=s(a,"contextmenu");if(c(`${String(t)}: ${a}`,{spec:i,context:o,shouldProtect:u}),u){const t={...i,update:Ue(r,i.update)};return Reflect.apply(d,e,[a,t,...l])}return Reflect.apply(d,e,[a,i,...l])};case"addContextToolbar":case"addContextForm":return(...n)=>{const[a,i,...l]=n,u=s(a,"contexttoolbar");if(c(`${String(t)}: ${a}`,{spec:i,context:o,shouldProtect:u}),u){const t={...i,predicate:Fe(r,i.predicate)};return Reflect.apply(d,e,[a,t,...l])}return Reflect.apply(d,e,[a,i,...l])};case"addIcon":case"getAll":case"addContext":return d}}})},$e=new Set(["addCommand","addCommands","addQueryStateHandler","addQueryValueHandler"]),He=e=>(t,n)=>{e&&console.log(`[EditorProxy] ${t}`,n||"")},Be=(e,t)=>{const{statusProvider:n,uiContext:r,protection:o,debug:s=!1}=t,{events:a,commands:i,ui:l}=o;He(s)("Creating enhanced editor with options:",{hasStatusProvider:!!n,uiContext:r,debug:s,protection:o});const{editorUiProxy:u,editorCommandsProxy:m,editorEventListenerProxy:h}=((e,t,n,r,o,s,a)=>{const i=s.protect?{...e.ui,registry:ze(e,e.ui.registry,t,n,Pe(s),a)}:e.ui,l=r.protect?((e,t,n,r,o)=>{const s={protectedCommands:[],cleanupScheduled:!1},a=(e,t)=>{o&&console.log(`[CommandsProxy] ${e}`,t||"")},i=(e,t)=>{const o=r(e),a=n.getStatus();return o&&s.protectedCommands.push(e),o&&"invalid"===a?d:t},l=t=>{"invalid"===t&&s.protectedCommands.length>0&&(a("Removing commands",s.protectedCommands),A(s.protectedCommands,(t=>{e.editorCommands.removeCommand(t)})),s.protectedCommands=[])},c=()=>{s.cleanupScheduled||(s.cleanupScheduled=!0,window.setTimeout((()=>{l(n.getStatus()),s.cleanupScheduled=!1}),0))},u=n.onStatusChange(l);return e.on("remove",u),new Proxy(t,{get:(e,n,o)=>{if(a(`Accessing property: ${String(n)}`),"addCommand"===n){const s=Reflect.get(e,n,o);return(e,n,...o)=>{a(`Adding command: ${e}`,{shouldProtect:r(e)});const l=i(e,n);return c(),Reflect.apply(s,t,[e,l,...o])}}if("addCommands"===n){const r=Reflect.get(e,n,o);return(e,n="exec")=>{a(`Adding commands (${n})`,{commandCount:Object.keys(e).length,willApplyEnforcement:"exec"===n});const o="exec"!==n?e:W(e,((e,t)=>i(t,e)));return c(),Reflect.apply(r,t,[o,n])}}return Reflect.get(e,n,o)}})})(e,e.editorCommands,t,_e(r),a):e.editorCommands;return{editorUiProxy:i,editorCommandsProxy:l,editorEventListenerProxy:o.protect?Ne(e,t,_e(o),a):e.on.bind(e)}})(e,n,r||"",i,a,l,s),p=((e,t,n,r)=>(o,s,a)=>{const i=String(s);if("on"===s)return He(r)("on intercepted"),n;if($e.has(i))return He(r)(`${i} intercepted`),t[i].bind(t);if("editorCommands"===s)return He(r)("editorCommands accessed"),t;if("ui"===s)return He(r)("ui accessed"),e;const l=Reflect.get(o,s,a);return c(l)?l.bind(o):l})(u,m,h,s);return new Proxy(e,{get:p,set:(e,t,n,r)=>Reflect.set(e,t,n,r),has:(e,t)=>Reflect.has(e,t),ownKeys:e=>Reflect.ownKeys(e),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e,t),defineProperty:(e,t,n)=>Reflect.defineProperty(e,t,n),deleteProperty:(e,t)=>Reflect.deleteProperty(e,t),isExtensible:e=>Reflect.isExtensible(e),preventExtensions:e=>Reflect.preventExtensions(e),getPrototypeOf:e=>Reflect.getPrototypeOf(e),setPrototypeOf:(e,t)=>Reflect.setPrototypeOf(e,t)})},We=e=>parseInt(e,10),Ve=(e,t)=>{const n=e-t;return 0===n?0:n>0?1:-1},Ge=(e,t,n)=>({major:e,minor:t,patch:n}),qe=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?Ge(We(t[1]),We(t[2]),We(t[3])):Ge(0,0,0)},Ye=(e,t)=>!!e&&-1===((e,t)=>{const n=Ve(e.major,t.major);if(0!==n)return n;const r=Ve(e.minor,t.minor);if(0!==r)return r;const o=Ve(e.patch,t.patch);return 0!==o?o:0})((e=>qe((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),qe(t)),Ke=qe("8.3.0"),Xe=`${Ke.major}.${Ke.minor}.0`,Je=`${Ke.major+1}.0.0`,Ze=(e,t)=>{const{setup:n,protection:r}=t;return(o,s)=>{if(!((e,t)=>Ye(e,Xe)?(console.error(`The "${t}" plugin requires at least version ${Xe} of TinyMCE.`),!1):!!Ye(e,Je)||(console.error(`The "${t}" plugin requires at least version ${Xe} of TinyMCE but less than ${Je}.`),!1))(tinymce,e)||((e,t)=>!!(e=>{var t;const n=null===(t=e.options.get("license_key"))||void 0===t?void 0:t.toLowerCase(),r=e.options.get("online_license_key");return i(r)&&"gpl"===n})(e)&&(((e,t)=>{const{console:n,editor:r}=t;l(r)&&(e._skinLoaded?Ae(e,r):e.on("SkinLoaded",(()=>{Ae(e,r)}))),l(n)&&Oe(n)})(e,{console:{type:"error",message:[`The "${t}" plugin requires a valid TinyMCE license key.`,"Read more: https://www.tiny.cloud/docs/tinymce/latest/license-key/"].join(" ")}}),!0))(o,e))return{};const a=(e=>{const{protect:t=!0,events:n,commands:r,ui:o,api:s}=null!=e?e:{};return{protect:t,events:Le(n,false),commands:Le(r,true),ui:Le(o,true),api:Le(s,true)}})(r),u=((e="pre-validation")=>{const t=X(e),n=new Set;let r=!1;const{enableLogging:o=!1}={},s=(e,...t)=>{o&&console.log(`[StatusProvider] ${e}`,...t)};return{setStatus:e=>{const r=t.get();if(r===e)return s("Status unchanged:",e),!1;t.set(e),s("Status changed:",r,"->",e);const o={currentStatus:e,previousStatus:r},a=Array.from(n);return A(a,(e=>{e(o.currentStatus,o.previousStatus)})),!0},onStatusChange:e=>(n.add(e),s("Callback registered, total listeners:",n.size),()=>{n.delete(e)&&s("Callback unregistered, remaining listeners:",n.size)}),getStatus:t.get,hasListeners:()=>n.size>0,destroy:()=>{r||(s("Destroying StatusProvider, clearing",n.size,"listeners"),n.clear(),r=!0)}}})(),d=((e,t,n)=>{const r=`commercial-license-${t}`;return e.ui.registry.addContext(r,(()=>"invalid"!==n.getStatus()&&!e.mode.isReadOnly())),e.licenseKeyManager.validate({plugin:t}).then((e=>{n.setStatus(e?"valid":"invalid")}),(e=>{console.error(e),console.error(`An unknown error occurred when trying to validate "${t}" plugin.`),n.setStatus("invalid")})),{ui:{context:r}}})(o,e,u),m=a.protect?Be(o,{statusProvider:u,uiContext:d.ui.context,debug:t.debug||!1,protection:a}):o,h=((e,t)=>({pluginCode:e,enforcer:{isInvalid:()=>"invalid"===t.getStatus(),onInvalid:e=>t.onStatusChange(((t,n)=>{"invalid"===t&&e(t,n)}))}}))(e,u);return((e,t,n,r)=>{if(t.protect&&t.api.protect&&l(e)){const s=_e(t.api);return(o=e=>"invalid"===n.getStatus()&&s(e),(e,t)=>W(e,((e,n)=>c(e)?(...r)=>{if(o(n.toLowerCase())){const e=`Method "${l(t)?`${t}.`:""}${n}" is not available due to license key restrictions.`,r=new Error(e);throw console.error(e),r}return e(...r)}:e)))(e,r)}var o;return e})(n(m,s,h),a,u,e)}},Qe=e=>t=>t.options.get(e),et=Qe("paste_as_text"),tt=Qe("paste_merge_formats"),nt=Qe("paste_tab_spaces"),rt=Qe("smart_paste"),ot=Qe("cache_suffix"),st=Qe("automatic_uploads"),at=Qe("indent_use_margin"),it=Qe("powerpaste_block_drop"),lt=Qe("powerpaste_keep_unsupported_src"),ct=Qe("powerpaste_allow_local_images"),ut=Qe("powerpaste_word_import"),dt=Qe("powerpaste_googledocs_import"),mt=Qe("powerpaste_html_import"),ht=Qe("powerpaste_clean_filtered_inline_elements"),pt=Qe("link_default_protocol"),ft=Qe("powerpaste_autolink_urls"),gt=Qe("powerpaste_emf_processor"),vt=e=>{var t;return tinymce.explode(null!==(t=e.options.get("images_file_types"))&&void 0!==t?t:"")},yt=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},bt={fromHtml:(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return yt(n.childNodes[0])},fromTag:(e,t)=>{const n=(t||document).createElement(e);return yt(n)},fromText:(e,t)=>{const n=(t||document).createTextNode(e);return yt(n)},fromDom:yt,fromPoint:(e,t,n)=>w.from(e.dom.elementFromPoint(t,n)).map(yt)},xt=(e,t,n)=>{const r=e.document.createRange();var o;return o=r,t.fold((e=>{o.setStartBefore(e.dom)}),((e,t)=>{o.setStart(e.dom,t)}),(e=>{o.setStartAfter(e.dom)})),((e,t)=>{t.fold((t=>{e.setEndBefore(t.dom)}),((t,n)=>{e.setEnd(t.dom,n)}),(t=>{e.setEndAfter(t.dom)}))})(r,n),r},wt=(e,t,n,r,o)=>{const s=e.document.createRange();return s.setStart(t.dom,n),s.setEnd(r.dom,o),s},kt=K([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),St=(e,t,n)=>t(bt.fromDom(n.startContainer),n.startOffset,bt.fromDom(n.endContainer),n.endOffset);kt.ltr,kt.rtl;const Ct=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},Tt=(e,t)=>{const n=void 0===t?document:t.dom;return 1!==(r=n).nodeType&&9!==r.nodeType&&11!==r.nodeType||0===r.childElementCount?[]:E(n.querySelectorAll(e),bt.fromDom);var r},It=(e,t)=>e.dom===t.dom,Et=Ct,At=()=>Ot(0,0),Ot=(e,t)=>({major:e,minor:t}),Lt={nu:Ot,detect:(e,t)=>{const n=String(t).toLowerCase();return 0===e.length?At():((e,t)=>{const n=((e,t)=>{for(let n=0;n<e.length;n++){const r=e[n];if(r.test(t))return r}})(e,t);if(!n)return{major:0,minor:0};const r=e=>Number(t.replace(n,"$"+e));return Ot(r(1),r(2))})(e,n)},unknown:At},_t=(e,t)=>{const n=String(t).toLowerCase();return P(e,(e=>e.search(n)))},Pt=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Nt=e=>t=>ke(t,e),Dt=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>ke(e,"edge/")&&ke(e,"chrome")&&ke(e,"safari")&&ke(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Pt],search:e=>ke(e,"chrome")&&!ke(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>ke(e,"msie")||ke(e,"trident")},{name:"Opera",versionRegexes:[Pt,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Nt("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Nt("firefox")},{name:"Safari",versionRegexes:[Pt,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(ke(e,"safari")||ke(e,"mobile/"))&&ke(e,"applewebkit")}],Rt=[{name:"Windows",search:Nt("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>ke(e,"iphone")||ke(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Nt("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Nt("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Nt("linux"),versionRegexes:[]},{name:"Solaris",search:Nt("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Nt("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Nt("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Mt={browsers:h(Dt),oses:h(Rt)},Ut=e=>{const t=e.current,n=e.version,r=e=>()=>t===e;return{current:t,version:n,isEdge:r("Edge"),isChromium:r("Chromium"),isIE:r("IE"),isOpera:r("Opera"),isFirefox:r("Firefox"),isSafari:r("Safari")}},Ft=()=>Ut({current:void 0,version:Lt.unknown()}),jt=Ut,zt=e=>{const t=e.current,n=e.version,r=e=>()=>t===e;return{current:t,version:n,isWindows:r("Windows"),isiOS:r("iOS"),isAndroid:r("Android"),isMacOS:r("macOS"),isLinux:r("Linux"),isSolaris:r("Solaris"),isFreeBSD:r("FreeBSD"),isChromeOS:r("ChromeOS")}},$t=()=>zt({current:void 0,version:Lt.unknown()}),Ht=zt,Bt=e=>window.matchMedia(e).matches;let Wt=Ee((()=>((e,t,n)=>{const r=Mt.browsers(),o=Mt.oses(),s=t.bind((e=>((e,t)=>z(t.brands,(t=>{const n=t.brand.toLowerCase();return P(e,(e=>n===e.brand?.toLowerCase())).map((e=>({current:e.name,version:Lt.nu(parseInt(t.version,10),0)})))})))(r,e))).orThunk((()=>((e,t)=>_t(e,t).map((e=>{const n=Lt.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(r,e))).fold(Ft,jt),a=((e,t)=>_t(e,t).map((e=>{const n=Lt.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(o,e).fold($t,Ht),i=((e,t,n,r)=>{const o=e.isiOS()&&!0===/ipad/i.test(n),s=e.isiOS()&&!o,a=e.isiOS()||e.isAndroid(),i=a||r("(pointer:coarse)"),l=o||!s&&a&&r("(min-device-width:768px)"),c=s||a&&!l,u=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(n),d=!c&&!l&&!u;return{isiPad:h(o),isiPhone:h(s),isTablet:h(l),isPhone:h(c),isTouch:h(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:h(u),isDesktop:h(d)}})(a,s,e,n);return{browser:s,os:a,deviceType:i}})(window.navigator.userAgent,w.from(window.navigator.userAgentData),Bt)));const Vt=()=>Wt(),Gt=e=>e.dom.nodeName.toLowerCase(),qt=e=>e.dom.nodeType,Yt=e=>t=>qt(t)===e,Kt=e=>8===qt(e)||"#comment"===Gt(e),Xt=Yt(1),Jt=Yt(3),Zt=Yt(9),Qt=Yt(11),en=e=>t=>Xt(t)&&Gt(t)===e,tn=e=>bt.fromDom(e.dom.ownerDocument),nn=e=>Zt(e)?e:tn(e),rn=e=>bt.fromDom(nn(e).dom.defaultView),on=e=>w.from(e.dom.parentNode).map(bt.fromDom),sn=e=>w.from(e.dom.previousSibling).map(bt.fromDom),an=e=>w.from(e.dom.nextSibling).map(bt.fromDom),ln=e=>(e=>{const t=k.call(e,0);return t.reverse(),t})(((e,t)=>{const n=[],r=e=>(n.push(e),t(e));let o=t(e);do{o=o.bind(r)}while(o.isSome());return n})(e,sn)),cn=e=>E(e.dom.childNodes,bt.fromDom),un=(e,t,n,r)=>{const o=tn(e).dom.createRange();return o.setStart(e.dom,t),o.setEnd(n.dom,r),o},dn=e=>bt.fromDom(e.dom.host),mn=e=>{const t=bt.fromDom((e=>{if(l(e.target)){const t=bt.fromDom(e.target);if(Xt(t)&&l(t.dom.shadowRoot)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return j(t)}}return w.from(e.target)})(e).getOr(e.target)),n=()=>e.stopPropagation(),r=()=>e.preventDefault(),o=m(r,n);return((e,t,n,r,o,s,a)=>({target:e,x:t,y:n,stop:r,prevent:o,kill:s,raw:a}))(t,e.clientX,e.clientY,n,r,o,e)},hn=(e,t,n,r)=>{e.dom.removeEventListener(t,n,r)},pn=x,fn=(e,t,n)=>((e,t,n,r)=>((e,t,n,r,o)=>{const s=((e,t)=>n=>{e(n)&&t(mn(n))})(n,r);return e.dom.addEventListener(t,s,o),{unbind:g(hn,e,t,s,o)}})(e,t,n,r,!1))(e,t,pn,n),gn=(e,t)=>{on(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},vn=(e,t)=>{an(e).fold((()=>{on(e).each((e=>{bn(e,t)}))}),(e=>{gn(e,t)}))},yn=(e,t)=>{(e=>(e=>{const t=e.dom.childNodes;return w.from(t[0]).map(bt.fromDom)})(e))(e).fold((()=>{bn(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))},bn=(e,t)=>{e.dom.appendChild(t.dom)},xn=(e,t)=>{gn(e,t),bn(t,e)},wn=(e,t)=>{A(t,((n,r)=>{const o=0===r?e:t[r-1];vn(o,n)}))},kn=(e,t)=>{A(t,(t=>{bn(e,t)}))},Sn=(e,t,r)=>{if(!(n(r)||s(r)||u(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")},Cn=(e,t,n)=>{Sn(e.dom,t,n)},Tn=(e,t)=>{const n=e.dom;B(t,((e,t)=>{Sn(n,t,e)}))},In=(e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n},En=(e,t)=>w.from(In(e,t)),An=(e,t)=>{const n=e.dom;return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},On=(e,t)=>{e.dom.removeAttribute(t)},Ln=e=>{e.dom.textContent="",A(cn(e),(e=>{_n(e)}))},_n=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Pn=e=>{const t=cn(e);t.length>0&&wn(e,t),_n(e)},Nn=(e,t)=>{const n=(t||document).createElement("div");return n.innerHTML=e,cn(bt.fromDom(n))},Dn=e=>e.dom.innerHTML,Rn=e=>void 0!==e.style&&c(e.style.getPropertyValue),Mn=e=>{const t=Jt(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=(e=>bt.fromDom(e.dom.getRootNode()))(e);return Qt(n=t)&&l(n.dom.host)?w.some(t):w.none();var n})(bt.fromDom(t)).fold((()=>n.body.contains(t)),(r=Mn,o=dn,e=>r(o(e))));var r,o},Un=(e,t,r)=>{if(!n(r))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",r,":: Element ",e),new Error("CSS value must be a string: "+r);Rn(e)&&e.style.setProperty(t,r)},Fn=(e,t)=>{Rn(e)&&e.style.removeProperty(t)},jn=(e,t,n)=>{const r=e.dom;Un(r,t,n)},zn=(e,t)=>{const n=e.dom;B(t,((e,t)=>{Un(n,t,e)}))},$n=(e,t)=>{const n=e.dom,r=window.getComputedStyle(n).getPropertyValue(t);return""!==r||Mn(e)?r:Hn(n,t)},Hn=(e,t)=>Rn(e)?e.style.getPropertyValue(t):"",Bn=(e,t)=>{const n=e.dom,r=Hn(n,t);return w.from(r).filter((e=>e.length>0))},Wn=e=>{const t={},n=e.dom;if(Rn(n))for(let e=0;e<n.style.length;e++){const r=n.style.item(e);t[r]=n.style[r]}return t},Vn=(e,t)=>{const n=e.dom;Fn(n,t),de(En(e,"style").map(Te),"")&&On(e,"style")},Gn=(e,t)=>{const n=t=>e(t)?w.from(t.dom.nodeValue):w.none();return{get:r=>{if(!e(r))throw new Error("Can only get "+t+" value of a "+t+" node");return n(r).getOr("")},getOption:n,set:(n,r)=>{if(!e(n))throw new Error("Can only set raw "+t+" value of a "+t+" node");n.dom.nodeValue=r}}},qn=Gn(Kt,"comment"),Yn=e=>qn.get(e),Kn=Gn(Jt,"text"),Xn=e=>Kn.get(e),Jn=e=>"rtl"===$n(e,"direction")?"rtl":"ltr",Zn=(e,t)=>{const n=In(e,t);return void 0===n||""===n?[]:n.split(" ")},Qn=(e,t,n)=>{let r=e.dom;const o=c(n)?n:b;for(;r.parentNode;){r=r.parentNode;const e=bt.fromDom(r);if(t(e))return w.some(e);if(o(e))break}return w.none()},er=(e,t)=>P(e.dom.childNodes,(e=>t(bt.fromDom(e)))).map(bt.fromDom),tr=(e,t)=>{const n=e=>{for(let r=0;r<e.childNodes.length;r++){const o=bt.fromDom(e.childNodes[r]);if(t(o))return w.some(o);const s=n(e.childNodes[r]);if(s.isSome())return s}return w.none()};return n(e.dom)},nr=(e,t,n)=>Qn(e,(e=>Ct(e,t)),n),rr=(e,t,n)=>((e,t,n,r,o)=>((e,t)=>Ct(e,t))(n,r)?w.some(n):c(o)&&o(n)?w.none():t(n,r,o))(0,nr,e,t,n),or=e=>void 0!==e.dom.classList,sr=e=>Zn(e,"class"),ar=(e,t)=>{or(e)?e.dom.classList.add(t):((e,t)=>{((e,t,n)=>{const r=Zn(e,t).concat([n]);Cn(e,t,r.join(" "))})(e,"class",t)})(e,t)},ir=(e,t)=>{or(e)?e.dom.classList.remove(t):((e,t)=>{((e,t,n)=>{const r=L(Zn(e,t),(e=>e!==n));r.length>0?Cn(e,t,r.join(" ")):On(e,t)})(e,"class",t)})(e,t),(e=>{0===(or(e)?e.dom.classList:sr(e)).length&&On(e,"class")})(e)},lr=(e,t)=>or(e)&&e.dom.classList.contains(t),cr=e=>t=>lr(t,e),ur=e=>e.dom.textContent,dr=(e,t)=>{let n=[];return A(cn(e),(e=>{t(e)&&(n=n.concat([e])),n=n.concat(dr(e,t))})),n},mr=(e,t)=>Tt(t,e),hr=(e,t,n,r)=>({start:e,soffset:t,finish:n,foffset:r}),pr=K([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),fr={before:pr.before,on:pr.on,after:pr.after,cata:(e,t,n,r)=>e.fold(t,n,r),getStart:e=>e.fold(p,p,p)},gr=K([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),vr={domRange:gr.domRange,relative:gr.relative,exact:gr.exact,exactFromRange:e=>gr.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>bt.fromDom(e.startContainer),relative:(e,t)=>fr.getStart(e),exact:(e,t,n,r)=>e}))(e);return rn(t)},range:hr},yr=(e,t)=>{const n=Gt(e);return"input"===n?fr.after(e):T(["br","img"],n)?0===t?fr.before(e):fr.after(e):fr.on(e,t)},br=e=>w.from(e.getSelection()),xr=(e,t,n,r,o)=>{((e,t)=>{br(e).each((e=>{e.removeAllRanges(),e.addRange(t)}))})(e,wt(e,t,n,r,o))},wr=(e,t,n,r,o)=>{const s=((e,t,n,r)=>{const o=yr(e,t),s=yr(n,r);return vr.relative(o,s)})(t,n,r,o);((e,t)=>{((e,t)=>{const n=((e,t)=>t.match({domRange:e=>({ltr:h(e),rtl:w.none}),relative:(t,n)=>({ltr:Ee((()=>xt(e,t,n))),rtl:Ee((()=>w.some(xt(e,n,t))))}),exact:(t,n,r,o)=>({ltr:Ee((()=>wt(e,t,n,r,o))),rtl:Ee((()=>w.some(wt(e,r,o,t,n))))})}))(e,t);return((e,t)=>{const n=t.ltr();return n.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>kt.rtl(bt.fromDom(e.endContainer),e.endOffset,bt.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>St(0,kt.ltr,n))):St(0,kt.ltr,n)})(0,n)})(e,t).match({ltr:(t,n,r,o)=>{xr(e,t,n,r,o)},rtl:(t,n,r,o)=>{br(e).each((s=>{if(s.setBaseAndExtent)s.setBaseAndExtent(t.dom,n,r.dom,o);else if(s.extend)try{((e,t,n,r,o,s)=>{t.collapse(n.dom,r),t.extend(o.dom,s)})(0,s,t,n,r,o)}catch{xr(e,r,o,t,n)}else xr(e,r,o,t,n)}))}})})(e,s)},kr=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),n=e.getRangeAt(e.rangeCount-1);return w.some(hr(bt.fromDom(t.startContainer),t.startOffset,bt.fromDom(n.endContainer),n.endOffset))}return w.none()},Sr=e=>{if(null===e.anchorNode||null===e.focusNode)return kr(e);{const t=bt.fromDom(e.anchorNode),n=bt.fromDom(e.focusNode);return((e,t,n,r)=>{const o=un(e,t,n,r),s=It(e,n)&&t===r;return o.collapsed&&!s})(t,e.anchorOffset,n,e.focusOffset)?w.some(hr(t,e.anchorOffset,n,e.focusOffset)):kr(e)}},Cr=e=>br(e).filter((e=>e.rangeCount>0)).bind(Sr),Tr=K([{error:["message"]},{paste:["elements","correlated"]},{cancel:[]},{incomplete:["elements","correlated","message"]}]),Ir=(e,t,n,r,o)=>e.fold(t,n,r,o),Er=Tr.error,Ar=Tr.paste,Or=Tr.cancel,Lr=Tr.incomplete,_r=["officeStyles","htmlStyles","gdocsStyles","isWord","isGoogleDocs","proxyBin","isInternal"],Pr=(e,t)=>{const n={};return A(_r,(r=>{t[r].or(e[r]).each((e=>{n[r]=e}))})),Nr(n)},Nr=e=>U(_r,(t=>w.from(e[t]))),Dr=e=>({response:Er(e),bundle:Nr({})}),Rr=e=>Promise.resolve(Dr(e)),Mr={response:Or(),bundle:Nr({})},Ur=e=>l(e.then),Fr=(e,t,n,r)=>({steps:e,input:t,label:n,capture:r}),jr=(e,t)=>{const n=Pr(e.bundle,t.bundle),r=((e,t)=>Ir(e,w.none,w.none,w.none,((e,n,r)=>Ir(t,w.none,((e,t)=>w.some(Tr.incomplete(e,t,r))),w.none,w.none))).getOr(t))(e.response,t.response);return{response:r,bundle:n}},zr=(e,t,n)=>{const r=()=>e,o=()=>{const r=n(t,e);return Ur(r)?r.then((t=>jr(e,t))):jr(e,r)};return Ir(e.response,r,o,r,o)},$r=e=>{return(o=e,Kt(o)?(t=o,n="v:shape",w.from((r=t,r.dom.nodeValue)).bind((e=>{const t=e.indexOf("]>"),r=(e=>{try{return(new DOMParser).parseFromString(e,"text/html").body}catch(t){const n=document.implementation.createHTMLDocument("").body;return n.innerHTML=e,n}})(`<div>${e.slice(t+2,e.lastIndexOf("<!["))}</div>`);return tr(bt.fromDom(r),(e=>Gt(e)===n))}))):w.none()).map((e=>{const t=In(e,"o:spid"),n=void 0===t?En(e,"id").getOr(""):t,r=bt.fromTag("img");return ar(r,"rtf-data-image"),Cn(r,"data-image-id",n.substr(7)),Cn(r,"data-image-type","code"),((e,t)=>{const n=e.dom;B(t,((e,t)=>{e.fold((()=>{Fn(n,t)}),(e=>{Un(n,t,e)}))}))})(r,{width:Bn(e,"width"),height:Bn(e,"height")}),r}));var t,n,r,o},Hr=e=>{if(en("img")(e)){const t=In(e,"src");if(null!=t&&Se(t,"file://")){const n=(e=>(e=>bt.fromDom(e.dom.cloneNode(!1)))(e))(e),r=t.split(/[\/\\]/),o=r[r.length-1];return Cn(n,"data-image-id",o),On(n,"src"),Cn(n,"data-image-type","local"),ar(n,"rtf-data-image"),w.some(n)}return w.none()}return w.none()},Br="startElement",Wr="endElement",Vr="text",Gr="comment",qr=(e,t,n)=>{let r,o,s;const a=bt.fromDom(e);switch(e.nodeType){case 1:t?r=Wr:(r=Br,zn(a,n||{}));const i=e;o="HTML"!==i.scopeName&&i.scopeName&&i.tagName&&i.tagName.indexOf(":")<=0?(i.scopeName+":"+i.tagName).toLowerCase():i.tagName.toLowerCase();break;case 3:r=Vr,s=e.nodeValue;break;case 8:r=Gr,s=e.nodeValue;break;default:console.log("WARNING: Unsupported node type encountered: "+e.nodeType)}return{getNode:h(e),tag:()=>o,type:()=>r,text:()=>s}},Yr=(e,t,n,r)=>{const o=r.createElement(e);return B(t,((e,t)=>{o.setAttribute(t,e+"")})),qr(o,!1,n)},Kr=(e,t)=>qr(t.createElement(e),!0),Xr=Kr("html",window.document),Jr=(e,t)=>{const n=Gt(e),r=t.name,o=void 0!==t.condition?t.condition:x;return be.matches(r,n)&&o(e)},Zr=(e,t,n)=>{const r=(e=>{const t={},n=l(e)?e.split(";"):[];return A(n,(e=>{const n=e.split(":");2===n.length&&(t[Te(n[0])]=Te(n[1]))})),t})(e.dom.getAttribute("style")),o={};return A(t,(e=>{const t=r[e];void 0===t||n(t,e)||(o[e]=t)})),o},Qr=e=>{const t=$(e);return E(t,(t=>t+": "+e[t])).join("; ")},eo=["mso-list"],to=(e,t)=>{const n=Zr(e,eo,t),r=((e,t)=>{const n=e.dom.style,r=i(n)?[]:n,o={};return A(r,(n=>{Bn(e,n).each((e=>{t(e,n)||(o[n]=e)}))})),o})(e,t);((e,t,n)=>{Cn(e,"style","");const r=q(t),o=q(n);if(0===r&&0===o)On(e,"style");else if(0===r)Cn(e,"style",Qr(n));else{B(t,((t,n)=>{jn(e,n,t)}));const r=In(e,"style"),s=o>0?Qr(n)+"; ":"";Cn(e,"style",s+r)}})(e,r,n)},no=(e,t)=>{const n=((e,t)=>{const n={};return A(e.dom.attributes,(e=>{t(e.value,e.name)||(n[e.name]=e.value)})),n})(e,t);((e,t)=>{const n=E(e.dom.attributes,(e=>e.name));q(t)!==n.length&&((e,t,n)=>{A(t,(t=>{On(e,t)})),B(n,((t,n)=>{Cn(e,n,t)}))})(e,n,t)})(e,n)},ro=(e,t)=>{to(bt.fromDom(e),t)},oo=(e,t,n)=>{e(n,((e,r)=>I(t,(t=>((e,t,n,r)=>{const o=r.name,s=void 0!==r.condition?r.condition:x,a=void 0!==r.value?r.value:be.all();return be.matches(o,n)&&be.matches(a,t)&&s(e)})(n,e,r,t)))))},so=e=>{const t=e.createDocumentFragment();let n=t;const r=e=>{n.appendChild(e)};return{dom:t,receive:o=>{switch(o.type()){case Br:s=o.getNode().cloneNode(!1),r(s),n=s;break;case Vr:(t=>{const n=e.createTextNode(t.text());r(n)})(o);break;case Wr:(()=>{const e=n.parentNode;n=null===e?t:e})();break;case Gr:break;default:throw new Error("Unsupported token type: "+o.type())}var s},label:"SERIALISER"}},ao=e=>t=>{((e,t)=>{const n=ce({styles:[],attributes:[],classes:[],tags:[]},t),r=mr(e,"*");A(r,(e=>{oo(to,n.styles,e),oo(no,n.attributes,e),A(n.classes,(t=>{const n=An(e,"class")?(e=>or(e)?(e=>{const t=e.dom.classList,n=new Array(t.length);for(let e=0;e<t.length;e++){const r=t.item(e);null!==r&&(n[e]=r)}return n})(e):sr(e))(e):[];A(n,(n=>{be.matches(t.name,n)&&ir(e,n)}))}))}));const o=mr(e,"*");A(o,(e=>{I(n.tags,g(Jr,e))&&_n(e)}))})(t,e)},io=e=>t=>{((e,t)=>{const n=ce({tags:[]},t),r=mr(e,"*");A(r,(e=>{I(n.tags,g(Jr,e))&&Pn(e)}))})(t,e)},lo=e=>t=>{((e,t)=>{const n=ce({tags:[]},t),r=mr(e,"*");A(r,(e=>{P(n.tags,g(Jr,e)).each((t=>{t.mutate(e)}))}))})(t,e)},co=e=>t=>{const n=Dn(t),r=((e,t,n)=>{const r=so(e),o=((e,t=window.document)=>{const n=t.createElement("div");t.body.appendChild(n),n.style.position="absolute",n.style.left="-10000px",n.innerHTML=e;let r=n.firstChild||Xr;const o=[];let s=!1;return{hasNext:()=>void 0!==r,next:()=>{const e=r,a=r,i=s;return!s&&e.firstChild?(o.push(e),r=e.firstChild):s||1!==e.nodeType?e.nextSibling?(r=e.nextSibling,s=!1):(r=o.pop(),s=!0):s=!0,a===Xr||r||(t.body.removeChild(n),r=Xr),(l=a)===Xr?l:l?qr(l,i):void 0;var l}}})(t,e),s=((e,t,n)=>{let r=n;for(let n=t.length-1;n>=0;n--)r=t[n](r,{},e);return r})(e,n,r);for(;o.hasNext();){const e=o.next();s.receive(e)}return r.dom})(tn(t).dom,n,e);Ln(t),t.dom.appendChild(r)},uo=(e,t,n)=>{const r=bt.fromTag("div",e.dom);zn(r,{position:"fixed",left:"-100000px",top:"0px"}),bn((e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return bt.fromDom(t)})(e),r),r.dom.innerHTML=t,A(n,(e=>{e(r)}));const o=Dn(r);return _n(r),o},mo=(e,t)=>n=>{const r=e=>{n.receive(e)},o=(e,t,n)=>(n=void 0!==n?n:e.type()===Wr,qr(t,n,{})),s={emit:r,emitTokens:e=>{A(e,r)},receive:t=>{e(s,t,o)},document:window.document};return t(s),s},ho=(e,t)=>{if(void 0===e||void 0===t)throw console.trace(),new Error("brick");e.nextFilter.set(t)},po=(e,t,n=!1)=>e===t||l(e)&&l(t)&&e.tag===t.tag&&e.type===t.type&&(n||e.variant===t.variant),fo=(e,t)=>An(bt.fromDom(t.getNode()),"data-list-level"),go=(e,t,n,r)=>{const o=n.getCurrentListType(),s=n.getCurrentLevel()==r.level()?o:null;return(a=r.emblems(),i=s,P(a,(e=>"ul"===e.tag||l(i)&&po(e,i,!0))).orThunk((()=>j(a)))).filter((e=>!("ol"===e.tag&&(e=>{if(T(["p"],e.tag())){const t=(e=>{const t=bt.fromDom(e.getNode());return In(t,"class")})(e);return l(t)&&/^MsoHeading/.test(t)}return!0})(t))));var a,i},vo=e=>(t,n,r)=>{const o=r,s=(e=>{const t=parseInt(In(e,"data-list-level"),10),n=In(e,"data-list-emblems"),r=l(n)?JSON.parse(n):[];return On(e,"data-list-level"),On(e,"data-list-emblems"),{level:h(t),emblems:h(r)}})(bt.fromDom(o.getNode()));n.originalToken.set(o);const a=((e,t,n)=>(go(n.listType.get(),e,n.emitter,t).each(n.listType.set),((e,t,n)=>({level:h(e),token:h(t),type:h(n)}))(t.level(),n.originalToken.get(),n.listType.get())))(o,s,n);n.emitter.openItem(a.level(),a.token(),a.type()),ho(n,e.inside())},yo=(e,t,n)=>({pred:e,action:t,label:h(n)});var bo=(e,t,n)=>{const r=(e,r,o)=>{P(t,(e=>e.pred(r,o))).fold(h(n),(e=>e.action))(e,r,o)};return r.toString=()=>"Handlers for "+e,r};const xo=(e,t)=>({state:h(e),result:h(t)}),wo=(e,t)=>({state:h(e),value:h(t)}),ko=(e,t,n,r)=>({level:h(e),type:h(t),types:h(n),items:h(r)}),So=e=>{const t=e.items().slice(0);if(t.length>0&&"p"!==t[t.length-1]){const n=t[t.length-1];t[t.length-1]="p";const r=ko(e.level(),e.type(),e.types(),t);return wo(r,w.some(n))}return wo(e,w.none())},Co=(e,t,n)=>{let r=[],o=e;for(;t(o);){const e=n(o);o=e.state(),r=r.concat(e.result())}return xo(o,r)},To=(e,t,n)=>{const r=t.start&&t.start>1?{start:t.start}:{},o=e.level()+1,s=t,a=e.types().concat([t]),i=[g(Yr,t.tag,r,n)],l=ko(o,s,a,e.items());return xo(l,i)},Io=e=>{const t=e.types().slice(0),n=[g(Kr,t.pop().tag)],r=e.level()-1,o=t[t.length-1],s=ko(r,o,t,e.items());return xo(s,n)},Eo=(e,t,n)=>{const r=(c=t)?(e=>{const t=(e=>{const t=bt.fromDom(e.getNode());return $n(t,"margin-left")})(e);return l(t)&&"0px"!==t?{"margin-left":t}:{}})(c):{"list-style-type":"none"},o=e.type()&&!po(e.type(),n)?((e,t)=>{const n=Io(e),r=To(n.state(),t,t.type?{"list-style-type":t.type}:{});return xo(r.state(),n.result().concat(r.result()))})(e,n):xo(e,[]),s=[g(Yr,"li",{},r)],a=((e,t)=>{const n=e.items().slice(0),r=void 0!==t&&"p"!==t?w.some(t):w.none();r.fold((()=>{n.push("p")}),(e=>{n.push(e)}));const o=ko(e.level(),e.type(),e.types(),n);return wo(o,r)})(o.state(),t&&t.tag()),i=a.value().map((e=>{const n=t;return ro(n.getNode(),x),[h(n)]})).getOr([]);var c;return xo(a.state(),o.result().concat(s).concat(i))},Ao=e=>{const t=g(Kr,"li"),n=So(e),r=n.value().fold((()=>[t]),(e=>[g(Kr,e),t]));return xo(n.state(),r)},Oo=e=>{if(0===e.length)throw new Error("Compose must have at least one element in the list");const t=e[e.length-1],n=R(e,(e=>e.result()));return xo(t.state(),n)},Lo=e=>{const t=Ao(e),n=Io(t.state());return Oo([t,n])},_o=(e,t)=>((e,t,n)=>Co(e,(e=>e.level()>t),n))(e,t,Lo),Po=(e,t,n,r)=>{const o=e.level()>t?_o(e,t):xo(e,[]),s=o.state().level()===t?((e,t,n)=>{const r=e.level()>0?Ao(e):xo(e,[]),o=Eo(r.state(),n,t);return Oo([r,o])})(o.state(),r,n):((e,t,n,r)=>{const o=n>1?So(e):wo(e,w.none()),s=o.value().map((e=>[g(Kr,e)])).getOr([]),a=((e,t,n,r)=>((e,t,n)=>Co(e,(e=>e.level()<t),n))(e,n,(e=>((e,t,n,r)=>{const o=e.level()===n-1&&t.type?{"list-style-type":t.type}:{},s=To(e,t,o),a=Eo(s.state(),s.state().level()==n?r:void 0,t);return Oo([s,a])})(e,t,n,r))))(o.state(),t,n,r);return xo(a.state(),s.concat(a.result()))})(o.state(),r,t,n);return Oo([o,s])},No=_o,Do=["disc","circle","square"],Ro={getCurrentListType:()=>Mo().getCurrentListType(),getCurrentLevel:()=>Mo().getCurrentLevel(),closeAllLists:()=>Mo().closeAllLists(),openItem:(e,t,n)=>Mo().openItem(e,t,n)};let Mo=()=>({getCurrentListType:h({}),getCurrentLevel:h(1),closeAllLists:d,openItem:p});const Uo={inside:()=>jo,outside:()=>zo},Fo=(()=>{let e=!1;return{check:t=>!(!e||t.type()!==Vr)||(t.type()===Br&&"style"===t.tag()?(e=!0,!0):t.type()===Wr&&"style"===t.tag()&&(e=!1,!0))}})(),jo=(e=>bo("Inside.List.Item",[yo(((e,t)=>{const n=e.originalToken.get();return t.type()===Wr&&null!==n&&t.tag()===n.tag()}),((t,n)=>{ho(n,e.outside())}),"Closing open tag")],((e,t,n)=>{e.emit(n)})))(Uo),zo=(e=>bo("Outside.List.Item",[yo(fo,vo(e),"Data List ****"),yo(((e,t)=>t.type()===Vr&&(e=>e.type()===Vr&&/^[\s\u00A0]*$/.test(e.text()))(t)),((e,t,n)=>{e.emit(n)}),"Whitespace")],((t,n,r)=>{n.emitter.closeAllLists(),t.emit(r),ho(n,e.outside())})))(Uo),$o=(e=>{const t=X(e),n=X(null),r=X(null);return{reset:o=>{t.set(e),n.set(null),r.set(null),Mo=h(((e,t)=>{let n=ko(0,void 0,[],[]);const r=n=>{A(n.result(),(n=>{const r=n(t);e.emit(r)}))};return{closeAllLists:()=>{const e=No(n,0);n=e.state(),r(e)},openItem:(e,t,o)=>{if(!o)return;const s=((e,t)=>"ul"===e.tag&&Do[t-1]===e.type?{tag:"ul"}:e)(o,e),a=Po(n,e,t,s);n=a.state(),r(a)},getCurrentListType:()=>n.type(),getCurrentLevel:()=>n.level()}})(o,o.document))},nextFilter:t,originalToken:n,listType:r,emitter:Ro}})(zo);var Ho=mo(((e,t,n)=>{Fo.check(t)||((e,t,n)=>{t.nextFilter.get()(e,t,n)})(e,$o,t)}),$o.reset);const Bo=[{regex:/^\(?[dc][\.\)]$/,type:{tag:"ol",type:"lower-alpha"}},{regex:/^\(?[DC][\.\)]$/,type:{tag:"ol",type:"upper-alpha"}},{regex:/^\(?M*(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})[\.\)]$/,type:{tag:"ol",type:"upper-roman"}},{regex:/^\(?m*(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})[\.\)]$/,type:{tag:"ol",type:"lower-roman"}},{regex:/^\(?[0-9]+[\.\)]$/,type:{tag:"ol"}},{regex:/^([0-9]+\.)*[0-9]+\.?$/,type:{tag:"ol",variant:"outline"}},{regex:/^\(?[a-z]+[\.\)]$/,type:{tag:"ol",type:"lower-alpha"}},{regex:/^\(?[A-Z]+[\.\)]$/,type:{tag:"ol",type:"upper-alpha"}}],Wo={"\u2022":{tag:"ul",type:"disc"},"\xb7":{tag:"ul",type:"disc"},"\xa7":{tag:"ul",type:"square"}},Vo={o:{tag:"ul",type:"circle"},"-":{tag:"ul",type:"disc"},"\u25cf":{tag:"ul",type:"disc"},"\ufffd":{tag:"ul",type:"circle"}},Go=(e,t)=>a(e.variant)?"("===t.charAt(0)?"()":")"===t.charAt(t.length-1)?")":".":e.variant,qo=e=>{const t=e.split("."),n=(()=>{if(0===t.length)return e;const n=t[t.length-1];return 0===n.length&&t.length>1?t[t.length-2]:n})(),r=parseInt(n,10);return isNaN(r)?{}:{start:r}},Yo=e=>{const t=(e=>Zr(e,["mso-list"],b)["mso-list"])(e),n=l(t)&&/ level([0-9]+)/.exec(t);return n&&n[1]?w.some(parseInt(n[1],10)):w.none()},Ko=(e,t)=>{const n=((e,t)=>{const n=Vo[e]?[Vo[e]]:[],r=((e,t)=>t&&Wo[e]?[Wo[e]]:t?[{tag:"ul",variant:e}]:[])(e,t),o=R(Bo,(t=>t.regex.test(e)?[ce(t.type,qo(e),{variant:Go(t.type,e)})]:[])),s=n.concat(r).concat(o);return E(s,(t=>void 0!==t.variant?t:ce(t,{variant:e})))})(ur(e).trim(),t);return n.length>0?w.some(n):w.none()},Xo=e=>er(e,Kt).bind(an).filter(en("span")),Jo=e=>tr(e,(e=>!!(Xt(e)?Zr(e,["mso-list"],b):{})["mso-list"])),Zo=e=>Xt(e)&&Bn(e,"font-family").exists((e=>T(["wingdings","symbol"],e.toLowerCase()))),Qo=(e,t,n,r)=>{((e,t,n)=>{Cn(e,"data-list-level",t);const r=JSON.stringify(n);Cn(e,"data-list-emblems",r)})(e,t,n),(e=>{const t=((e,t)=>{const n=t.getOr(x);return(e=>{const t=[];for(;null!==e.nextNode();)t.push(bt.fromDom(e.currentNode));return t})(document.createTreeWalker(e.dom,NodeFilter.SHOW_COMMENT,{acceptNode:e=>n(e.nodeValue)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))})(e,w.none());A(t,_n)})(e),A(r,_n),On(e,"style"),On(e,"class")},es=e=>(e=>Yo(e).bind((t=>(e=>er(e,Zo))(e).bind((n=>Ko(n,!0).map((r=>({mutate:()=>{Qo(e,t,r,[n])}}))))))))(e).orThunk((()=>(e=>Yo(e).bind((t=>Xo(e).bind((n=>Ko(n,Zo(n)).map((r=>({mutate:()=>{Qo(e,t,r,[n])}}))))))))(e))).orThunk((()=>(e=>Yo(e).bind((t=>Xo(e).bind((n=>Ko(n,Zo(n)).map((r=>({mutate:()=>{Qo(e,t,r,[n])}}))))))))(e))).orThunk((()=>(e=>"p"!==Gt(e)?w.none():Yo(e).bind((t=>Jo(e).bind((n=>Ko(n,!1).map((r=>({mutate:()=>{Qo(e,t,r,[on(n).getOr(n)])}}))))))))(e))).orThunk((()=>(e=>"p"!==Gt(e)?w.none():Jo(e).bind((t=>{const n=on(t).getOr(t),r=Zo(n);return Ko(t,r).bind((t=>(e=>Bn(e,"margin-left").bind((e=>{const t=parseInt(e,10);return isNaN(t)?w.none():w.some(Math.max(1,Math.ceil(t/18)))})))(e).map((r=>({mutate:()=>{Qo(e,r,t,[n])}})))))})))(e))),ts=lo({tags:[{name:be.pattern(/^(p|h\d+)$/,be.caseInsensitive),mutate:e=>{es(e).each((e=>{e.mutate()}))}}]}),ns=Ho,rs=e=>{const t=e.dom.attributes;return null==t||0===t.length||1===t.length&&"style"===t[0].name},os=(e,t)=>{const n=bt.fromTag(e);gn(t,n);const r=t.dom.attributes;A(r,(e=>{n.dom.setAttribute(e.name,e.value)}));const o=cn(t);return kn(n,o),_n(t),n},ss=en("li"),as=e=>sn(e).bind((e=>Jt(e)&&0===Xn(e).trim().length?as(e):ss(e)?w.some(e):w.none())),is=e=>{const t=os("span",e),n={"font-size":{1:"8pt",2:"10pt",3:"12pt",4:"14pt",5:"18pt",6:"24pt",7:"36pt"}};B({face:"font-family",size:"font-size",color:"color"},((e,r)=>{En(t,r).each((o=>{const s=n[e],a=void 0!==s&&void 0!==s[o]?s[o]:o;jn(t,e,a),On(t,r)}))}))};var ls;!function(e){e[e.Word=0]="Word",e[e.GoogleDocs=1]="GoogleDocs",e[e.Html=2]="Html"}(ls||(ls={}));const cs=e=>t=>{En(t,e.attrName).each((n=>{const r=l(e.styleName)?e.styleName:e.attrName;if(Bn(t,r).isNone()){const o=e.mapValue(n);jn(t,r,o)}On(t,e.attrName)}))},us=e=>{const t=Gt(e);return"td"===t||"tr"===t||"col"===t||"th"===t},ds=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,ms=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,hs=e=>we(e,"#").toUpperCase(),ps=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},fs=e=>(e=>({value:hs(e)}))(ps(e.red)+ps(e.green)+ps(e.blue)),gs=/^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i,vs=/^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i,ys=(e,t,n,r)=>({red:e,green:t,blue:n,alpha:r}),bs=(e,t,n,r)=>{const o=parseInt(e,10),s=parseInt(t,10),a=parseInt(n,10),i=parseFloat(r);return ys(o,s,a,i)},xs=["background-repeat-x","background-repeat-y"],ws=e=>{return"currentcolor"===e||"transparent"===e?e:"#"+(t=we(e,"#").toUpperCase(),(e=>ds.test(e)||ms.test(e))(t)?w.some({value:hs(t)}):w.none()).orThunk((()=>(e=>{const t=gs.exec(e);if(null!==t)return w.some(bs(t[1],t[2],t[3],"1"));const n=vs.exec(e);return null!==n?w.some(bs(n[1],n[2],n[3],n[4])):w.none()})(e).map(fs))).getOrThunk((()=>{const t=document.createElement("canvas");t.height=1,t.width=1;const n=t.getContext("2d");n.clearRect(0,0,t.width,t.height),n.fillStyle="#FFFFFF",n.fillStyle=e,n.fillRect(0,0,1,1);const r=n.getImageData(0,0,1,1).data,o=r[0],s=r[1],a=r[2],i=r[3];return fs(ys(o,s,a,i))})).value;var t},ks=(e,t)=>{if(a(e))return"";switch(t){case"color":return ws(e);case"font-family":return e.replace(/['"]/g,"");case"font-weight":return(e=>{switch(e){case"bold":return"700";case"normal":return"400";default:return e}})(e);default:return Ce(t,"-color")?ws(e):(e=>e.replace(/^0(pt|px|pc|in|cm|mm|Q|cap|ch|ic|em|ex|lh|rlh|rem|vw|vh|vb|vi|vmax|vmin|%)$/,"0"))(e)}},Ss=lo({tags:[{name:be.pattern(/^(p|div)$/,be.caseInsensitive),mutate:e=>{const t="ltr"===Jn(e),n=t?"margin-left":"margin-right",r=t?"padding-left":"padding-right";Bn(e,n).each((()=>{const t=$n(e,n);jn(e,r,t),Vn(e,n)}))}}]}),Cs=io({tags:[{name:be.exact("b",be.caseInsensitive),condition:e=>En(e,"id").exists((e=>Se(e,"docs-internal-guid")))}]}),Ts=ao({attributes:[{name:be.exact("id",be.caseInsensitive),value:be.starts("docs-internal-guid",be.caseInsensitive)}]}),Is=[lo({tags:[{name:be.exact("col",be.caseInsensitive),mutate:cs({attrName:"width",mapValue:e=>e.replace(/^(\d+)$/,"$1px")})}]})],Es=e=>lo({tags:[{name:be.exact(e.matchTag,be.caseInsensitive),mutate:t=>{var n,r;(n=Wn(t),r=e.key,Y(n,r)?w.from(n[r]):w.none()).exists((t=>T(e.values,t)))&&(xn(t,bt.fromTag(e.newTag)),Vn(t,e.key),o(e.removeExtra)&&A(e.removeExtra,(e=>Vn(t,e))))}}]}),As=[Es({matchTag:"span",key:"font-weight",values:["700","bold"],newTag:"strong"}),Es({matchTag:"span",key:"font-style",values:["italic"],newTag:"em"}),Es({matchTag:"span",key:"vertical-align",values:["sub"],newTag:"sub",removeExtra:["font-size"]}),Es({matchTag:"span",key:"vertical-align",values:["super"],newTag:"sup",removeExtra:["font-size"]})],Os=e=>t=>{const n=[],r={border:e.browser.isFirefox()?"medium none":"none","text-decoration":"none"},o=(e,t)=>{if(!a(t)){const r=bt.fromTag(Gt(e));bn(t,r),n.push({me:e,fake:r})}const r=L(cn(e),Xt);A(r,(t=>o(t,e)))};o(t);const s=E(n,(e=>{const{fake:t,me:n}=e,o=Wn(n),s=G(o,((e,r)=>{const o=((e,t)=>T(xs,t)?Bn(e,"background-repeat"):w.none())(n,r).getOr(e),s=((e,t)=>T(xs,t)?$n(e,"background-repeat"):$n(e,t))(t,r);return ks(o,r)===ks(s,r)})),a=G(r,((e,t)=>de(Bn(n,t),e)));return{fake:t,me:n,toRemove:s,toPreserve:a}}));A(s,(e=>{const{me:t,toRemove:n,toPreserve:r,fake:o}=e;B(n,((e,n)=>{Vn(t,n)})),B(r,((e,n)=>{jn(t,n,e)})),_n(o)}))},Ls=["p","div","article","aside","details","dt","figcaption","footer","form","fieldset","header","hgroup","html","main","nav","section","summary","body","dl","multicol","dd","figure","address","center","blockquote","h1","h2","h3","h4","h5","h6","listing","xmp","pre","plaintext","menu","dir","ul","ol","li","hr","table","tbody","thead","tfoot","th","tr","td","caption"],_s=ao({styles:[{name:be.exact("background-color",be.caseInsensitive),value:be.exact("transparent",be.caseInsensitive)},{name:be.exact("white-space",be.caseInsensitive),value:be.starts("pre",be.caseInsensitive)},{name:be.exact("white-space-collapse",be.caseInsensitive),value:be.starts("preserve",be.caseInsensitive)},{name:be.exact("text-wrap",be.caseInsensitive),value:be.not(be.exact("wrap",be.caseInsensitive))},{name:be.exact("text-wrap-mode",be.caseInsensitive),value:be.not(be.exact("wrap",be.caseInsensitive))},{name:be.pattern(/^overflow(-[xy])?$/,be.caseInsensitive),condition:e=>us(e)&&de(Bn(e,"overflow"),"hidden")},{name:be.exact("overflow-wrap",be.caseInsensitive),condition:us},{name:be.exact("table-layout",be.caseInsensitive),value:be.exact("fixed",be.caseInsensitive),condition:en("table")},{name:be.exact("line-height",be.caseInsensitive),value:be.exact("1.38",be.caseInsensitive)},{name:be.exact("vertical-align",be.caseInsensitive),value:be.exact("baseline",be.caseInsensitive)},{name:be.exact("font-style",be.caseInsensitive),value:be.exact("normal",be.caseInsensitive)},{name:be.exact("font-variant",be.caseInsensitive),value:be.exact("normal",be.caseInsensitive)},{name:be.exact("background-color",be.caseInsensitive),value:be.exact("transparent",be.caseInsensitive)},{name:be.starts("padding",be.caseInsensitive),condition:us},{name:be.pattern(/^text-decoration(-(line|thickness|style|color))?$/,be.caseInsensitive),condition:e=>!en("a")(e)&&de(Bn(e,"text-decoration"),"none")}],attributes:[{name:be.exact("aria-level",be.caseInsensitive),condition:en("li")},{name:be.exact("dir",be.caseInsensitive),value:be.exact("ltr",be.caseInsensitive),condition:e=>T(Ls,Gt(e))},{name:be.exact("role",be.caseInsensitive),value:be.exact("presentation",be.caseInsensitive),condition:e=>en("p")(e)&&on(e).exists(en("li"))}]}),Ps=ao({styles:[{name:be.exact("text-align",be.caseInsensitive),value:be.exact("right",be.caseInsensitive),condition:e=>"rtl"===Jn(e)}]}),Ns=lo({tags:[{name:be.exact("p",be.caseInsensitive),condition:e=>{const t=t=>Bn(e,t).map((e=>parseInt(e,10))).filter((e=>!isNaN(e))).getOr(0),n=Jn(e);return t("text-indent")+t("rtl"===n?"padding-right":"padding-left")===0},mutate:e=>{const t=Jn(e);Vn(e,"text-indent"),Vn(e,"rtl"===t?"padding-right":"padding-left")}}]}),Ds=ao({tags:[{name:be.exact("script",be.caseInsensitive)},{name:be.exact("link",be.caseInsensitive)},{name:be.exact("style",be.caseInsensitive),condition:e=>0===Dn(e).length}],attributes:[{name:be.starts("on",be.caseInsensitive)},{name:be.exact('"',be.caseInsensitive)},{name:be.exact("lang",be.caseInsensitive)},{name:be.exact("language",be.caseInsensitive)}],styles:[{name:be.all(),value:be.pattern(/OLE_LINK/i,be.caseInsensitive)}]}),Rs=ao({tags:[{name:be.exact("meta",be.caseInsensitive)}]}),Ms=ao({tags:[{name:be.exact("style",be.caseInsensitive)}]}),Us=ao({styles:[{name:be.not(be.pattern(/^(width|height|list-style-type)$/,be.caseInsensitive)),condition:e=>!lr(e,"ephox-limbo-transform")},{name:be.pattern(/^(width|height)$/,be.caseInsensitive),condition:e=>{return(e=>"img"!==Gt(e))(e)&&!("table"===Gt(t=e)||us(t));var t}}]}),Fs=(e=[])=>{const t=E(e,(e=>({name:be.exact(e,be.caseInsensitive)})));return io({tags:t})},js=ao({classes:[{name:be.not(be.exact("rtf-data-image",be.caseInsensitive))}]}),zs=ao({styles:[{name:be.pattern(/^(mso-.*|tab-stops|tab-interval|language|text-underline|text-effect|text-line-through|font-color|horiz-align|list-image-[0-9]+|separator-image|table-border-color-(dark|light)|vert-align|vnd\..*)$/,be.caseInsensitive)}]}),$s=ao({classes:[{name:be.pattern(/mso/i,be.caseInsensitive)}]}),Hs=io({tags:[{name:be.exact("img",be.caseInsensitive),condition:e=>{const t=In(e,"src");return n(t)&&/^file:/.test(t)}}]}),Bs=io({tags:[{name:be.exact("a",be.caseInsensitive),condition:rs}]}),Ws=ao({attributes:[{name:be.exact("style",be.caseInsensitive),value:be.exact("",be.caseInsensitive)}]}),Vs=ao({attributes:[{name:be.exact("class",be.caseInsensitive),value:be.exact("",be.caseInsensitive)}]}),Gs=io({tags:[{name:be.pattern(/^(font|em|strong|samp|acronym|cite|code|dfn|kbd|tt|b|i|u|s|sub|sup|ins|del|var|span)$/,be.caseInsensitive),condition:(qs=e=>!rs(e)||(e=>{const t=e.dom.attributes,n=null!=t&&t.length>0;return"span"!==Gt(e)||n})(e)&&tr(e,(e=>{const t=!rs(e),n=!T(["font","em","strong","samp","acronym","cite","code","dfn","kbd","tt","b","i","u","s","sub","sup","ins","del","var","span"],Gt(e));return Jt(e)||t||n})).isSome(),e=>!qs(e))}]});var qs;const Ys=lo({tags:[{name:be.exact("p",be.caseInsensitive),mutate:e=>{0===Dn(e).length&&bn(e,bt.fromTag("br"))}}]}),Ks=e=>{const t=os("span",e);ar(t,"ephox-limbo-transform"),jn(t,"text-decoration","underline")},Xs=lo({tags:[{name:be.pattern(/ol|ul/,be.caseInsensitive),mutate:e=>{on(e).each((t=>{const n=Gt(t);T(["ol","ul"],n)&&as(e).fold((()=>{const t=bt.fromTag("li");jn(t,"list-style-type","none"),xn(e,t)}),(t=>{bn(t,e)}))}))}}]}),Js=e=>{const t=[{name:"b",transform:{mutate:g(os,"strong")}},{name:"i",transform:{mutate:g(os,"em")}},{name:"u",transform:{mutate:Ks}},{name:"s",transform:{mutate:g(os,"strike")}},{name:"font",transform:{mutate:is,debug:!0}}],n=L(t,(t=>!T(e,t.name))).map((e=>({name:be.exact(e.name,be.caseInsensitive),...e.transform})));return lo({tags:n})},Zs=ao({classes:[{name:be.exact("ephox-limbo-transform",be.caseInsensitive)}]}),Qs=ao({tags:[{name:be.exact("br",be.caseInsensitive),condition:cr("Apple-interchange-newline")}]}),ea=ao({styles:[{name:be.pattern(/^-/,be.caseInsensitive)},{name:be.all(),value:be.exact("initial",be.caseInsensitive)},{name:be.exact("background-color",be.caseInsensitive),value:be.exact("transparent",be.caseInsensitive)},{name:be.exact("font-style",be.caseInsensitive),value:be.exact("normal",be.caseInsensitive)},{name:be.pattern(/font-variant.*/,be.caseInsensitive)},{name:be.exact("letter-spacing",be.caseInsensitive)},{name:be.exact("font-weight",be.caseInsensitive),value:be.pattern(/400|normal/,be.caseInsensitive)},{name:be.exact("orphans",be.caseInsensitive)},{name:be.exact("text-decoration",be.caseInsensitive),value:be.exact("none",be.caseInsensitive)},{name:be.exact("text-size-adjust",be.caseInsensitive)},{name:be.exact("text-indent",be.caseInsensitive),value:be.exact("0px",be.caseInsensitive)},{name:be.exact("text-transform",be.caseInsensitive),value:be.exact("none",be.caseInsensitive)},{name:be.exact("white-space",be.caseInsensitive),value:be.exact("normal",be.caseInsensitive)},{name:be.exact("widows",be.caseInsensitive)},{name:be.exact("word-spacing",be.caseInsensitive),value:be.exact("0px",be.caseInsensitive)},{name:be.exact("text-align",be.caseInsensitive),value:be.pattern(/start|end/,be.caseInsensitive)},{name:be.exact("font-weight",be.caseInsensitive),value:be.pattern(/700|bold/,be.caseInsensitive),condition:e=>/^h\d$/.test(Gt(e))}]}),ta=(()=>{const e=(e,t)=>n=>e(n).filter((e=>Jt(n)&&t(ur(e)||""," "))).isSome(),t=e(sn,Ce),n=e(an,Se);return lo({tags:[{name:be.exact("span",be.caseInsensitive),condition:cr("Apple-converted-space"),mutate:e=>{"\xa0"===ur(e)&&(t(e)||n(e)?Pn(e):(gn(e,bt.fromText(" ")),_n(e)))}}]})})(),na=(()=>{const e=/^file:\/\/\/[^#]+(#[^#]+)$/;return lo({tags:[{name:be.exact("a",be.caseInsensitive),condition:t=>{const n=In(t,"href");return!!n&&e.test(n)},mutate:t=>{En(t,"href").each((n=>{Cn(t,"href",n.replace(e,"$1"))}))}}]})})(),ra=ao({attributes:[{name:be.exact("href",be.caseInsensitive),value:be.starts("file:///",be.caseInsensitive)}]}),oa=(()=>{const e=(e,t,n)=>({name:be.exact(e,be.caseInsensitive),condition:e=>An(e,t),mutate:e=>{En(e,t).each((r=>{Cn(e,n,r),On(e,t)}))}});return lo({tags:[e("a","data-ephox-href","href"),e("img","data-ephox-src","src")]})})(),sa=e=>{const t=["table","thead","tbody","tfoot","th","tr","td","ul","ol","li"],n=dr(e,Kt),r=P(n,(e=>ke(Yn(e),"StartFragment"))),o=P(n,(e=>ke(Yn(e),"EndFragment")));r.each((n=>{o.each((r=>{let o=n;const s=[];let a=((e,t,n)=>{const r=un(e,0,n,0);return bt.fromDom(r.commonAncestorContainer)})(n,0,r);for(;void 0!==a&&!It(a,e);)T(t,Gt(a))?o=a:s.push(a),a=on(a).getOrUndefined();A(s,Pn),A(ln(o),_n)})),_n(n)})),o.each(_n)},aa=lo({tags:[{name:be.pattern(/^(img|table)$/,be.caseInsensitive),mutate:e=>{Bn(e,"margin-left").exists((e=>Se(e,"-")))&&Vn(e,"margin-left"),Se($n(e,"margin-left"),"-")&&(jn(e,"margin-top",$n(e,"margin-top")),jn(e,"margin-bottom",$n(e,"margin-bottom")),jn(e,"margin-right",$n(e,"margin-right")),Vn(e,"margin"))}}]}),ia=lo({tags:[{name:be.exact("p",be.caseInsensitive),mutate:cs({attrName:"align",styleName:"text-align",mapValue:p})}]}),la=(e,t)=>{return(n=e,Kn.getOption(n)).exists((e=>0===t(e).length));var n},ca=ao({tags:[{name:be.exact("font",be.caseInsensitive),condition:e=>{const t=cn(e),n=e=>e.replace(/[ \r\n\uFEFF]+/g,"");return 0===t.length||M(t,(e=>la(e,n)))}}]}),ua=e=>A(cn(e),(e=>{la(e,Te)&&_n(e)})),da=lo({tags:[{name:be.exact("ol",be.caseInsensitive),mutate:ua},{name:be.exact("ul",be.caseInsensitive),mutate:ua}]}),ma=io({tags:[{name:be.pattern(/^([OVWXP]|U[0-9]+|ST[0-9]+):/i,be.caseInsensitive)}]}),ha=[co([ns])],pa=ao({attributes:[{name:be.exact("height",be.caseInsensitive),condition:en("table")}]}),fa=ao({attributes:[{name:be.pattern(/^(width|height)$/,be.caseInsensitive),condition:us}]}),ga=lo({tags:[{name:be.exact("table",be.caseInsensitive),mutate:cs({attrName:"width",mapValue:e=>e.replace(/^(\d+)$/,"$1px")})}]}),va=ao({styles:[{name:be.exact("height",be.caseInsensitive),condition:en("td")},{name:be.exact("width",be.caseInsensitive),condition:en("tr")},{name:be.exact("height",be.caseInsensitive),condition:en("col")}]}),ya=ao({attributes:[{name:be.pattern(/^v:/,be.caseInsensitive)},{name:be.exact("href",be.caseInsensitive),value:be.contains("#_toc",be.caseInsensitive)},{name:be.exact("href",be.caseInsensitive),value:be.contains("#_mso",be.caseInsensitive)},{name:be.pattern(/^xmlns(:|$)/,be.caseInsensitive)},{name:be.exact("type",be.caseInsensitive),condition:e=>"ol"===Gt(e)||"ul"===Gt(e)}]});io({tags:[{name:be.exact("p",be.caseInsensitive),condition:e=>on(e).exists((e=>"li"===Gt(e)&&1===cn(e).length))}]}),lo({tags:[{name:be.pattern(/^(img|table)$/,be.caseInsensitive),mutate:e=>{Bn(e,"margin-left").exists((e=>Se(e,"-")))&&Vn(e,"margin-left"),Se($n(e,"margin-left"),"-")&&(jn(e,"margin-top",$n(e,"margin-top")),jn(e,"margin-bottom",$n(e,"margin-bottom")),jn(e,"margin-right",$n(e,"margin-right")),Vn(e,"margin"))}}]});const ba=e=>{const t=[ia,zs,$s],n=[ia,Us,Fs(e.cleanFilteredInlineElements),js];return e.merge?t:n},xa=e=>e.type===ls.Word?[ts]:[],wa=e=>e.type===ls.Word?[ma,...ha,ya]:[],ka=e=>e.type===ls.GoogleDocs?[Cs]:[],Sa=e=>e.type!==ls.GoogleDocs||e.indentUseMargin?[]:[Ss],Ca=(e,t)=>e.type===ls.GoogleDocs?[_s,...As,...Is,Os(t),Ps,Ns,...Sa(e)]:[],Ta=e=>e.type===ls.Html&&e.merge?[ea]:[],Ia=e=>e.type===ls.Word?[va,ga,fa,pa]:[];var Ea={cata:(e,t,n)=>e.fold(t,n),...K([{blob:["id","imageresult","objurl"]},{url:["id","url","raw"]}])};const Aa=(e,t)=>_a(document.createElement("canvas"),e,t),Oa=e=>{const t=Aa(e.width,e.height);return La(t).drawImage(e,0,0),t},La=e=>e.getContext("2d"),_a=(e,t,n)=>(e.width=t,e.height=n,e),Pa=e=>e.naturalWidth||e.width,Na=e=>e.naturalHeight||e.height,Da=e=>fetch(e).then((e=>e.ok?e.blob():Promise.reject(new Error("Error "+e.status+" downloading image"))),(()=>Promise.reject((()=>{const e=new Error("No access to download image");return e.code=18,e.name="SecurityError",e})()))),Ra=e=>{const t=e.split(","),n=/data:([^;]+)/.exec(t[0]);if(!n)return w.none();const r=n[1],o=t[1],s=1024,a=atob(o),i=a.length,l=Math.ceil(i/s),c=new Array(l);for(let e=0;e<l;++e){const t=e*s,n=Math.min(t+s,i),r=new Array(n-t);for(let e=t,o=0;e<n;++o,++e)r[o]=a[e].charCodeAt(0);c[e]=new Uint8Array(r)}return w.some(new Blob(c,{type:r}))},Ma=e=>new Promise(((t,n)=>{Ra(e).fold((()=>{n("uri is not base64: "+e)}),t)})),Ua=(e,t,n)=>(t=t||"image/png",c(HTMLCanvasElement.prototype.toBlob)?new Promise(((r,o)=>{e.toBlob((e=>{e?r(e):o()}),t,n)})):Ma(e.toDataURL(t,n))),Fa=e=>(e=>{const t=URL.createObjectURL(e),n=new Image;return n.src=t,(e=>new Promise(((t,n)=>{const r=()=>{s(),t(e)},o=[fn(e,"load",r),fn(e,"error",(()=>{s(),n("Unable to load data from image: "+e.dom.src)}))],s=()=>A(o,(e=>e.unbind()));e.dom.complete&&r()})))(bt.fromDom(n)).then((e=>e.dom))})(e).then((e=>{za(e);const t=Aa(Pa(e),Na(e));return La(t).drawImage(e,0,0),t})),ja=e=>new Promise((t=>{const n=new FileReader;n.onloadend=()=>{t(n.result)},n.readAsDataURL(e)})),za=e=>{URL.revokeObjectURL(e.src)},$a=e=>ja(e),Ha=(e,t,n)=>{const r=t.type,o=h(r),s=h(n),a=(t,n)=>e.then((e=>((e,t,n)=>(t=t||"image/png",e.toDataURL(t,n)))(e,t,n)));return{getType:o,toBlob:()=>Promise.resolve(t),toDataURL:s,toBase64:()=>n.split(",")[1],toAdjustedBlob:(t,n)=>e.then((e=>Ua(e,t,n))),toAdjustedDataURL:a,toAdjustedBase64:(e,t)=>a(e,t).then((e=>e.split(",")[1])),toCanvas:()=>e.then(Oa)}},Ba=(e,t)=>Ua(e,t).then((t=>Ha(Promise.resolve(e),t,e.toDataURL()))),Wa=(e,t)=>((e,t)=>Ha(Fa(e),e,t))(e,t),Va=e=>(e=>(e=>{const t=e.src;return 0===t.indexOf("data:")?Ma(t):Da(t)})(e).then((e=>(e=>ja(e).then((t=>Ha(Fa(e),e,t))))(e))))(e),Ga=e=>e.toDataURL(),qa=e=>{const t=URL.createObjectURL(e);return Ya(e,t)},Ya=(e,t)=>$a(e).then((n=>{const r=Wa(e,n),o=le("image");return Ea.blob(o,r,t)})),Ka=e=>Promise.all(E(e,qa)),Xa=(e,t,n)=>{const r=Pa(e),o=Na(e);let s=t/r,a=n/o,i=!1;(s<.5||s>2)&&(s=s<.5?.5:2,i=!0),(a<.5||a>2)&&(a=a<.5?.5:2,i=!0);const l=Ja(e,s,a);return i?l.then((e=>Xa(e,t,n))):l},Ja=(e,t,n)=>new Promise((r=>{const o=Pa(e),s=Na(e),a=Math.floor(o*t),i=Math.floor(s*n),l=Aa(a,i);La(l).drawImage(e,0,0,o,s,0,0,a,i),r(l)})),Za=(e,t=2)=>{const n=Math.pow(10,t),r=Math.round(e*n);return Math.ceil(r/n)},Qa=(e,t,n,r,o)=>((e,t,n,r,o)=>e.toCanvas().then((s=>((e,t,n,r,o,s)=>{const a=Aa(o,s);return La(a).drawImage(e,-n,-r),Ba(a,t)})(s,e.getType(),t,n,r,o))))(e,t,n,r,o),ei=(e,t)=>((e,t)=>e.toCanvas().then((n=>((e,t,n)=>{const r=(n<0?360+n:n)*Math.PI/180,o=e.width,s=e.height,a=Math.sin(r),i=Math.cos(r),l=Za(Math.abs(o*i)+Math.abs(s*a)),c=Za(Math.abs(o*a)+Math.abs(s*i)),u=Aa(l,c),d=La(u);return d.translate(l/2,c/2),d.rotate(r),d.drawImage(e,-o/2,-s/2),Ba(u,t)})(n,e.getType(),t))))(e,t),ti=(e,t,n=!1)=>fetch(e,{credentials:n?"include":"same-origin",headers:t}).then((async e=>{const t=await e.blob();return{ok:e.ok,status:e.status,blob:t}}),(()=>({ok:!1,status:0}))),ni=[{code:404,message:"Could not find Image Proxy"},{code:403,message:"Rejected request"},{code:0,message:"Incorrect Image Proxy URL"}],ri=[{type:"not_found",message:"Failed to load image."},{type:"key_missing",message:"The request did not include an api key."},{type:"key_not_found",message:"The provided api key could not be found."},{type:"domain_not_trusted",message:"The api key is not valid for the request origins."}],oi=e=>{const t=(e=>{const t=P(ni,(t=>e===t.code)).fold(h("Unknown ImageProxy error"),(e=>e.message));return"ImageProxy HTTP error: "+t})(e);return Promise.reject(t)},si=e=>P(ri,(t=>t.type===e)).fold(h("Unknown service error"),(e=>e.message)),ai=e=>(e=>new Promise(((t,n)=>{const r=new FileReader;r.onload=()=>{t(r.result)},r.onerror=e=>{n(e)},r.readAsText(e)})))(e).then((e=>{const t=(e=>{const t=(e=>{try{return w.some(JSON.parse(e))}catch(e){return w.none()}})(e),n=t.bind((e=>(e=>{const t=_(["error","type"],((e,t)=>l(e)?e[t]:void 0),e);return w.from(t)})(e).map(si))).getOr("Invalid JSON in service error message");return"ImageProxy Service error: "+n})(e);return Promise.reject(t)})),ii=(e,t,n=!0)=>t?((e,t)=>{const n={"Content-Type":"application/json;charset=UTF-8","tiny-api-key":t};return ti(((e,t)=>{const n=-1===e.indexOf("?")?"?":"&";return/[?&]apiKey=/.test(e)?e:e+n+"apiKey="+encodeURIComponent(t)})(e,t),n).then((e=>{return e.ok?Promise.resolve(e.blob):((e,t)=>"application/json"===(null==t?void 0:t.type)&&(400===e||403===e||404===e||500===e))(t=e.status,n=e.blob)?ai(n):oi(t);var t,n}))})(e,t):((e,t)=>ti(e,{},t).then((e=>e.ok?Promise.resolve(e.blob):oi(e.status))))(e,n),li=e=>parseInt(e,10),ci=e=>e.isPx&&(e.cropWidth!==e.width||e.cropHeight!==e.height),ui=/rotate\((\d\.\d+)rad\)/,di=(e,t,n)=>Va(e.dom).then((e=>t=>((e,t,n)=>((e,t,n)=>e.toCanvas().then((r=>Xa(r,t,n).then((t=>Ba(t,e.getType()))))))(e,t,n))(t,e.width,e.height))(t)).then(((e,t)=>n=>{if(ci(t)){const r=-1*li($n(e,"margin-top")),o=-1*li($n(e,"margin-left"));return Qa(n,o,r,t.cropWidth,t.cropHeight).then((n=>(Tn(e,{width:t.cropWidth,height:t.cropHeight}),n)))}return Promise.resolve(n)})(e,t)).then(((e,t)=>n=>(e=>{const t=$n(e,"transform");return w.from(ui.exec(t)).map((e=>Math.round(parseFloat(e[1])*(180/Math.PI))))})(t).fold((()=>Promise.resolve(n)),(r=>ei(n,r).then((n=>(Vn(t,"transform"),On(e,"width"),On(e,"height"),n))))))(e,n)).then((t=>{const n=Ga(t);return Cn(e,"src",n),Promise.resolve()})),mi=e=>on(e).filter(en("span")).map((t=>{const n=()=>((e,t)=>{var n,r,o;Vn(e,"margin-top"),Vn(e,"margin-left"),Vn(t,"width"),Vn(t,"height"),Vn(t,"overflow"),Vn(t,"display"),r=e,o=["transform"],Xt(n=t)&&Xt(r)&&A(o,(e=>{((e,t,n)=>{Bn(e,n).each((e=>{Bn(t,n).isNone()&&jn(t,n,e)}))})(n,r,e)})),Vn(t,"transform")})(e,t),r=((e,t)=>{const n=(e,t)=>En(e,t).map(li).filter((e=>!isNaN(e))).getOr(0),r=$n(t,"width"),o=$n(t,"height"),s=n(e,"width"),a=n(e,"height"),i=/^\d+px$/;return{isPx:i.test(r)&&i.test(o),cropWidth:li(r),cropHeight:li(o),width:s,height:a}})(e,t);return(ci(r)||ui.test($n(t,"transform"))?di(e,r,t):Promise.resolve()).then(n,n)})).getOrThunk((()=>Promise.resolve())),hi=(e,t,n)=>({element:e,start:t,finish:n}),pi=K([{boundary:["item","universe"]},{empty:["item","universe"]},{text:["item","universe"]},{nonEditable:["item","universe"]}]),fi=b,gi=x,vi=h(0),yi=h(1),bi=e=>({...e,isBoundary:()=>e.fold(gi,fi,fi,fi),toText:()=>e.fold(w.none,w.none,(e=>w.some(e)),w.none),is:t=>e.fold(fi,fi,((e,n)=>n.eq(e,t)),fi),len:()=>e.fold(vi,yi,((e,t)=>t.property().getText(e).length),yi)}),xi={text:m(bi,pi.text),boundary:m(bi,pi.boundary),empty:m(bi,pi.empty),nonEditable:m(bi,pi.empty),cata:(e,t,n,r,o)=>e.fold(t,n,r,o)};var wi=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];const ki=K([{include:["item"]},{excludeWith:["item"]},{excludeWithout:["item"]}]),Si={include:ki.include,excludeWith:ki.excludeWith,excludeWithout:ki.excludeWithout,cata:(e,t,n,r)=>e.fold(t,n,r)},Ci=(e,t)=>N(e,(e=>e.start===t)),Ti=(e,t,n=0)=>_(e,((e,n)=>t(n,e.len).fold(h(e),(t=>({len:t.finish,list:e.list.concat([t])})))),{len:n,list:[]}).list,Ii=(e,t,n)=>0===t.length?e:R(e,(e=>{const r=R(t,(t=>((e,t)=>t>=e.start&&t<=e.finish)(e,t)?[t-e.start]:[]));return r.length>0?((e,t,n)=>((e,t)=>E(e,(e=>({...e,start:e.start+t,finish:e.finish+t}))))(n(e,t),e.start))(e,r,n):[e]})),Ei=(e,t)=>{const n=R(t,(t=>{const n=((e,t)=>{const n=t.term(),r=[];let o=n.exec(e);for(;o;){const s=o.index+t.prefix(o),a=o[0].length-t.prefix(o)-t.suffix(o);r.push({start:s,finish:s+a}),n.lastIndex=s+a,o=n.exec(e)}return r})(e,t.pattern);return E(n,(e=>({...t,...e})))}));return(e=>{const t=(e=>F(e,((e,t)=>e.start-t.start)))(e);return _(t,((e,t)=>{const n=I(e,(e=>t.start>=e.start&&t.finish<=e.finish||t.finish>e.start&&t.start<e.start||t.finish>e.finish&&t.start<e.finish));return N(e,(e=>t.start===e.start)).fold((()=>n?e:[...e,t]),(n=>t.finish>e[n].finish?[...e.slice(0,n),t]:e))}),[])})(n)},Ai=h([]),Oi=(e,t,n)=>{if(e.property().isText(t))return[xi.text(t,e)];if(e.property().isEmptyTag(t))return[xi.empty(t,e)];if(e.property().isNonEditable(t))return[];if(e.property().isElement(t)){const r=e.property().children(t),o=e.property().isBoundary(t)?[xi.boundary(t,e)]:[],s=void 0!==n&&n(t)?[]:R(r,(t=>Oi(e,t,n)));return o.concat(s).concat(o)}return[]},Li=Oi,_i=(e,t,n)=>{const r=((e,t)=>{const n=[];let r=[];return A(e,(e=>{const o=t(e);Si.cata(o,(()=>{r.push(e)}),(()=>{r.length>0&&n.push(r),n.push([e]),r=[]}),(()=>{r.length>0&&n.push(r),r=[]}))})),r.length>0&&n.push(r),n})(R(t,(t=>Li(e,t,n))),(e=>e.match({boundary:()=>Si.excludeWithout(e),empty:()=>Si.excludeWith(e),text:()=>Si.include(e),nonEditable:()=>Si.excludeWithout(e)})));return L(r,(e=>e.length>0))},Pi=(e,t,n)=>{const r=R(n,(e=>[e.start,e.finish])),o=Ii(t,r,((t,n)=>((e,t,n)=>{const r=e.property().getText(t),o=L(((e,t)=>{if(0===t.length)return[e];const n=_(t,((t,n)=>{if(0===n)return t;const r=e.substring(t.prev,n);return{prev:n,values:t.values.concat([r])}}),{prev:0,values:[]}),r=t[t.length-1];return r<e.length?n.values.concat(e.substring(r)):n.values})(r,n),(e=>e.length>0));if(o.length<=1)return[hi(t,0,r.length)];e.property().setText(t,o[0]);const s=Ti(o.slice(1),((t,n)=>{const r=e.create().text(t),o=hi(r,n,n+t.length);return w.some(o)}),o[0].length),a=E(s,(e=>e.element));return e.insert().afterAll(t,a),[hi(t,0,o[0].length)].concat(s)})(e,t.element,n)));return E(n,(t=>{const n=((e,t,n)=>{const r=Ci(e,t),o=Ci(e,n);return r.bind((t=>{const r=o.getOr(((e,t)=>e[e.length-1]&&e[e.length-1].finish===t?e.length+1:-1)(e,n));return r>-1?w.some(e.slice(t,r)):w.none()})).getOr([])})(o,t.start,t.finish),r=E(n,(e=>e.element)),s=E(r,e.property().getText).join("");return{elements:r,word:t.word,exact:s}}))},Ni={up:h({selector:nr,closest:rr,predicate:Qn,all:(e,t)=>{const n=c(t)?t:b;let r=e.dom;const o=[];for(;null!==r.parentNode&&void 0!==r.parentNode;){const e=r.parentNode,t=bt.fromDom(e);if(o.push(t),!0===n(t))break;r=e}return o}}),down:h({selector:mr,predicate:dr}),styles:h({get:$n,getRaw:Bn,set:jn,remove:Vn}),attrs:h({get:In,set:Cn,remove:On,copyTo:(e,t)=>{const n=_(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{});Tn(t,n)}}),insert:h({before:gn,after:vn,afterAll:wn,append:bn,appendAll:kn,prepend:yn,wrap:xn}),remove:h({unwrap:Pn,remove:_n}),create:h({nu:bt.fromTag,clone:e=>bt.fromDom(e.dom.cloneNode(!1)),text:bt.fromText}),query:h({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:sn,nextSibling:an}),property:h({children:cn,name:Gt,parent:on,document:e=>nn(e).dom,isText:Jt,isComment:Kt,isElement:Xt,isSpecial:e=>{const t=Gt(e);return T(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>Xt(e)?En(e,"lang"):w.none(),getText:Xn,setText:(e,t)=>Kn.set(e,t),isBoundary:e=>!!Xt(e)&&("body"===Gt(e)||T(wi,Gt(e))),isEmptyTag:e=>!!Xt(e)&&T(["br","img","hr","input"],Gt(e)),isNonEditable:e=>Xt(e)&&"false"===In(e,"contenteditable")}),eq:It,is:Et},Di=/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source,Ri=e=>{return((e,t)=>((e,t,n,r)=>{const o=_i(e,t,r),s=R(o,(t=>{const r=R(t,(e=>e.fold(Ai,Ai,(e=>[e]),Ai))),o=E(r,e.property().getText).join(""),s=Ei(o,n),a=((e,t)=>Ti(t,((t,n)=>{const r=n+e.property().getText(t).length;return w.from(hi(t,n,r))})))(e,r);return Pi(e,a,s)}));return s})(Ni,e,t,void 0))(e,[{word:"__INTERNAL__",pattern:(t=Di,((e,t,n,r)=>({term:()=>new RegExp(e,r.getOr("g")),prefix:t,suffix:n}))(t,h(0),h(0),w.none()))}]);var t},Mi=e=>!rr(e,"a",undefined).isSome(),Ui=(e,t)=>{const n=Ri(e);A(n,(e=>{const n=e.exact;if(n.indexOf("@")<0||Fi(n)){const r=ke(n,"://")?n:`${t.defaultProtocol}://${n}`;((e,t)=>{w.from(e[0]).filter(Mi).map((n=>{const r=bt.fromTag("a");return gn(n,r),kn(r,e),Cn(r,"href",t),r}))})(e.elements,r)}}))},Fi=e=>{const t=e.indexOf("://");return t>=3&&t<=9},ji=(e,t)=>{A(e,(e=>{Xt(e)&&Bn(e,"position").isSome()&&Vn(e,"position")}))},zi=(e,t)=>{const n=L(e,en("li"));if(n.length>0){const t=ln(n[0]),r=bt.fromTag("ul");if(gn(e[0],r),t.length>0){const e=bt.fromTag("li");bn(r,e),kn(e,t)}kn(r,n)}},$i=(e,t)=>{const n=cn(e);A([...t.autoLinkUrls?[Ui]:[],ji,zi],(e=>{e(n,t)}))};var Hi=Object.create,Bi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,Vi=Object.getOwnPropertyNames,Gi=Object.getPrototypeOf,qi=Object.prototype.hasOwnProperty,Yi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ki=(e,t)=>{for(var n in t)Bi(e,n,{get:t[n],enumerable:!0})},Xi=Yi((e=>{var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");e.encode=function(e){if(0<=e&&e<t.length)return t[e];throw new TypeError("Must be between 0 and 63: "+e)},e.decode=function(e){return 65<=e&&e<=90?e-65:97<=e&&e<=122?e-97+26:48<=e&&e<=57?e-48+52:43==e?62:47==e?63:-1}})),Ji=Yi((e=>{var t=Xi();e.encode=function(e){var n,r,o="",s=(r=e)<0?1+(-r<<1):0+(r<<1);do{n=31&s,(s>>>=5)>0&&(n|=32),o+=t.encode(n)}while(s>0);return o},e.decode=function(e,n,r){var o,s,a=e.length,i=0,l=0;do{if(n>=a)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(s=t.decode(e.charCodeAt(n++))))throw new Error("Invalid base64 digit: "+e.charAt(n-1));o=!!(32&s),i+=(s&=31)<<l,l+=5}while(o);r.value=function(e){var t=e>>1;return 1&~e?t:-t}(i),r.rest=n}})),Zi=Yi((e=>{e.getArg=function(e,t,n){if(t in e)return e[t];if(3===arguments.length)return n;throw new Error('"'+t+'" is a required argument.')};var t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,n=/^data:.+\,.+$/;function r(e){var n=e.match(t);return n?{scheme:n[1],auth:n[2],host:n[3],port:n[4],path:n[5]}:null}function o(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}e.urlParse=r,e.urlGenerate=o;var s=function(){var t=[];return function(n){for(var s=0;s<t.length;s++)if(t[s].input===n){var a=t[0];return t[0]=t[s],t[s]=a,t[0].result}var i=function(t){var n=t,s=r(t);if(s){if(!s.path)return t;n=s.path}for(var a=e.isAbsolute(n),i=[],l=0,c=0;;){if(l=c,-1===(c=n.indexOf("/",l))){i.push(n.slice(l));break}for(i.push(n.slice(l,c));c<n.length&&"/"===n[c];)c++}var u,d=0;for(c=i.length-1;c>=0;c--)"."===(u=i[c])?i.splice(c,1):".."===u?d++:d>0&&(""===u?(i.splice(c+1,d),d=0):(i.splice(c,2),d--));return""===(n=i.join("/"))&&(n=a?"/":"."),s?(s.path=n,o(s)):n}(n);return t.unshift({input:n,result:i}),t.length>32&&t.pop(),i}}();function a(e,t){""===e&&(e="."),""===t&&(t=".");var a=r(t),i=r(e);if(i&&(e=i.path||"/"),a&&!a.scheme)return i&&(a.scheme=i.scheme),o(a);if(a||t.match(n))return t;if(i&&!i.host&&!i.path)return i.host=t,o(i);var l="/"===t.charAt(0)?t:s(e.replace(/\/+$/,"")+"/"+t);return i?(i.path=l,o(i)):l}e.normalize=s,e.join=a,e.isAbsolute=function(e){return"/"===e.charAt(0)||t.test(e)},e.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var n=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0||(e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)};var i=!("__proto__"in Object.create(null));function l(e){return e}function c(e){if(!e)return!1;var t=e.length;if(t<9||95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var n=t-10;n>=0;n--)if(36!==e.charCodeAt(n))return!1;return!0}function u(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}e.toSetString=i?l:function(e){return c(e)?"$"+e:e},e.fromSetString=i?l:function(e){return c(e)?e.slice(1):e},e.compareByOriginalPositions=function(e,t,n){var r=u(e.source,t.source);return 0!==r||0!=(r=e.originalLine-t.originalLine)||0!=(r=e.originalColumn-t.originalColumn)||n||0!=(r=e.generatedColumn-t.generatedColumn)||0!=(r=e.generatedLine-t.generatedLine)?r:u(e.name,t.name)},e.compareByOriginalPositionsNoSource=function(e,t,n){var r;return 0!=(r=e.originalLine-t.originalLine)||0!=(r=e.originalColumn-t.originalColumn)||n||0!=(r=e.generatedColumn-t.generatedColumn)||0!=(r=e.generatedLine-t.generatedLine)?r:u(e.name,t.name)},e.compareByGeneratedPositionsDeflated=function(e,t,n){var r=e.generatedLine-t.generatedLine;return 0!==r||0!=(r=e.generatedColumn-t.generatedColumn)||n||0!==(r=u(e.source,t.source))||0!=(r=e.originalLine-t.originalLine)||0!=(r=e.originalColumn-t.originalColumn)?r:u(e.name,t.name)},e.compareByGeneratedPositionsDeflatedNoLine=function(e,t,n){var r=e.generatedColumn-t.generatedColumn;return 0!==r||n||0!==(r=u(e.source,t.source))||0!=(r=e.originalLine-t.originalLine)||0!=(r=e.originalColumn-t.originalColumn)?r:u(e.name,t.name)},e.compareByGeneratedPositionsInflated=function(e,t){var n=e.generatedLine-t.generatedLine;return 0!==n||0!=(n=e.generatedColumn-t.generatedColumn)||0!==(n=u(e.source,t.source))||0!=(n=e.originalLine-t.originalLine)||0!=(n=e.originalColumn-t.originalColumn)?n:u(e.name,t.name)},e.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},e.computeSourceURL=function(e,t,n){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),n){var i=r(n);if(!i)throw new Error("sourceMapURL could not be parsed");if(i.path){var l=i.path.lastIndexOf("/");l>=0&&(i.path=i.path.substring(0,l+1))}t=a(o(i),t)}return s(t)}})),Qi=Yi((e=>{var t=Zi(),n=Object.prototype.hasOwnProperty,r=typeof Map<"u";function o(){this._array=[],this._set=r?new Map:Object.create(null)}o.fromArray=function(e,t){for(var n=new o,r=0,s=e.length;r<s;r++)n.add(e[r],t);return n},o.prototype.size=function(){return r?this._set.size:Object.getOwnPropertyNames(this._set).length},o.prototype.add=function(e,o){var s=r?e:t.toSetString(e),a=r?this.has(e):n.call(this._set,s),i=this._array.length;(!a||o)&&this._array.push(e),a||(r?this._set.set(e,i):this._set[s]=i)},o.prototype.has=function(e){if(r)return this._set.has(e);var o=t.toSetString(e);return n.call(this._set,o)},o.prototype.indexOf=function(e){if(r){var o=this._set.get(e);if(o>=0)return o}else{var s=t.toSetString(e);if(n.call(this._set,s))return this._set[s]}throw new Error('"'+e+'" is not in the set.')},o.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},o.prototype.toArray=function(){return this._array.slice()},e.ArraySet=o})),el=Yi((e=>{var t=Zi();function n(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}n.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},n.prototype.add=function(e){!function(e,n){var r=e.generatedLine,o=n.generatedLine,s=e.generatedColumn,a=n.generatedColumn;return o>r||o==r&&a>=s||t.compareByGeneratedPositionsInflated(e,n)<=0}(this._last,e)?(this._sorted=!1,this._array.push(e)):(this._last=e,this._array.push(e))},n.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},e.MappingList=n})),tl=Yi((e=>{var t=Ji(),n=Zi(),r=Qi().ArraySet,o=el().MappingList;function s(e){e||(e={}),this._file=n.getArg(e,"file",null),this._sourceRoot=n.getArg(e,"sourceRoot",null),this._skipValidation=n.getArg(e,"skipValidation",!1),this._sources=new r,this._names=new r,this._mappings=new o,this._sourcesContents=null}s.prototype._version=3,s.fromSourceMap=function(e){var t=e.sourceRoot,r=new s({file:e.file,sourceRoot:t});return e.eachMapping((function(e){var o={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(o.source=e.source,null!=t&&(o.source=n.relative(t,o.source)),o.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(o.name=e.name)),r.addMapping(o)})),e.sources.forEach((function(o){var s=o;null!==t&&(s=n.relative(t,o)),r._sources.has(s)||r._sources.add(s);var a=e.sourceContentFor(o);null!=a&&r.setSourceContent(o,a)})),r},s.prototype.addMapping=function(e){var t=n.getArg(e,"generated"),r=n.getArg(e,"original",null),o=n.getArg(e,"source",null),s=n.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,o,s),null!=o&&(o=String(o),this._sources.has(o)||this._sources.add(o)),null!=s&&(s=String(s),this._names.has(s)||this._names.add(s)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:o,name:s})},s.prototype.setSourceContent=function(e,t){var r=e;null!=this._sourceRoot&&(r=n.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[n.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[n.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},s.prototype.applySourceMap=function(e,t,o){var s=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');s=e.file}var a=this._sourceRoot;null!=a&&(s=n.relative(a,s));var i=new r,l=new r;this._mappings.unsortedForEach((function(t){if(t.source===s&&null!=t.originalLine){var r=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=r.source&&(t.source=r.source,null!=o&&(t.source=n.join(o,t.source)),null!=a&&(t.source=n.relative(a,t.source)),t.originalLine=r.line,t.originalColumn=r.column,null!=r.name&&(t.name=r.name))}var c=t.source;null!=c&&!i.has(c)&&i.add(c);var u=t.name;null!=u&&!l.has(u)&&l.add(u)}),this),this._sources=i,this._names=l,e.sources.forEach((function(t){var r=e.sourceContentFor(t);null!=r&&(null!=o&&(t=n.join(o,t)),null!=a&&(t=n.relative(a,t)),this.setSourceContent(t,r))}),this)},s.prototype._validateMapping=function(e,t,n,r){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||n||r){if(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))}},s.prototype._serializeMappings=function(){for(var e,r,o,s,a=0,i=1,l=0,c=0,u=0,d=0,m="",h=this._mappings.toArray(),p=0,f=h.length;p<f;p++){if(e="",(r=h[p]).generatedLine!==i)for(a=0;r.generatedLine!==i;)e+=";",i++;else if(p>0){if(!n.compareByGeneratedPositionsInflated(r,h[p-1]))continue;e+=","}e+=t.encode(r.generatedColumn-a),a=r.generatedColumn,null!=r.source&&(s=this._sources.indexOf(r.source),e+=t.encode(s-d),d=s,e+=t.encode(r.originalLine-1-c),c=r.originalLine-1,e+=t.encode(r.originalColumn-l),l=r.originalColumn,null!=r.name&&(o=this._names.indexOf(r.name),e+=t.encode(o-u),u=o)),m+=e}return m},s.prototype._generateSourcesContent=function(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=n.relative(t,e));var r=n.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)},s.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},s.prototype.toString=function(){return JSON.stringify(this.toJSON())},e.SourceMapGenerator=s}));function nl(e){return e>=48&&e<=57}function rl(e){return nl(e)||e>=65&&e<=70||e>=97&&e<=102}function ol(e){return e>=65&&e<=90}function sl(e){return function(e){return ol(e)||function(e){return e>=97&&e<=122}(e)}(e)||function(e){return e>=128}(e)||95===e}function al(e){return sl(e)||nl(e)||45===e}function il(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e}function ll(e){return 10===e||13===e||12===e}function cl(e){return ll(e)||32===e||9===e}function ul(e,t){return!(92!==e||ll(t)||0===t)}function dl(e,t,n){return 45===e?sl(t)||45===t||ul(t,n):!!sl(e)||92===e&&ul(e,t)}function ml(e,t,n){return 43===e||45===e?nl(t)?2:46===t&&nl(n)?3:0:46===e?nl(t)?2:0:nl(e)?1:0}function hl(e){return 65279===e||65534===e?1:0}var pl=new Array(128),fl=130;for(let e=0;e<pl.length;e++)pl[e]=(cl(e)?fl:nl(e)&&131)||sl(e)&&132||il(e)&&133||e||128;function gl(e){return e<128?pl[e]:132}function vl(e,t){return t<e.length?e.charCodeAt(t):0}function yl(e,t,n){return 13===n&&10===vl(e,t+1)?2:1}function bl(e,t,n){let r=e.charCodeAt(t);return ol(r)&&(r|=32),r===n}function xl(e,t,n,r){if(n-t!==r.length||t<0||n>e.length)return!1;for(let o=t;o<n;o++){let n=r.charCodeAt(o-t),s=e.charCodeAt(o);if(ol(s)&&(s|=32),s!==n)return!1}return!0}function wl(e,t){for(;t<e.length&&cl(e.charCodeAt(t));t++);return t}function kl(e,t){for(;t<e.length&&nl(e.charCodeAt(t));t++);return t}function Sl(e,t){if(rl(vl(e,(t+=2)-1))){for(let n=Math.min(e.length,t+5);t<n&&rl(vl(e,t));t++);let n=vl(e,t);cl(n)&&(t+=yl(e,t,n))}return t}function Cl(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(!al(n)){if(ul(n,vl(e,t+1))){t=Sl(e,t)-1;continue}break}}return t}function Tl(e,t){let n=e.charCodeAt(t);if((43===n||45===n)&&(n=e.charCodeAt(t+=1)),nl(n)&&(t=kl(e,t+1),n=e.charCodeAt(t)),46===n&&nl(e.charCodeAt(t+1))&&(t=kl(e,t+=2)),bl(e,t,101)){let r=0;n=e.charCodeAt(t+1),(45===n||43===n)&&(r=1,n=e.charCodeAt(t+2)),nl(n)&&(t=kl(e,t+1+r+1))}return t}function Il(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(41===n){t++;break}ul(n,vl(e,t+1))&&(t=Sl(e,t))}return t}function El(e){if(1===e.length&&!rl(e.charCodeAt(0)))return e[0];let t=parseInt(e,16);return(0===t||t>=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var Al=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token"];function Ol(e=null,t){return null===e||e.length<t?new Uint32Array(Math.max(t+1024,16384)):e}function Ll(e){let t=e.source,n=t.length,r=t.length>0?hl(t.charCodeAt(0)):0,o=Ol(e.lines,n),s=Ol(e.columns,n),a=e.startLine,i=e.startColumn;for(let e=r;e<n;e++){let r=t.charCodeAt(e);o[e]=a,s[e]=i++,(10===r||13===r||12===r)&&(13===r&&e+1<n&&10===t.charCodeAt(e+1)&&(e++,o[e]=a,s[e]=i),a++,i=1)}o[n]=a,s[n]=i,e.lines=o,e.columns=s,e.computed=!0}var _l=class{constructor(){this.lines=null,this.columns=null,this.computed=!1}setSource(e,t=0,n=1,r=1){this.source=e,this.startOffset=t,this.startLine=n,this.startColumn=r,this.computed=!1}getLocation(e,t){return this.computed||Ll(this),{source:t,offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]}}getLocationRange(e,t,n){return this.computed||Ll(this),{source:n,start:{offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]},end:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}}},Pl=16777215,Nl=24,Dl=new Map([[2,22],[21,22],[19,20],[23,24]]),Rl=class{constructor(e,t){this.setSource(e,t)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(e="",t=()=>{}){let n=(e=String(e||"")).length,r=Ol(this.offsetAndType,e.length+1),o=Ol(this.balance,e.length+1),s=0,a=0,i=0,l=-1;for(this.offsetAndType=null,this.balance=null,t(e,((e,t,c)=>{switch(e){default:o[s]=n;break;case a:{let e=i&Pl;for(i=o[e],a=i>>Nl,o[s]=e,o[e++]=s;e<s;e++)o[e]===n&&(o[e]=s);break}case 21:case 2:case 19:case 23:o[s]=i,a=Dl.get(e),i=a<<Nl|s}r[s++]=e<<Nl|c,-1===l&&(l=t)})),r[s]=0|n,o[s]=n,o[n]=n;0!==i;){let e=i&Pl;i=o[e],o[e]=n}this.source=e,this.firstCharOffset=-1===l?0:l,this.tokenCount=s,this.offsetAndType=r,this.balance=o,this.reset(),this.next()}lookupType(e){return(e+=this.tokenIndex)<this.tokenCount?this.offsetAndType[e]>>Nl:0}lookupOffset(e){return(e+=this.tokenIndex)<this.tokenCount?this.offsetAndType[e-1]&Pl:this.source.length}lookupValue(e,t){return(e+=this.tokenIndex)<this.tokenCount&&xl(this.source,this.offsetAndType[e-1]&Pl,this.offsetAndType[e]&Pl,t)}getTokenStart(e){return e===this.tokenIndex?this.tokenStart:e>0?e<this.tokenCount?this.offsetAndType[e-1]&Pl:this.offsetAndType[this.tokenCount]&Pl:this.firstCharOffset}substrToCursor(e){return this.source.substring(e,this.tokenStart)}isBalanceEdge(e){return this.balance[this.tokenIndex]<e}isDelim(e,t){return t?9===this.lookupType(t)&&this.source.charCodeAt(this.lookupOffset(t))===e:9===this.tokenType&&this.source.charCodeAt(this.tokenStart)===e}skip(e){let t=this.tokenIndex+e;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.offsetAndType[t-1]&Pl,t=this.offsetAndType[t],this.tokenType=t>>Nl,this.tokenEnd=t&Pl):(this.tokenIndex=this.tokenCount,this.next())}next(){let e=this.tokenIndex+1;e<this.tokenCount?(this.tokenIndex=e,this.tokenStart=this.tokenEnd,e=this.offsetAndType[e],this.tokenType=e>>Nl,this.tokenEnd=e&Pl):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;13===this.tokenType||25===this.tokenType;)this.next()}skipUntilBalanced(e,t){let n,r,o=e;e:for(;o<this.tokenCount&&(n=this.balance[o],!(n<e));o++)switch(r=o>0?this.offsetAndType[o-1]&Pl:this.firstCharOffset,t(this.source.charCodeAt(r))){case 1:break e;case 2:o++;break e;default:this.balance[n]===o&&(o=n)}this.skip(o-this.tokenIndex)}forEachToken(e){for(let t=0,n=this.firstCharOffset;t<this.tokenCount;t++){let r=n,o=this.offsetAndType[t],s=o&Pl;n=s,e(o>>Nl,r,s,t)}}dump(){let e=new Array(this.tokenCount);return this.forEachToken(((t,n,r,o)=>{e[o]={idx:o,type:Al[t],chunk:this.source.substring(n,r),balance:this.balance[o]}})),e}};function Ml(e,t){function n(t){return t<i?e.charCodeAt(t):0}function r(){return c=Tl(e,c),dl(n(c),n(c+1),n(c+2))?(a=12,void(c=Cl(e,c))):37===n(c)?(a=11,void c++):void(a=10)}function o(){let t=c;return c=Cl(e,c),xl(e,t,c,"url")&&40===n(c)?(c=wl(e,c+1),34===n(c)||39===n(c)?(a=2,void(c=t+4)):void function(){for(a=7,c=wl(e,c);c<e.length;c++){let t=e.charCodeAt(c);switch(gl(t)){case 41:return void c++;case fl:return c=wl(e,c),41===n(c)||c>=e.length?void(c<e.length&&c++):(c=Il(e,c),void(a=8));case 34:case 39:case 40:case 133:return c=Il(e,c),void(a=8);case 92:if(ul(t,n(c+1))){c=Sl(e,c)-1;break}return c=Il(e,c),void(a=8)}}}()):40===n(c)?(a=2,void c++):void(a=1)}function s(t){for(t||(t=n(c++)),a=5;c<e.length;c++){let r=e.charCodeAt(c);switch(gl(r)){case t:return void c++;case fl:if(ll(r))return c+=yl(e,c,r),void(a=6);break;case 92:if(c===e.length-1)break;let o=n(c+1);ll(o)?c+=yl(e,c+1,o):ul(r,o)&&(c=Sl(e,c)-1)}}}let a,i=(e=String(e||"")).length,l=hl(n(0)),c=l;for(;c<i;){let i=e.charCodeAt(c);switch(gl(i)){case fl:a=13,c=wl(e,c+1);break;case 34:s();break;case 35:al(n(c+1))||ul(n(c+1),n(c+2))?(a=4,c=Cl(e,c+1)):(a=9,c++);break;case 39:s();break;case 40:a=21,c++;break;case 41:a=22,c++;break;case 43:ml(i,n(c+1),n(c+2))?r():(a=9,c++);break;case 44:a=18,c++;break;case 45:ml(i,n(c+1),n(c+2))?r():45===n(c+1)&&62===n(c+2)?(a=15,c+=3):dl(i,n(c+1),n(c+2))?o():(a=9,c++);break;case 46:ml(i,n(c+1),n(c+2))?r():(a=9,c++);break;case 47:42===n(c+1)?(a=25,c=e.indexOf("*/",c+2),c=-1===c?e.length:c+2):(a=9,c++);break;case 58:a=16,c++;break;case 59:a=17,c++;break;case 60:33===n(c+1)&&45===n(c+2)&&45===n(c+3)?(a=14,c+=4):(a=9,c++);break;case 64:dl(n(c+1),n(c+2),n(c+3))?(a=3,c=Cl(e,c+1)):(a=9,c++);break;case 91:a=19,c++;break;case 92:ul(i,n(c+1))?o():(a=9,c++);break;case 93:a=20,c++;break;case 123:a=23,c++;break;case 125:a=24,c++;break;case 131:r();break;case 132:o();break;default:a=9,c++}t(a,l,l=c)}}var Ul,Fl=(Ul=tl(),((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of Vi(t))!qi.call(e,n)&&"default"!==n&&Bi(e,n,{get:()=>t[n],enumerable:!(r=Wi(t,n))||r.enumerable});return e})((e=>Bi(e,"__esModule",{value:!0}))(Bi(null!=Ul?Hi(Gi(Ul)):{},"default",{value:Ul,enumerable:!0})),Ul)),jl=new Set(["Atrule","Selector","Declaration"]),zl={};Ki(zl,{safe:()=>Gl,spec:()=>Vl});var $l=(e,t)=>{if(9===e&&(e=t),"string"==typeof e){let t=e.charCodeAt(0);return t>127?32768:t<<8}return e},Hl=[[1,1],[1,2],[1,7],[1,8],[1,"-"],[1,10],[1,11],[1,12],[1,15],[1,21],[3,1],[3,2],[3,7],[3,8],[3,"-"],[3,10],[3,11],[3,12],[3,15],[4,1],[4,2],[4,7],[4,8],[4,"-"],[4,10],[4,11],[4,12],[4,15],[12,1],[12,2],[12,7],[12,8],[12,"-"],[12,10],[12,11],[12,12],[12,15],["#",1],["#",2],["#",7],["#",8],["#","-"],["#",10],["#",11],["#",12],["#",15],["-",1],["-",2],["-",7],["-",8],["-","-"],["-",10],["-",11],["-",12],["-",15],[10,1],[10,2],[10,7],[10,8],[10,10],[10,11],[10,12],[10,"%"],[10,15],["@",1],["@",2],["@",7],["@",8],["@","-"],["@",15],[".",10],[".",11],[".",12],["+",10],["+",11],["+",12],["/","*"]],Bl=Hl.concat([[1,4],[12,4],[4,4],[3,21],[3,5],[3,16],[11,11],[11,12],[11,2],[11,"-"],[22,1],[22,2],[22,11],[22,12],[22,4],[22,"-"]]);function Wl(e){let t=new Set(e.map((([e,t])=>$l(e)<<16|$l(t))));return function(e,n,r){let o=$l(n,r),s=r.charCodeAt(0);return(45===s&&1!==n&&2!==n&&15!==n||43===s?t.has(e<<16|s<<8):t.has(e<<16|o))&&this.emit(" ",13,!0),o}}var Vl=Wl(Hl),Gl=Wl(Bl);function ql(e,t){if("function"!=typeof t)e.children.forEach(this.node,this);else{let n=null;e.children.forEach((e=>{null!==n&&t.call(this,n),this.node(e),n=e}))}}function Yl(e){Ml(e,((t,n,r)=>{this.token(t,e.slice(n,r))}))}var Kl={};Ki(Kl,{AnPlusB:()=>sc,Atrule:()=>ac,AtrulePrelude:()=>ic,AttributeSelector:()=>dc,Block:()=>mc,Brackets:()=>hc,CDC:()=>pc,CDO:()=>fc,ClassSelector:()=>vc,Combinator:()=>bc,Comment:()=>xc,Declaration:()=>wc,DeclarationList:()=>kc,Dimension:()=>Sc,Function:()=>Cc,Hash:()=>Tc,IdSelector:()=>Oc,Identifier:()=>Ec,MediaFeature:()=>Lc,MediaQuery:()=>_c,MediaQueryList:()=>Pc,NestingSelector:()=>Dc,Nth:()=>Mc,Number:()=>Uc,Operator:()=>Fc,Parentheses:()=>jc,Percentage:()=>$c,PseudoClassSelector:()=>Bc,PseudoElementSelector:()=>Vc,Ratio:()=>Gc,Raw:()=>Kc,Rule:()=>Xc,Selector:()=>Zc,SelectorList:()=>eu,String:()=>su,StyleSheet:()=>au,TypeSelector:()=>cu,UnicodeRange:()=>uu,Url:()=>vu,Value:()=>yu,WhiteSpace:()=>bu});var Xl=43,Jl=45,Zl=110,Ql=!0;function ec(e,t){let n=this.tokenStart+e,r=this.charCodeAt(n);for((r===Xl||r===Jl)&&(t&&this.error("Number sign is not allowed"),n++);n<this.tokenEnd;n++)nl(this.charCodeAt(n))||this.error("Integer is expected",n)}function tc(e){return ec.call(this,0,e)}function nc(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n="";switch(t){case Zl:n="N is expected";break;case Jl:n="HyphenMinus is expected"}this.error(n,this.tokenStart+e)}}function rc(){let e=0,t=0,n=this.tokenType;for(;13===n||25===n;)n=this.lookupType(++e);if(10!==n){if(!this.isDelim(Xl,e)&&!this.isDelim(Jl,e))return null;t=this.isDelim(Xl,e)?Xl:Jl;do{n=this.lookupType(++e)}while(13===n||25===n);10!==n&&(this.skip(e),tc.call(this,Ql))}return e>0&&this.skip(e),0===t&&(n=this.charCodeAt(this.tokenStart),n!==Xl&&n!==Jl&&this.error("Number sign is expected")),tc.call(this,0!==t),t===Jl?"-"+this.consume(10):this.consume(10)}function oc(){let e=this.tokenStart,t=null,n=null;if(10===this.tokenType)tc.call(this,!1),n=this.consume(10);else if(1===this.tokenType&&this.cmpChar(this.tokenStart,Jl))switch(t="-1",nc.call(this,1,Zl),this.tokenEnd-this.tokenStart){case 2:this.next(),n=rc.call(this);break;case 3:nc.call(this,2,Jl),this.next(),this.skipSC(),tc.call(this,Ql),n="-"+this.consume(10);break;default:nc.call(this,2,Jl),ec.call(this,3,Ql),this.next(),n=this.substrToCursor(e+2)}else if(1===this.tokenType||this.isDelim(Xl)&&1===this.lookupType(1)){let r=0;switch(t="1",this.isDelim(Xl)&&(r=1,this.next()),nc.call(this,0,Zl),this.tokenEnd-this.tokenStart){case 1:this.next(),n=rc.call(this);break;case 2:nc.call(this,1,Jl),this.next(),this.skipSC(),tc.call(this,Ql),n="-"+this.consume(10);break;default:nc.call(this,1,Jl),ec.call(this,2,Ql),this.next(),n=this.substrToCursor(e+r+1)}}else if(12===this.tokenType){let r=this.charCodeAt(this.tokenStart),o=r===Xl||r===Jl,s=this.tokenStart+o;for(;s<this.tokenEnd&&nl(this.charCodeAt(s));s++);s===this.tokenStart+o&&this.error("Integer is expected",this.tokenStart+o),nc.call(this,s-this.tokenStart,Zl),t=this.substring(e,s),s+1===this.tokenEnd?(this.next(),n=rc.call(this)):(nc.call(this,s-this.tokenStart+1,Jl),s+2===this.tokenEnd?(this.next(),this.skipSC(),tc.call(this,Ql),n="-"+this.consume(10)):(ec.call(this,s-this.tokenStart+2,Ql),this.next(),n=this.substrToCursor(s+1)))}else this.error();return null!==t&&t.charCodeAt(0)===Xl&&(t=t.substr(1)),null!==n&&n.charCodeAt(0)===Xl&&(n=n.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:n}}function sc(e){if(e.a){let t=("+1"===e.a||"1"===e.a?"n":"-1"===e.a&&"-n")||e.a+"n";if(e.b){let n="-"===e.b[0]||"+"===e.b[0]?e.b:"+"+e.b;this.tokenize(t+n)}else this.tokenize(t)}else this.tokenize(e.b)}function ac(e){this.token(3,"@"+e.name),null!==e.prelude&&this.node(e.prelude),e.block?this.node(e.block):this.token(17,";")}function ic(e){this.children(e)}function lc(){this.eof&&this.error("Unexpected end of input");let e=this.tokenStart,t=!1;return this.isDelim(42)?(t=!0,this.next()):this.isDelim(124)||this.eat(1),this.isDelim(124)?61!==this.charCodeAt(this.tokenStart+1)?(this.next(),this.eat(1)):t&&this.error("Identifier is expected",this.tokenEnd):t&&this.error("Vertical line is expected"),{type:"Identifier",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function cc(){let e=this.tokenStart,t=this.charCodeAt(e);return 61!==t&&126!==t&&94!==t&&36!==t&&42!==t&&124!==t&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),61!==t&&(this.isDelim(61)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}function uc(){let e,t=this.tokenStart,n=null,r=null,o=null;return this.eat(19),this.skipSC(),e=lc.call(this),this.skipSC(),20!==this.tokenType&&(1!==this.tokenType&&(n=cc.call(this),this.skipSC(),r=5===this.tokenType?this.String():this.Identifier(),this.skipSC()),1===this.tokenType&&(o=this.consume(1),this.skipSC())),this.eat(20),{type:"AttributeSelector",loc:this.getLocation(t,this.tokenStart),name:e,matcher:n,value:r,flags:o}}function dc(e){this.token(9,"["),this.node(e.name),null!==e.matcher&&(this.tokenize(e.matcher),this.node(e.value)),null!==e.flags&&this.token(1,e.flags),this.token(9,"]")}function mc(e){this.token(23,"{"),this.children(e,(e=>{"Declaration"===e.type&&this.token(17,";")})),this.token(24,"}")}function hc(e){this.token(9,"["),this.children(e),this.token(9,"]")}function pc(){this.token(15,"--\x3e")}function fc(){this.token(14,"\x3c!--")}function gc(){return this.eatDelim(46),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function vc(e){this.token(9,"."),this.token(1,e.name)}function yc(){let e,t=this.tokenStart;switch(this.tokenType){case 13:e=" ";break;case 9:switch(this.charCodeAt(this.tokenStart)){case 62:case 43:case 126:this.next();break;case 47:this.next(),this.eatIdent("deep"),this.eatDelim(47);break;default:this.error("Combinator is expected")}e=this.substrToCursor(t)}return{type:"Combinator",loc:this.getLocation(t,this.tokenStart),name:e}}function bc(e){this.tokenize(e.name)}function xc(e){this.token(25,"/*"+e.value+"*/")}function wc(e){this.token(1,e.property),this.token(16,":"),this.node(e.value),e.important&&(this.token(9,"!"),this.token(1,!0===e.important?"important":e.important))}function kc(e){this.children(e,(e=>{"Declaration"===e.type&&this.token(17,";")}))}function Sc(e){this.token(12,e.value+e.unit)}function Cc(e){this.token(2,e.name+"("),this.children(e),this.token(22,")")}function Tc(e){this.token(4,"#"+e.value)}function Ic(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function Ec(e){this.token(1,e.name)}function Ac(){let e=this.tokenStart;return this.eat(4),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function Oc(e){this.token(9,"#"+e.name)}function Lc(e){this.token(21,"("),this.token(1,e.name),null!==e.value&&(this.token(16,":"),this.node(e.value)),this.token(22,")")}function _c(e){this.children(e)}function Pc(e){this.children(e,(()=>this.token(18,",")))}function Nc(){let e=this.tokenStart;return this.eatDelim(38),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function Dc(){this.token(9,"&")}function Rc(){this.skipSC();let e,t=this.tokenStart,n=t,r=null;return e=this.lookupValue(0,"odd")||this.lookupValue(0,"even")?this.Identifier():this.AnPlusB(),n=this.tokenStart,this.skipSC(),this.lookupValue(0,"of")&&(this.next(),r=this.SelectorList(),n=this.tokenStart),{type:"Nth",loc:this.getLocation(t,n),nth:e,selector:r}}function Mc(e){this.node(e.nth),null!==e.selector&&(this.token(1,"of"),this.node(e.selector))}function Uc(e){this.token(10,e.value)}function Fc(e){this.tokenize(e.value)}function jc(e){this.token(21,"("),this.children(e),this.token(22,")")}function zc(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function $c(e){this.token(11,e.value+"%")}function Hc(){let e,t,n=this.tokenStart,r=null;return this.eat(16),2===this.tokenType?(e=this.consumeFunctionName(),t=e.toLowerCase(),hasOwnProperty.call(this.pseudo,t)?(this.skipSC(),r=this.pseudo[t].call(this),this.skipSC()):(r=this.createList(),r.push(this.Raw(this.tokenIndex,null,!1))),this.eat(22)):e=this.consume(1),{type:"PseudoClassSelector",loc:this.getLocation(n,this.tokenStart),name:e,children:r}}function Bc(e){this.token(16,":"),null===e.children?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}function Wc(){let e,t,n=this.tokenStart,r=null;return this.eat(16),this.eat(16),2===this.tokenType?(e=this.consumeFunctionName(),t=e.toLowerCase(),hasOwnProperty.call(this.pseudo,t)?(this.skipSC(),r=this.pseudo[t].call(this),this.skipSC()):(r=this.createList(),r.push(this.Raw(this.tokenIndex,null,!1))),this.eat(22)):e=this.consume(1),{type:"PseudoElementSelector",loc:this.getLocation(n,this.tokenStart),name:e,children:r}}function Vc(e){this.token(16,":"),this.token(16,":"),null===e.children?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}function Gc(e){this.token(10,e.left),this.token(9,"/"),this.token(10,e.right)}function qc(){return this.tokenIndex>0&&13===this.lookupType(-1)?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}function Yc(e,t,n){let r,o=this.getTokenStart(e);return this.skipUntilBalanced(e,t||this.consumeUntilBalanceEnd),r=n&&this.tokenStart>o?qc.call(this):this.tokenStart,{type:"Raw",loc:this.getLocation(o,r),value:this.substring(o,r)}}function Kc(e){this.tokenize(e.value)}function Xc(e){this.node(e.prelude),this.node(e.block)}function Jc(){let e=this.readSequence(this.scope.Selector);return null===this.getFirstListNode(e)&&this.error("Selector is expected"),{type:"Selector",loc:this.getLocationFromList(e),children:e}}function Zc(e){this.children(e)}function Qc(){let e=this.createList();for(;!this.eof&&(e.push(this.Selector()),18===this.tokenType);)this.next();return{type:"SelectorList",loc:this.getLocationFromList(e),children:e}}function eu(e){this.children(e,(()=>this.token(18,",")))}var tu=92,nu=34;function ru(e){let t=e.length,n=e.charCodeAt(0),r=n===nu||39===n?1:0,o=1===r&&t>1&&e.charCodeAt(t-1)===n?t-2:t-1,s="";for(let n=r;n<=o;n++){let r=e.charCodeAt(n);if(r===tu){if(n===o){n!==t-1&&(s=e.substr(n+1));break}if(r=e.charCodeAt(++n),ul(tu,r)){let t=n-1,r=Sl(e,t);n=r-1,s+=El(e.substring(t+1,r))}else 13===r&&10===e.charCodeAt(n+1)&&n++}else s+=e[n]}return s}function ou(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:ru(this.consume(5))}}function su(e){this.token(5,function(e){let t=nu,n="",r=!1;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);0!==s?s<=31||127===s?(n+="\\"+s.toString(16),r=!0):s===t||s===tu?(n+="\\"+e.charAt(o),r=!1):(r&&(rl(s)||cl(s))&&(n+=" "),n+=e.charAt(o),r=!1):n+="\ufffd"}return'"'+n+'"'}(e.value))}function au(e){this.children(e)}function iu(){1!==this.tokenType&&!1===this.isDelim(42)&&this.error("Identifier or asterisk is expected"),this.next()}function lu(){let e=this.tokenStart;return this.isDelim(124)?(this.next(),iu.call(this)):(iu.call(this),this.isDelim(124)&&(this.next(),iu.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function cu(e){this.tokenize(e.name)}function uu(e){this.tokenize(e.value)}var du=32,mu=92,hu=34,pu=39,fu=40,gu=41;function vu(e){this.token(7,function(e){let t="",n=!1;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);0!==o?o<=31||127===o?(t+="\\"+o.toString(16),n=!0):o===du||o===mu||o===hu||o===pu||o===fu||o===gu?(t+="\\"+e.charAt(r),n=!1):(n&&rl(o)&&(t+=" "),t+=e.charAt(r),n=!1):t+="\ufffd"}return"url("+t+")"}(e.value))}function yu(e){this.children(e)}function bu(e){this.token(13,e.value)}var xu=function(e){let t=new Map;for(let n in e.node){let r=e.node[n];"function"==typeof(r.generate||r)&&t.set(n,r.generate||r)}return function(e,n){let r="",o=0,s={node(e){if(!t.has(e.type))throw new Error("Unknown node type: "+e.type);t.get(e.type).call(a,e)},tokenBefore:Gl,token(e,t){o=this.tokenBefore(o,e,t),this.emit(t,e,!1),9===e&&92===t.charCodeAt(0)&&this.emit("\n",13,!0)},emit(e){r+=e},result:()=>r};n&&("function"==typeof n.decorator&&(s=n.decorator(s)),n.sourceMap&&(s=function(e){let t=new Fl.SourceMapGenerator,n={line:1,column:0},r={line:0,column:0},o={line:1,column:0},s={generated:o},a=1,i=0,l=!1,c=e.node;e.node=function(e){if(e.loc&&e.loc.start&&jl.has(e.type)){let c=e.loc.start.line,u=e.loc.start.column-1;(r.line!==c||r.column!==u)&&(r.line=c,r.column=u,n.line=a,n.column=i,l&&(l=!1,(n.line!==o.line||n.column!==o.column)&&t.addMapping(s)),l=!0,t.addMapping({source:e.loc.source,original:r,generated:n}))}c.call(this,e),l&&jl.has(e.type)&&(o.line=a,o.column=i)};let u=e.emit;e.emit=function(e,t,n){for(let t=0;t<e.length;t++)10===e.charCodeAt(t)?(a++,i=0):i++;u(e,t,n)};let d=e.result;return e.result=function(){return l&&t.addMapping(s),{css:d(),map:t}},e}(s)),n.mode in zl&&(s.tokenBefore=zl[n.mode]));let a={node:e=>s.node(e),children:ql,token:(e,t)=>s.token(e,t),tokenize:Yl};return s.node(e),s.result()}}({node:Kl}),wu=null,ku=class{static createItem(e){return{prev:null,next:null,data:e}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(e){return ku.createItem(e)}allocateCursor(e,t){let n;return null!==wu?(n=wu,wu=wu.cursor,n.prev=e,n.next=t,n.cursor=this.cursor):n={prev:e,next:t,cursor:this.cursor},this.cursor=n,n}releaseCursor(){let{cursor:e}=this;this.cursor=e.cursor,e.prev=null,e.next=null,e.cursor=wu,wu=e}updateCursors(e,t,n,r){let{cursor:o}=this;for(;null!==o;)o.prev===e&&(o.prev=t),o.next===n&&(o.next=r),o=o.cursor}*[Symbol.iterator](){for(let e=this.head;null!==e;e=e.next)yield e.data}get size(){let e=0;for(let t=this.head;null!==t;t=t.next)e++;return e}get isEmpty(){return null===this.head}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(e){let t=null;this.head=null;for(let n of e){let e=ku.createItem(n);null!==t?t.next=e:this.head=e,e.prev=t,t=e}return this.tail=t,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(e,t=this){let n=this.allocateCursor(null,this.head);for(;null!==n.next;){let r=n.next;n.next=r.next,e.call(t,r.data,r,this)}this.releaseCursor()}forEachRight(e,t=this){let n=this.allocateCursor(this.tail,null);for(;null!==n.prev;){let r=n.prev;n.prev=r.prev,e.call(t,r.data,r,this)}this.releaseCursor()}reduce(e,t,n=this){let r,o=this.allocateCursor(null,this.head),s=t;for(;null!==o.next;)r=o.next,o.next=r.next,s=e.call(n,s,r.data,r,this);return this.releaseCursor(),s}reduceRight(e,t,n=this){let r,o=this.allocateCursor(this.tail,null),s=t;for(;null!==o.prev;)r=o.prev,o.prev=r.prev,s=e.call(n,s,r.data,r,this);return this.releaseCursor(),s}some(e,t=this){for(let n=this.head;null!==n;n=n.next)if(e.call(t,n.data,n,this))return!0;return!1}map(e,t=this){let n=new ku;for(let r=this.head;null!==r;r=r.next)n.appendData(e.call(t,r.data,r,this));return n}filter(e,t=this){let n=new ku;for(let r=this.head;null!==r;r=r.next)e.call(t,r.data,r,this)&&n.appendData(r.data);return n}nextUntil(e,t,n=this){if(null===e)return;let r=this.allocateCursor(null,e);for(;null!==r.next;){let e=r.next;if(r.next=e.next,t.call(n,e.data,e,this))break}this.releaseCursor()}prevUntil(e,t,n=this){if(null===e)return;let r=this.allocateCursor(e,null);for(;null!==r.prev;){let e=r.prev;if(r.prev=e.prev,t.call(n,e.data,e,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){let e=new ku;for(let t of this)e.appendData(t);return e}prepend(e){return this.updateCursors(null,e,this.head,e),null!==this.head?(this.head.prev=e,e.next=this.head):this.tail=e,this.head=e,this}prependData(e){return this.prepend(ku.createItem(e))}append(e){return this.insert(e)}appendData(e){return this.insert(ku.createItem(e))}insert(e,t=null){if(null!==t)if(this.updateCursors(t.prev,e,t,e),null===t.prev){if(this.head!==t)throw new Error("before doesn't belong to list");this.head=e,t.prev=e,e.next=t,this.updateCursors(null,e)}else t.prev.next=e,e.prev=t.prev,t.prev=e,e.next=t;else this.updateCursors(this.tail,e,null,e),null!==this.tail?(this.tail.next=e,e.prev=this.tail):this.head=e,this.tail=e;return this}insertData(e,t){return this.insert(ku.createItem(e),t)}remove(e){if(this.updateCursors(e,e.prev,e,e.next),null!==e.prev)e.prev.next=e.next;else{if(this.head!==e)throw new Error("item doesn't belong to list");this.head=e.next}if(null!==e.next)e.next.prev=e.prev;else{if(this.tail!==e)throw new Error("item doesn't belong to list");this.tail=e.prev}return e.prev=null,e.next=null,e}push(e){this.insert(ku.createItem(e))}pop(){return null!==this.tail?this.remove(this.tail):null}unshift(e){this.prepend(ku.createItem(e))}shift(){return null!==this.head?this.remove(this.head):null}prependList(e){return this.insertList(e,this.head)}appendList(e){return this.insertList(e)}insertList(e,t){return null===e.head||(null!=t?(this.updateCursors(t.prev,e.tail,t,e.head),null!==t.prev?(t.prev.next=e.head,e.head.prev=t.prev):this.head=e.head,t.prev=e.tail,e.tail.next=t):(this.updateCursors(this.tail,e.tail,null,e.head),null!==this.tail?(this.tail.next=e.head,e.head.prev=this.tail):this.head=e.head,this.tail=e.tail),e.head=null,e.tail=null),this}replace(e,t){"head"in t?this.insertList(t,e):this.insert(t,e),this.remove(e)}};function Su({source:e,line:t,column:n},r){function o(e,t){return s.slice(e,t).map(((t,n)=>String(e+n+1).padStart(l)+" |"+t)).join("\n")}let s=e.split(/\r\n?|\n|\f/),a=Math.max(1,t-r)-1,i=Math.min(t+r,s.length+1),l=Math.max(4,String(i).length)+1,c=0;(n+=3*(s[t-1].substr(0,n-1).match(/\t/g)||[]).length)>100&&(c=n-60+3,n=58);for(let e=a;e<=i;e++)e>=0&&e<s.length&&(s[e]=s[e].replace(/\t/g," "),s[e]=(c>0&&s[e].length>c?"\u2026":"")+s[e].substr(c,98)+(s[e].length>c+100-1?"\u2026":""));return[o(a,t),new Array(n+l+2).join("-")+"^",o(t,i)].filter(Boolean).join("\n")}function Cu(e,t,n,r,o){return Object.assign(function(e,t){let n=Object.create(SyntaxError.prototype),r=new Error;return Object.assign(n,{name:e,message:t,get stack(){return(r.stack||"").replace(/^(.+\n){1,3}/,`${e}: ${t}\n`)}})}("SyntaxError",e),{source:t,offset:n,line:r,column:o,sourceFragment:e=>Su({source:t,line:r,column:o},isNaN(e)?0:e),get formattedMessage(){return`Parse error: ${e}\n`+Su({source:t,line:r,column:o},2)}})}function Tu(e){let t=this.createList(),n=!1,r={recognizer:e};for(;!this.eof;){switch(this.tokenType){case 25:this.next();continue;case 13:n=!0,this.next();continue}let o=e.getNode.call(this,r);if(void 0===o)break;n&&(e.onWhiteSpace&&e.onWhiteSpace.call(this,o,t,r),n=!1),t.push(o)}return n&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,r),t}var Iu=()=>{};function Eu(e){return function(){return this[e]()}}function Au(e){let t=Object.create(null);for(let n in e){let r=e[n],o=r.parse||r;o&&(t[n]=o)}return t}var Ou={parse(){return this.createSingleNodeList(this.SelectorList())}},Lu={parse(){return this.createSingleNodeList(this.Selector())}},_u={parse(){return this.createSingleNodeList(this.Identifier())}},Pu={parse(){return this.createSingleNodeList(this.Nth())}},Nu={dir:_u,has:Ou,lang:_u,matches:Ou,is:Ou,"-moz-any":Ou,"-webkit-any":Ou,where:Ou,not:Ou,"nth-child":Pu,"nth-last-child":Pu,"nth-last-of-type":Pu,"nth-of-type":Pu,slotted:Lu,host:Lu,"host-context":Lu},Du={};Ki(Du,{AnPlusB:()=>oc,AttributeSelector:()=>uc,ClassSelector:()=>gc,Combinator:()=>yc,IdSelector:()=>Ac,Identifier:()=>Ic,NestingSelector:()=>Nc,Nth:()=>Rc,Percentage:()=>zc,PseudoClassSelector:()=>Hc,PseudoElementSelector:()=>Wc,Raw:()=>Yc,Selector:()=>Jc,SelectorList:()=>Qc,String:()=>ou,TypeSelector:()=>lu});var Ru=function(e){let t="",n="<unknown>",r=!1,o=Iu,s=!1,a=new _l,i=Object.assign(new Rl,function(e){let t={context:Object.create(null),scope:Object.assign(Object.create(null),e.scope),atrule:Au(e.atrule),pseudo:Au(e.pseudo),node:Au(e.node)};for(let n in e.parseContext)switch(typeof e.parseContext[n]){case"function":t.context[n]=e.parseContext[n];break;case"string":t.context[n]=Eu(e.parseContext[n])}return{config:t,...t,...t.node}}(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:Tu,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket:e=>123===e?1:0,consumeUntilLeftCurlyBracketOrSemicolon:e=>123===e||59===e?1:0,consumeUntilExclamationMarkOrSemicolon:e=>33===e||59===e?1:0,consumeUntilSemicolonIncluded:e=>59===e?2:0,createList:()=>new ku,createSingleNodeList:e=>(new ku).appendData(e),getFirstListNode:e=>e&&e.first,getLastListNode:e=>e&&e.last,parseWithFallback(e,t){let n=this.tokenIndex;try{return e.call(this)}catch(e){if(s)throw e;let r=t.call(this,n);return s=!0,o(e,r),s=!1,r}},lookupNonWSType(e){let t;do{if(t=this.lookupType(e++),13!==t)return t}while(0!==t);return 0},charCodeAt:e=>e>=0&&e<t.length?t.charCodeAt(e):0,substring:(e,n)=>t.substring(e,n),substrToCursor(e){return this.source.substring(e,this.tokenStart)},cmpChar:(e,n)=>bl(t,e,n),cmpStr:(e,n,r)=>xl(t,e,n,r),consume(e){let t=this.tokenStart;return this.eat(e),this.substrToCursor(t)},consumeFunctionName(){let e=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(2),e},consumeNumber(e){let n=t.substring(this.tokenStart,Tl(t,this.tokenStart));return this.eat(e),n},eat(e){if(this.tokenType!==e){let t=Al[e].slice(0,-6).replace(/-/g," ").replace(/^./,(e=>e.toUpperCase())),n=`${/[[\](){}]/.test(t)?`"${t}"`:t} is expected`,r=this.tokenStart;switch(e){case 1:2===this.tokenType||7===this.tokenType?(r=this.tokenEnd-1,n="Identifier is expected but function found"):n="Identifier is expected";break;case 4:this.isDelim(35)&&(this.next(),r++,n="Name is expected");break;case 11:10===this.tokenType&&(r=this.tokenEnd,n="Percent sign is expected")}this.error(n,r)}this.next()},eatIdent(e){(1!==this.tokenType||!1===this.lookupValue(0,e))&&this.error(`Identifier "${e}" is expected`),this.next()},eatDelim(e){this.isDelim(e)||this.error(`Delim "${String.fromCharCode(e)}" is expected`),this.next()},getLocation:(e,t)=>r?a.getLocationRange(e,t,n):null,getLocationFromList(e){if(r){let t=this.getFirstListNode(e),r=this.getLastListNode(e);return a.getLocationRange(null!==t?t.loc.start.offset-a.startOffset:this.tokenStart,null!==r?r.loc.end.offset-a.startOffset:this.tokenStart,n)}return null},error(e,n){let r=typeof n<"u"&&n<t.length?a.getLocation(n):this.eof?a.getLocation(function(e,t){for(;t>=0&&cl(e.charCodeAt(t));t--);return t+1}(t,t.length-1)):a.getLocation(this.tokenStart);throw new Cu(e||"Unexpected input",t,r.offset,r.line,r.column)}});return Object.assign((function(e,l){t=e,l=l||{},i.setSource(t,Ml),a.setSource(t,l.offset,l.line,l.column),n=l.filename||"<unknown>",r=Boolean(l.positions),o="function"==typeof l.onParseError?l.onParseError:Iu,s=!1,i.parseAtrulePrelude=!("parseAtrulePrelude"in l)||Boolean(l.parseAtrulePrelude),i.parseRulePrelude=!("parseRulePrelude"in l)||Boolean(l.parseRulePrelude),i.parseValue=!("parseValue"in l)||Boolean(l.parseValue),i.parseCustomProperty="parseCustomProperty"in l&&Boolean(l.parseCustomProperty);let{context:c="default",onComment:u}=l;if(!(c in i.context))throw new Error("Unknown context `"+c+"`");"function"==typeof u&&i.forEachToken(((e,n,r)=>{if(25===e){let e=i.getLocation(n,r),o=xl(t,r-2,r,"*/")?t.slice(n+2,r-2):t.slice(n+2,r);u(o,e)}}));let d=i.context[c].call(i,l);return i.eof||i.error(),d}),{SyntaxError:Cu,config:i.config})}({parseContext:{default:"SelectorList",selectorList:"SelectorList",selector:"Selector"},scope:{Selector:{onWhiteSpace:function(e,t){null!==t.last&&"Combinator"!==t.last.type&&null!==e&&"Combinator"!==e.type&&t.push({type:"Combinator",loc:null,name:" "})},getNode:function(){switch(this.tokenType){case 19:return this.AttributeSelector();case 4:return this.IdSelector();case 16:return 16===this.lookupType(1)?this.PseudoElementSelector():this.PseudoClassSelector();case 1:return this.TypeSelector();case 10:case 11:return this.Percentage();case 12:46===this.charCodeAt(this.tokenStart)&&this.error("Identifier is expected",this.tokenStart+1);break;case 9:switch(this.charCodeAt(this.tokenStart)){case 43:case 62:case 126:case 47:return this.Combinator();case 46:return this.ClassSelector();case 42:case 124:return this.TypeSelector();case 35:return this.IdSelector();case 38:return this.NestingSelector()}}}}},atrule:{},pseudo:Nu,node:Du}),Mu=(e,t)=>e.a===t.a?e.b===t.b?e.c-t.c:e.b-t.b:e.a-t.a,Uu=(e,t)=>0===Mu(e,t),Fu=(e,t)=>Mu(e,t)>0,ju=(e,t)=>Mu(e,t)<0,zu=(e,t="ASC")=>{let n=e.sort(Mu);return"DESC"===t?n.reverse():n},$u=(...e)=>zu(e,"ASC"),Hu=(...e)=>zu(e,"DESC"),Bu=(...e)=>Hu(...e)[0],Wu=e=>{let t={a:0,b:0,c:0};return e.children.forEach((e=>{switch(e.type){case"IdSelector":t.a+=1;break;case"AttributeSelector":case"ClassSelector":t.b+=1;break;case"PseudoClassSelector":switch(e.name.toLowerCase()){case"where":break;case"is":case"matches":case"-webkit-any":case"-moz-any":case"any":case"not":case"has":if(e.children){let n=Bu(...Vu(e.children.first));t.a+=n.a,t.b+=n.b,t.c+=n.c}break;case"nth-child":case"nth-last-child":if(t.b+=1,e.children.first.selector){let n=Bu(...Vu(e.children.first.selector));t.a+=n.a,t.b+=n.b,t.c+=n.c}break;case"host-context":case"host":if(t.b+=1,e.children){let n={type:"Selector",children:[]},r=!1;e.children.first.children.forEach((e=>!r&&("Combinator"===e.type?(r=!0,!1):void n.children.push(e))));let o=Vu(n)[0];t.a+=o.a,t.b+=o.b,t.c+=o.c}break;case"after":case"before":case"first-letter":case"first-line":t.c+=1;break;default:t.b+=1}break;case"PseudoElementSelector":switch(e.name){case"slotted":if(t.c+=1,e.children){let n={type:"Selector",children:[]},r=!1;e.children.first.children.forEach((e=>!r&&("Combinator"===e.type?(r=!0,!1):void n.children.push(e))));let o=Vu(n)[0];t.a+=o.a,t.b+=o.b,t.c+=o.c}break;case"view-transition-group":case"view-transition-image-pair":case"view-transition-old":case"view-transition-new":if(e.children&&"*"===e.children.first.value)break;t.c+=1;break;default:t.c+=1}break;case"TypeSelector":let n=e.name;n.includes("|")&&(n=n.split("|")[1]),"*"!==n&&(t.c+=1)}})),new Gu(t,e)},Vu=e=>{if(!e)return[];let t=(e=>{if("string"==typeof e||e instanceof String)try{return Ru(e,{context:"selectorList"})}catch(t){throw new TypeError(`Could not convert passed in source '${e}' to SelectorList: ${t.message}`)}if(e instanceof Object){if(e.type&&["Selector","SelectorList"].includes(e.type))return e;if(e.type&&"Raw"===e.type)try{return Ru(e.value,{context:"selectorList"})}catch(e){throw new TypeError(`Could not convert passed in source to SelectorList: ${e.message}`)}throw new TypeError("Passed in source is an Object but no AST / AST of the type Selector or SelectorList")}throw new TypeError("Passed in source is not a String nor an Object. I don't know what to do with it.")})(e);if("Selector"===t.type)return[Wu(e)];if("SelectorList"===t.type){let e=[];return t.children.forEach((t=>{let n=Wu(t);e.push(n)})),e}},Gu=class{constructor(e,t=null){this.value=e,this.selector=t}get a(){return this.value.a}set a(e){throw new Error("Manipulating the port of the specificity directly is not allowed. Instead, directly set a new value")}get b(){return this.value.b}set b(e){throw new Error("Manipulating the port of the specificity directly is not allowed. Instead, directly set a new value")}get c(){return this.value.c}set c(e){throw new Error("Manipulating the port of the specificity directly is not allowed. Instead, directly set a new value")}selectorString(){return"string"==typeof this.selector||this.selector instanceof String?this.selector:this.selector instanceof Object&&"Selector"===this.selector.type?xu(this.selector):""}toObject(){return this.value}toArray(){return[this.value.a,this.value.b,this.value.c]}toString(){return`(${this.value.a},${this.value.b},${this.value.c})`}toJSON(){return{selector:this.selectorString(),asObject:this.toObject(),asArray:this.toArray(),asString:this.toString()}}isEqualTo(e){return Uu(this,e)}isGreaterThan(e){return Fu(this,e)}isLessThan(e){return ju(this,e)}static calculate(e){return Vu(e)}static compare(e,t){return Mu(e,t)}static equals(e,t){return Uu(e,t)}static lessThan(e,t){return ju(e,t)}static greaterThan(e,t){return Fu(e,t)}static min(...e){return((...e)=>$u(...e)[0])(...e)}static max(...e){return Bu(...e)}static sortAsc(...e){return $u(...e)}static sortDesc(...e){return Hu(...e)}};const qu=e=>(e=>{const t=new Map,n=e=>{const n=t.get(e);if(l(n))return n;{const n=Gu.calculate(e)[0];return t.set(e,n),n}};return F(e,((e,t)=>{const r=n(e.selector),o=n(t.selector);return Gu.compare(r,o)}))})((e=>R(e,(e=>(e=>-1!==e.selector.indexOf(","))(e)?(e=>{const t=e.selector.split(/,(?![^(]*\))/g);return E(t,(t=>{const n=t.trim();return{...e,selector:n}}))})(e):[e])))(e)),Yu=e=>{const t={};return A(e,(r=>{const o=e.getPropertyValue(r);n(o)&&(t[r]=o)})),t},Ku=e=>({selector:e.selectorText,styles:Yu(e.style)}),Xu=e=>{const t=e.cssRules;return R(t,(e=>(e=>e.type===window.CSSRule.IMPORT_RULE)(e)&&l(e.styleSheet)?Xu(e.styleSheet):(e=>e.type===window.CSSRule.STYLE_RULE)(e)?[Ku(e)]:[]))},Ju=(e,t)=>{const n=_(t,((e,t)=>({...e,...t.styles})),{});return G(n,((t,n)=>!T(e.dom.style,n)))},Zu=e=>{return t=(e=>{const t=e.dom.styleSheets;return Array.prototype.slice.call(t)})(e),R(t,Xu);var t},Qu=(e,t,n)=>((e,t,r)=>{var o,s;((e,t)=>{((e,t)=>{const n=[],r=document.createTreeWalker(e.dom,NodeFilter.SHOW_ELEMENT);for(;l(r.nextNode());){const e=bt.fromDom(r.currentNode),o=L(t,(t=>Ct(e,t.selector)));if(o.length>0){const t=Ju(e,o);zn(e,t),n.push(e)}}A(n,(e=>On(e,"class")))})(t,qu(e))})((o=Zu(t),s=n,E(o,(e=>{const t=e.selector,n=s.hasOwnProperty(t)?s[t]:t;return{...e,selector:n}}))),r)})(0,e,t),ed={p:"p, li[data-converted-paragraph]"},td=(e,t)=>{const n=mr(e,"li[data-converted-paragraph]");if(A(n,(e=>{On(e,"data-converted-paragraph")})),t){const t=mr(e,"li");A(t,(t=>{const n=(e=>{const t=(()=>{const t=bt.fromTag("spn");return yn(e,t),t})();return{convertToPx:e=>{return jn(t,"margin-left",e),n=$n(t,"margin-left"),parseFloat(/-?\d+\.?\d*/.exec(n)[0]);var n},destroy:()=>_n(t)}})(e),r=((e,t)=>{const n=En(e,"data-tab-interval").getOr("36pt");return t.convertToPx(n)})(e,n),o=nd(t,r,n).getOr({});(e=>{On(e,"data-list-level"),On(e,"data-text-indent-alt"),On(e,"data-border-margin"),Vn(e,"margin-left"),Vn(e,"text-indent"),B(Wn(e),((t,n)=>{!Se(n,"border")||"border-image"!==n&&"none"!==t.trim()&&"initial"!==t.trim()||Vn(e,n)}))})(t),n.destroy(),zn(t,o)}));const n=mr(e,"ol,ul");A(n,(e=>{const t=mr(e,"li");Bn(e,"margin-top").isNone()&&w.from(t[0]).each((t=>{jn(e,"margin-top",$n(t,"margin-top"))})),Bn(e,"margin-bottom").isNone()&&w.from(t[t.length-1]).each((t=>{jn(e,"margin-bottom",$n(t,"margin-bottom"))}))}))}On(e,"data-tab-interval")},nd=(e,t,n)=>{const r=e=>En(e,"data-list-level").map((e=>parseInt(e,10))).getOr(1);return Bn(e,"text-indent").bind((o=>Bn(e,"margin-left").map((s=>{const a=Bn(e,"list-style").exists((e=>ke(e,"none"))),i=En(e,"data-border-margin").getOr("0px"),l=a?r(e)+1:r(e),c=n.convertToPx(s)+n.convertToPx(i),u=t*l,d=En(e,"data-text-indent-alt").getOr(o),m=n.convertToPx(d),h={},p=t/2*-1-m;p>0&&(h["text-indent"]=p+"px");const f=c-u-p;return h["margin-left"]=f>0?f+"px":"0px",h}))))},rd=e=>{const t=ad(e);return t&&od(e)||!t&&sd(e)},od=e=>e.officeStyles.getOr(!0),sd=e=>e.htmlStyles.getOr(!1),ad=e=>e.isWord.getOr(!1),id=e=>e.isInternal.getOr(!1),ld=e=>ad(e)?ls.Word:(e=>e.isGoogleDocs.getOr(!1))(e)?ls.GoogleDocs:ls.Html,cd=Vt(),ud=cd.deviceType.isiOS()||cd.deviceType.isAndroid(),dd=h({isSupported:!1,cleanDocument:()=>Promise.reject("not supported")});var md=ud?dd:(e,t,n)=>{const r=t+"/wordimport.js"+(e=>w.from(e).filter((e=>0!==e.length)).map((e=>(-1===e.indexOf("?")?"?":"")+e)).getOr(""))(n||"v=6.0.0"),o=e.loadScript("ephox.wimp",r);return o.catch((e=>{console.error("Unable to load word import: ",e)})),{isSupported:!0,cleanDocument:(e,t,n)=>o.then((r=>r.cleanDocument(e,t,n.cleanFilteredInlineElements)))}};const hd=e=>{let t=[];return{bind:e=>{if(void 0===e)throw new Error("Event bind error: undefined handler");t.push(e)},unbind:e=>{t=L(t,(t=>t!==e))},trigger:(...n)=>{const r={};A(e,((e,t)=>{r[e]=n[t]})),A(t,(e=>{e(r)}))}}},pd=e=>{const t=W(e,(e=>({bind:e.bind,unbind:e.unbind}))),n=W(e,(e=>e.trigger));return{registry:t,trigger:n}},fd=(e,t,n,r)=>{const o=It(e,n)&&t===r;return{startContainer:h(e),startOffset:h(t),endContainer:h(n),endOffset:h(r),collapsed:h(o)}},gd=e=>{const t=vd(e);return{resolve:e=>{const n=e.split(" ");return E(n,(e=>yd(t,e))).join(" ")}}},vd=e=>e.replace(/\./g,"-"),yd=(e,t)=>e+"-"+t,bd=gd("ephox-sloth").resolve,xd=h(bd("bin")),wd=["b","i","u","sub","sup","strike"],kd=xd(),Sd=kd+le(""),Cd=e=>"rtl"===Jn(e)?"100000px":"-100000px";const Td=(e,t)=>{const n=bt.fromTag("div");var r;Tn(n,t),Tn(n,{contenteditable:"true","aria-hidden":"true"}),zn(n,{position:"fixed",top:"0px",width:"100px",height:"100px",overflow:"hidden",opacity:"0"}),r=n,A([kd,Sd],(e=>{ar(r,e)}));const o=e=>lr(e,Sd);return{attach:e=>{Ln(n),jn(n,"left",Cd(e)),bn(e,n)},focus:()=>{nr(n,"body").each((t=>{e.toOff(t,n)}))},contents:()=>(((e,t)=>{an(e).filter(t).each((t=>{const n=cn(t);kn(e,n),_n(t)})),((e,t)=>{const n=cn(e);A(n,(e=>{t(e)&&(e=>{const t=cn(e),n=bt.fromTag("div",tn(e).dom);kn(n,t),gn(e,n),_n(e)})(e)}))})(e,t),A(cn(e),(e=>{(e=>Xt(e)&&!e.dom.hasChildNodes()&&T(wd,Gt(e)))(e)&&_n(e)}))})(n,o),{elements:cn(n),html:Dn(n),offscreen:n}),container:h(n),detach:()=>{_n(n)}}},Id=(e,t,n)=>{const r=Td(e,n),o=()=>{e.cleanup();const t=r.contents();r.detach(),s.trigger.after(t.elements,t.html,r.container())},s=pd({before:hd([]),after:hd(["elements","html","container"])}),a=d;return{instance:h((()=>{s.trigger.before(),r.attach(t),r.focus(),((e,t)=>{((e,t)=>{setTimeout(t,1)})(0,t)})(tn(t),o)})),destroy:a,events:s.registry}},Ed=e=>{const t=It(e.start,e.finish)&&e.soffset===e.foffset;return{startContainer:h(e.start),startOffset:h(e.soffset),endContainer:h(e.finish),endOffset:h(e.foffset),collapsed:h(t)}},Ad={set:(e,t)=>{wr(e,t.startContainer(),t.startOffset(),t.endContainer(),t.endOffset())},get:e=>Cr(e).map(Ed)};const Od=gd("ephox-cement").resolve,Ld={cacheSuffix:"",pasteBinAttrs:{},keepSrc:!1,sanitizer:{sanitizeHtml:h(""),sanitizeText:h("")},tabSpaces:4,cleanFilteredInlineElements:[],indentUseMargin:!1,defaultProtocol:"https",autoLinkUrls:!0,emfProcessor:w.none()},_d=h(Od("smartpaste-eph-bin")),Pd=()=>{const e={};return{getOrSetIndexed:(t,n)=>(t=>void 0!==e[t])(t)?e[t]:((t,n)=>(e[t]=n,n))(t,n()),waitForLoad:()=>{const t=((e,t)=>{const n=[];return B(e,((e,r)=>{n.push(t(e,r))})),n})(e,p);return se(t)}}},Nd=(e=>{const t=g(pe,e);pe("callbacks",t());const n=(n,o)=>{const s=t(),a=(e=>{const t=void 0===e.count?0:e.count,n="callback_"+t;return e.count=t+1,n})(s);return s.callbacks[a]=(...e)=>{o||r(a),n(...e)},(t=>e+".callbacks."+t)(a)},r=e=>{const n=e.substring(e.lastIndexOf(".")+1),r=t();void 0!==r.callbacks[n]&&delete r.callbacks[n]};return{ephemeral:e=>n(e,!1),permanent:e=>n(e,!0),unregister:r}})("ephox.henchman.features"),Dd=(e,t)=>Z.nu((n=>{const o=t=>{A(a,(e=>{e.unbind()})),n(t.fold((t=>oe.error(t+'Unable to download editor stylesheets from "'+e+'"')),oe.value))},s=(e=>{const t=bt.fromDom(document),n=bt.fromTag("link",t.dom);return Tn(n,{rel:"stylesheet",type:"text/css",href:e}),((e,t)=>{const n=(e=>{const t=e.dom.head;if(null==t)throw new Error("Head is not available yet");return bt.fromDom(t)})(e);bn(n,t)})(t,n),n})(e),a=[fn(s,"load",(e=>{(e=>{var t;try{const n=null===(t=e.target.dom.sheet)||void 0===t?void 0:t.cssRules;return r(n)&&0===n.length}catch(e){}return!1})(e)?o(oe.error("")):t(o)})),fn(s,"error",g(o,oe.error("")))]})),Rd=(()=>{const e=Pd(),t=()=>e.waitForLoad();return{preload:()=>{t().get(p)},addStylesheet:(t,n)=>e.getOrSetIndexed(t,(()=>Dd(t,n))),addScript:(t,n)=>e.getOrSetIndexed(t,(()=>(e=>Z.nu((t=>{const n=()=>{o.unbind(),s.unbind()},r=bt.fromTag("script");Cn(r,"src",e),Cn(r,"type","text/javascript"),Cn(r,"async","async"),Cn(r,"data-main",Nd.ephemeral((e=>{t(oe.value(e))})));const o=fn(r,"error",(()=>{n(),t(oe.error("Error loading external script tag "+e))})),s=fn(r,"load",n);bn(bt.fromDom(document.head),r)})))(t).map(n))),waitForLoad:t}})(),Md={loadScript:(e,t)=>new Promise(((e,n)=>{((e,t)=>Rd.addScript(e,t))(t,p).get((t=>{t.fold(n,e)}))}))},Ud={disabled:()=>({discriminator:"disabled",data:{}}),fromClipboard:e=>({discriminator:"fromClipboard",data:{rtf:e}})},Fd=$(Ud),jd=Ud.disabled,zd=Ud.fromClipboard,$d=e=>void 0!==e&&void 0!==e.types&&null!==e.types,Hd=(e,t)=>{const n=new RegExp(t,"i");return z(e,(e=>me(null!==n.exec(e),{type:e,flavor:t})))},{entries:Bd,setPrototypeOf:Wd,isFrozen:Vd,getPrototypeOf:Gd,getOwnPropertyDescriptor:qd}=Object;let{freeze:Yd,seal:Kd,create:Xd}=Object,{apply:Jd,construct:Zd}="undefined"!=typeof Reflect&&Reflect;Yd||(Yd=function(e){return e}),Kd||(Kd=function(e){return e}),Jd||(Jd=function(e,t,n){return e.apply(t,n)}),Zd||(Zd=function(e,t){return new e(...t)});const Qd=pm(Array.prototype.forEach),em=pm(Array.prototype.lastIndexOf),tm=pm(Array.prototype.pop),nm=pm(Array.prototype.push),rm=pm(Array.prototype.splice),om=pm(String.prototype.toLowerCase),sm=pm(String.prototype.toString),am=pm(String.prototype.match),im=pm(String.prototype.replace),lm=pm(String.prototype.indexOf),cm=pm(String.prototype.trim),um=pm(Object.prototype.hasOwnProperty),dm=pm(RegExp.prototype.test),mm=(hm=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Zd(hm,t)});var hm;function pm(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Jd(e,t,r)}}function fm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:om;Wd&&Wd(e,null);let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&(Vd(t)||(t[r]=e),o=e)}e[o]=!0}return e}function gm(e){for(let t=0;t<e.length;t++)um(e,t)||(e[t]=null);return e}function vm(e){const t=Xd(null);for(const[n,r]of Bd(e))um(e,n)&&(Array.isArray(r)?t[n]=gm(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=vm(r):t[n]=r);return t}function ym(e,t){for(;null!==e;){const n=qd(e,t);if(n){if(n.get)return pm(n.get);if("function"==typeof n.value)return pm(n.value)}e=Gd(e)}return function(){return null}}const bm=Yd(["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","section","select","shadow","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"]),xm=Yd(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),wm=Yd(["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"]),km=Yd(["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"]),Sm=Yd(["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"]),Cm=Yd(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Tm=Yd(["#text"]),Im=Yd(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Em=Yd(["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","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"]),Am=Yd(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","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"]),Om=Yd(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Lm=Kd(/\{\{[\w\W]*|[\w\W]*\}\}/gm),_m=Kd(/<%[\w\W]*|[\w\W]*%>/gm),Pm=Kd(/\$\{[\w\W]*/gm),Nm=Kd(/^data-[\-\w.\u00B7-\uFFFF]+$/),Dm=Kd(/^aria-[\-\w]+$/),Rm=Kd(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Mm=Kd(/^(?:\w+script|data):/i),Um=Kd(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Fm=Kd(/^html$/i),jm=Kd(/^[a-z][.\w]*(-[.\w]+)+$/i);var zm=Object.freeze({__proto__:null,ARIA_ATTR:Dm,ATTR_WHITESPACE:Um,CUSTOM_ELEMENT:jm,DATA_ATTR:Nm,DOCTYPE_NAME:Fm,ERB_EXPR:_m,IS_ALLOWED_URI:Rm,IS_SCRIPT_OR_DATA:Mm,MUSTACHE_EXPR:Lm,TMPLIT_EXPR:Pm});const $m=function(){return"undefined"==typeof window?null:window};var Hm=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$m();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const o=r,s=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:m,DOMParser:h,trustedTypes:p}=t,f=c.prototype,g=ym(f,"cloneNode"),v=ym(f,"remove"),y=ym(f,"nextSibling"),b=ym(f,"childNodes"),x=ym(f,"parentNode");if("function"==typeof i){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let w,k="";const{implementation:S,createNodeIterator:C,createDocumentFragment:T,getElementsByTagName:I}=r,{importNode:E}=o;let A={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Bd&&"function"==typeof x&&S&&void 0!==S.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:L,TMPLIT_EXPR:_,DATA_ATTR:P,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:D,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:M}=zm;let{IS_ALLOWED_URI:U}=zm,F=null;const j=fm({},[...bm,...xm,...wm,...Sm,...Tm]);let z=null;const $=fm({},[...Im,...Em,...Am,...Om]);let H=Object.seal(Xd(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}})),B=null,W=null,V=!0,G=!0,q=!1,Y=!0,K=!1,X=!0,J=!1,Z=!1,Q=!1,ee=!1,te=!1,ne=!1,re=!0,oe=!1,se=!0,ae=!1,ie={},le=null;const ce=fm({},["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"]);let ue=null;const de=fm({},["audio","video","img","source","image","track"]);let me=null;const he=fm({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pe="http://www.w3.org/1998/Math/MathML",fe="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let ve=ge,ye=!1,be=null;const xe=fm({},[pe,fe,ge],sm);let we=fm({},["mi","mo","mn","ms","mtext"]),ke=fm({},["annotation-xml"]);const Se=fm({},["title","style","font","a","script"]);let Ce=null;const Te=["application/xhtml+xml","text/html"];let Ie=null,Ee=null;const Ae=r.createElement("form"),Oe=function(e){return e instanceof RegExp||e instanceof Function},Le=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ee||Ee!==e){if(e&&"object"==typeof e||(e={}),e=vm(e),Ce=-1===Te.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ie="application/xhtml+xml"===Ce?sm:om,F=um(e,"ALLOWED_TAGS")?fm({},e.ALLOWED_TAGS,Ie):j,z=um(e,"ALLOWED_ATTR")?fm({},e.ALLOWED_ATTR,Ie):$,be=um(e,"ALLOWED_NAMESPACES")?fm({},e.ALLOWED_NAMESPACES,sm):xe,me=um(e,"ADD_URI_SAFE_ATTR")?fm(vm(he),e.ADD_URI_SAFE_ATTR,Ie):he,ue=um(e,"ADD_DATA_URI_TAGS")?fm(vm(de),e.ADD_DATA_URI_TAGS,Ie):de,le=um(e,"FORBID_CONTENTS")?fm({},e.FORBID_CONTENTS,Ie):ce,B=um(e,"FORBID_TAGS")?fm({},e.FORBID_TAGS,Ie):vm({}),W=um(e,"FORBID_ATTR")?fm({},e.FORBID_ATTR,Ie):vm({}),ie=!!um(e,"USE_PROFILES")&&e.USE_PROFILES,V=!1!==e.ALLOW_ARIA_ATTR,G=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,K=e.SAFE_FOR_TEMPLATES||!1,X=!1!==e.SAFE_FOR_XML,J=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,Q=e.FORCE_BODY||!1,re=!1!==e.SANITIZE_DOM,oe=e.SANITIZE_NAMED_PROPS||!1,se=!1!==e.KEEP_CONTENT,ae=e.IN_PLACE||!1,U=e.ALLOWED_URI_REGEXP||Rm,ve=e.NAMESPACE||ge,we=e.MATHML_TEXT_INTEGRATION_POINTS||we,ke=e.HTML_INTEGRATION_POINTS||ke,H=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Oe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Oe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(H.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),K&&(G=!1),te&&(ee=!0),ie&&(F=fm({},Tm),z=[],!0===ie.html&&(fm(F,bm),fm(z,Im)),!0===ie.svg&&(fm(F,xm),fm(z,Em),fm(z,Om)),!0===ie.svgFilters&&(fm(F,wm),fm(z,Em),fm(z,Om)),!0===ie.mathMl&&(fm(F,Sm),fm(z,Am),fm(z,Om))),e.ADD_TAGS&&(F===j&&(F=vm(F)),fm(F,e.ADD_TAGS,Ie)),e.ADD_ATTR&&(z===$&&(z=vm(z)),fm(z,e.ADD_ATTR,Ie)),e.ADD_URI_SAFE_ATTR&&fm(me,e.ADD_URI_SAFE_ATTR,Ie),e.FORBID_CONTENTS&&(le===ce&&(le=vm(le)),fm(le,e.FORBID_CONTENTS,Ie)),se&&(F["#text"]=!0),J&&fm(F,["html","head","body"]),F.table&&(fm(F,["tbody"]),delete B.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw mm('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw mm('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,k=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(p,s)),null!==w&&"string"==typeof k&&(k=w.createHTML(""));Yd&&Yd(e),Ee=e}},_e=fm({},[...xm,...wm,...km]),Pe=fm({},[...Sm,...Cm]),Ne=function(e){nm(n.removed,{element:e});try{x(e).removeChild(e)}catch(t){v(e)}},De=function(e,t){try{nm(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){nm(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Ne(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Re=function(e){let t=null,n=null;if(Q)e="<remove></remove>"+e;else{const t=am(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Ce&&ve===ge&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=w?w.createHTML(e):e;if(ve===ge)try{t=(new h).parseFromString(o,Ce)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(ve,"template",null);try{t.documentElement.innerHTML=ye?k:o}catch(e){}}const s=t.body||t.documentElement;return e&&n&&s.insertBefore(r.createTextNode(n),s.childNodes[0]||null),ve===ge?I.call(t,J?"html":"body")[0]:J?t.documentElement:s},Me=function(e){return C.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Ue=function(e){return e instanceof m&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Fe=function(e){return"function"==typeof l&&e instanceof l};function je(e,t,r){Qd(e,(e=>{e.call(n,t,r,Ee)}))}const ze=function(e){let t=null;if(je(A.beforeSanitizeElements,e,null),Ue(e))return Ne(e),!0;const r=Ie(e.nodeName);if(je(A.uponSanitizeElement,e,{tagName:r,allowedTags:F}),X&&e.hasChildNodes()&&!Fe(e.firstElementChild)&&dm(/<[/\w!]/g,e.innerHTML)&&dm(/<[/\w!]/g,e.textContent))return Ne(e),!0;if(7===e.nodeType)return Ne(e),!0;if(X&&8===e.nodeType&&dm(/<[/\w]/g,e.data))return Ne(e),!0;if(!F[r]||B[r]){if(!B[r]&&He(r)){if(H.tagNameCheck instanceof RegExp&&dm(H.tagNameCheck,r))return!1;if(H.tagNameCheck instanceof Function&&H.tagNameCheck(r))return!1}if(se&&!le[r]){const t=x(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t)for(let r=n.length-1;r>=0;--r){const o=g(n[r],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,y(e))}}return Ne(e),!0}return e instanceof c&&!function(e){let t=x(e);t&&t.tagName||(t={namespaceURI:ve,tagName:"template"});const n=om(e.tagName),r=om(t.tagName);return!!be[e.namespaceURI]&&(e.namespaceURI===fe?t.namespaceURI===ge?"svg"===n:t.namespaceURI===pe?"svg"===n&&("annotation-xml"===r||we[r]):Boolean(_e[n]):e.namespaceURI===pe?t.namespaceURI===ge?"math"===n:t.namespaceURI===fe?"math"===n&&ke[r]:Boolean(Pe[n]):e.namespaceURI===ge?!(t.namespaceURI===fe&&!ke[r])&&!(t.namespaceURI===pe&&!we[r])&&!Pe[n]&&(Se[n]||!_e[n]):!("application/xhtml+xml"!==Ce||!be[e.namespaceURI]))}(e)?(Ne(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!dm(/<\/no(script|embed|frames)/i,e.innerHTML)?(K&&3===e.nodeType&&(t=e.textContent,Qd([O,L,_],(e=>{t=im(t,e," ")})),e.textContent!==t&&(nm(n.removed,{element:e.cloneNode()}),e.textContent=t)),je(A.afterSanitizeElements,e,null),!1):(Ne(e),!0)},$e=function(e,t,n){if(re&&("id"===t||"name"===t)&&(n in r||n in Ae))return!1;if(G&&!W[t]&&dm(P,t));else if(V&&dm(N,t));else if(!z[t]||W[t]){if(!(He(e)&&(H.tagNameCheck instanceof RegExp&&dm(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&dm(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t))||"is"===t&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&dm(H.tagNameCheck,n)||H.tagNameCheck instanceof Function&&H.tagNameCheck(n))))return!1}else if(me[t]);else if(dm(U,im(n,R,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==lm(n,"data:")||!ue[e])if(q&&!dm(D,im(n,R,"")));else if(n)return!1;return!0},He=function(e){return"annotation-xml"!==e&&am(e,M)},Be=function(e){je(A.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Ue(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0};let o=t.length;for(;o--;){const s=t[o],{name:a,namespaceURI:i,value:l}=s,c=Ie(a),u=l;let d="value"===a?u:cm(u);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,je(A.uponSanitizeAttribute,e,r),d=r.attrValue,!oe||"id"!==c&&"name"!==c||(De(a,e),d="user-content-"+d),X&&dm(/((--!?|])>)|<\/(style|title)/i,d)){De(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){De(a,e);continue}if(!Y&&dm(/\/>/i,d)){De(a,e);continue}K&&Qd([O,L,_],(e=>{d=im(d,e," ")}));const m=Ie(e.nodeName);if($e(m,c,d)){if(w&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(i);else switch(p.getAttributeType(m,c)){case"TrustedHTML":d=w.createHTML(d);break;case"TrustedScriptURL":d=w.createScriptURL(d)}if(d!==u)try{i?e.setAttributeNS(i,a,d):e.setAttribute(a,d),Ue(e)?Ne(e):tm(n.removed)}catch(t){De(a,e)}}else De(a,e)}je(A.afterSanitizeAttributes,e,null)},We=function e(t){let n=null;const r=Me(t);for(je(A.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)je(A.uponSanitizeShadowNode,n,null),ze(n),Be(n),n.content instanceof a&&e(n.content);je(A.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,s=null,i=null,c=null;if(ye=!e,ye&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Fe(e)){if("function"!=typeof e.toString)throw mm("toString is not a function");if("string"!=typeof(e=e.toString()))throw mm("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Z||Le(t),n.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=Ie(e.nodeName);if(!F[t]||B[t])throw mm("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)r=Re("\x3c!----\x3e"),s=r.ownerDocument.importNode(e,!0),1===s.nodeType&&"BODY"===s.nodeName||"HTML"===s.nodeName?r=s:r.appendChild(s);else{if(!ee&&!K&&!J&&-1===e.indexOf("<"))return w&&ne?w.createHTML(e):e;if(r=Re(e),!r)return ee?null:ne?k:""}r&&Q&&Ne(r.firstChild);const u=Me(ae?e:r);for(;i=u.nextNode();)ze(i),Be(i),i.content instanceof a&&We(i.content);if(ae)return e;if(ee){if(te)for(c=T.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return(z.shadowroot||z.shadowrootmode)&&(c=E.call(o,c,!0)),c}let d=J?r.outerHTML:r.innerHTML;return J&&F["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&dm(Fm,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),K&&Qd([O,L,_],(e=>{d=im(d,e," ")})),w&&ne?w.createHTML(d):d},n.setConfig=function(){Le(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},n.clearConfig=function(){Ee=null,Z=!1},n.isValidAttribute=function(e,t,n){Ee||Le({});const r=Ie(e),o=Ie(t);return $e(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&nm(A[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=em(A[e],t);return-1===n?void 0:rm(A[e],n,1)[0]}return tm(A[e])},n.removeHooks=function(e){A[e]=[]},n.removeAllHooks=function(){A={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const Bm=["script","svg"],Wm=e=>-1!==e.lastIndexOf("</html>"),Vm=e=>({sanitizeHtml:(t,n)=>e(t)?t:(e=>{Hm.addHook("uponSanitizeElement",((e,t)=>{T(Bm,t.tagName)||Y(t.allowedTags,t.tagName)||(t.allowedTags[t.tagName]=!0)})),Hm.addHook("uponSanitizeAttribute",((e,t)=>{0===t.attrName.indexOf("on")||Y(t.allowedAttributes,t.attrName)||(t.allowedAttributes[t.attrName]=!0),t.attrValue&&-1!==t.attrValue.indexOf("\n")&&(t.attrValue=t.attrValue.replace(/\r?\n/g,""))}));const t=(e=>Se(Te(e),"<!"))(e),n=t?`<body>${e}</body>`:(e=>e.replace(/^[\S\s]*?(<!DOCTYPE|<html)/i,"$1"))(e),r=Hm.sanitize(n,{ALLOW_UNKNOWN_PROTOCOLS:!0,FORBID_TAGS:Bm,WHOLE_DOCUMENT:Wm(e)});return Hm.removeHook("uponSanitizeElement"),Hm.removeHook("uponSanitizeAttribute"),t?(o=we(r,"<body>"),Ce(o,"</body>")?(e=>e.substring(0,e.length-7))(o):o):r;var o})(t),sanitizeText:p}),Gm={sanitizeHtml:p,sanitizeText:p},qm=e=>t=>({discriminator:e,data:t}),Ym=e=>t=>t.discriminator===e?w.some(t.data):w.none(),Km=qm("event"),Xm=qm("html"),Jm=qm("images"),Zm=qm("word"),Qm=qm("text"),eh=qm("void"),th=Ym("html"),nh=Ym("images"),rh=Ym("word"),oh=Ym("text"),sh=["^image/","file"],ah=e=>(e=>ke(e,"<html")&&(ke(e,'xmlns:o="urn:schemas-microsoft-com:office:office"')||ke(e,'xmlns:x="urn:schemas-microsoft-com:office:excel"')))(e)||(e=>ke(e,'meta name="ProgId" content="Word.Document"'))(e),ih=e=>ke(e,'id="docs-internal-guid-'),lh=e=>e.length>0,ch=(e,t)=>Hd(e.types,t).map((t=>e.getData(t.type))).filter(lh),uh=e=>ch(e,"html"),dh=e=>uh(e).filter(ih),mh=e=>w.from(e.clipboardData).filter($d),hh=e=>{const t=bt.fromTag("div"),n=((e,t)=>uo(e,t,[sa]))(tn(t),e);return((e,t)=>{const n=tn(e).dom,r=bt.fromDom(n.createDocumentFragment()),o=Nn(t,n);kn(r,o),Ln(e),bn(e,r)})(t,n),Xm({container:t})},ph={native:"Outside of Textbox.io pasting HTML5 API (could be internal)",fallback:"Outside of Textbox.io pasting offscreen (could be internal)",msoffice:"Word Import pasting",googledocs:"Google Docs pasting",image:"Image pasting",plaintext:"Only plain text is available to paste",text:"Plain text pasting",none:"There is no valid way to paste",discard:"There is no valid way to paste, discarding content"},fh={getLabelForApi:e=>{const t=$(ph);return P(t,(t=>ph[t]===e)).fold(h("unknown"),(e=>{switch(e){case"native":case"fallback":return"html";case"none":case"discard":return"invalid";default:return e}}))},...ph},gh=e=>E(e,(e=>e.asset)),vh=(e,t,n)=>{const r=pd({cancel:hd([]),error:hd(["message"]),insert:hd(["elements","assets","correlated","isInternal","source","mode"]),block:hd(["state"])});let o=!1;r.registry.block.bind((e=>o=e.state));const s=(n,o)=>{r.trigger.block(!0);const s=((e,t,n)=>{const r=((e,t)=>z(e,(e=>e.getAvailable(t).map((t=>Fr(e.steps,t,e.label,e.capture()))))))(e,n);return r.getOrThunk((()=>{const e=t.getAvailable(n);return Fr(t.steps,e,t.label,t.capture())}))})(e,t,n);s.capture&&o();const a=((e,t)=>{const n={response:Ar([],[]),bundle:Nr({})};return _(e,((e,n)=>Ur(e)?e.then((e=>zr(e,t,n))):zr(e,t,n)),n)})(s.steps,s.input),i=fh.getLabelForApi(s.label),l=e=>{const t=e.bundle.isInternal.getOr(!1),n=e.bundle.officeStyles.fold(h("auto"),(e=>e?"merge":"clean"));r.trigger.block(!1),Ir(e.response,(e=>{r.trigger.error(e)}),((e,o)=>{r.trigger.insert(e,gh(o),o,t,i,n)}),(()=>{r.trigger.cancel()}),((e,o,s)=>{r.trigger.insert(e,gh(o),o,t,i,n),r.trigger.error(s)}))};return Ur(a)?a.then(l):l(a)};return{paste:e=>{const t=rn(bt.fromDom(e.target));Cr(t.dom).each((t=>{if(!lr(t.start,xd())){const t=((e,t=Gm)=>{const n=e=>{return void 0===e.items?w.none():(t=sh,n=e.types,z(t,(e=>Hd(n,e)))).map((t=>{const n=[];for(let t=0;t<e.items.length;t++)n.push(e.items[t]);return Jm({images:n})}));var t,n},r=e=>z(e.types,(n=>"text/plain"===n?w.some(e.getData(n)).map((e=>Qm({text:t.sanitizeText(e)}))):w.none()));return{getWordData:()=>mh(e).bind((e=>(e=>uh(e).filter(ah))(e).map((t=>{const n=(e=>ch(e,"rtf"))(e);return Zm({html:t,rtf:n.fold((()=>jd()),(e=>zd(e)))})})))),getGoogleDocsData:()=>mh(e).bind(dh).map((e=>t.sanitizeHtml(e,"googledocs"))).map(hh),getImage:()=>mh(e).bind(n),getText:()=>mh(e).bind(r),getHtml:()=>mh(e).bind(uh).map(t.sanitizeHtml).map(hh),getOnlyText:()=>mh(e).bind((e=>{return 1===(t=e.types).length&&"text/plain"===t[0]?r(e):w.none();var t})),getNative:()=>Km({nativeEvent:e}),getVoid:()=>eh({})}})(e,n);s(t,(()=>{e.preventDefault()}))}}))},pasteCustom:(e,t=d)=>{s(e,t)},isBlocked:()=>o,destroy:d,events:r.registry}},yh=(e,t)=>({asset:e,image:t}),bh=(e,t)=>Ea.cata(e,((e,n,r)=>(Cn(t,"src",r),!0)),b),xh=(e,t)=>{const n=[];return A(e,((e,r)=>{const o=t[r];bh(e,o)&&n.push(yh(e,o))})),n},wh=(e,t)=>({asyncAsset:e.then(oe.value,oe.error),image:t}),kh=e=>{const t=bt.fromTag("div");return kn(t,e),mr(t,"img[src]")},Sh=e=>0===e.indexOf("data:")&&e.indexOf("base64")>-1,Ch=e=>0===e.indexOf("blob:"),Th=e=>En(e,"src").exists((e=>Sh(e)||Ch(e))),Ih=e=>R(kh(e),(e=>{const t=En(e,"src").getOr("");return Sh(t)?((e,t)=>{return(n=t,Ra(n)).map((t=>wh(qa(t),e)));var n})(e,t).toArray():Ch(t)?((e,t)=>{return(n=t,w.from(0===(r=n).indexOf("blob:")?Da(r):0===r.indexOf("data:")?Ma(r):null)).map((t=>{const n=t.then(qa);return wh(n,e)}));var n,r})(e,t).toArray():[]})),Eh=e=>{const t=L(e,(e=>!en("img")(e)||!Th(e)));return Lr(t,[],"errors.local.images.disallowed")};var Ah=e=>(t,n)=>{const r=()=>Promise.resolve(n),o=(t,o)=>!1===e.allowLocalImages?(e=>{const t=L(kh(e),Th);return A(t,_n),Promise.resolve({response:t.length>0?Eh(e):n.response,bundle:n.bundle})})(t):0===o.length?(e=>{const t=Ih(e),r=Promise.all(E(t,(e=>e.asyncAsset))),o=E(t,(e=>e.image));return r.then((t=>{const r=(e=>{const t=[],n=[];return A(e,(e=>{e.fold((e=>{t.push(e)}),(e=>{n.push(e)}))})),{errors:t,values:n}})(t),s=xh(r.values,o);return{response:r.errors.length>0?Lr(e,s,"errors.imageimport.failed"):Ar(e,s),bundle:n.bundle}}))})(t):r();return Ir(n.response,Rr,o,r,o)};const Oh=/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@\/]*)(?::([^:@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,Lh=/^(?:(?![^:@\/]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*)(?::([^:@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,_h=/(?:^|&)([^&=]+)=?([^&]*)/g,Ph=e=>{const t={};for(;;){const n=_h.exec(e);if(null===n)return t;t[n[1]]=n[2]}},Nh=(e,t)=>{const n=()=>Promise.resolve({response:t.response,bundle:t.bundle}),r=e=>$a(e).then((t=>{const n=le("image"),r=Wa(e,t),o=URL.createObjectURL(e);return Ea.blob(n,r,o)})),o=(e,t)=>Ea.url(le("image"),t,e),s=(e,n)=>{let s=!1;const a=R(e,(e=>mr(e,"img")));return Promise.all(E(a,(e=>{const t=e.dom.src;return(e=>{const t=((e,t={})=>{var n;return((e,t)=>{const n=(t?Oh:Lh).exec(e),r=U(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],((e,t)=>{var r;return null!==(r=n[t])&&void 0!==r?r:""}));return{...r,queryKey:Ph(r.query)}})(e,null!==(n=t.strictMode)&&void 0!==n&&n)})(e);return ke(t.host,"google")&&!Se(t.path,"/drawings/")})(t)?ii(e.dom.src,void 0,!0).then(r,(()=>(s=!0,o(e,t)))):o(e,t)}))).then((r=>{const o=n.concat(xh(r,a));return{response:s?Lr(e,o,"errors.imageimport.failed"):Ar(e,o),bundle:t.bundle}}),(()=>({response:Er("errors.imageimport.invalid"),bundle:t.bundle})))};return Ir(t.response,n,s,n,s)},Dh=(e,t)=>{const n=((e,t)=>{const n=t.translations,r=e=>w.some(ce(t,{officeStyles:e,gdocsStyles:e,htmlStyles:e}));return{get:o=>{const s=(e=>{switch(e){case ls.Word:return"officeStyles";case ls.GoogleDocs:return"gdocsStyles";default:return"htmlStyles"}})(o),a=t[s];return c(a)?a().then((e=>r("merge"===e)),(e=>(console.error(e),r(!1)))):"clean"===a?Promise.resolve(r(!1)):"merge"===a?Promise.resolve(r(!0)):new Promise((t=>{const o=bt.fromTag("div");ar(o,Od("styles-dialog-content"));const s=bt.fromTag("p"),a=Nn(n("cement.dialog.paste.instructions"));kn(s,a),bn(o,s);const i={text:n("cement.dialog.paste.clean"),tabindex:0,className:Od("clean-styles"),click:()=>{c(),t(r(!1))}},l={text:n("cement.dialog.paste.merge"),tabindex:1,className:Od("merge-styles"),click:()=>{c(),t(r(!0))}},c=()=>{u.destroy()},u=e();u.setTitle(n("cement.dialog.paste.title")),u.setContent(o),u.setButtons([i,l]),u.events.close.bind((()=>{c(),t(w.none())})),u.show()}))},destroy:d}})(e,t);return(e,t)=>{const r=t.bundle,o=t.response;return n.get(ld(r)).then((e=>e.fold((()=>({response:Or(),bundle:t.bundle})),(e=>({response:o,bundle:Nr({officeStyles:e.officeStyles,gdocsStyles:e.gdocsStyles,htmlStyles:e.htmlStyles})})))))}},Rh=(e,t)=>(n,r)=>id(r.bundle)?(e=>Promise.resolve({response:r.response,bundle:Nr({officeStyles:e,gdocsStyles:e,htmlStyles:e})}))(!0):Dh(e,t)(n,r),Mh=(e,t)=>{if(!Mn(e))throw new Error("Internal error: attempted to write to an iframe that is not in the DOM");const n=(e=>(e=>{const t=e.dom;try{return((e,t)=>null!=e?w.some(t(e)):w.none())(t.contentWindow?t.contentWindow.document:t.contentDocument,bt.fromDom)}catch(e){return console.log("Error reading iframe: ",t),console.log("Error was: "+e),w.none()}})(e).getOrThunk((()=>tn(e))))(e),r=n.dom;r.open("text/html","replace"),r.write(t),r.close()},Uh=e=>{const t=(n=bt.fromDom(document.body),{play:(e,t,r)=>{const o=bt.fromTag("div"),s=bt.fromTag("iframe");zn(o,{display:"none"});const a=fn(s,"load",(()=>{var n;a.unbind(),Mh(s,e);const i=null===(n=s.dom.contentWindow)||void 0===n?void 0:n.document;if(void 0===i)throw new Error("sandbox iframe load event did not fire correctly");const l=bt.fromDom(i),c=l.dom.body;if(void 0===c)throw new Error("sandbox iframe does not have a body");const u=bt.fromDom(c),d=t(l,u);_n(o),setTimeout(g(r,d),0)}));bn(o,s),bn(n,o)}});var n;return n=>new Promise((r=>{t.play(n,((t,n)=>(((e,t,n)=>{const r=n.mergeInline();r&&(Qu(e,t,ed),(e=>{aa(e)})(t)),td(t,r)})(t,n,{mergeInline:h(e)}),Dn(n))),r)}))},Fh=(e,t,n,r)=>{const o=e.html;return n.cleanDocument(o,t,r).then((e=>{if(null==(n=e)||0===n.length)return{response:Ar([],[]),bundle:Nr({})};{const n=void 0===r.sanitizer?Vm(r.intraFlag.isMarked):r.sanitizer;return((e,t,n,r)=>{const o=e=>({response:e,bundle:Nr({})}),s=r.sanitizeHtml(t,"word");return Uh(e)(s).then((e=>{const t=Nn(e),r=e=>o(Ar(t,e)),s=bt.fromTag("div");kn(s,t);const a=L(Tt("img[src]",s),(e=>En(e,"src").exists((e=>Se(e,"blob:")||Se(e,"data:"))))),i=Tt("img[data-image-src]",s);if(0===a.length&&0===i.length)return r([]);if(n)return A(a,(e=>On(e,"id"))),(e=>Promise.all(E(e,(e=>{const t=e.dom;return Va(t).then((n=>n.toBlob().then((r=>((n,r)=>{const o=Se(t.src,"blob:")?t.src:URL.createObjectURL(r),s=le("image"),a=Ea.blob(s,n,o);return yh(a,e)})(n,r)))))}))))(a).then(r);{A(a,_n),A(i,_n);const e=cn(s);return o(Lr(e,[],"errors.local.images.disallowed"))}}))})(t,e,r.allowLocalImages,n)}var n}),(e=>(console.error("PowerPaste error code: WIM01"),{response:Er("errors.paste.process.failure"),bundle:Nr({})})))},jh=Vt(),zh=e=>{try{const t=e(),n=null!=t&&t.length>0?Nn(t):[];return oe.value(n)}catch(e){return console.error("PowerPaste error code: PT01. Message: ",e),oe.error("errors.paste.process.failure")}},$h=e=>e.fold(Dr,(e=>({response:Ar(e,[]),bundle:Nr({})}))),Hh=(e,t,n,r,o)=>zh((()=>{const s={type:r,merge:n,cleanFilteredInlineElements:o.cleanFilteredInlineElements,indentUseMargin:o.indentUseMargin,preprocessor:{defaultProtocol:o.defaultProtocol,autoLinkUrls:o.autoLinkUrls}};return((e,t,n,r)=>{$i(n,r.preprocessor);const o=Dn(n),s=((e,t)=>{const n=t.merge,r=((e,t)=>{const n=t.browser.isFirefox(),r=co([(s=n?Hr:$r,a=!n,mo(((e,t)=>{const n=((e,t,n)=>t(bt.fromDom(e.getNode())).fold((()=>[e]),(t=>{const r=e.type()===Wr,o=[qr(t.dom,r)];return!r&&n&&o.push(qr(t.dom,!0)),o})))(t,s,a);e.emitTokens(n)}),d))]),o=n?d:Hs;var s,a;return{annotate:[e.type===ls.Word?r:d],local:[o]}})(t,e);return D([r.local,xa(t),ka(t),r.annotate,(o=n?[]:t.cleanFilteredInlineElements,[ca,da,Js(o)]),wa(t),Ca(t,e),[Ts],[Xs],[Ds],[Rs],ba(t),[na,ra,Bs,oa],[Ws],[Vs],[Gs],[Qs],Ta(t),[ta],[Ys],[aa],Ia(t),[Zs],[Ms]]);var o})(t,r);return uo(e,o,s)})(e,jh,t,s)})),Bh=(e,t)=>{const n=zh((()=>((e,t)=>((e,t)=>uo(e,t,[Rs,oa]))(e,Dn(t)))(e,t)));return $h(n)},Wh=(e,t,n,r,o)=>Hh(e,t,r,n,o).fold(Rr,(e=>Promise.resolve({response:Ar(e,[]),bundle:Nr({})}))),Vh=e=>"\n"===e||"\r"===e,Gh=(e,t)=>{const n=(e=>{const t=bt.fromTag("div");return((e,t)=>{e.dom.textContent=t})(t,e),Dn(t)})(e),r=((e,t)=>{const n=((e,t)=>{const n=e.replace(/\t/g,(r=t)<=0?"":new Array(r+1).join(" "));var r;const o=_(n,((e,t)=>(e=>-1!==" \f\t\v".indexOf(e))(t)||"\xa0"===t?e.pcIsSpace||""===e.str||e.str.length===n.length-1||((e,t)=>t<e.length&&t>=0&&Vh(e[t]))(n,e.str.length+1)?{pcIsSpace:!1,str:e.str+"\xa0"}:{pcIsSpace:!0,str:e.str+" "}:{pcIsSpace:Vh(t),str:e.str+t}),{pcIsSpace:!1,str:""});return o.str})(e,t).replace(/^[\r\n]*|[\r\n]*$/g,"").split(/(?:\r?\n){2}/),r=E(n,(e=>e.split(/\n|\r\n/).join("<br />")));return 1===r.length?r[0]:E(r,(e=>"<p>"+e+"</p>")).join("")})(n,t),o=Nn(r);return Ar(o,[])},qh=e=>(t,n)=>((e,t)=>{const n=oh(e).getOrDie("Required text input for Text Handler");return{response:n.text.length>0?Gh(n.text,t):Or(),bundle:Nr({})}})(t,e),Yh=e=>(t,n)=>{const r=(t,r)=>{const o=bt.fromTag("div");kn(o,t),$i(o,e);const s=cn(o);return{response:Ar(s,r),bundle:n.bundle}},o=h(n);return Ir(n.response,o,r,o,r)},Kh=(e,t,n)=>(r,o)=>{const s=th(r).getOrDie("Wrong input type for HTML handler").container,a=tn(t),i=o.bundle;return id(i)?Bh(a,s):(e(s),((e,t,n,r,o)=>{const s=Hh(e,t,n,r,o);return $h(s)})(a,s,rd(i),ld(i),n))},Xh=(e,t,n)=>(r,o)=>{const s=o.bundle;return(e=>({handle:(t,n)=>e.proxyBin.fold((()=>(console.error(t),Promise.resolve({response:Or(),bundle:Nr({})}))),n)}))(s).handle("There was no proxy bin setup. Ensure you have run proxyStep first.",(r=>{const o=rd(s),a=ld(s),i=id(s),l=tn(e);return i?((e,t,n,r)=>{const o=ls.Html,s=t.findClipboardTags(cn(n)).getOr([]);return A(s,_n),Wh(e,n,o,!0,r)})(l,t,r,n):((e,t,n,r,o)=>Wh(e,t,r,n,o))(l,r,o,a,n)}))},Jh=(e,t)=>(n,r)=>{const o=rh(n).getOrDie("Wrong input type for Word Import handler"),s=od(r.bundle);return Fh(o,s,e,t)},Zh=(e,t)=>Mr,Qh=e=>(t,n)=>{const r=Pr(n.bundle,Nr(e));return{response:n.response,bundle:r}},ep=(e,t)=>(e=>{const t=e=>({response:Ar([e],[]),bundle:Nr({})});return(e=>(e=>{const t=mr(e,"img");return Promise.all(E(t,mi)).then((()=>e))})(e))(e).then(t).catch((()=>t(e)))})(th(e).getOrDie("Wrong input type for HTML handler").container);Vt();var tp=(e,t,n,r)=>(t,o)=>{const s=o.response;return new Promise(((t,o)=>{const a=e(n);a.events.after.bind((e=>{const n=e.container;ar(n,_d());const o=(c=Dn(n)).indexOf("<o:p>")>=0||c.indexOf("mso-list")>=0||c.indexOf("p.MsoNormal, li.MsoNormal, div.MsoNormal")>=0||c.indexOf("MsoListParagraphCxSpFirst")>=0||c.indexOf("<w:WordDocument>")>=0,a=((e,t)=>{const n=mr(t,"*[id]");return I(n,(e=>En(e,"id").exists((e=>Se(e,"docs-internal-guid-")))))})(0,n),i=cn(n),l=r.findClipboardTags(i).isSome();var c;t({response:s,bundle:Nr({isWord:o,isGoogleDocs:a,isInternal:l,proxyBin:n})})})),a.run()}))};const np=K([{unsupported:["id","message","isEquation","attrs"]},{supported:["id","contentType","blob","isEquation","attrs"]}]),rp={unsupported:np.unsupported,supported:np.supported,cata:(e,t,n)=>e.fold(t,n)},op=(e,t,n)=>t.indexOf(e,n),sp=(e,t,n,r,o,s,a)=>-1===e||-1===t?w.none():w.some({start:e,end:t,bower:n,regex:r,idRef:o,isEquation:s,attrs:a}),ap=(e,t,n)=>e.substring(t,n),ip=(e,t)=>{if(-1===t)return t;let n=0;const r=e.length;do{const o=e.indexOf("{",t),s=e.indexOf("}",t);if(s>o&&-1!==o?(t=o+1,++n):(o>s||o<0)&&-1!==s&&(t=s+1,--n),t>r||-1===s)return-1}while(n>0);return t},lp=(e,t,n,r,o)=>{const s=ap(e,n,r),a=((e,t)=>{const n=op("\\picscalex",e,t),r=op("\\bliptag",e,n);return n>-1&&n<r?w.from(e.substring(n,r)):w.none()})(e,n);return sp(n,r,s,/[^a-fA-F0-9]([a-fA-F0-9]+)\}$/,"i",o,a)},cp=(e,t,n,r,o)=>{const s=ap(e,n,r);return sp(n,r,s,/([a-fA-F0-9]{64,})(?:\}.*)/,"s",o,w.none())},up=(e,t)=>((e,t)=>{const n=op("{\\pict{",e,t),r=ip(e,n),o=op("{\\shp{",e,t),s=ip(e,o),a=op("{\\mmathPict{",e,t),i=ip(e,a),l=-1!==a&&a<n&&i>r,c=g(cp,e,t,o,s,-1!==a&&a<o&&i>s),u=g(lp,e,t,n,r,l);return-1===n&&-1===o?w.none():-1===n?c():-1===o||o<n&&s>r?u():n<o&&r>s?c():n<o?u():o<n?c():w.none()})(e,t),dp=(e,t)=>{let n=[];const r=()=>e.length,o=e=>{const r=((e,t)=>{const n=e.bower,r=e.regex,o=e.isEquation,s=e.attrs;return(e=>{const t=/\\shplid(\d+)/.exec(e);return null!==t?w.some(t[1]):w.none()})(n).map((a=>{const i=e.idRef+a;return((e,t=!1)=>e.indexOf("\\pngblip")>=0?oe.value("image/png"):e.indexOf("\\jpegblip")>=0?oe.value("image/jpeg"):e.indexOf("\\emfblip")>=0&&t?oe.value("image/emf"):oe.error("errors.imageimport.unsupported"))(n,t).fold((e=>rp.unsupported(i,e,o,s)),(e=>((e,t)=>{const n=e.match(t);return n&&n[1]&&n[1].length%2==0?oe.value(n[1]):oe.error("errors.imageimport.invalid")})(n,r).fold((e=>rp.unsupported(i,e,o,s)),(t=>rp.supported(i,e,((e,t)=>{if(0===e.length)throw new Error("Zero length content passed to Hex conversion");const n=(e=>{const t=new Array(e.length/2);for(let n=0;n<e.length;n+=2){const r=e.substr(n,2);t[Math.floor(n/2)]=parseInt(r,16)}return t})(e),r=new Uint8Array(n);return new Blob([r],{type:t})})(t,e),o,s)))))}))})(e,t);return n=n.concat(r.toArray()),e.end};let s=0;for(;s<e.length;)s=up(e,s).fold(r,o);return n},mp=e=>rp.cata(e,((e,t,n)=>e),((e,t,n,r,o)=>e)),hp=e=>rp.cata(e,((e,t,n)=>n),((e,t,n,r,o)=>r)),pp=e=>rp.cata(e,((e,t,n)=>oe.error(t)),((e,t,n,r,o)=>oe.value(n))),fp=(e,t)=>{const n=new RegExp("\\\\pic"+t+"(\\-?\\d+)\\\\").exec(e)[1];return parseInt(n,10)},gp=(e,t,n,r,o)=>{const s=[],a=[];let i=!1;const l=R(e,((e,l)=>{const c=In(e,"data-image-id");return On(e,"rtf-data-image"),On(e,"data-image-id"),On(e,"data-ms-equation"),o||On(e,"data-image-src"),"unsupported"===c?(i=!0,Cn(e,"alt",n("errors.imageimport.unsupported")),[]):P(t,((e,t)=>r(e,t,c,l))).fold((()=>(console.log("WARNING: unable to find data for image ",e.dom),i=!0,Cn(e,"alt",n("errors.imageimport.unsupported")),[])),(t=>pp(t).fold((t=>(i=!0,console.error("PowerPaste error code: RTF04"),Cn(e,"alt",n(t)),"errors.imageimport.unsupported"===t&&On(e,"src"),[])),(n=>{var r;return s.push(e),a.push((r=t,rp.cata(r,((e,t,n)=>w.none()),((e,t,n,r,o)=>o)))),o&&On(e,"data-image-src"),[n]}))))}));return{blobs:l,filteredImages:s,imageAttrs:a,failedImage:i}},vp=(e,t,n,r,o)=>{const s=(e=>_(e,((e,t)=>{const n=mp(t),r=hp(t);return N(e,(e=>!(r||hp(e))&&mp(e)===n)).fold((()=>e.concat([t])),(n=>pp(e[n]).isValue()?e:e.slice(0,n).concat(e.slice(n+1)).concat([t])))}),[]))(t),{pass:a,fail:i}=O(s,(e=>!hp(e))),{pass:l,fail:c}=O(e,(e=>!(e=>"true"===In(e,"data-ms-equation"))(e))),u=gp(l,a,r,((e,t,n,r)=>mp(e)===n),o.keepSrc),d=gp(c,i,r,((e,t,n,r)=>t===r),o.keepSrc),m=u.filteredImages.concat(d.filteredImages),h=u.imageAttrs.concat(d.imageAttrs),p=u.blobs.concat(d.blobs),f=u.failedImage||d.failedImage;o.emfProcessor.fold((()=>Promise.resolve(p)),(e=>Promise.all(E(p,(t=>"image/emf"===t.type?e(t):Promise.resolve(t)))))).then((e=>{Ka(e).then((e=>{((e,t)=>e.length===t.length?Promise.all(E(e,((e,n)=>((e,t)=>t.fold((()=>Promise.resolve(e)),(t=>Ea.cata(e,((n,r,o)=>r.toCanvas().then((s=>{const a=bt.fromDom(s),i=En(a,"width").map((e=>parseInt(e,10))).getOr(1),l=En(a,"height").map((e=>parseInt(e,10))).getOr(1),c=((e,t,n)=>{const r=g(fp,e),o=r("wgoal"),s=r("hgoal"),a=o/t,i=s/n,l=r("cropl"),c=r("cropt");return{cropl:l/a,cropt:c/i,cropw:(o-l-r("cropr"))/a,croph:(s-c-r("cropb"))/i}})(t,i,l);return i===c.cropw&&l===c.croph&&0===c.cropl&&0===c.cropt?Promise.resolve(e):Qa(r,c.cropl,c.cropt,c.cropw,c.croph).then((e=>e.toBlob().then((t=>{URL.revokeObjectURL(o);const r=URL.createObjectURL(t);return Ea.blob(n,e,r)}))))}))),((t,n,r)=>Promise.resolve(e))))))(e,t[n])))):Promise.resolve(e))(e,h).then((e=>{const t=xh(e,m);n(t,f)}))}))}),(e=>{console.error("Error processing EMF images:",e)}))},yp=e=>mr(e,"[rtf-data-image]"),bp=e=>{const t=e.translations,n=pd({insert:hd(["elements","correlated"]),incomplete:hd(["elements","correlated","message"])});return{events:n.registry,processRtf:(e,r,o,s)=>{const a=((e,t=!1)=>{const n=e.replace(/\r/g,"").replace(/\n/g,"");return dp(n,t)})(o,s.emfProcessor.isSome());const i=yp(e);vp(i,a,((t,o)=>{const s=cn(e),a=t.concat(r);o?(console.error("PowerPaste error code: RTF01"),n.trigger.incomplete(s,a,"errors.imageimport.failed")):n.trigger.insert(s,a)}),t,s)}}};var xp=e=>(t,n)=>{const r=X(!1),o=(t,o)=>Promise.all(E(t,((e,t)=>n=>{const r=()=>Promise.resolve(n);return Vt().browser.isSafari()?Ea.cata(n.asset,((o,s,a)=>/(tiff|pdf)$/.test(s.getType())?(e=>(e=>e.toAdjustedBlob("image/png",void 0))(e).then(qa).then(w.some).catch((e=>(console.warn(e),w.none()))))(s).then((e=>e.map((e=>{const t=n.image;return URL.revokeObjectURL(a),bh(e,t),yh(e,t)})).getOr(n))):/emf$/.test(s.getType())?(e.set(!0),Cn(n.image,"alt",t("errors.imageimport.unsupported")),On(n.image,"src"),Promise.resolve(n)):r()),r):r()})(r,e))).then((e=>({response:o(e),bundle:n.bundle})));return Ir(n.response,Rr,((e,t)=>o(t,(t=>r.get()?(console.error("PowerPaste error code: IMG01"),Lr(e,t,"errors.imageimport.failed")):Ar(e,t)))),(()=>Promise.resolve(n)),((e,t,n)=>o(t,(t=>(console.error("PowerPaste error code: IMG01"),Lr(e,t,n))))))};const wp=(e,t)=>e.isSupported?t.getWordData():w.none(),kp=e=>e.getNative(),Sp=e=>e.getImage(),Cp=e=>e.getHtml(),Tp=e=>e.getText(),Ip=e=>e.getOnlyText(),Ep=e=>e.getGoogleDocsData(),Ap=e=>e.getVoid(),Op=(e,t,n,r)=>({label:e,getAvailable:t,steps:n,capture:h(r)}),Lp=(e,t,n,r)=>({label:e,getAvailable:t,steps:n,capture:h(r)}),_p=(e,t,n,r)=>{return Op(fh.native,Cp,[(o=t.intraFlag,(e,t)=>{const n=th(e).getOrDie("Wrong input type for HTML handler"),r=o.findClipboardTags(cn(n.container));r.each((e=>{A(e,_n)}));const s=r.isSome();return{response:t.response,bundle:Nr({isInternal:s})}}),Rh(e,t),Kh(n,r,t),Ah(t),xp(t.translations)],!0);var o},Pp=(e,t,n)=>{return Op(fh.msoffice,g(wp,e),[Qh({isWord:!0}),Dh(t,n),Jh(e,n),(r=n,(e,t)=>new Promise(((n,o)=>{const s=bp(r),a=e=>n({response:e,bundle:Nr({})});s.events.insert.bind((e=>{a(Ar(e.elements,e.correlated))})),s.events.incomplete.bind((e=>{console.error("PowerPaste error code: RTF02"),a(Lr(e.elements,e.correlated,e.message))}));const i=rh(e).getOrDie("Word input required for rtf data"),l=e=>{const n=()=>t,o=(t,n)=>{const o=bt.fromTag("div");return kn(o,t),e.fold((()=>{const e=yp(o);return e.length>0?(e=>{A(e,_n);const t=cn(o);return console.error("PowerPaste error code: RTF03"),a(Lr(t,n,"errors.imageimport.failed"))})(e):(()=>{const e=cn(o);return a(Ar(e,n))})()}),(e=>{s.processRtf(o,n,e,r)}))};return Ir(t.response,n,o,n,o)};((e,t)=>{const n=$(t);if(n.length!==Fd.length)throw new Error("Partial match");z(n,(n=>me(e.discriminator===n,t[n]))).getOrDie("Must find branch for constructor: "+e.discriminator)(e.data)})(i.rtf,{disabled:()=>{l(w.none())},fromClipboard:e=>{l(!0===r.allowLocalImages?w.some(e.rtf):w.none())}})}))),xp(n.translations)],!0);var r},Np=(e,t,n,r)=>Op(fh.googledocs,Ep,[Qh({isGoogleDocs:!0}),Dh(e,t),ep,Kh(n,r,t),Nh,Ah(t),xp(t.translations)],!0),Dp=e=>Op(fh.image,Sp,[!1===e.allowLocalImages?(e,t)=>Rr("errors.local.images.disallowed"):(e,t)=>(e=>{const t=L(e,(e=>"file"===e.kind&&/image/.test(e.type))),n=_(t,((e,t)=>{const n=t.getAsFile();return(e=>null!==e)(n)?e.concat(n):e}),[]);return Ka(n).then((e=>{const t=(e=>{const t=[],n=[];return A(e,(e=>Ea.cata(e,((r,o,s)=>{const a=bt.fromTag("img");Cn(a,"src",s),t.push(a),n.push(yh(e,a))}),((e,t,n)=>{console.error("Internal error: Paste operation produced an image URL instead of a Data URI: ",t)})))),Ar(t,n)})(e);return{response:t,bundle:Nr({})}}))})(nh(e).getOrDie("Must have image data for images handler").images),xp(e.translations)],!0),Rp=e=>{const t=[qh(e.tabSpaces)];return e.autoLinkUrls&&t.push(Yh({defaultProtocol:e.defaultProtocol,autoLinkUrls:!0})),Op(fh.plaintext,Ip,t,!0)},Mp=(e,t,n)=>{const r=[qh(e)];return n&&r.push(Yh({defaultProtocol:t,autoLinkUrls:!0})),Op(fh.text,Tp,r,!0)},Up=(e,t,n,r,o=Md)=>{const s={...{...Ld,sanitizer:Vm(r.intraFlag.isMarked)},...G(r,l)},a=md(o,s.baseUrl,s.cacheSuffix),i=(d=s.pasteBinAttrs,e=>{const t=pd({after:hd(["container"])}),n=(e=>{const t=bt.fromTag("br");let n=w.none();const r=e=>rn(e).dom;return{cleanup:()=>{_n(t)},toOn:(t,o)=>{const s=r(o);n.each((n=>{const r=(e=>e.dom.childNodes.length)(t),o=It(t,n.startContainer())&&r<n.startOffset()?r:n.startOffset(),a=It(t,n.endContainer())&&r<n.endOffset()?r:n.endOffset(),i=fd(n.startContainer(),o,n.endContainer(),a);e.set(s,i)}))},toOff:(o,s)=>{const a=r(s);bn(s,t),n=e.get(a),e.set(a,fd(t,0,t,0))}}})(Ad),r=Id(n,e,d);return r.events.after.bind((r=>{n.toOn(e,r.container),t.trigger.after(r.container)})),{run:()=>{r.instance()()},events:t.registry}}),c=[Rp(s),Pp(a,t,s),Np(t,s,n,e),_p(t,s,n,e),Dp(s),Mp(s.tabSpaces,s.defaultProtocol,s.autoLinkUrls)],u=((e,t,n,r,o)=>Lp(fh.fallback,kp,[tp(r,0,o,t.intraFlag),Rh(e,t),Xh(o,t.intraFlag,t),Ah(t),xp(t.translations)],!1))(t,s,0,i,e);var d;return vh(c,u,s.sanitizer)};var Fp=Object.freeze({__proto__:null,loadScript:(e,t)=>tinymce.Resource.load(e,t)});const jp={"cement.dialog.paste.title":"Paste Formatting Options","cement.dialog.paste.instructions":"Choose to keep or remove formatting in the pasted content.","cement.dialog.paste.merge":"Keep formatting","cement.dialog.paste.clean":"Remove formatting","error.code.images.not.found":"The images service was not found: (","error.imageupload":"Image failed to upload: (","error.full.stop":").","errors.local.images.disallowed":"Local image paste has been disabled. Local images have been removed from pasted content.","errors.imageimport.failed":"Some images failed to import.","errors.imageimport.unsupported":"Unsupported image type.","errors.imageimport.invalid":"Image is invalid."},zp=e=>tinymce.translate((e=>jp[e])(e)),$p=e=>{const t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},Hp="x-tinymce/html",Bp=h(Hp),Wp="\x3c!-- "+Hp+" --\x3e",Vp=e=>-1!==e.indexOf(Wp),Gp=e=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(e),qp=e=>{const t=/^<a href="([^"]+)">([^<]+)<\/a>$/.exec(e);return w.from(t).bind((t=>{const n={url:t[1],html:e};return me(t[1]===t[2],n)}))},Yp=(e,t,n)=>(e=>"extra"in e.undoManager)(e)?(e.undoManager.extra((()=>{Jp(e,t)}),n),w.some(!0)):w.none(),Kp=(e,t)=>qp(t).bind((t=>!1===e.selection.isCollapsed()&&Gp(t.url)?((e,t)=>Yp(e,t.html,(()=>{e.execCommand("mceInsertLink",!1,t.url)})))(e,t):w.none())),Xp=(e,t)=>qp(t).bind((t=>((e,t)=>{const n=e.toLowerCase();return Gp(n)&&I(t,(e=>Ce(n,`.${e.toLowerCase()}`)))})(t.url,vt(e))?((e,t)=>Yp(e,t.html,(()=>{e.insertContent('<img src="'+t.url+'">')})))(e,t):w.none())),Jp=(e,t)=>(e.insertContent(t,{merge:tt(e),paste:!0}),w.some(!0)),Zp=(e,t)=>e.hasEventListeners(t),Qp=(e,t,n,r,o)=>{const s=(e=>e.replace(Wp,""))(t),a=((e,t,n,r,o)=>Zp(e,"PastePreProcess")?((e,t,n,r,o)=>{const s=((e,t)=>e.dispatch("PastePreProcess",t))(e,{internal:n,content:t,source:r,mode:o}),a=s.isDefaultPrevented();return a?{cancelled:a}:{cancelled:a,content:s.content}})(e,t,n,r,o):{cancelled:!1,content:t})(e,s,n,r,o);return a.cancelled?a:((e,t,n,r,o)=>Zp(e,"PastePostProcess")?((e,t,n,r,o)=>{const s=e.dom.add(e.getBody(),"div",{style:"display:none"},t),a=((e,t)=>e.dispatch("PastePostProcess",t))(e,{internal:n,node:s,source:r,mode:o}),i=a.isDefaultPrevented();if(i)return e.dom.remove(s),{cancelled:i};const l=a.node.innerHTML;return e.dom.remove(s),{cancelled:i,content:l}})(e,t,n,r,o):{content:t,cancelled:!1})(e,a.content,n,r,o)},ef=(e,t,n,r,o,s)=>{const a=fe(),i=n.replace(/\/$/,"")+"/"+"/js".replace(/^\//,"");const l=(e,t)=>(e.undoManager.transact((()=>{var n;Jp(e,t),n=e.getBody(),A(E(n.getElementsByTagName("*"),bt.fromDom),(e=>{An(e,"data-mce-style")&&!An(e,"style")&&En(e,"data-mce-style").each((t=>Cn(e,"style",t)))}))})),w.some(!0)),c=()=>{a.on((t=>e.selection.moveToBookmark(t))),a.clear()},u=nt(e),m={baseUrl:i,cacheSuffix:ot(e),officeStyles:ut(e),htmlStyles:mt(e),gdocsStyles:dt(e),translations:zp,allowLocalImages:ct(e),pasteBinAttrs:{"data-mce-bogus":"all",class:"mce-pastebin"},intraFlag:{isMarked:Vp,findClipboardTags:e=>{const t=L(e,(e=>Kt(e)&&ke(Yn(e),Bp())));return t.length?w.some(t):w.none()}},keepSrc:lt(e),cleanFilteredInlineElements:ht(e),indentUseMargin:at(e),sanitizer:o,tabSpaces:u,defaultProtocol:pt(e),autoLinkUrls:ft(e),emfProcessor:w.from(gt(e))},h=Up(bt.fromDom(e.getBody()),(e=>({createDialog:()=>{let t="";const n=fe(),r=(()=>{const e=X([{text:"Close",name:"close",type:"custom",primary:!0}]),t=X({});return{setButtons:n=>{const r={},o=E(n,(e=>{const t=e.text;return r[t.toLowerCase()]=e.click,{text:t,name:t.toLowerCase(),type:"custom"}}));t.set(r),e.set(o)},getButtons:e.get,getAction:e=>{const n=t.get();return Y(n,e)?w.some(n[e]):w.none()}}})(),o=pd({close:hd([])}),s=()=>{o.trigger.close()};return{events:o.registry,setTitle:e=>t=e,setContent:e=>n.set(e),setButtons:e=>{r.setButtons(e)},show:()=>{n.on((n=>{const o=$p(n.dom),a={title:t,body:{type:"panel",items:[{type:"htmlpanel",html:o}]},initialData:{},buttons:r.getButtons(),onCancel:s,onAction:(e,t)=>{r.getAction(t.name).each(y),e.close()}};e.windowManager.open(a)}))},hide:d,destroy:()=>{n.clear()},reflow:d}}}))(e).createDialog,d,m,Fp),p=((e=Gm,t=Ld.tabSpaces,n=Ld.autoLinkUrls)=>vh([Mp(t,Ld.defaultProtocol,n)],Lp(fh.discard,Ap,[Zh],!0),e))(o,u,ft(e));return A([h,p],(t=>{t.events.cancel.bind((()=>{c()})),t.events.error.bind((t=>{c(),e.notificationManager?e.notificationManager.open({text:zp(t.message),type:"error"}):((e,t)=>{const n={title:"Error",body:{type:"panel",items:[{type:"htmlpanel",html:t}]},initialData:{},buttons:[{text:"OK",type:"cancel",name:"ok",primary:!0}]};e.windowManager.open(n)})(e,zp(t.message))})),t.events.insert.bind((t=>{const n=E(t.elements,(e=>$p(e.dom))).join("");e.focus();const r=()=>{c();const r=Qp(e,n,t.isInternal,t.source,t.mode);r.cancelled||(((e,t)=>{((e,t,n)=>{z(n,(n=>n(e,t)))})(e,t,(rt(e)?[Kp,Xp]:[]).concat([l]))})(e,r.content),st(e)&&s.uploadImages(t.assets))};0===t.assets.length?r():s.importImages(t.assets).get(r)})),t.events.block.bind((t=>{e.setProgressState(t.state)}))})),{pasteHtml:e=>h.pasteCustom(((e,t=Gm)=>({getWordData:()=>w.from(e).filter(ah).map((e=>Zm({html:e,rtf:jd()}))),getGoogleDocsData:()=>w.from(e).filter(ih).map((e=>t.sanitizeHtml(e,"googledocs"))).map(hh),getImage:w.none,getHtml:()=>w.some(hh(t.sanitizeHtml(e))),getText:w.none,getNative:v("There is no native event"),getOnlyText:w.none,getVoid:v("There is no paste event")}))(e,o)),pasteText:e=>p.pasteCustom(((e,t=Gm)=>({getWordData:w.none,getGoogleDocsData:w.none,getImage:w.none,getHtml:w.none,getText:()=>w.some(Qm({text:t.sanitizeText(e)})),getNative:v("There is no native event"),getOnlyText:w.none,getVoid:v("There is no paste event")}))(e,o)),pasteEvent:n=>{(e=>{return(t=e,w.from(t.clipboardData).bind((e=>w.from(e.getData("text/html"))))).bind((e=>(e=>ke(e,"<google-sheets-html-origin"))(e)?w.some("googlesheets"):(e=>ke(e," data-ccp-props=")&&ke(e," paraid=")&&/font-family:.+?_MSFontService(&quot;)?[,;]/.test(e))(e)?w.some("mswordonline"):(e=>ke(e,"<meta name=ProgId content=Excel.Sheet>")&&!ke(e,'="urn:schemas-microsoft-com:office:'))(e)?w.some("msexcelonline"):w.none()));var t})(n).each((t=>{((e,t)=>{e.dispatch("PowerPasteTempStats",{source:t})})(e,t)})),a.isSet()||a.set(e.selection.getBookmark(1)),(t.isText()?p:h).paste(n),t.reset(),n.stopImmediatePropagation()}}},tf=(e,t)=>{const n=tinymce.html.DomParser({},e.schema).parse(t,{forced_root_block:!1,isRootContent:!0});return tinymce.html.Serializer({validate:!0},e.schema).serialize(n)},nf=(e,t)=>{e.dom.bind(t,"drop dragstart dragend dragover dragenter dragleave dragdrop draggesture",(e=>{e.preventDefault(),e.stopImmediatePropagation()}))},rf=e=>{var t,n;return I(null!==(n=null===(t=e.dataTransfer)||void 0===t?void 0:t.items)&&void 0!==n?n:[],(e=>Se(e.type,"image/")))},of=(e,t,n,r,o)=>{const s=tinymce.dom.RangeUtils;let a;const i=t=>{var n,r;const o=s.getCaretRangeFromPoint(null!==(n=t.clientX)&&void 0!==n?n:0,null!==(r=t.clientY)&&void 0!==r?r:0,e.getDoc());l(o)&&e.selection.setRng(o),e.focus()};e.on("dragstart dragend",(e=>{a="dragstart"===e.type})),e.on("dragover dragend dragleave",(e=>{a||rf(e)||(e.preventDefault(),i(e))}));const c=(e,t)=>t in e&&e[t].length>0;e.on("drop",(t=>{if(!a&&!rf(t)&&!o.isInvalid()){i(t);const o=(t=>{var n,r,o;const s=null!==(o=null!==(n=t.target.files)&&void 0!==n?n:null===(r=t.dataTransfer)||void 0===r?void 0:r.files)&&void 0!==o?o:[],a=vt(e);return L(s,(e=>Se(e.type,"image/")&&I(a,(t=>(e=>{const t=e.toLowerCase(),n={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return Y(n,t)?"image/"+n[t]:"image/"+t})(t)===e.type))))})(t);if(o.length>0)return(t=>{Ka(t).then((t=>{const n=(e=>E(e,(e=>{const t=bt.fromTag("img"),n=Ea.cata(e,r.getLocalURL,((e,t,n)=>t));return Cn(t,"src",n),t.dom.outerHTML})).join(""))(t),o=Qp(e,n,!1,"imagedrop","auto");o.cancelled||(e.insertContent(o.content,{merge:tt(e)}),st(e)&&r.uploadImages(t))}))})(o),void t.preventDefault();const s=(e=>{const t={};if(e&&e.types)for(let n=0;n<e.types.length;n++){const r=e.types[n];t[r]=e.getData(r)}return t})(t.dataTransfer);c(s,"text/html")?(n.pasteHtml(s["text/html"]),t.preventDefault()):c(s,"text/plain")&&!(e=>{const t=e["text/plain"];return!!t&&0===t.indexOf("file://")})(s)&&(n.pasteText(s["text/plain"]),t.preventDefault())}}))};((e,t)=>{const{i18n:n=!0}=t;n&&tinymce.PluginManager.requireLangPack(e,"ar,bg-BG,ca,cs,da,de,el,es,eu,fa,fi,fr-FR,he-IL,hi,hr,hu-HU,id,it,ja,kk,ko-KR,ms,nb-NO,nl,pl,pt-BR,pt-PT,ro,ru,sk,sl-SI,sv-SE,th-TH,tr,uk,vi,zh-CN,zh-TW"),tinymce.PluginManager.add(e,Ze(e,t))})("powerpaste",{setup:(e,t,r)=>{(e=>{const t=e.options.register,r=e=>{const t=c(e)||(e=>n(e)&&T(["clean","merge","prompt"],e))(e);return t?{value:e,valid:t}:{valid:!1,message:"Must be prompt, clean or merge."}};t("powerpaste_block_drop",{processor:"boolean",default:!1}),t("powerpaste_keep_unsupported_src",{processor:"boolean",default:!1}),t("powerpaste_allow_local_images",{processor:"boolean",default:!0}),t("powerpaste_word_import",{processor:r,default:"prompt"}),t("powerpaste_googledocs_import",{processor:r,default:"prompt"}),t("powerpaste_html_import",{processor:r,default:"clean"}),t("powerpaste_clean_filtered_inline_elements",{processor:"string[]",default:[]}),e.options.isRegistered("link_default_protocol")||t("link_default_protocol",{processor:"string",default:"https"}),t("powerpaste_autolink_urls",{processor:"boolean",default:!0}),t("powerpaste_emf_processor",{processor:"function"})})(e),(e=>{const t=e.options.set;t("paste_block_drop",!1),t("paste_remove_styles_if_webkit",!1)})(e);const o=(e=>{const t=X(et(e)),n=X(!1);return e.on("keydown",(e=>{(e=>tinymce.util.VK.metaKeyPressed(e)&&86===e.keyCode&&e.shiftKey)(e)&&n.set(!0)})),e.on("PastePlainTextToggle",(e=>{t.set(e.state)})),{reset:()=>{n.set(!1)},isText:()=>n.get()||t.get()}})(e),s=(e=>{const t=(e,t)=>h(e+"."+(e=>{const t=e.toLowerCase(),n={"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png","image/apng":"apng","image/avif":"avif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"};return Y(n,t)?n[t]:"dat"})(t)),n=(n,r,o,s)=>te((a=>{(e=>e.toBlob())(r).then((r=>{e.editorUpload.blobCache.add({id:h(n),name:h(n),filename:t(n,r.type),blob:h(r),base64:h(o.split(",")[1]),blobUri:h(s),uri:h(void 0)}),a(r)}))}));return{importImages:e=>{const t=R(e,(e=>Ea.cata(e,((e,t,r)=>{const o=Ga(t);return[n(e,t,o,r)]}),h([]))));return se(t)},uploadImages:()=>{e.uploadImages()},getLocalURL:(e,t,n)=>Ga(t)}})(e),a=(e=>{const t=Vm(Vp),n=(e=>({sanitizeHtml:g(tf,e),sanitizeText:p}))(e);return{sanitizeText:t.sanitizeText,sanitizeHtml:(e,r)=>(Vp(e)?n:t).sanitizeHtml(e,r)}})(e);e.on("PreInit",(()=>{if(e.removed)return;const i=ef(e,o,t,0,a,s);((e,t)=>{e.addCommand("mceInsertClipboardContent",((e,r)=>{n(r.html)?t.pasteHtml(r.html):n(r.text)&&t.pasteText(r.text)}))})(e,i),((e,t,n)=>{e.on("paste",(e=>{e.isDefaultPrevented()||(e=>{var t,n;const r=null!==(n=null===(t=e.clipboardData)||void 0===t?void 0:t.items)&&void 0!==n?n:[],o=L(r,(e=>Se(e.type,"image/")));return o.length>0&&o.length===r.length})(e)||n.isInvalid()||t.pasteEvent(e)}))})(e,i,r.enforcer),it(e)?(e=>{nf(e,e.getBody()),e.inline||nf(e,e.getDoc())})(e):of(e,0,i,s,r.enforcer)}))}})}();