HEX
Server: Apache/2.4.57 (Debian)
System: Linux web-server-k8s-e92jnr3j-6f99bff6b6-rp2wg 6.1.0-22-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.94-1 (2024-06-21) x86_64
User: apache (48)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/sites/1250.info/wp-content/plugins/mailpoet/assets/dist/js/form_editor.12be43d2.js
/*! For license information please see form_editor.12be43d2.js.LICENSE.txt */
(self.webpackChunkMailPoet3=self.webpackChunkMailPoet3||[]).push([[514],{89504:function(e,t,n){e=n.nmd(e),function(t){"use strict";var n,r="function"==typeof(n=t.atob)?n:"function"==typeof Buffer?function(e){return new Buffer(e,"base64").toString("binary")}:"object"==typeof t.base64js?function(e){var n=t.base64js.b64ToByteArray(e);return Array.prototype.map.call(n,(function(e){return String.fromCharCode(e)})).join("")}:function(){throw new Error("You're probably in an old browser or an iOS webworker. It might help to include beatgammit's base64-js.")};t.atob=r,e&&e.exports&&(e.exports=r)}(window)},41228:function(e,t,n){"use strict";var r={};n.r(r),n.d(r,{applyStylesToAllTextInputs:function(){return Vn},blocksChangedInBlockEditor:function(){return Un},changeActiveSidebar:function(){return Pn},changeFormBlocks:function(){return hn},changeFormName:function(){return gn},changeFormSettings:function(){return Tn},changeFormStyles:function(){return xn},changePreviewSettings:function(){return Fn},createCustomField:function(){return Hn},createCustomFieldDone:function(){return kn},createCustomFieldFailed:function(){return En},createCustomFieldStarted:function(){return In},customFieldEdited:function(){return wn},deleteCustomField:function(){return Zn},deleteCustomFieldDone:function(){return bn},deleteCustomFieldFailed:function(){return yn},deleteCustomFieldStarted:function(){return vn},hidePreview:function(){return Rn},historyRedo:function(){return qn},historyUndo:function(){return Gn},removeNotice:function(){return On},saveCustomField:function(){return zn},saveCustomFieldDone:function(){return Cn},saveCustomFieldFailed:function(){return Sn},saveCustomFieldStarted:function(){return _n},saveForm:function(){return Wn},saveFormDone:function(){return An},saveFormFailed:function(){return Ln},saveFormStarted:function(){return Dn},showPlacementSettings:function(){return Nn},showPreview:function(){return jn},switchDefaultSidebarTab:function(){return Mn},toggleForm:function(){return mn},toggleFullscreen:function(){return fn},toggleInserter:function(){return pn},toggleSidebar:function(){return dn},toggleSidebarPanel:function(){return Bn},tutorialDismissed:function(){return $n}});var i={};n.r(i),n.d(i,{selectCategory:function(){return df},selectTemplate:function(){return uf}});var o={};n.r(o),n.d(o,{CALL_API:function(){return dr.t},TRACK_EVENT:function(){return pf}});var a=n(49231),l=n(64151),s=n(34206),c=n(76087),u=n(1349),d=n(65443),p=n.n(d),m=n(81963),f=n(87834),h=n(85479),g=n(33851),v=n(90057),b=n(30337);const{wp:y}=window,x=[],w=()=>y.media.view.MediaFrame.Select.extend({featuredImageToolbar(e){this.createSelectToolbar(e,{text:y.media.view.l10n.setFeaturedImage,state:this.options.state})},editState(){const e=this.state("featured-image").get("selection"),t=new y.media.view.EditImage({model:e.single(),controller:this}).render();this.content.set(t),t.loadEditor()},createStates:function(){this.on("toolbar:create:featured-image",this.featuredImageToolbar,this),this.on("content:render:edit-image",this.editState,this),this.states.add([new y.media.controller.FeaturedImage,new y.media.controller.EditImage({model:this.options.editImage})])}}),C=()=>y.media.view.MediaFrame.Post.extend({galleryToolbar(){const e=this.state().get("editing");this.toolbar.set(new y.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:e?y.media.view.l10n.updateGallery:y.media.view.l10n.insertGallery,priority:80,requires:{library:!0},click(){const e=this.controller,t=e.state();e.close(),t.trigger("update",t.get("library")),e.setState(e.options.state),e.reset()}}}}))},editState(){const e=this.state("gallery").get("selection"),t=new y.media.view.EditImage({model:e.single(),controller:this}).render();this.content.set(t),t.loadEditor()},createStates:function(){this.on("toolbar:create:main-gallery",this.galleryToolbar,this),this.on("content:render:edit-image",this.editState,this),this.states.add([new y.media.controller.Library({id:"gallery",title:y.media.view.l10n.createGalleryTitle,priority:40,toolbar:"main-gallery",filterable:"uploaded",multiple:"add",editable:!1,library:y.media.query({type:"image",...this.options.library})}),new y.media.controller.EditImage({model:this.options.editImage}),new y.media.controller.GalleryEdit({library:this.options.selection,editing:this.options.editing,menu:"gallery",displaySettings:!1,multiple:!0}),new y.media.controller.GalleryAdd])}}),_=e=>["sizes","mime","type","subtype","id","url","alt","link","caption"].reduce(((t,n)=>(null!=e&&e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{}),S=e=>y.media.query({order:"ASC",orderby:"post__in",post__in:e,posts_per_page:-1,query:!0,type:"image"});class k extends a.Component{constructor(e){let{allowedTypes:t,gallery:n=!1,unstableFeaturedImageFlow:r=!1,modalClass:i,multiple:o=!1,title:a=(0,b.__)("Select or Upload Media")}=e;if(super(...arguments),this.openModal=this.openModal.bind(this),this.onOpen=this.onOpen.bind(this),this.onSelect=this.onSelect.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onClose=this.onClose.bind(this),n)this.buildAndSetGalleryFrame();else{const e={title:a,multiple:o};t&&(e.library={type:t}),this.frame=y.media(e)}i&&this.frame.$el.addClass(i),r&&this.buildAndSetFeatureImageFrame(),this.initializeListeners()}initializeListeners(){this.frame.on("select",this.onSelect),this.frame.on("update",this.onUpdate),this.frame.on("open",this.onOpen),this.frame.on("close",this.onClose)}buildAndSetGalleryFrame(){const{addToGallery:e=!1,allowedTypes:t,multiple:n=!1,value:r=x}=this.props;if(r===this.lastGalleryValue)return;let i;this.lastGalleryValue=r,this.frame&&this.frame.remove(),i=e?"gallery-library":r&&r.length?"gallery-edit":"gallery",this.GalleryDetailsMediaFrame||(this.GalleryDetailsMediaFrame=C());const o=S(r),a=new y.media.model.Selection(o.models,{props:o.props.toJSON(),multiple:n});this.frame=new this.GalleryDetailsMediaFrame({mimeType:t,state:i,multiple:n,selection:a,editing:!(!r||!r.length)}),y.media.frame=this.frame,this.initializeListeners()}buildAndSetFeatureImageFrame(){const e=w(),t=S(this.props.value),n=new y.media.model.Selection(t.models,{props:t.props.toJSON()});this.frame=new e({mimeType:this.props.allowedTypes,state:"featured-image",multiple:this.props.multiple,selection:n,editing:!!this.props.value}),y.media.frame=this.frame}componentWillUnmount(){this.frame.remove()}onUpdate(e){const{onSelect:t,multiple:n=!1}=this.props,r=this.frame.state(),i=e||r.get("selection");i&&i.models.length&&t(n?i.models.map((e=>_(e.toJSON()))):_(i.models[0].toJSON()))}onSelect(){const{onSelect:e,multiple:t=!1}=this.props,n=this.frame.state().get("selection").toJSON();e(t?n:n[0])}onOpen(){const{value:e}=this.props;if(this.updateCollection(),this.props.mode&&this.frame.content.mode(this.props.mode),!(Array.isArray(e)?null!=e&&e.length:e))return;const t=this.props.gallery,n=this.frame.state().get("selection"),r=Array.isArray(e)?e:[e];t||r.forEach((e=>{n.add(y.media.attachment(e))}));const i=S(r);i.more().done((function(){var e;t&&null!=i&&null!==(e=i.models)&&void 0!==e&&e.length&&n.add(i.models)}))}onClose(){const{onClose:e}=this.props;e&&e()}updateCollection(){const e=this.frame.content.get();if(e&&e.collection){const t=e.collection;t.toArray().forEach((e=>e.trigger("destroy",e))),t.mirroring._hasMore=!0,t.more()}}openModal(){this.props.gallery&&this.buildAndSetGalleryFrame(),this.frame.open()}render(){return this.props.render({open:this.openModal})}}var I=k,E=n(90712);const T=()=>{};async function A(e){let{allowedTypes:t,additionalData:n={},filesList:r,maxUploadFileSize:i,onError:o=T,onFileChange:a,wpAllowedMimeTypes:l=null}=e;const s=[...r],c=[],u=(e,t)=>{var n;(0,E.Vg)(null===(n=c[e])||void 0===n?void 0:n.url),c[e]=t,a(c.filter(Boolean))},d=e=>!t||t.some((t=>t.includes("/")?t===e:e.startsWith(`${t}/`))),p=(m=l)?Object.entries(m).map((e=>{let[t,n]=e;const[r]=n.split("/");return[n,...t.split("|").map((e=>`${r}/${e}`))]})).flat():m;var m;const f=[];for(const e of s)p&&e.type&&(h=e.type,!p.includes(h))?o({code:"MIME_TYPE_NOT_ALLOWED_FOR_USER",message:(0,b.sprintf)((0,b.__)("%s: Sorry, you are not allowed to upload this file type."),e.name),file:e}):!e.type||d(e.type)?i&&e.size>i?o({code:"SIZE_ABOVE_LIMIT",message:(0,b.sprintf)((0,b.__)("%s: This file exceeds the maximum upload size for this site."),e.name),file:e}):e.size<=0?o({code:"EMPTY_FILE",message:(0,b.sprintf)((0,b.__)("%s: This file is empty."),e.name),file:e}):(f.push(e),c.push({url:(0,E.ZR)(e)}),a(c)):o({code:"MIME_TYPE_NOT_SUPPORTED",message:(0,b.sprintf)((0,b.__)("%s: Sorry, this file type is not supported here."),e.name),file:e});var h;for(let e=0;e<f.length;++e){const t=f[e];try{var g,v;const r=await D(t,n),{alt_text:i,source_url:o,...a}=r;u(e,{...a,alt:r.alt_text,caption:null!==(g=null===(v=r.caption)||void 0===v?void 0:v.raw)&&void 0!==g?g:"",title:r.title.raw,url:r.source_url})}catch(n){let r;u(e,null),r=n.message?n.message:(0,b.sprintf)((0,b.__)("Error while uploading file %s to the media library."),t.name),o({code:"GENERAL",message:r,file:t})}}}function D(e,t){const n=new window.FormData;return n.append("file",e,e.name||e.type.replace("/",".")),t&&Object.entries(t).forEach((e=>{let[t,r]=e;return n.append(t,r)})),(0,s.default)({path:"/wp/v2/media",body:n,method:"POST"})}var L=n(67257),P=n(353),F=n(95393),N=n(86218),j=n(62668);const R=async function(e){let{perPage:t=20}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=await(0,s.default)({path:(0,F.f)("/wp/v2/search",{search:e,per_page:t,type:"post"})});return Array.isArray(n)?n.map((e=>({id:e.id,url:e.url,title:(0,N.decodeEntities)(e.title)||`(${j.x.I18n.t("noName")})`,type:e.subtype||e.type}))):[]};var O=n(52278),M=n(83115),B=n(53703),W=n(9487),z=n(62006),H=n(96097),Z=n(39519),U=n.n(Z),V=n(73435),G=n(62271),q=n(20264);function $(e){let{isActive:t,label:n,info:r,onToggle:i}=e;return(0,q.jsx)(V.Z,{icon:t&&G.Z,isSelected:t,onClick:i,role:"menuitemcheckbox",info:r,children:n})}var Y=n(33140),K=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"})),X=n(83830);function J(e){const t=(0,f.Z)((e=>e("mailpoet-form-editor").hasEditorUndo()),[]),{historyUndo:n}=(0,h.Z)("mailpoet-form-editor"),{registerShortcut:r}=(0,h.Z)("core/keyboard-shortcuts");return(0,P.bx)("mailpoet-form-editor/undo",(e=>{n(),e.preventDefault()})),(0,a.useEffect)((()=>{r({name:"mailpoet-form-editor/undo",category:"block",description:(0,b.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}})}),[r]),(0,q.jsx)(O.Z,{...e,icon:K,label:(0,b.__)("Undo"),shortcut:X.displayShortcut.primary("z"),"aria-disabled":!t,onClick:t?()=>{n()}:void 0,className:"editor-history__undo"})}var Q=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"}));function ee(e){const t=(0,f.Z)((e=>e("mailpoet-form-editor").hasEditorRedo()),[]),{historyRedo:n}=(0,h.Z)("mailpoet-form-editor"),{registerShortcut:r}=(0,h.Z)("core/keyboard-shortcuts"),i=()=>{n()};return(0,P.bx)("mailpoet-form-editor/redo",(e=>{i(),e.preventDefault()})),(0,a.useEffect)((()=>{r({name:"mailpoet-form-editor/redo",category:"block",description:(0,b.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"}})}),[r]),(0,q.jsx)(O.Z,{...e,icon:Q,label:(0,b.__)("Redo"),shortcut:X.displayShortcut.primaryShift("z"),"aria-disabled":!t,onClick:t?i:void 0,className:"editor-history__redo"})}function te(e){let{isInserterOpened:t,setIsInserterOpened:n}=e;const r=(0,f.Z)((e=>e("mailpoet-form-editor").getSidebarOpened()),[]),i=(0,f.Z)((e=>e("mailpoet-form-editor").getIsFormSaving()),[]),o=(0,f.Z)((e=>e("mailpoet-form-editor").getIsPreviewShown()),[]),a=(0,f.Z)((e=>e("mailpoet-form-editor").isFullscreenEnabled()),[]),{toggleSidebar:l,saveForm:s,showPreview:c,toggleFullscreen:u}=(0,h.Z)("mailpoet-form-editor");return(0,q.jsxs)("div",{className:"edit-post-header",children:[(0,q.jsxs)("div",{className:"edit-post-header__settings",children:[(0,q.jsx)(O.Z,{isSecondary:!0,onClick:c,isPressed:o,className:"mailpoet-preview-button","data-automation-id":"form_preview_button",children:(0,b.__)("Preview")}),(0,q.jsx)(O.Z,{isPrimary:!0,className:"editor-post-publish-button","data-automation-id":"form_save_button",isBusy:i,onClick:s,children:i?`${(0,b.__)("Saving")}`:(0,b.__)("Save")}),(0,q.jsx)(O.Z,{icon:"admin-generic",label:j.x.I18n.t("formSettings"),tooltipPosition:"down",onClick:()=>l(!r),isPressed:r,className:"mailpoet-editor-header-button"}),(0,q.jsx)(M.Z,{icon:z.Z,label:(0,b.__)("More tools & options"),className:"edit-post-more-menu",popoverProps:{className:"edit-post-more-menu__content"},children:()=>(0,q.jsx)(B.Z,{label:(0,b._x)("View","noun"),className:"mailpoet-dropdown-menu-group",children:(0,q.jsx)($,{shortcut:"Ctrl+Shift+Alt+F",label:(0,b.__)("Fullscreen mode"),info:(0,b.__)("Work without distraction"),isActive:a,onToggle:()=>u(!a)})})})]}),(0,q.jsx)("div",{className:"edit-post-header__toolbar",children:(0,q.jsxs)("div",{className:"toolbar edit-post-header-toolbar edit-post-header-toolbar__left",children:[(0,q.jsx)(O.Z,{isSecondary:!0,href:"?page=mailpoet-forms#/",className:"mailpoet-editor-header-button",children:j.x.I18n.t("back")}),(0,q.jsx)(W.Z,{as:O.Z,"data-automation-id":"form_inserter_open",className:"edit-post-header-toolbar__inserter-toggle",isPrimary:!0,isPressed:t,onClick:()=>n(!t),icon:H.Z,label:(0,b._x)("Add block","Generic label for block inserter button")}),(0,q.jsx)(J,{"data-automation-id":"form_undo_button"}),(0,q.jsx)(ee,{"data-automation-id":"form_redo_button"})]})})]})}te.propTypes={isInserterOpened:U().bool.isRequired,setIsInserterOpened:U().func.isRequired};var ne=n(69156),re=n(49029);function ie(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getTutorialUrl()),[]),t=(0,f.Z)((e=>e("mailpoet-form-editor").getTutorialSeen()),[]),{tutorialDismissed:n}=(0,h.Z)("mailpoet-form-editor"),r=(0,a.useCallback)((()=>{n()}),[n]);return t?null:(0,q.jsx)(ne.u,{isDismissible:!0,onRequestClose:r,children:(0,q.jsxs)("div",{className:"mailpoet_drag_and_drop_tutorial","data-automation-id":"form-editor-tutorial",children:[(0,q.jsx)(re.X,{level:2,children:j.x.I18n.t("tutorialHeading")}),(0,q.jsx)("video",{style:{height:"640px"},src:e,controls:!0,autoPlay:!0})]})})}var oe=n(61888),ae=n(76874),le=n(21840),se=n(58897),ce=n(79838),ue=n(53556),de=n(97873),pe=n(52405),me=n(26138),fe=n(65311),he=n.n(fe),ge=n(35614);n(1201);class ve extends a.Component{constructor(e){super(e),(0,me.Z)(this,"getFieldId",(e=>{const t=e||this.props;return t.field.id||t.field.name})),(0,me.Z)(this,"getSelectedValues",(()=>{if(void 0!==this.props.field.selected)return this.props.field.selected(this.props.item);if(void 0!==this.props.item&&void 0!==this.props.field.name){if(!this.allowMultipleValues())return this.props.item[this.props.field.name];if(ge.ZP.isArray(this.props.item[this.props.field.name]))return this.props.item[this.props.field.name].map((e=>e.id))}return null})),(0,me.Z)(this,"getItems",(()=>{let e;return void 0!==window[`mailpoet_${this.props.field.endpoint}`]?e=window[`mailpoet_${this.props.field.endpoint}`]:void 0!==this.props.field.values&&(e=this.props.field.values),ge.ZP.isArray(e)&&void 0!==this.props.field.filter&&(e=e.filter(this.props.field.filter)),e})),(0,me.Z)(this,"getLabel",(e=>void 0!==this.props.field.getLabel?this.props.field.getLabel(e,this.props.item):e.name)),(0,me.Z)(this,"getSearchLabel",(e=>void 0!==this.props.field.getSearchLabel?this.props.field.getSearchLabel(e,this.props.item):null)),(0,me.Z)(this,"getValue",(e=>void 0!==this.props.field.getValue?this.props.field.getValue(e,this.props.item):e.id)),(0,me.Z)(this,"setupSelect2",(()=>{if(this.isSelect2Initialized())return;let e={disabled:this.props.disabled||!1,width:this.props.width||"",placeholder:{id:"",text:this.props.field.placeholder},templateResult:function(e){return e.element&&e.element.selected?null:e.title?e.title:e.text}};this.props.dropDownParent&&(e.dropdownParent=he()(this.props.dropDownParent));const t=this.props.field.remoteQuery||null;t&&(e=Object.assign(e,{ajax:{url:window.ajaxurl,type:"POST",dataType:"json",data:function(e){return{action:"mailpoet",api_version:window.mailpoet_api_version,token:window.mailpoet_token,endpoint:t.endpoint,method:t.method,data:Object.assign(t.data,{query:e.term})}},processResults:function(e){let t;return t=ge.ZP.has(e,"data")?e.data.map((e=>({id:e.id||e.value,text:e.name||e.text}))):[],{results:t}}},minimumInputLength:t.minimumInputLength||2})),void 0!==this.props.field.extendSelect2Options&&(e=Object.assign(e,this.props.field.extendSelect2Options));const n=he()(`#${this.selectRef.current.id}`).select2(e);let r=!1;n.on("select2:unselecting",(()=>{r=!0})),n.on("select2:opening",(e=>{!0===r&&(r=!1,e.preventDefault())})),n.on("change",this.handleChange)})),(0,me.Z)(this,"resetSelect2",(()=>{this.destroySelect2(),this.setupSelect2()})),(0,me.Z)(this,"destroySelect2",(()=>{this.isSelect2Initialized()&&(he()(`#${this.selectRef.current.id}`).select2("destroy"),this.cleanupAfterSelect2())})),(0,me.Z)(this,"cleanupAfterSelect2",(()=>{he()(`#${this.selectRef.current.id}`).find("option:not(.default)").remove(),he()(`#${this.selectRef.current.id}`).off("select2:unselecting").off("select2:opening")})),(0,me.Z)(this,"allowMultipleValues",(()=>!0===this.props.field.multiple)),(0,me.Z)(this,"isSelect2Initialized",(()=>!0===he()(`#${this.selectRef.current.id}`).hasClass("select2-hidden-accessible"))),(0,me.Z)(this,"isSelect2Component",(()=>this.allowMultipleValues()||this.props.field.forceSelect2)),(0,me.Z)(this,"handleChange",(e=>{if(void 0===this.props.onValueChange)return;const t=he()(`#${this.selectRef.current.id}`).children(":selected").map((function(){return{id:he()(this).val(),text:he()(this).text()}})),n=this.props.field.multiple?ge.ZP.pluck(t,"id"):ge.ZP.pluck(t,"id").toString(),r=this.transformChangedValue(n,t);this.props.onValueChange({target:{value:r,name:this.props.field.name,id:e.target.id}})})),(0,me.Z)(this,"transformChangedValue",((e,t)=>"function"==typeof this.props.field.transformChangedValue?this.props.field.transformChangedValue.call(this,e,t):e)),(0,me.Z)(this,"insertEmptyOption",(()=>{if(!this.allowMultipleValues())return this.props.field.placeholder?(0,q.jsx)("option",{className:"default"}):void 0})),this.selectRef=(0,a.createRef)()}componentDidMount(){this.isSelect2Component()&&this.setupSelect2()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&he()(`#${this.selectRef.current.id}`).val(this.getSelectedValues()).trigger("change"),void 0!==this.props.item&&void 0!==e.item&&this.allowMultipleValues()&&ge.ZP.isArray(this.props.item[this.props.field.name])&&!ge.ZP.isEqual(this.props.item[this.props.field.name],e.item[this.props.field.name])&&he()(`#${this.selectRef.current.id}`).val(this.getSelectedValues()).trigger("change"),this.isSelect2Initialized()&&this.getFieldId(this.props)!==this.getFieldId(e)&&void 0!==this.props.field.resetSelect2OnUpdate&&this.resetSelect2()}componentWillUnmount(){this.isSelect2Component()&&this.destroySelect2()}render(){const e=this.getItems(this.props.field),t=this.getSelectedValues(),n=e.map((e=>{const t=this.getLabel(e),n=this.getSearchLabel(e),r=this.getValue(e);return(0,q.jsx)("option",{className:"default",value:r,title:n,children:t},`option-${e.id}`)}));return(0,q.jsxs)("select",{id:this.getFieldId(),ref:this.selectRef,disabled:this.props.field.disabled,"data-placeholder":this.props.field.placeholder,multiple:this.props.field.multiple,defaultValue:t,...this.props.field.validation,children:[this.insertEmptyOption(),n]})}}function be(){const[e,t]=(0,a.useState)(!1),n=(0,f.Z)((e=>e("mailpoet-form-editor").getFormName()),[]),r=p()({"is-selected":e}),{changeFormName:i}=(0,h.Z)("mailpoet-form-editor");return(0,q.jsxs)("div",{className:r,children:[(0,q.jsx)("label",{htmlFor:"post-title",className:"screen-reader-text",children:j.x.I18n.t("addFormName")}),(0,q.jsx)("input",{id:"form-title",className:"form-editor-title",placeholder:j.x.I18n.t("addFormName"),"data-automation-id":"form_title_input",type:"text",onKeyPress:()=>t(!1),onBlur:()=>t(!1),onChange:e=>i(e.target.value),value:n})]})}function ye(e){let{onToggle:t,isOpened:n}=e;const r=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),i=(0,f.Z)((e=>e("mailpoet-form-editor").getAllAvailableSegments()),[]),o=(0,f.Z)((e=>e("mailpoet-form-editor").getAllAvailablePages()),[]),a=(0,f.Z)((e=>e("mailpoet-form-editor").getNotice("missing-lists")),[]),l=(0,f.Z)((e=>e("mailpoet-form-editor").isFormEnabled()),[]),{changeFormSettings:s,toggleForm:c}=(0,h.Z)("mailpoet-form-editor"),u=r.segments?i.filter((e=>r.segments.includes(e.id.toString()))):[],d=a&&!u.length;return(0,q.jsx)(ae.Z,{children:(0,q.jsxs)(le.Z,{title:j.x.I18n.t("formSettings"),opened:n,onToggle:t,children:[(0,q.jsx)(be,{}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("displayForm"),checked:l,onChange:c}),(0,q.jsxs)(ce.ZP,{label:j.x.I18n.t("settingsListLabel"),className:p()({"mailpoet-form-missing-lists":d}),children:[d?(0,q.jsx)("span",{className:"mailpoet-form-lists-error",children:j.x.I18n.t("settingsPleaseSelectList")}):null,(0,q.jsx)(ve,{item:{segments:u},onValueChange:e=>{(0,oe.isEqual)(r.segments,e.target.value)||s({...r,segments:e.target.value})},field:{id:"segments",name:"segments",values:i,multiple:!0,placeholder:j.x.I18n.t("settingsPleaseSelectList"),getLabel:e=>`${e.name} (${parseInt(e.subscribers,10).toLocaleString()})`,filter:e=>!(e.deleted_at||"default"!==e.type)}})]}),(0,q.jsx)(ue.Z,{className:"mailpoet-form-success-types__control",onChange:e=>{s({...r,on_success:e})},selected:r.on_success||"message",label:j.x.I18n.t("settingsAfterSubmit"),options:[{label:j.x.I18n.t("settingsShowMessage"),value:"message"},{label:j.x.I18n.t("settingsGoToPage"),value:"page"}]}),"page"===r.on_success?(0,q.jsx)(de.Z,{value:r.success_page,options:o.map((e=>({value:e.id.toString(),label:e.title}))),onChange:e=>{s({...r,success_page:e})}}):(0,q.jsx)(pe.Z,{value:r.success_message,onChange:e=>{s({...r,success_message:e})},rows:3})]})})}ve.propTypes={onValueChange:U().func,field:U().shape({name:U().string.isRequired,values:U().oneOfType([U().object,U().array]),getLabel:U().func,resetSelect2OnUpdate:U().bool,selected:U().func,endpoint:U().string,filter:U().func,getSearchLabel:U().func,getValue:U().func,placeholder:U().string,remoteQuery:U().object,extendSelect2Options:U().object,multiple:U().bool,forceSelect2:U().bool,transformChangedValue:U().func,disabled:U().bool,validation:U().shape({"data-parsley-required":U().bool,"data-parsley-required-message":U().string,"data-parsley-type":U().string,"data-parsley-errors-container":U().string,maxLength:U().number})}).isRequired,item:U().object,disabled:U().bool,width:U().string,dropDownParent:U().string},ve.defaultProps={onValueChange:function(){},disabled:!1,width:"",item:void 0,dropDownParent:void 0},ye.propTypes={onToggle:U().func.isRequired,isOpened:U().bool.isRequired};var xe=n(82667);let we;!function(e){e.Left="left",e.Center="center",e.Right="right"}(we||(we={}));var Ce=n(86215),_e=n(72660),Se=n(49601),ke=n(78869),Ie=n(98742),Ee=n(86430),Te=n(44006),Ae=n(58105),De=n(178);const Le=["colors","disableCustomColors","gradients","disableCustomGradients"],Pe=e=>{let{className:t,colors:n,gradients:r,disableCustomColors:i,disableCustomGradients:o,children:l,settings:s,title:c,showTitle:u=!0,__experimentalHasMultipleOrigins:d,__experimentalIsRenderedInSidebar:m,enableAlpha:f}=e;const h=(0,Ie.Z)(Pe),{batch:g}=(0,ke.Z)();return(0,oe.isEmpty)(n)&&(0,oe.isEmpty)(r)&&i&&o&&(0,oe.every)(s,(e=>(0,oe.isEmpty)(e.colors)&&(0,oe.isEmpty)(e.gradients)&&(void 0===e.disableCustomColors||e.disableCustomColors)&&(void 0===e.disableCustomGradients||e.disableCustomGradients)))?null:(0,a.createElement)(_e.Z,{className:p()("block-editor-panel-color-gradient-settings",t),label:u?c:void 0,resetAll:()=>{g((()=>{s.forEach((e=>{let{colorValue:t,gradientValue:n,onColorChange:r,onGradientChange:i}=e;t?r():n&&i()}))}))},panelId:h,__experimentalFirstVisibleItemClass:"first",__experimentalLastVisibleItemClass:"last"},(0,a.createElement)(Ee.Z,{settings:s,panelId:h,colors:n,gradients:r,disableCustomColors:i,disableCustomGradients:o,__experimentalHasMultipleOrigins:d,__experimentalIsRenderedInSidebar:m,enableAlpha:f}),!!l&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(Se.Z,{marginY:4})," ",l))},Fe=e=>{const t=(0,Ae.Z)();return t.colors=(0,Te.Z)("color.palette"),t.gradients=(0,Te.Z)("color.gradients"),(0,a.createElement)(Pe,(0,Ce.Z)({},t,e))},Ne=e=>{const t=(0,De.Z)();return(0,a.createElement)(Pe,(0,Ce.Z)({},t,e))};var je=e=>(0,oe.every)(Le,(t=>e.hasOwnProperty(t)))?(0,a.createElement)(Pe,e):e.__experimentalHasMultipleOrigins?(0,a.createElement)(Ne,e):(0,a.createElement)(Fe,e);function Re(e){let{title:t,settings:n}=e;const r=(0,L.yu)("color.palette"),i=(0,L.yu)("color.gradients");return(0,q.jsx)("div",{children:(0,q.jsx)(je,{title:t,colors:r,gradients:i,settings:n})})}var Oe=n(91016);function Me(e){let{value:t,onChange:n}=e;const r=(0,L.yu)("typography.fontSizes");return(0,q.jsx)(Oe.Z,{value:t,onChange:n,fontSizes:r})}function Be(e){let{name:t,imageUrl:n,onImageUrlChange:r,imageDisplay:i,onImageDisplayChange:o}=e;return(0,q.jsxs)("div",{className:"mailpoet-styles-settings-image-url",children:[(0,q.jsx)(ce.ZP.VisualLabel,{children:t}),(0,q.jsxs)("div",{className:"mailpoet-styles-settings-image-url-body",children:[(0,q.jsx)("input",{type:"text",value:n??"",onChange:e=>r(e.target.value)}),(0,q.jsx)(L.R,{onSelect:e=>r(e.url),allowedTypes:["image"],render:e=>{let{open:t}=e;return(0,q.jsx)(O.Z,{isSecondary:!0,isSmall:!0,onClick:t,children:j.x.I18n.t("formSettingsStylesSelectImage")})}})]}),(0,q.jsx)("div",{className:"mailpoet-styles-settings-image-url-display",children:(0,q.jsx)(de.Z,{value:i,options:[{label:j.x.I18n.t("imagePlacementScale"),value:"scale"},{label:j.x.I18n.t("imagePlacementFit"),value:"fit"},{label:j.x.I18n.t("imagePlacementTile"),value:"tile"}],onChange:o})})]})}const We=(0,q.jsx)(Y.Wj,{width:"14px",height:"14px",viewBox:"0 0 14 14",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)(Y.G,{id:"Symbols",stroke:"none",strokeWidth:"1",children:(0,q.jsx)(Y.G,{id:"icons/ic_settings",children:(0,q.jsx)(Y.y$,{d:"M8.05,0 L8.05101528,2.11065231 C8.65254335,2.23933489 9.2139617,2.47621094 9.71391655,2.7999267 L11.2072853,1.30779041 L12.6922096,2.79271465 L11.199432,4.28509331 C11.5234762,4.78529701 11.7605802,5.34705952 11.8893477,5.94898472 L14,5.95 L14,8.05 L11.8895604,8.05002048 C11.7608414,8.65232154 11.5236547,9.21442744 11.199432,9.71490669 L12.6922096,11.2072853 L11.2072853,12.6922096 L9.71391655,11.2000733 C9.2139617,11.5237891 8.65254335,11.7606651 8.05101528,11.8893477 L8.05,14 L5.95,14 L5.94898472,11.8893477 C5.34705952,11.7605802 4.78529701,11.5234762 4.28509331,11.199432 L2.79271465,12.6922096 L1.30779041,11.2072853 L2.7999267,9.71391655 C2.4760325,9.21368611 2.23907376,8.65192438 2.11043961,8.05002048 L8.8817842e-16,8.05 L1.01676633e-15,5.95 L2.11065231,5.94898472 C2.23933489,5.34745665 2.47621094,4.7860383 2.7999267,4.28608345 L1.30779041,2.79271465 L2.79271465,1.30779041 L4.28509331,2.80056797 C4.78529701,2.47652376 5.34705952,2.23941984 5.94898472,2.11065231 L5.95,0 L8.05,0 Z M7,4 C5.34314575,4 4,5.34314575 4,7 C4,8.65685425 5.34314575,10 7,10 C8.65685425,10 10,8.65685425 10,7 C10,5.34314575 8.65685425,4 7,4 Z",id:"ic_settings"})})})}),ze=(0,q.jsx)(Y.Wj,{width:"13",height:"13",viewBox:"4 4 16 16",xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)(Y.G,{id:"icons/checkbox-on-small",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:(0,q.jsx)(Y.y$,{d:"M12,4 C16.418278,4 20,7.581722 20,12 C20,16.418278 16.418278,20 12,20 C7.581722,20 4,16.418278 4,12 C4,7.581722 7.581722,4 12,4 Z M15.5939818,8.20494484 C15.1497095,7.86124495 14.5235958,7.95992422 14.1955177,8.42535116 L14.1955177,8.42535116 L11.2218999,12.6438652 L9.73479332,10.9561217 C9.36019283,10.530981 8.72753928,10.5044698 8.32172209,10.8969074 C7.91590488,11.289345 7.89059874,11.9521231 8.26519924,12.3772638 L8.26519924,12.3772638 L10.5728715,14.9962817 C10.9986562,15.4795122 11.7391892,15.4370557 12.1120948,14.9080343 L12.1120948,14.9080343 L15.8043703,9.66999857 C16.1324484,9.20457165 16.0382543,8.54864475 15.5939818,8.20494484 Z",id:"Combined-Shape",fill:"#ff5301",fillRule:"nonzero"})})});function He(e){let{label:t,active:n,canBeActive:r,onClick:i,children:o,className:l,automationId:s,displaySettingsIcon:c}=e;const[u,d]=(0,a.useState)(!1);return(0,q.jsxs)("div",{"data-automation-id":s,className:p()(l,"selection-item",{"selection-item-active":n&&r}),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:i,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),i())},role:"button",tabIndex:0,children:[(0,q.jsxs)("div",{className:"selection-item-body",children:[(0,q.jsxs)("div",{className:"selection-item-settings",children:[c?(0,q.jsx)("div",{className:p()("selection-item-icon",{"selection-item-icon-hover":u}),children:We}):(0,q.jsx)("div",{}),u&&!n&&r&&(0,q.jsx)("div",{className:"selection-item-settings-oval"}),n&&r&&(0,q.jsx)("div",{className:"selection-item-check",children:ze})]}),o]}),u&&(0,q.jsx)("div",{className:"selection-item-overlay"})]},t)}function Ze(e){let{label:t,active:n,onClick:r,iconUrl:i}=e;return(0,q.jsx)(He,{label:t,onClick:r,active:n,canBeActive:!0,displaySettingsIcon:!1,className:"close-button-selection-item",children:(0,q.jsx)("img",{src:i,alt:t.replace("_"," "),className:"close-button-selection-item-icon"})})}function Ue(e){let{name:t,value:n,onChange:r}=e;const i=(0,f.Z)((e=>e("mailpoet-form-editor").getCloseIconsUrl()),[]);return(0,q.jsxs)("div",{children:[(0,q.jsx)(ce.ZP.VisualLabel,{children:t}),(0,q.jsxs)("div",{className:"close-button-selection-item-list",children:[(0,q.jsx)(Ze,{label:"round_white",active:"round_white"===n,iconUrl:i.replace("img/form_close_icon","img/form_close_icon/round_white.svg"),onClick:()=>r("round_white")}),(0,q.jsx)(Ze,{label:"round_black",active:"round_black"===n,iconUrl:i.replace("img/form_close_icon","img/form_close_icon/round_black.svg"),onClick:()=>r("round_black")}),(0,q.jsx)(Ze,{label:"square_white",active:"square_white"===n,iconUrl:i.replace("img/form_close_icon","img/form_close_icon/square_white.svg"),onClick:()=>r("square_white")}),(0,q.jsx)(Ze,{label:"square_black",active:"square_black"===n,iconUrl:i.replace("img/form_close_icon","img/form_close_icon/square_black.svg"),onClick:()=>r("square_black")}),(0,q.jsx)(Ze,{label:"classic",active:"classic"===n,iconUrl:i.replace("img/form_close_icon","img/form_close_icon/classic.svg"),onClick:()=>r("classic")}),(0,q.jsx)(Ze,{label:"classic_white",active:"classic_white"===n,iconUrl:i.replace("img/form_close_icon","img/form_close_icon/classic_white.svg"),onClick:()=>r("classic_white")})]})]})}He.defaultProps={canBeActive:!0,displaySettingsIcon:!0,className:void 0,automationId:void 0};const Ve={width:{unit:"percent",value:100}},Ge={formDelay:15,formCookieExpiration:7},qe={styles:{width:{unit:"pixel",value:560}},...Ge,animation:"slideup"},$e={styles:{width:{unit:"percent",value:100}},position:"top",...Ge,animation:"slideup"},Ye={width:{unit:"percent",value:100}},Ke={styles:{width:{unit:"pixel",value:560}},position:"right",...Ge,animation:"slideup"},Xe={formPadding:20,inputPadding:5,borderSize:0,borderRadius:0,alignment:"left",closeButton:"round_white"};var Je=n(75929);const Qe=["Arial","Comic Sans MS","Courier New","Georgia","Lucida","Tahoma","Times New Roman","Trebuchet MS","Verdana"];function et(e){let{onChange:t,value:n,name:r,hideLabelFromVision:i=!1}=e;const o=(0,f.Z)((e=>e("mailpoet-form-editor").getAllCustomFonts()),[]),a={color:"lightgray",backgroundColor:"white",cursor:"default"},l=e=>({fontFamily:e,cursor:"default",marginLeft:16}),s=[{key:j.x.I18n.t("formFontsDefaultTheme"),name:j.x.I18n.t("formFontsDefaultTheme"),selectable:!0,value:""},{key:j.x.I18n.t("formFontsStandard"),name:j.x.I18n.t("formFontsStandard"),selectable:!1,style:a},...Qe.map((e=>({key:e,name:e,selectable:!0,style:l(e),value:e})))];j.x.libs3rdPartyEnabled&&(s.push({key:j.x.I18n.t("formFontsCustom"),name:j.x.I18n.t("formFontsCustom"),selectable:!1,style:a}),o.forEach((e=>{s.push({key:e,name:e,selectable:!0,style:l(e),value:e})})));let c=void 0!==n&&s.find((e=>e.value===n));return c||(c=s[0]),(0,q.jsx)(Je.Z,{options:s,onChange:e=>{const n=e.selectedItem;n.selectable&&t(n.value)},value:c,label:r,className:"mailpoet-font-family-select",hideLabelFromVision:i})}function tt(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getAllCustomFonts()),[]);if(!j.x.libs3rdPartyEnabled)return null;const t=e.map((e=>e.replace(" ","+"))).map((e=>e.concat(":400,400i,700,700i"))).join("|");return(0,q.jsx)("link",{rel:"stylesheet",href:`https://fonts.googleapis.com/css?family=${t}`})}function nt(e){let{onToggle:t,isOpened:n}=e;const{changeFormSettings:r}=(0,h.Z)("mailpoet-form-editor"),i=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),o=(0,a.useRef)(i);(0,a.useEffect)((()=>{o.current=i}),[i]);const l=(e,t)=>{const n={...o.current};n[e]=t??Xe[e]??void 0,r(n),o.current=n};return(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("formSettingsStyles"),opened:n,onToggle:t,children:(0,q.jsxs)("div",{className:"mailpoet-styles-settings",children:[(0,q.jsx)(Re,{title:j.x.I18n.t("formSettingsColor"),settings:[{label:j.x.I18n.t("formSettingsStylesBackground"),colorValue:i.backgroundColor,gradientValue:i.gradient,onColorChange:(0,oe.partial)(l,"backgroundColor"),onGradientChange:(0,oe.partial)(l,"gradient")},{label:j.x.I18n.t("formSettingsStylesFont"),colorValue:i.fontColor,onColorChange:(0,oe.partial)(l,"fontColor")},{label:j.x.I18n.t("formSettingsBorder"),colorValue:i.borderColor,onColorChange:(0,oe.partial)(l,"borderColor")}]}),(0,q.jsx)(Be,{name:j.x.I18n.t("formSettingsStylesBackgroundImage"),imageUrl:i.backgroundImageUrl,onImageUrlChange:(0,oe.partial)(l,"backgroundImageUrl"),imageDisplay:i.backgroundImageDisplay,onImageDisplayChange:(0,oe.partial)(l,"backgroundImageDisplay")}),(0,q.jsx)(Me,{value:i.fontSize,onChange:(0,oe.partial)(l,"fontSize")}),(0,q.jsx)(et,{name:j.x.I18n.t("formSettingsStylesFontFamily"),value:i.fontFamily,onChange:(0,oe.partial)(l,"fontFamily")}),(0,q.jsx)(xe.Z,{label:j.x.I18n.t("formSettingsInputPadding"),value:i.inputPadding,min:0,max:30,allowReset:!0,onChange:(0,oe.partial)(l,"inputPadding")}),(0,q.jsx)(xe.Z,{label:j.x.I18n.t("formSettingsBorderSize"),value:void 0!==i.borderSize?i.borderSize:0,min:0,max:10,allowReset:!0,onChange:(0,oe.partial)(l,"borderSize"),className:"mailpoet-automation-styles-border-size"}),(0,q.jsx)(xe.Z,{label:j.x.I18n.t("formSettingsBorderRadius"),value:void 0!==i.borderRadius?i.borderRadius:0,min:0,max:40,allowReset:!0,onChange:(0,oe.partial)(l,"borderRadius")}),(0,q.jsx)(de.Z,{label:j.x.I18n.t("formSettingsAlignment"),onChange:(0,oe.partial)(l,"alignment"),options:[{value:we.Left,label:j.x.I18n.t("formSettingsAlignmentLeft")},{value:we.Center,label:j.x.I18n.t("formSettingsAlignmentCenter")},{value:we.Right,label:j.x.I18n.t("formSettingsAlignmentRight")}],value:i.alignment}),(0,q.jsx)(xe.Z,{label:j.x.I18n.t("formSettingsFormPadding"),value:i.formPadding,min:0,max:40,allowReset:!0,onChange:(0,oe.partial)(l,"formPadding")}),(0,q.jsx)(Re,{title:j.x.I18n.t("validationMessageColor"),settings:[{label:j.x.I18n.t("successValidationColorTitle"),colorValue:i.successValidationColor,onColorChange:(0,oe.partial)(l,"successValidationColor")},{label:j.x.I18n.t("errorValidationColorTitle"),colorValue:i.errorValidationColor,onColorChange:(0,oe.partial)(l,"errorValidationColor")}]}),(0,q.jsx)(Ue,{name:j.x.I18n.t("closeButtonHeading"),value:i.closeButton,onChange:(0,oe.partial)(l,"closeButton")})]})})})}nt.propTypes={onToggle:U().func.isRequired,isOpened:U().bool.isRequired};const rt=(0,q.jsxs)(Y.Wj,{width:"144",height:"120",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 144 120",children:[(0,q.jsxs)("defs",{children:[(0,q.jsx)(Y.UL,{id:"a",x:"8",y:"8",width:"128",height:"68",rx:"1"}),(0,q.jsx)(Y.UL,{id:"b",x:"8",y:"100",width:"128",height:"12",rx:"1"})]}),(0,q.jsxs)(Y.G,{fill:"none",fillRule:"evenodd",children:[(0,q.jsx)(Y.y$,{d:"M4 0h136a4 4 0 0 1 4 4v112a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#FFF",fillRule:"nonzero"}),(0,q.jsx)("use",{fill:"#FFF",xlinkHref:"#a"}),(0,q.jsx)("use",{fillOpacity:".4",fill:"#E5E9F8",xlinkHref:"#a"}),(0,q.jsx)("use",{fill:"#FFF",xlinkHref:"#b"}),(0,q.jsx)("use",{fillOpacity:".4",fill:"#E5E9F8",xlinkHref:"#b"}),(0,q.jsx)(Y.UL,{fill:"#FF5301",fillRule:"nonzero",x:"98",y:"84",width:"38",height:"8",rx:"1"}),(0,q.jsx)(Y.UL,{fill:"#FFE0D0",fillRule:"nonzero",x:"53",y:"84",width:"38",height:"8",rx:"1"}),(0,q.jsx)(Y.UL,{fill:"#FFE0D0",fillRule:"nonzero",x:"8",y:"84",width:"38",height:"8",rx:"1"})]})]});function it(e){let{label:t,icon:n,active:r,canBeActive:i,onClick:o}=e;return(0,q.jsxs)(He,{label:t,onClick:o,active:r,canBeActive:i,className:"form-placement-option",automationId:`form-placement-option-${t}`,children:[(0,q.jsx)("div",{className:"form-placement-option-icon",children:n}),(0,q.jsx)("div",{className:"form-placement-option-label",children:(0,q.jsx)("p",{children:t})})]})}function ot(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),{showPlacementSettings:t}=(0,h.Z)("mailpoet-form-editor");return(0,q.jsx)(it,{active:e.formPlacement.belowPosts.enabled,label:j.x.I18n.t("placeFormBellowPages"),icon:rt,onClick:()=>{t("below_posts")},canBeActive:!0})}it.defaultProps={canBeActive:!0};const at=(0,q.jsxs)(Y.Wj,{width:"144",height:"120",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 144 120",children:[(0,q.jsxs)("defs",{children:[(0,q.jsx)(Y.UL,{id:"popup_icon_a",x:"8",y:"8",width:"128",height:"104",rx:"1"}),(0,q.jsx)(Y.y$,{d:"M49 34h46a4 4 0 0 1 4 4v40a4 4 0 0 1-4 4H49a4 4 0 0 1-4-4V38a4 4 0 0 1 4-4z",id:"popup_icon_c"}),(0,q.jsxs)("filter",{x:"-61.1%",y:"-56.2%",width:"222.2%",height:"237.5%",filterUnits:"objectBoundingBox",id:"popup_icon_b",children:[(0,q.jsx)("feOffset",{dy:"6",in:"SourceAlpha",result:"shadowOffsetOuter1"}),(0,q.jsx)("feGaussianBlur",{stdDeviation:"10",in:"shadowOffsetOuter1",result:"shadowBlurOuter1"}),(0,q.jsx)("feColorMatrix",{values:"0 0 0 0 0.265158067 0 0 0 0 0.293073922 0 0 0 0 0.400749362 0 0 0 0.145352129 0",in:"shadowBlurOuter1"})]})]}),(0,q.jsxs)(Y.G,{fill:"none",fillRule:"evenodd",children:[(0,q.jsx)(Y.y$,{d:"M4 0h136a4 4 0 0 1 4 4v112a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#FFF",fillRule:"nonzero"}),(0,q.jsx)("use",{fill:"#FFF",xlinkHref:"#popup_icon_a"}),(0,q.jsx)("use",{fillOpacity:".4",fill:"#E5E9F8",xlinkHref:"#popup_icon_a"}),(0,q.jsxs)(Y.G,{fillRule:"nonzero",children:[(0,q.jsx)("use",{fill:"#000",filter:"url(#popup_icon_b)",xlinkHref:"#popup_icon_c"}),(0,q.jsx)("use",{fill:"#FFF",xlinkHref:"#popup_icon_c"})]}),(0,q.jsx)(Y.UL,{fill:"#FF5301",fillRule:"nonzero",x:"53",y:"66",width:"38",height:"8",rx:"1"}),(0,q.jsx)(Y.UL,{fill:"#FFE0D0",fillRule:"nonzero",x:"53",y:"54",width:"38",height:"8",rx:"1"}),(0,q.jsx)(Y.UL,{fill:"#FFE0D0",fillRule:"nonzero",x:"53",y:"42",width:"38",height:"8",rx:"1"})]})]});function lt(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),{showPlacementSettings:t}=(0,h.Z)("mailpoet-form-editor");return(0,q.jsx)(it,{active:e.formPlacement.popup.enabled,label:j.x.I18n.t("placePopupFormOnPages"),icon:at,onClick:()=>{t("popup")},canBeActive:!0})}const st=(0,q.jsxs)(Y.Wj,{width:"144",height:"120",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 144 120",children:[(0,q.jsx)("defs",{children:(0,q.jsx)(Y.UL,{id:"fixed_bar_a",x:"8",y:"24",width:"128",height:"88",rx:"1"})}),(0,q.jsxs)(Y.G,{fill:"none",fillRule:"evenodd",children:[(0,q.jsx)(Y.y$,{d:"M4 0h136a4 4 0 0 1 4 4v112a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#FFF",fillRule:"nonzero"}),(0,q.jsx)("use",{fill:"#FFF",xlinkHref:"#a"}),(0,q.jsx)("use",{fillOpacity:".4",fill:"#E5E9F8",xlinkHref:"#fixed_bar_a"}),(0,q.jsx)(Y.UL,{fill:"#FF5301",fillRule:"nonzero",x:"98",y:"8",width:"38",height:"8",rx:"1"}),(0,q.jsx)(Y.UL,{fill:"#FFE0D0",fillRule:"nonzero",x:"53",y:"8",width:"38",height:"8",rx:"1"}),(0,q.jsx)(Y.UL,{fill:"#FFE0D0",fillRule:"nonzero",x:"8",y:"8",width:"38",height:"8",rx:"1"})]})]});function ct(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),{showPlacementSettings:t}=(0,h.Z)("mailpoet-form-editor");return(0,q.jsx)(it,{active:e.formPlacement.fixedBar.enabled,label:j.x.I18n.t("placeFixedBarFormOnPages"),icon:st,onClick:()=>{t("fixed_bar")},canBeActive:!0})}const ut=(0,q.jsxs)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"76",height:"63",viewBox:"0 0 76 63",children:[(0,q.jsxs)("defs",{children:[(0,q.jsxs)("filter",{id:"slide_in_prefix__a",width:"216.9%",height:"245.3%",x:"-55.8%",y:"-67.2%",filterUnits:"objectBoundingBox",children:[(0,q.jsx)("feOffset",{dy:"4",in:"SourceAlpha",result:"shadowOffsetOuter1"}),(0,q.jsx)("feGaussianBlur",{in:"shadowOffsetOuter1",result:"shadowBlurOuter1",stdDeviation:"9"}),(0,q.jsx)("feColorMatrix",{in:"shadowBlurOuter1",result:"shadowMatrixOuter1",values:"0 0 0 0 0.265158067 0 0 0 0 0.293073922 0 0 0 0 0.400749362 0 0 0 0.145352129 0"}),(0,q.jsxs)("feMerge",{children:[(0,q.jsx)("feMergeNode",{in:"shadowMatrixOuter1"}),(0,q.jsx)("feMergeNode",{in:"SourceGraphic"})]})]}),(0,q.jsxs)("filter",{id:"slide_in_prefix__c",width:"226.3%",height:"255.8%",x:"-73.7%",y:"-77.9%",filterUnits:"objectBoundingBox",children:[(0,q.jsx)("feOffset",{dx:"-3",in:"SourceAlpha",result:"shadowOffsetOuter1"}),(0,q.jsx)("feGaussianBlur",{in:"shadowOffsetOuter1",result:"shadowBlurOuter1",stdDeviation:"5.5"}),(0,q.jsx)("feColorMatrix",{in:"shadowBlurOuter1",values:"0 0 0 0 0.265158067 0 0 0 0 0.293073922 0 0 0 0 0.400749362 0 0 0 0.145352129 0"})]}),(0,q.jsx)(Y.UL,{id:"slide_in_prefix__b",width:"67.556",height:"54.6",x:"4.222",y:"4.2",rx:".525"}),(0,q.jsx)(Y.y$,{id:"slide_in_prefix__d",d:"M.525 0h27.45c.29 0 .525.235.525.525v22.05c0 .29-.235.525-.525.525H.525c-.29 0-.525-.235-.525-.525V.525C0 .235.235 0 .525 0z"})]}),(0,q.jsxs)(Y.G,{fill:"none",fillRule:"evenodd",filter:"url(#slide_in_prefix__a)",children:[(0,q.jsx)(Y.y$,{fill:"#FFF",fillRule:"nonzero",d:"M2.1 0h71.8c1.16 0 2.1.94 2.1 2.1v58.8c0 1.16-.94 2.1-2.1 2.1H2.1C.94 63 0 62.06 0 60.9V2.1C0 .94.94 0 2.1 0z"}),(0,q.jsx)("use",{fill:"#FFF",xlinkHref:"#slide_in_prefix__b"}),(0,q.jsx)("use",{fill:"#E5E9F8",fillOpacity:".4",xlinkHref:"#slide_in_prefix__b"}),(0,q.jsxs)(Y.G,{fillRule:"nonzero",transform:"translate(43.278 35.7)",children:[(0,q.jsx)("use",{fill:"#000",filter:"url(#slide_in_prefix__c)",xlinkHref:"#slide_in_prefix__d"}),(0,q.jsx)("use",{fill:"#FFF",xlinkHref:"#slide_in_prefix__d"}),(0,q.jsx)(Y.UL,{width:"15.833",height:"4.2",x:"6.333",y:"14.7",fill:"#FF5301",rx:".525"}),(0,q.jsx)(Y.UL,{width:"15.833",height:"4.2",x:"6.333",y:"9.45",fill:"#FFE0D0",rx:".525"}),(0,q.jsx)(Y.UL,{width:"15.833",height:"4.2",x:"6.333",y:"4.2",fill:"#FFE0D0",rx:".525"})]})]})]});function dt(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),{showPlacementSettings:t}=(0,h.Z)("mailpoet-form-editor");return(0,q.jsx)(it,{active:e.formPlacement.slideIn.enabled,label:j.x.I18n.t("placeSlideInFormOnPages"),icon:ut,onClick:()=>{t("slide_in")},canBeActive:!0})}const pt=(0,q.jsxs)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",width:"144",height:"120",viewBox:"0 0 144 120",children:[(0,q.jsxs)("defs",{children:[(0,q.jsx)(Y.UL,{id:"sidebar_icon_prefix__b",width:"82",height:"104",x:"8",y:"8",rx:"1"}),(0,q.jsx)(Y.UL,{id:"sidebar_icon_prefix__c",width:"38",height:"30",x:"98",y:"8",rx:"1"}),(0,q.jsx)(Y.UL,{id:"sidebar_icon_prefix__d",width:"38",height:"30",x:"98",y:"82",rx:"1"}),(0,q.jsxs)("filter",{id:"sidebar_icon_prefix__a",width:"212.5%",height:"235%",x:"-56.2%",y:"-67.5%",filterUnits:"objectBoundingBox",children:[(0,q.jsx)("feOffset",{dy:"7",in:"SourceAlpha",result:"shadowOffsetOuter1"}),(0,q.jsx)("feGaussianBlur",{in:"shadowOffsetOuter1",result:"shadowBlurOuter1",stdDeviation:"17.5"}),(0,q.jsx)("feColorMatrix",{in:"shadowBlurOuter1",result:"shadowMatrixOuter1",values:"0 0 0 0 0.265158067 0 0 0 0 0.293073922 0 0 0 0 0.400749362 0 0 0 0.145352129 0"}),(0,q.jsxs)("feMerge",{children:[(0,q.jsx)("feMergeNode",{in:"shadowMatrixOuter1"}),(0,q.jsx)("feMergeNode",{in:"SourceGraphic"})]})]})]}),(0,q.jsxs)(Y.G,{fill:"none",fillRule:"evenodd",filter:"url(#sidebar_icon_prefix__a)",children:[(0,q.jsx)(Y.y$,{fill:"#FFF",fillRule:"nonzero",d:"M4 0h136c2.21 0 4 1.79 4 4v112c0 2.21-1.79 4-4 4H4c-2.21 0-4-1.79-4-4V4c0-2.21 1.79-4 4-4z"}),(0,q.jsx)("use",{fill:"#FFF",xlinkHref:"#sidebar_icon_prefix__b"}),(0,q.jsx)("use",{fill:"#E5E9F8",fillOpacity:".4",xlinkHref:"#sidebar_icon_prefix__b"}),(0,q.jsx)("use",{fill:"#FFF",xlinkHref:"#sidebar_icon_prefix__c"}),(0,q.jsx)("use",{fill:"#E5E9F8",fillOpacity:".4",xlinkHref:"#sidebar_icon_prefix__c"}),(0,q.jsx)("use",{fill:"#FFF",xlinkHref:"#sidebar_icon_prefix__d"}),(0,q.jsx)("use",{fill:"#E5E9F8",fillOpacity:".4",xlinkHref:"#sidebar_icon_prefix__d"}),(0,q.jsx)(Y.UL,{width:"38",height:"8",x:"98",y:"66",fill:"#FF5301",fillRule:"nonzero",rx:"1"}),(0,q.jsx)(Y.UL,{width:"38",height:"8",x:"98",y:"56",fill:"#FFE0D0",fillRule:"nonzero",rx:"1"}),(0,q.jsx)(Y.UL,{width:"38",height:"8",x:"98",y:"46",fill:"#FFE0D0",fillRule:"nonzero",rx:"1"})]})]});function mt(){const{showPlacementSettings:e}=(0,h.Z)("mailpoet-form-editor");return(0,q.jsx)(it,{active:!1,label:j.x.I18n.t("formPlacementOtherLabel"),icon:pt,onClick:()=>{e("others")},canBeActive:!1})}function ft(e){let{onToggle:t,isOpened:n}=e;return(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("formPlacement"),opened:n,onToggle:t,className:"form-sidebar-form-placement-panel",children:(0,q.jsxs)("div",{className:"form-placement-option-list",children:[(0,q.jsx)(ot,{}),(0,q.jsx)(ct,{}),(0,q.jsx)(lt,{}),(0,q.jsx)(dt,{}),(0,q.jsx)(mt,{})]})})})}ft.propTypes={onToggle:U().func.isRequired,isOpened:U().bool.isRequired};var ht=n(70907),gt=n.n(ht);function vt(e){let{options:t,value:n,onChange:r}=e;const i=(0,a.useRef)(null),o=(0,a.useRef)(null),l=(0,a.useCallback)((e=>{r(e.getValue())}),[r]);return(0,a.useEffect)((()=>(o.current=gt().fromTextArea(i.current,t),o.current.on("change",l),()=>{o.current&&o.current.toTextArea()})),[t,l]),(0,a.useEffect)((()=>{o.current.getValue()!==n&&(o.current.off("change",l),o.current.setValue(n),o.current.on("change",l))}),[n,l]),(0,q.jsx)("div",{children:(0,q.jsx)("textarea",{ref:i,name:"name",defaultValue:n,autoComplete:"off"})})}function bt(e){let{onToggle:t,isOpened:n}=e;const r=(0,f.Z)((e=>e("mailpoet-form-editor").getFormStyles()),[]),{changeFormStyles:i}=(0,h.Z)("mailpoet-form-editor");return(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("customCss"),opened:n,onToggle:t,children:(0,q.jsx)(vt,{value:r,onChange:i})})})}function yt(){const e=(0,h.Z)("mailpoet-form-editor").toggleSidebarPanel,t=(0,f.Z)((e=>e("mailpoet-form-editor").getSidebarOpenedPanels()),[]);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ye,{isOpened:t.includes("basic-settings"),onToggle:(0,oe.partial)(e,"basic-settings")}),(0,q.jsx)(nt,{isOpened:t.includes("styles-settings"),onToggle:(0,oe.partial)(e,"styles-settings")}),(0,q.jsx)(ft,{isOpened:t.includes("form-placement"),onToggle:(0,oe.partial)(e,"form-placement")}),(0,q.jsx)(bt,{isOpened:t.includes("custom-css"),onToggle:(0,oe.partial)(e,"custom-css")})]})}function xt(){return(0,q.jsx)(ae.Z,{children:(0,q.jsx)(L.N$,{})})}function wt(e){let{children:t,closeSidebar:n}=e;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)("div",{className:"components-panel__header interface-complementary-area-header__small",children:[(0,q.jsx)("span",{className:"interface-complementary-area-header__small-title",children:j.x.I18n.t("formSettings")}),(0,q.jsx)(O.Z,{onClick:n,icon:"no-alt"})]}),(0,q.jsxs)("div",{className:"components-panel__header interface-complementary-area-header edit-post-sidebar__panel-tabs",children:[t,(0,q.jsx)(O.Z,{onClick:n,icon:"no-alt"})]})]})}function Ct(e){let{onClose:t}=e;const n=(0,f.Z)((e=>e("mailpoet-form-editor").getDefaultSidebarActiveTab()),[]),r=(0,f.Z)((e=>e("core/block-editor").getSelectedBlockClientId()),[]),{switchDefaultSidebarTab:i}=(0,h.Z)("mailpoet-form-editor");return(0,a.useEffect)((()=>{i(r?"block":"form")}),[r,i]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(wt,{closeSidebar:t,children:(0,q.jsxs)("ul",{children:[(0,q.jsx)("li",{children:(0,q.jsx)("button",{onClick:()=>{i("form")},className:p()("components-button edit-post-sidebar__panel-tab",{"is-active":"form"===n}),"data-automation-id":"mailpoet_form_settings_tab",type:"button",children:j.x.I18n.t("form")})}),(0,q.jsx)("li",{children:(0,q.jsx)("button",{onClick:()=>{i("block")},className:p()("components-button edit-post-sidebar__panel-tab",{"is-active":"block"===n}),"data-automation-id":"mailpoet_block_settings_tab",type:"button",children:(0,b.__)("Block")})})]})}),"form"===n?(0,q.jsx)(yt,{}):(0,q.jsx)(xt,{})]})}n(25002),vt.propTypes={value:U().string.isRequired,onChange:U().func.isRequired,options:U().shape({lineNumbers:U().bool,tabMode:U().string,matchBrackets:U().bool,theme:U().string,mode:U().string})},vt.defaultProps={options:{lineNumbers:!0,tabMode:"indent",matchBrackets:!0,theme:"neo",mode:"css"}},bt.propTypes={onToggle:U().func.isRequired,isOpened:U().bool.isRequired};var _t=n(30211);function St(e){let{label:t,minPercents:n=0,maxPercents:r=100,minPixels:i=10,maxPixels:o=1e3,value:l,defaultPercentValue:s=50,defaultPixelValue:c=200,onChange:u}=e;const[d,p]=(0,a.useState)(l??{unit:"pixel",value:void 0});return(0,a.useEffect)((()=>{p(l)}),[l]),(0,q.jsxs)("div",{className:"mailpoet-size-settings-control",children:[(0,q.jsx)(ce.ZP.VisualLabel,{children:t}),(0,q.jsx)(ue.Z,{selected:d.unit||"pixel",options:[{label:"px",value:"pixel"},{label:"%",value:"percent"}],onChange:e=>{const t={value:"pixel"===e?c:s,unit:e};p(t),u(t)}}),(0,q.jsx)(xe.Z,{value:d.value??("pixel"===d.unit?c:s),min:"pixel"===d.unit?i:n,max:"pixel"===d.unit?o:r,onChange:e=>{const t={unit:"pixel"===d.unit?"pixel":"percent",value:e};p(t),u(t)}})]})}function kt(e){let{settingsPlacementKey:t}=e;const n=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),r=(0,f.Z)((e=>(0,_t.sortBy)("name",e("mailpoet-form-editor").getAllWPTags().concat(e("mailpoet-form-editor").getAllWooCommerceTags()))),[]),i=(0,f.Z)((e=>(0,_t.sortBy)("name",e("mailpoet-form-editor").getAllWPCategories().concat(e("mailpoet-form-editor").getAllWooCommerceCategories()))),[]),o=(0,f.Z)((e=>e("mailpoet-form-editor").getAllWPPages()),[]),a=(0,f.Z)((e=>(0,_t.sortBy)("name",e("mailpoet-form-editor").getAllWPPosts().concat(e("mailpoet-form-editor").getAllWooCommerceProducts()))),[]),l=(0,f.Z)((e=>e("mailpoet-form-editor").getIsPreviewShown()),[]),{changeFormSettings:s}=(0,h.Z)("mailpoet-form-editor");let c="no-preview";return l&&(c="preview"),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(se.Z,{label:j.x.I18n.t("placeFormOnAllPages"),checked:n.formPlacement[t].pages.all,onChange:e=>{(0,_t.compose)([s,(0,_t.assocPath)(`formPlacement.${t}.pages.all`,e),(0,_t.cond)([[()=>e,(0,_t.compose)([(0,_t.assocPath)(`formPlacement.${t}.pages.selected`,[]),(0,_t.assocPath)(`formPlacement.${t}.categories`,[]),(0,_t.assocPath)(`formPlacement.${t}.tags`,[])])],[()=>!e,_t.identity]])])(n)}}),(0,q.jsx)("div",{"data-automation-id":"form-placement-select-page",children:(0,q.jsx)("div",{className:"form-editor-placement-selection",children:(0,q.jsx)(ve,{dropDownParent:l?".mailpoet-modal-content":void 0,item:{id:`${c}${n.formPlacement[t].pages.selected.join()}`},onValueChange:e=>{const r=n.formPlacement[t].pages.selected;(0,_t.isEqual)(r,e.target.value)||(0,_t.compose)([s,(0,_t.assocPath)(`formPlacement.${t}.pages.selected`,e.target.value),(0,_t.cond)([[()=>!!e.target.value.length,(0,_t.assocPath)(`formPlacement.${t}.pages.all`,!1)],[()=>!e.target.value.length,_t.identity]])])(n)},field:{id:`${c}pages`,name:"pages",values:o,multiple:!0,placeholder:j.x.I18n.t("selectPage"),getLabel:e=>e.name,selected:()=>n.formPlacement[t].pages.selected}})})}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("placeFormOnAllPosts"),checked:n.formPlacement[t].posts.all,onChange:e=>{(0,_t.compose)([s,(0,_t.assocPath)(`formPlacement.${t}.posts.all`,e),(0,_t.cond)([[()=>e,(0,_t.compose)([(0,_t.assocPath)(`formPlacement.${t}.posts.selected`,[]),(0,_t.assocPath)(`formPlacement.${t}.categories`,[]),(0,_t.assocPath)(`formPlacement.${t}.tags`,[])])],[()=>!e,_t.identity]])])(n)}}),(0,q.jsx)("div",{className:"form-editor-placement-selection",children:(0,q.jsx)(ve,{dropDownParent:l?".mailpoet-modal-content":void 0,item:{id:`${c}${n.formPlacement[t].posts.selected.join()}`},onValueChange:e=>{const r=n.formPlacement[t].posts.selected;(0,_t.isEqual)(r,e.target.value)||(0,_t.compose)([s,(0,_t.assocPath)(`formPlacement.${t}.posts.selected`,e.target.value),(0,_t.cond)([[()=>!!e.target.value.length,(0,_t.assocPath)(`formPlacement.${t}.posts.all`,!1)],[()=>!e.target.value.length,_t.identity]])])(n)},field:{id:`${c}posts`,name:"posts",values:a,multiple:!0,placeholder:j.x.I18n.t("selectPage"),getLabel:e=>e.name,selected:()=>n.formPlacement[t].posts.selected}})}),(0,q.jsxs)("div",{children:[(0,q.jsx)("h3",{className:"form-editor-sidebar-heading",children:j.x.I18n.t("displayOnCategories")}),(0,q.jsx)("div",{className:"form-editor-placement-selection",children:(0,q.jsx)(ve,{dropDownParent:l?".mailpoet-modal-content":void 0,item:{id:`${c}${n.formPlacement[t].categories.join()}`},onValueChange:e=>{const r=n.formPlacement[t].categories;(0,_t.isEqual)(r,e.target.value)||(0,_t.compose)([s,(0,_t.assocPath)(`formPlacement.${t}.categories`,e.target.value),(0,_t.cond)([[()=>!!e.target.value.length,(0,_t.compose)([(0,_t.assocPath)(`formPlacement.${t}.pages.all`,!1),(0,_t.assocPath)(`formPlacement.${t}.posts.all`,!1)])],[()=>!e.target.value.length,_t.identity]])])(n)},field:{id:`${c}categories`,name:"categories",values:i,multiple:!0,placeholder:j.x.I18n.t("selectPage"),getLabel:e=>e.name,selected:()=>n.formPlacement[t].categories}})})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("h3",{className:"form-editor-sidebar-heading",children:j.x.I18n.t("displayOnTags")}),(0,q.jsx)("div",{className:"form-editor-placement-selection",children:(0,q.jsx)(ve,{dropDownParent:l?".mailpoet-modal-content":void 0,item:{id:`${c}${n.formPlacement[t].tags.join()}`},onValueChange:e=>{const r=n.formPlacement[t].tags;(0,_t.isEqual)(r,e.target.value)||(0,_t.compose)([s,(0,_t.assocPath)(`formPlacement.${t}.tags`,e.target.value),(0,_t.cond)([[()=>!!e.target.value.length,(0,_t.compose)([(0,_t.assocPath)(`formPlacement.${t}.pages.all`,!1),(0,_t.assocPath)(`formPlacement.${t}.posts.all`,!1)])],[()=>!e.target.value.length,_t.identity]])])(n)},field:{id:`${c}tags`,name:"tags",values:r,multiple:!0,placeholder:j.x.I18n.t("selectPage"),getLabel:e=>e.name,selected:()=>n.formPlacement[t].tags}})})]})]})}function It(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),{changeFormSettings:t}=(0,h.Z)("mailpoet-form-editor"),n=e.formPlacement.belowPosts.enabled;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("p",{children:j.x.I18n.t("placeFormBellowPagesDescription")}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("enable"),checked:n,onChange:(0,_t.compose)([t,(0,_t.assocPath)("formPlacement.belowPosts.enabled",_t.__,e)])}),n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(St,{label:j.x.I18n.t("formSettingsWidth"),value:e.formPlacement.belowPosts.styles.width,minPixels:200,maxPixels:1200,minPercents:10,maxPercents:100,defaultPixelValue:560,defaultPercentValue:100,onChange:n=>{t((0,_t.assocPath)("formPlacement.belowPosts.styles.width",n,e))}}),(0,q.jsx)(kt,{settingsPlacementKey:"belowPosts"})]})]})}function Et(e){let{settingsPlacementKey:t}=e;const n=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),{changeFormSettings:r}=(0,h.Z)("mailpoet-form-editor");return(0,q.jsx)(de.Z,{label:j.x.I18n.t("animationHeader"),value:n.formPlacement[t].animation,options:[{label:j.x.I18n.t("animationNone"),value:"none"},{label:"Fade In",value:"fadein"},{label:"Slide Right",value:"slideright"},{label:"Slide Left",value:"slideleft"},{label:"Slide Up",value:"slideup"},{label:"Slide Down",value:"slidedown"},{label:"Zoom Out",value:"zoomout"},{label:"Zoom In",value:"zoomin"},{label:"Flip",value:"flip"}],onChange:(0,_t.compose)([r,(0,_t.assocPath)(`formPlacement.${t}.animation`,_t.__,n)])})}function Tt(e){let{settingsPlacementKey:t}=e;const n=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),{changeFormSettings:r}=(0,h.Z)("mailpoet-form-editor");return(0,q.jsx)(de.Z,{label:j.x.I18n.t("formPlacementCookieExpiration"),value:n.formPlacement[t].cookieExpiration,options:[{value:"0",label:j.x.I18n.t("formPlacementCookieExpirationAlways")},{value:"1",label:j.x.I18n.t("formPlacementCookieExpirationDay")},...[3,7,14,30,60,90].map((e=>({value:`${e}`,label:j.x.I18n.t("formPlacementCookieExpirationDays").replace("%1s",e.toString())})))],onChange:(0,_t.compose)([r,(0,_t.assocPath)(`formPlacement.${t}.cookieExpiration`,_t.__,n)])})}const At=[0,2,5,10,15,30,45,60,120,180,240];function Dt(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),{changeFormSettings:t}=(0,h.Z)("mailpoet-form-editor"),n=e.formPlacement.popup.enabled;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("p",{children:j.x.I18n.t("placePopupFormOnPagesDescription")}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("enable"),checked:n,onChange:(0,_t.compose)([t,(0,_t.assocPath)("formPlacement.popup.enabled",_t.__,e)])}),n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("hr",{}),(0,q.jsx)(St,{label:j.x.I18n.t("formSettingsWidth"),value:e.formPlacement.popup.styles.width,minPixels:200,maxPixels:1200,minPercents:10,maxPercents:100,defaultPixelValue:560,defaultPercentValue:100,onChange:n=>{t((0,_t.assocPath)("formPlacement.popup.styles.width",n,e))}}),(0,q.jsx)(kt,{settingsPlacementKey:"popup"}),(0,q.jsx)(Et,{settingsPlacementKey:"popup"}),(0,q.jsx)(de.Z,{label:j.x.I18n.t("formPlacementDelay"),value:`${e.formPlacement.popup.delay}`,onChange:(0,_t.compose)([t,(0,_t.assocPath)("formPlacement.popup.delay",_t.__,e)]),options:At.map((e=>({value:`${e}`,label:j.x.I18n.t("formPlacementDelaySeconds").replace("%1s",`${e}`)})))}),(0,q.jsx)(Tt,{settingsPlacementKey:"popup"}),(0,q.jsxs)("div",{children:[(0,q.jsx)("p",{children:(0,q.jsx)("b",{children:j.x.I18n.t("exitIntentTitle")})}),(0,q.jsx)("p",{children:j.x.I18n.t("exitIntentDescription")}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("exitIntentSwitch"),checked:e.formPlacement.popup.exitIntentEnabled,onChange:(0,_t.compose)([t,(0,_t.assocPath)("formPlacement.popup.exitIntentEnabled",_t.__,e)])})]})]})]})}var Lt=n(34352),Pt=n.n(Lt);function Ft(){const[e,t]=(0,a.useState)(null),n=(0,f.Z)((e=>e("mailpoet-form-editor").getFormExports()),[]),r=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),i=(0,f.Z)((e=>e("mailpoet-form-editor").isFormSaved()),[]),{changeFormSettings:o}=(0,h.Z)("mailpoet-form-editor"),l=Pt()(j.x.I18n.t("addFormWidgetHint"),/\[link](.*?)\[\/link]/g,(e=>(0,q.jsx)("a",{href:"widgets.php",target:"_blank",children:e},"addFormWidgetHintLink"))),s=Pt()(j.x.I18n.t("addFormShortcodeHint"),/\[shortcode]/g,(e=>(0,q.jsx)("code",{children:n.shortcode},e))),c=(0,oe.curry)(((e,r)=>(r.preventDefault(),j.x.trackEvent("Forms > Embed",{"Embed type":e}),t("php"===e?n.php:n.iframe)))),u=Pt()(j.x.I18n.t("addFormPhpIframeHint"),/\[link](.*?)\[\/link]/g,(e=>"PHP"===e?(0,q.jsx)("a",{href:"#",onClick:c("php"),children:e},"exportPHP"):(0,q.jsx)("a",{href:"#",onClick:c("iframe"),children:e},"exportIframe")));return i?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("p",{children:l}),(0,q.jsx)("p",{children:s}),(0,q.jsx)("p",{children:u}),e?(0,q.jsx)(pe.Z,{readOnly:!0,onClick:e=>e.target.select(),rows:8,value:e,onChange:()=>{}},"copyTextArea"):null,(0,q.jsx)("hr",{}),(0,q.jsx)(St,{label:j.x.I18n.t("formSettingsWidth"),value:r.formPlacement.others.styles.width,minPixels:200,maxPixels:1200,minPercents:10,maxPercents:100,defaultPixelValue:200,defaultPercentValue:100,onChange:e=>{o((0,_t.assocPath)("formPlacement.others.styles.width",e,r))}})]}):(0,q.jsx)("p",{children:j.x.I18n.t("saveFormFirst")})}const Nt=[0,2,5,10,15,30,45,60,120,180,240];function jt(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),{changeFormSettings:t}=(0,h.Z)("mailpoet-form-editor"),n=e.formPlacement.fixedBar.enabled;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("p",{children:j.x.I18n.t("placeFixedBarFormOnPagesDescription")}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("enable"),checked:n,onChange:(0,_t.compose)([t,(0,_t.assocPath)("formPlacement.fixedBar.enabled",_t.__,e)])}),n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("hr",{}),(0,q.jsx)(ue.Z,{label:j.x.I18n.t("formPlacementPlacementPosition"),selected:e.formPlacement.fixedBar.position,options:[{label:j.x.I18n.t("formPlacementPlacementPositionTop"),value:"top"},{label:j.x.I18n.t("formPlacementPlacementPositionBottom"),value:"bottom"}],onChange:(0,_t.compose)([t,(0,_t.assocPath)("formPlacement.fixedBar.position",_t.__,e)])}),(0,q.jsx)(St,{label:j.x.I18n.t("formSettingsWidth"),value:e.formPlacement.fixedBar.styles.width,minPixels:200,maxPixels:1200,minPercents:10,maxPercents:100,defaultPixelValue:560,defaultPercentValue:100,onChange:n=>{t((0,_t.assocPath)("formPlacement.fixedBar.styles.width",n,e))}}),(0,q.jsx)(kt,{settingsPlacementKey:"fixedBar"}),(0,q.jsx)(Et,{settingsPlacementKey:"fixedBar"}),(0,q.jsx)(de.Z,{label:j.x.I18n.t("formPlacementDelay"),value:`${e.formPlacement.fixedBar.delay}`,onChange:(0,_t.compose)([t,(0,_t.assocPath)("formPlacement.fixedBar.delay",_t.__,e)]),options:Nt.map((e=>({value:`${e}`,label:j.x.I18n.t("formPlacementDelaySeconds").replace("%1s",`${e}`)})))}),(0,q.jsx)(Tt,{settingsPlacementKey:"fixedBar"})]})]})}const Rt=[0,2,5,10,15,30,45,60,120,180,240];function Ot(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),{changeFormSettings:t}=(0,h.Z)("mailpoet-form-editor"),n=e.formPlacement.slideIn.enabled;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("p",{children:j.x.I18n.t("placeSlideInFormOnPagesDescription")}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("enable"),checked:n,onChange:(0,_t.compose)([t,(0,_t.assocPath)("formPlacement.slideIn.enabled",_t.__,e)])}),n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("hr",{}),(0,q.jsx)(ue.Z,{label:j.x.I18n.t("formPlacementPlacementPosition"),selected:e.formPlacement.slideIn.position,options:[{label:j.x.I18n.t("formPlacementPlacementPositionLeft"),value:"left"},{label:j.x.I18n.t("formPlacementPlacementPositionRight"),value:"right"}],onChange:(0,_t.compose)([t,(0,_t.assocPath)("formPlacement.slideIn.position",_t.__,e)])}),(0,q.jsx)(St,{label:j.x.I18n.t("formSettingsWidth"),value:e.formPlacement.slideIn.styles.width,minPixels:200,maxPixels:1200,minPercents:10,maxPercents:100,defaultPixelValue:560,defaultPercentValue:100,onChange:n=>{t((0,_t.assocPath)("formPlacement.slideIn.styles.width",n,e))}}),(0,q.jsx)(kt,{settingsPlacementKey:"slideIn"}),(0,q.jsx)(Et,{settingsPlacementKey:"slideIn"}),(0,q.jsx)(de.Z,{label:j.x.I18n.t("formPlacementDelay"),value:`${e.formPlacement.slideIn.delay}`,onChange:(0,_t.compose)([t,(0,_t.assocPath)("formPlacement.slideIn.delay",_t.__,e)]),options:Rt.map((e=>({value:`${e}`,label:j.x.I18n.t("formPlacementDelaySeconds").replace("%1s",`${e}`)})))}),(0,q.jsx)(Tt,{settingsPlacementKey:"slideIn"})]})]})}function Mt(e){let{activePanel:t}=e;return(0,q.jsxs)("div",{className:"mailpoet-styles-settings",children:["others"===t&&(0,q.jsx)(Ft,{}),"below_posts"===t&&(0,q.jsx)(It,{}),"fixed_bar"===t&&(0,q.jsx)(jt,{}),"popup"===t&&(0,q.jsx)(Dt,{}),"slide_in"===t&&(0,q.jsx)(Ot,{})]})}function Bt(e){let{onClose:t}=e;const n=(0,f.Z)((e=>e("mailpoet-form-editor").getPreviewSettings()),[]);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(wt,{closeSidebar:t,children:(0,q.jsxs)("h3",{className:"mailpoet-sidebar-header-heading",children:["others"===n.formType&&j.x.I18n.t("placeFormOthers"),"below_posts"===n.formType&&j.x.I18n.t("placeFormBellowPages"),"fixed_bar"===n.formType&&j.x.I18n.t("placeFixedBarFormOnPages"),"popup"===n.formType&&j.x.I18n.t("placePopupFormOnPages"),"slide_in"===n.formType&&j.x.I18n.t("placeSlideInFormOnPages")]})}),(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{children:(0,q.jsx)(Mt,{activePanel:n.formType})})})]})}function Wt(){const{toggleSidebar:e,changeActiveSidebar:t}=(0,h.Z)("mailpoet-form-editor"),n=(0,f.Z)((e=>e("mailpoet-form-editor").getActiveSidebar()),[]),r=(0,f.Z)((e=>e("core/block-editor").getSelectedBlockClientId()),[]);return(0,a.useEffect)((()=>{r&&t("default")}),[r,t]),(0,q.jsxs)("div",{className:"edit-post-sidebar interface-complementary-area mailpoet_form_editor_sidebar",children:["default"===n&&(0,q.jsx)(Ct,{onClose:()=>{e(!1)}}),"placement_settings"===n&&(0,q.jsx)(Bt,{onClose:()=>{t("default")}})]})}var zt=n(65223);function Ht(e){let{setIsInserterOpened:t}=e;const n=(0,f.Z)((e=>e("mailpoet-form-editor").getInserterPanelInsertPoint()),[]);return(0,q.jsxs)("div",{className:"edit-post-editor__inserter-panel",children:[(0,q.jsx)("div",{className:"edit-post-editor__inserter-panel-header",children:(0,q.jsx)(O.Z,{icon:zt.Z,onClick:()=>t(!1)})}),(0,q.jsx)("div",{className:"edit-post-editor__inserter-panel-content",children:(0,q.jsx)(L.Yi,{showMostUsedBlocks:!0,showInserterHelpPanel:!1,rootClientId:n.rootClientId??void 0,__experimentalInsertionIndex:n.insertionIndex??void 0})})]})}var Zt=n(81535);function Ut(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getDismissibleNotices()),[]),t=(0,f.Z)((e=>e("mailpoet-form-editor").getNonDismissibleNotices()),[]),{removeNotice:n}=(0,h.Z)("mailpoet-form-editor"),r=(0,oe.memoize)((e=>{setTimeout((()=>n(e)),5e3)}));return e.forEach((e=>r(e.id))),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Zt.Z,{notices:t,className:"components-editor-notices__pinned"}),(0,q.jsx)(Zt.Z,{notices:e,className:"components-editor-notices__dismissible automation-dismissible-notices",onRemove:n})]})}function Vt(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").hasUnsavedChanges()),[]);function t(t){return e?(t.returnValue=j.x.I18n.t("changesNotSaved"),t.returnValue):""}return(0,a.useEffect)((()=>(window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)))),null}var Gt=n(35572);const qt=()=>{const e=document.getElementById("mailpoet-form-editor-form-styles"),t=(0,f.Z)((e=>e("mailpoet-form-editor").getFormStyles()),[]);try{Gt.parse(t)}catch(t){return l.createPortal(null,e)}const n=(0,L.Fu)([{css:t}],".editor-styles-wrapper");return l.createPortal(n[0],e)};var $t=n(3386);function Yt(){return(0,q.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"16px",height:"24px",viewBox:"0 0 16 24",version:"1.1",children:(0,q.jsx)("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:(0,q.jsx)("g",{className:"mailpoet_preview_icon_fill",transform:"translate(-760.000000, -64.000000)",fillRule:"nonzero",children:(0,q.jsx)("g",{transform:"translate(712.000000, 64.000000)",children:(0,q.jsx)("g",{transform:"translate(48.000000, 0.000000)",children:(0,q.jsx)("path",{d:"M16,3 C16,1.34314575 14.6568542,0 13,0 L3,0 C1.34314575,0 0,1.34314575 0,3 L0,21 C0,22.6568542 1.34314575,24 3,24 L13,24 C14.6568542,24 16,22.6568542 16,21 L16,3 Z M14,5.5 L14,17.5 C14,18.0522847 13.5522847,18.5 13,18.5 L3,18.5 C2.44771525,18.5 2,18.0522847 2,17.5 L2,5.5 C2,4.94771525 2.44771525,4.5 3,4.5 L13,4.5 C13.5522847,4.5 14,4.94771525 14,5.5 Z M7,21 C7,20.4477153 7.44771525,20 8,20 C8.55228475,20 9,20.4477153 9,21 C9,21.5522847 8.55228475,22 8,22 C7.44771525,22 7,21.5522847 7,21 Z",id:"Shape"})})})})})})}function Kt(){return(0,q.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24px",height:"24px",viewBox:"0 0 24 24",version:"1.1",children:(0,q.jsx)("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:(0,q.jsx)("g",{className:"mailpoet_preview_icon_fill",transform:"translate(-712.000000, -64.000000)",fillRule:"nonzero",children:(0,q.jsx)("g",{transform:"translate(712.000000, 64.000000)",children:(0,q.jsx)("g",{children:(0,q.jsx)("path",{d:"M13.965,20.5 C14.1138804,20.5 14.2550143,20.5663566 14.35,20.681 L14.35,20.681 L16.449,23.213 C16.5561084,23.3657981 16.5692196,23.5655248 16.4830056,23.7310137 C16.3967915,23.8965027 16.2255996,24.0002137 16.039,24 L16.039,24 L7.96,24 C7.7734004,24.0002137 7.60220849,23.8965027 7.51599443,23.7310137 C7.42978036,23.5655248 7.44289164,23.3657981 7.55,23.213 L7.55,23.213 L9.65,20.681 C9.74498572,20.5663566 9.88611956,20.5 10.035,20.5 L10.035,20.5 Z M22.5,-4.08562073e-14 C23.3284271,-4.08562073e-14 24,0.671572875 24,1.5 L24,1.5 L24,17.5 C24,18.3284271 23.3284271,19 22.5,19 L22.5,19 L1.5,19 C0.671572875,19 0,18.3284271 0,17.5 L0,17.5 L0,1.5 C0,0.671572875 0.671572875,-4.08562073e-14 1.5,-4.08562073e-14 L1.5,-4.08562073e-14 Z M21.5,2 L2.5,2 C2.22385763,2 2,2.22385763 2,2.5 L2,2.5 L2,14.5 C2,14.7761424 2.22385763,15 2.5,15 L2.5,15 L21.5,15 C21.7761424,15 22,14.7761424 22,14.5 L22,14.5 L22,2.5 C22,2.22385763 21.7761424,2 21.5,2 L21.5,2 Z"})})})})})})}function Xt(e){let{children:t,onDisplayTypeChange:n,selectedDisplayType:r}=e;const[i,o]=(0,a.useState)(r),l=e=>{o(e),n(e)};return(0,q.jsxs)("div",{className:"mailpoet_browser_preview",children:[(0,q.jsxs)("div",{className:"mailpoet_browser_preview_toggle",children:[(0,q.jsx)("a",{className:p()("mailpoet_browser_preview_icon",{mailpoet_active:"desktop"===i}),onClick:e=>{e.preventDefault(),l("desktop")},title:j.x.I18n.t("formPreviewDesktop"),href:"#","data-automation-id":"preview_type_desktop",children:(0,q.jsx)(Kt,{})}),(0,q.jsx)("a",{className:p()("mailpoet_browser_preview_icon",{mailpoet_active:"mobile"===i}),onClick:e=>{e.preventDefault(),l("mobile")},title:j.x.I18n.t("formPreviewMobile"),href:"#","data-automation-id":"preview_type_mobile",children:(0,q.jsx)(Yt,{})})]}),(0,q.jsx)("div",{className:p()("mailpoet_browser_preview_container",{mailpoet_browser_preview_container_mobile:"desktop"!==i},{mailpoet_browser_preview_container_desktop:"desktop"===i}),children:(0,q.jsx)("div",{className:"mailpoet_browser_preview_border",children:t})}),"desktop"!==i&&(0,q.jsx)("p",{className:"mailpoet_form_preview_disclaimer",children:j.x.I18n.t("formPreviewMobileDisclaimer")})]})}function Jt(){const e=(0,a.useRef)(null),[t,n]=(0,a.useState)(!1),{hidePreview:r,changePreviewSettings:i}=(0,h.Z)("mailpoet-form-editor"),o=(0,f.Z)((e=>e("mailpoet-form-editor").getIsPreviewShown()),[]),l=(0,f.Z)((e=>e("mailpoet-form-editor").getIsPreviewReady()),[]),s=(0,f.Z)((e=>e("mailpoet-form-editor").getPreviewSettings()),[]),c=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),u=(0,f.Z)((e=>e("mailpoet-form-editor").getFormData().id),[]),d=(0,f.Z)((e=>e("mailpoet-form-editor").getEditorUrl()),[]),p=(0,f.Z)((e=>e("mailpoet-form-editor").getPreviewPageUrl()),[]);(0,a.useEffect)((()=>{n(!1);const e=document.getElementById("beacon-container");o&&e&&(e.style.display="none")}),[o]),(0,a.useEffect)((()=>{if(!e.current||!t)return;const n={formType:s.formType,formSettings:c};e.current.contentWindow.postMessage(n,p)}),[c,e,s,t,p]);const m=(0,a.useCallback)((()=>{const e=document.getElementById("beacon-container");e&&(e.style.display="block"),r()}),[r]),g=(0,a.useCallback)((e=>{n(!1),i({...s,formType:e})}),[i,s]),v=(0,a.useCallback)((e=>{i({...s,displayType:e})}),[i,s]);if(!o)return null;const b={id:u,form_type:s.formType,editor_url:d};let y=`${p}&data=${btoa(JSON.stringify(b))}`;return["below_posts"].includes(s.formType)&&(y+=`#mailpoet_form_preview_${u}`),(0,q.jsxs)(ne.u,{onRequestClose:m,fullScreen:!0,contentClassName:"mailpoet_form_preview_modal",overlayClassName:"mailpoet_form_preview_modal_overlay",children:[!l&&(0,q.jsx)("div",{className:"mailpoet_spinner_wrapper",children:(0,q.jsx)($t.ZP,{})}),l&&(0,q.jsxs)("div",{className:"mailpoet_preview_content_wrapper",children:[(0,q.jsxs)("div",{className:"mailpoet_preview_sidebar",children:[(0,q.jsx)(de.Z,{label:j.x.I18n.t("formPlacementLabel"),value:s.formType,onChange:g,className:"mailpoet_preview_form_type_selection","data-automation-id":"form_type_selection",options:[{value:"others",label:j.x.I18n.t("placeFormOthers")},{value:"below_posts",label:j.x.I18n.t("placeFormBellowPages")},{value:"fixed_bar",label:j.x.I18n.t("placeFixedBarFormOnPages")},{value:"popup",label:j.x.I18n.t("placePopupFormOnPages")},{value:"slide_in",label:j.x.I18n.t("placeSlideInFormOnPages")}]}),(0,q.jsx)(Mt,{activePanel:s.formType})]}),(0,q.jsxs)(Xt,{onDisplayTypeChange:v,selectedDisplayType:s.displayType,children:[!t&&(0,q.jsx)("div",{className:"mailpoet_spinner_wrapper",children:(0,q.jsx)($t.ZP,{})}),(0,q.jsx)("iframe",{ref:e,className:"mailpoet_form_preview_iframe",src:y,title:j.x.I18n.t("formPreview"),onLoad:()=>n(!0),"data-automation-id":"form_preview_iframe",scrolling:"others"===s.formType?"no":"yes"}),"others"===s.formType&&"desktop"===s.displayType&&(0,q.jsx)("div",{className:"mailpoet_form_preview_disclaimer",children:j.x.I18n.t("formPreviewOthersDisclaimer")})]})]})]})}function Qt(e){let{children:t}=e;const{fontColor:n,backgroundColor:r,gradient:i,fontSize:o,borderRadius:a,borderSize:l,borderColor:s,alignment:c,formPadding:u,backgroundImageUrl:d,backgroundImageDisplay:p,fontFamily:m}=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),h=(0,f.Z)((e=>e("mailpoet-form-editor").getPreviewSettings()),[]),g=(0,f.Z)((e=>e("mailpoet-form-editor").getFormWidth(h.formType)),[h.formType]);let v;l&&s&&(v="solid");let b,y,x,w="";o&&(w=Number(o)),a&&(b=Number(a)),u&&(y=Number(u)),c&&(x=c);const C=[],_={color:n,fontSize:w,fontFamily:m,lineHeight:1.2,borderRadius:b,borderWidth:l,borderColor:s,borderStyle:v,textAlign:x,padding:y,width:"pixel"===g.unit?g.value:`${g.value}%`,margin:"0 auto",maxWidth:"100%"};if(["others","below_posts"].includes(h.formType)&&"percent"===g.unit&&(_.maxWidth=600),void 0!==d&&d){let e="center",t="no-repeat",n="cover";"fit"===p&&(n="auto",e="center top"),"tile"===p&&(t="repeat",n="auto"),C.push(`url(${d}) ${e}/${n} ${t}`)}if(i&&C.push(i),r&&C.push(r),C.length&&(_.background=C.join(", ")),"fixed_bar"===h.formType){const e={width:_.width,margin:"0 auto"};return _.width="max-content",_.minWidth="100%",_.maxWidth="auto",(0,q.jsx)("div",{className:"mailpoet-form-background",style:_,children:(0,q.jsx)("div",{style:e,children:t})})}return(0,q.jsx)("div",{className:"mailpoet-form-background",style:_,children:t})}function en(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").isFullscreenEnabled()),[]);return(0,a.useEffect)((()=>{e?document.body.classList.add("is-fullscreen-mode"):document.body.classList.remove("is-fullscreen-mode")}),[e]),null}function tn(){const e=(0,f.Z)((e=>e("mailpoet-form-editor").getSidebarOpened()),[]),t=(0,f.Z)((e=>e("mailpoet-form-editor").isInserterOpened()),[]),n=(0,f.Z)((e=>e("mailpoet-form-editor").getFormBlocks()),[]),r=(0,f.Z)((e=>e("core").canUser("create","media")),[]),i=(0,f.Z)((e=>e("core/block-editor").getSelectedBlock()),[]),o=p()("edit-post-layout interface-interface-skeleton",i?i.name.replace("/","-"):null,{"is-sidebar-opened":e}),{blocksChangedInBlockEditor:a,toggleInserter:l}=(0,h.Z)("mailpoet-form-editor"),s={mediaUpload:r?A:null,supportsLayout:!1,maxWidth:580,enableCustomSpacing:!0,enableCustomLineHeight:!0,disableCustomFontSizes:!1,enableCustomUnits:!0,__experimentalFetchLinkSuggestions:R,__experimentalBlockPatterns:[],__experimentalBlockPatternCategories:[],__experimentalSetIsInserterOpened:l,__experimentalFeatures:{color:{custom:!0,text:!0,background:!0,customGradient:!0,defaultPalette:!0,palette:{default:L.w0.colors},gradients:{default:L.w0.gradients}}}};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(tt,{}),(0,q.jsx)(P.vn,{children:(0,q.jsx)(g.zt,{children:(0,q.jsxs)("div",{className:o,children:[(0,q.jsxs)("div",{className:"interface-interface-skeleton__editor",children:[(0,q.jsx)("div",{className:"interface-interface-skeleton__header",children:(0,q.jsx)(te,{isInserterOpened:t,setIsInserterOpened:l})}),(0,q.jsx)("div",{className:"interface-interface-skeleton__body",children:(0,q.jsxs)(L.B5,{value:n,onInput:a,onChange:a,settings:s,useSubRegistry:!1,children:[t&&(0,q.jsx)("div",{className:"interface-interface-skeleton__secondary-sidebar",children:(0,q.jsx)(Ht,{setIsInserterOpened:l})}),(0,q.jsxs)("div",{className:"interface-interface-skeleton__content",children:[(0,q.jsx)(Ut,{}),(0,q.jsx)(Vt,{}),(0,q.jsx)(L._D,{className:"edit-post-visual-editor editor-styles-wrapper",children:(0,q.jsxs)(L.u9,{children:[(0,q.jsx)(L.$H,{}),(0,q.jsx)(L.$H.Register,{}),(0,q.jsx)("div",{className:"mailpoet_form",children:(0,q.jsx)(L.o2,{children:(0,q.jsx)(L.uy,{children:(0,q.jsx)(Qt,{children:(0,q.jsx)(L.WD,{})})})})})]})})]}),e&&(0,q.jsx)("div",{className:"interface-interface-skeleton__sidebar",children:(0,q.jsx)(Wt,{})})]})}),(0,q.jsx)(qt,{}),(0,q.jsx)(en,{})]}),(0,q.jsx)(v.Z.Slot,{})]})})}),(0,q.jsx)(Jt,{}),(0,q.jsx)(ie,{})]})}Xt.propTypes={children:U().node.isRequired,onDisplayTypeChange:U().func,selectedDisplayType:U().string},Xt.defaultProps={onDisplayTypeChange:()=>{},selectedDisplayType:"desktop"},Qt.propTypes={children:U().node.isRequired};var nn=n(18439),rn=n(38104);const on=e=>{const t={full_width:e.fullWidth?"1":"0"};return e.inheritFromTheme||(t.bold=e.bold?"1":"0",(0,oe.has)(e,"backgroundColor")&&e.backgroundColor&&(t.background_color=e.backgroundColor),(0,oe.has)(e,"gradient")&&e.gradient&&(t.gradient=e.gradient),(0,oe.has)(e,"fontSize")&&void 0!==e.fontSize&&(t.font_size=e.fontSize),(0,oe.has)(e,"fontColor")&&e.fontColor&&(t.font_color=e.fontColor),(0,oe.has)(e,"borderSize")&&void 0!==e.borderSize&&(t.border_size=e.borderSize),(0,oe.has)(e,"borderRadius")&&void 0!==e.borderRadius&&(t.border_radius=e.borderRadius),(0,oe.has)(e,"borderColor")&&e.borderColor&&(t.border_color=e.borderColor),(0,oe.has)(e,"padding")&&void 0!==e.padding&&(t.padding=e.padding),(0,oe.has)(e,"fontFamily")&&e.fontFamily&&(t.font_family=e.fontFamily)),t},an=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=e.find((e=>e.slug===t));return r?r.color:n},ln=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=e.find((e=>e.slug===t));return r?r.gradient:n},sn=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=e.find((e=>e.slug===t));return r?r.size:n},cn=(e,t,n,r)=>{if(!Array.isArray(r))throw new Error("Mapper expects customFields to be an array.");const i=o=>{if(!Array.isArray(o))throw new Error("Mapper expects blocks to be an array.");return o.map((o=>{var a,l,s,c,u,d,p,m,f,h,g,v,b,y,x,w,C,_,S,k,I,E,T,A,D,L,P,F,N,j,R,O;const M={type:"text",params:{label:o.attributes.label,class_name:o.attributes.className||null}};switch(o.attributes.mandatory&&(M.params.required="1"),o.attributes.labelWithinInput&&(M.params.label_within="1"),o.name){case"core/heading":return{type:"heading",id:"heading",params:{content:o.attributes.content,level:o.attributes.level,align:o.attributes.textAlign||"left",font_size:sn(e,o.attributes.fontSize,null===(a=o.attributes.style)||void 0===a||null===(l=a.typography)||void 0===l?void 0:l.fontSize),text_color:an(t,o.attributes.textColor,null===(s=o.attributes.style)||void 0===s||null===(c=s.color)||void 0===c?void 0:c.text),line_height:null===(u=o.attributes.style)||void 0===u||null===(d=u.typography)||void 0===d?void 0:d.lineHeight,background_color:an(t,o.attributes.backgroundColor,null===(p=o.attributes.style)||void 0===p||null===(m=p.color)||void 0===m?void 0:m.background),anchor:o.attributes.anchor||null,class_name:o.attributes.className||null}};case"core/paragraph":return{type:"paragraph",id:"paragraph",params:{content:o.attributes.content,drop_cap:o.attributes.dropCap?"1":"0",align:o.attributes.align||"left",font_size:sn(e,o.attributes.fontSize,null===(f=o.attributes.style)||void 0===f||null===(h=f.typography)||void 0===h?void 0:h.fontSize),line_height:null===(g=o.attributes.style)||void 0===g||null===(v=g.typography)||void 0===v?void 0:v.lineHeight,text_color:an(t,o.attributes.textColor,null===(b=o.attributes.style)||void 0===b||null===(y=b.color)||void 0===y?void 0:y.text),background_color:an(t,o.attributes.backgroundColor,null===(x=o.attributes.style)||void 0===x||null===(w=x.color)||void 0===w?void 0:w.background),class_name:o.attributes.className||null}};case"core/image":return{type:"image",id:"image",params:{class_name:o.attributes.className||null,align:o.attributes.align||null,url:o.attributes.url||null,alt:o.attributes.alt||null,title:o.attributes.title||null,caption:o.attributes.caption||null,link_destination:o.attributes.linkDestination||null,link:o.attributes.link||null,href:o.attributes.href||null,link_class:o.attributes.linkClass||null,rel:o.attributes.rel||null,link_target:o.attributes.linkTarget||null,id:o.attributes.id||null,size_slug:o.attributes.sizeSlug||null,width:o.attributes.width||null,height:o.attributes.height||null}};case"core/column":return{type:"column",body:i(o.innerBlocks),params:{class_name:o.attributes.className||null,vertical_alignment:o.attributes.verticalAlignment||null,width:o.attributes.width||null,padding:(null===(C=o.attributes.style)||void 0===C||null===(_=C.spacing)||void 0===_?void 0:_.padding)||null,text_color:an(t,o.attributes.textColor,null===(S=o.attributes.style)||void 0===S||null===(k=S.color)||void 0===k?void 0:k.text),background_color:an(t,o.attributes.backgroundColor,null===(I=o.attributes.style)||void 0===I||null===(E=I.color)||void 0===E?void 0:E.background),gradient:ln(n,o.attributes.gradient,null===(T=o.attributes.style)||void 0===T||null===(A=T.color)||void 0===A?void 0:A.gradient)}};case"core/columns":return{type:"columns",body:i(o.innerBlocks),params:{vertical_alignment:o.attributes.verticalAlignment||null,is_stacked_on_mobile:o.attributes.isStackedOnMobile||void 0===o.attributes.isStackedOnMobile?"1":"0",class_name:o.attributes.className||null,padding:(null===(D=o.attributes.style)||void 0===D||null===(L=D.spacing)||void 0===L?void 0:L.padding)||null,text_color:an(t,o.attributes.textColor,null===(P=o.attributes.style)||void 0===P||null===(F=P.color)||void 0===F?void 0:F.text),background_color:an(t,o.attributes.backgroundColor,null===(N=o.attributes.style)||void 0===N||null===(j=N.color)||void 0===j?void 0:j.background),gradient:ln(n,o.attributes.gradient,null===(R=o.attributes.style)||void 0===R||null===(O=R.color)||void 0===O?void 0:O.gradient)}};case"mailpoet-form/email-input":return{...M,id:"email",name:"Email",params:{...M.params,required:"1"},styles:on(o.attributes.styles)};case"mailpoet-form/first-name-input":return{...M,id:"first_name",name:"First name",styles:on(o.attributes.styles)};case"mailpoet-form/last-name-input":return{...M,id:"last_name",name:"Last name",styles:on(o.attributes.styles)};case"mailpoet-form/segment-select":return{...M,id:"segments",type:"segment",name:"List selection",params:{...M.params,values:o.attributes.values.map((e=>({id:e.id,is_checked:e.isChecked?"1":void 0})))}};case"mailpoet-form/submit-button":return{...M,id:"submit",type:"submit",name:"Submit",styles:on(o.attributes.styles)};case"mailpoet-form/divider":return{...M,id:"divider",type:"divider",name:"Divider",params:{class_name:o.attributes.className||null,height:o.attributes.height,type:o.attributes.type,style:o.attributes.style,divider_height:o.attributes.dividerHeight,divider_width:o.attributes.dividerWidth,color:o.attributes.color}};case"mailpoet-form/html":return{...M,id:"html",type:"html",name:"Custom text or HTML",params:{text:o.attributes&&o.attributes.content?o.attributes.content:"",nl2br:o.attributes&&o.attributes.nl2br?"1":"0",class_name:o.attributes.className||null}};default:return o.name.startsWith("mailpoet-form/custom-")?((e,t,n)=>{const r=t.find((t=>t.id===e.attributes.customFieldId));if(!r)return null;const i={...n,id:e.attributes.customFieldId.toString(),name:r.name};return e.name.startsWith("mailpoet-form/custom-date")&&(i.type="date"),e.name.startsWith("mailpoet-form/custom-text")&&(i.type="text",i.styles=on(e.attributes.styles)),e.name.startsWith("mailpoet-form/custom-textarea")&&(i.type="textarea",i.styles=on(e.attributes.styles)),e.name.startsWith("mailpoet-form/custom-radio")&&(i.type="radio"),e.name.startsWith("mailpoet-form/custom-checkbox")&&(i.type="checkbox"),e.name.startsWith("mailpoet-form/custom-select")&&(i.type="select"),(0,oe.has)(e.attributes,"validate")&&(i.params.validate=e.attributes.validate),(0,oe.has)(e.attributes,"hideLabel")&&e.attributes.hideLabel&&(i.params.hide_label="1"),(0,oe.has)(e.attributes,"defaultToday")&&e.attributes.defaultToday&&(i.params.is_default_today="1"),(0,oe.has)(e.attributes,"dateType")&&(i.params.date_type=e.attributes.dateType),(0,oe.has)(e.attributes,"lines")&&(i.params.lines=e.attributes.lines),(0,oe.has)(e.attributes,"dateFormat")&&(i.params.date_format=e.attributes.dateFormat),(0,oe.has)(e.attributes,"values")&&(i.params.values=e.attributes.values.map((e=>{const t={value:e.name};return(0,oe.has)(e,"isChecked")&&e.isChecked&&(t.is_checked="1"),t}))),i})(o,r,M):null}})).filter(Boolean)};return i};function un(e){var t,n,r,i,o,a,l,s,c,u,d,p,m,f,h,g,v,b,y,x,w,C,_,S,k,I,E,T,A,D,L,P,F,N,j,R,O,M,B,W,z,H,Z,U,V,G,q,$,Y,K,X,J,Q,ee,te,ne,re,ie,oe,ae,le,se,ce,ue,de,pe,me,fe,he,ge,ve,be,ye,xe,we,Ce,_e,Se,ke,Ie,Ee,Te,Ae,De,Le,Pe,Fe,Ne,je,Re,Oe,Me,Be,We,ze,He,Ze,Ue,Ve,Ge,qe,$e,Ye,Ke,Xe,Je;const Qe={...e,settings:{...e.settings,form_placement:{popup:{enabled:!0===(null===(t=e.settings.formPlacement)||void 0===t||null===(n=t.popup)||void 0===n?void 0:n.enabled)?"1":"",exit_intent_enabled:null!==(r=e.settings.formPlacement)&&void 0!==r&&null!==(i=r.popup)&&void 0!==i&&i.exitIntentEnabled?"1":"",delay:null===(o=e.settings.formPlacement)||void 0===o||null===(a=o.popup)||void 0===a?void 0:a.delay,cookieExpiration:null===(l=e.settings.formPlacement)||void 0===l||null===(s=l.popup)||void 0===s?void 0:s.cookieExpiration,styles:null===(c=e.settings.formPlacement)||void 0===c||null===(u=c.popup)||void 0===u?void 0:u.styles,animation:null===(d=e.settings.formPlacement)||void 0===d||null===(p=d.popup)||void 0===p?void 0:p.animation,categories:(null===(m=e.settings.formPlacement)||void 0===m||null===(f=m.popup)||void 0===f?void 0:f.categories)??[],tags:(null===(h=e.settings.formPlacement)||void 0===h||null===(g=h.popup)||void 0===g?void 0:g.tags)??[],posts:{all:!0===(null===(v=e.settings.formPlacement)||void 0===v||null===(b=v.popup)||void 0===b||null===(y=b.posts)||void 0===y?void 0:y.all)?"1":"",selected:null===(x=e.settings.formPlacement)||void 0===x||null===(w=x.popup)||void 0===w||null===(C=w.posts)||void 0===C?void 0:C.selected},pages:{all:!0===(null===(_=e.settings.formPlacement)||void 0===_||null===(S=_.popup)||void 0===S||null===(k=S.pages)||void 0===k?void 0:k.all)?"1":"",selected:null===(I=e.settings.formPlacement)||void 0===I||null===(E=I.popup)||void 0===E||null===(T=E.pages)||void 0===T?void 0:T.selected}},fixed_bar:{enabled:!0===(null===(A=e.settings.formPlacement)||void 0===A||null===(D=A.fixedBar)||void 0===D?void 0:D.enabled)?"1":"",delay:null===(L=e.settings.formPlacement)||void 0===L||null===(P=L.fixedBar)||void 0===P?void 0:P.delay,cookieExpiration:null===(F=e.settings.formPlacement)||void 0===F||null===(N=F.fixedBar)||void 0===N?void 0:N.cookieExpiration,styles:null===(j=e.settings.formPlacement)||void 0===j||null===(R=j.fixedBar)||void 0===R?void 0:R.styles,position:null===(O=e.settings.formPlacement)||void 0===O||null===(M=O.fixedBar)||void 0===M?void 0:M.position,animation:null===(B=e.settings.formPlacement)||void 0===B||null===(W=B.fixedBar)||void 0===W?void 0:W.animation,categories:(null===(z=e.settings.formPlacement)||void 0===z||null===(H=z.fixedBar)||void 0===H?void 0:H.categories)??[],tags:(null===(Z=e.settings.formPlacement)||void 0===Z||null===(U=Z.fixedBar)||void 0===U?void 0:U.tags)??[],posts:{all:!0===(null===(V=e.settings.formPlacement)||void 0===V||null===(G=V.fixedBar)||void 0===G||null===(q=G.posts)||void 0===q?void 0:q.all)?"1":"",selected:null===($=e.settings.formPlacement)||void 0===$||null===(Y=$.fixedBar)||void 0===Y||null===(K=Y.posts)||void 0===K?void 0:K.selected},pages:{all:!0===(null===(X=e.settings.formPlacement)||void 0===X||null===(J=X.fixedBar)||void 0===J||null===(Q=J.pages)||void 0===Q?void 0:Q.all)?"1":"",selected:null===(ee=e.settings.formPlacement)||void 0===ee||null===(te=ee.fixedBar)||void 0===te||null===(ne=te.pages)||void 0===ne?void 0:ne.selected}},below_posts:{enabled:!0===(null===(re=e.settings.formPlacement)||void 0===re||null===(ie=re.belowPosts)||void 0===ie?void 0:ie.enabled)?"1":"",styles:null===(oe=e.settings.formPlacement)||void 0===oe||null===(ae=oe.belowPosts)||void 0===ae?void 0:ae.styles,categories:(null===(le=e.settings.formPlacement)||void 0===le||null===(se=le.belowPosts)||void 0===se?void 0:se.categories)??[],tags:(null===(ce=e.settings.formPlacement)||void 0===ce||null===(ue=ce.belowPosts)||void 0===ue?void 0:ue.tags)??[],posts:{all:!0===(null===(de=e.settings.formPlacement)||void 0===de||null===(pe=de.belowPosts)||void 0===pe||null===(me=pe.posts)||void 0===me?void 0:me.all)?"1":"",selected:null===(fe=e.settings.formPlacement)||void 0===fe||null===(he=fe.belowPosts)||void 0===he||null===(ge=he.posts)||void 0===ge?void 0:ge.selected},pages:{all:!0===(null===(ve=e.settings.formPlacement)||void 0===ve||null===(be=ve.belowPosts)||void 0===be||null===(ye=be.pages)||void 0===ye?void 0:ye.all)?"1":"",selected:null===(xe=e.settings.formPlacement)||void 0===xe||null===(we=xe.belowPosts)||void 0===we||null===(Ce=we.pages)||void 0===Ce?void 0:Ce.selected}},slide_in:{enabled:!0===(null===(_e=e.settings.formPlacement)||void 0===_e||null===(Se=_e.slideIn)||void 0===Se?void 0:Se.enabled)?"1":"",delay:null===(ke=e.settings.formPlacement)||void 0===ke||null===(Ie=ke.slideIn)||void 0===Ie?void 0:Ie.delay,cookieExpiration:null===(Ee=e.settings.formPlacement)||void 0===Ee||null===(Te=Ee.slideIn)||void 0===Te?void 0:Te.cookieExpiration,position:null===(Ae=e.settings.formPlacement)||void 0===Ae||null===(De=Ae.slideIn)||void 0===De?void 0:De.position,animation:null===(Le=e.settings.formPlacement)||void 0===Le||null===(Pe=Le.slideIn)||void 0===Pe?void 0:Pe.animation,styles:null===(Fe=e.settings.formPlacement)||void 0===Fe||null===(Ne=Fe.slideIn)||void 0===Ne?void 0:Ne.styles,categories:(null===(je=e.settings.formPlacement)||void 0===je||null===(Re=je.slideIn)||void 0===Re?void 0:Re.categories)??[],tags:(null===(Oe=e.settings.formPlacement)||void 0===Oe||null===(Me=Oe.slideIn)||void 0===Me?void 0:Me.tags)??[],posts:{all:!0===(null===(Be=e.settings.formPlacement)||void 0===Be||null===(We=Be.slideIn)||void 0===We||null===(ze=We.posts)||void 0===ze?void 0:ze.all)?"1":"",selected:null===(He=e.settings.formPlacement)||void 0===He||null===(Ze=He.slideIn)||void 0===Ze||null===(Ue=Ze.posts)||void 0===Ue?void 0:Ue.selected},pages:{all:!0===(null===(Ve=e.settings.formPlacement)||void 0===Ve||null===(Ge=Ve.slideIn)||void 0===Ge||null===(qe=Ge.pages)||void 0===qe?void 0:qe.all)?"1":"",selected:null===($e=e.settings.formPlacement)||void 0===$e||null===(Ye=$e.slideIn)||void 0===Ye||null===(Ke=Ye.pages)||void 0===Ke?void 0:Ke.selected}},others:{styles:null===(Xe=e.settings.formPlacement)||void 0===Xe||null===(Je=Xe.others)||void 0===Je?void 0:Je.styles}},border_radius:e.settings.borderRadius,border_size:e.settings.borderSize,form_padding:e.settings.formPadding,input_padding:e.settings.inputPadding,border_color:e.settings.borderColor,font_family:e.settings.fontFamily,success_validation_color:e.settings.successValidationColor,error_validation_color:e.settings.errorValidationColor,background_image_url:e.settings.backgroundImageUrl,background_image_display:e.settings.backgroundImageDisplay,close_button:e.settings.closeButton}};return""===Qe.settings.font_family&&delete Qe.settings.font_family,delete Qe.settings.formPlacement,delete Qe.settings.successValidationColor,delete Qe.settings.errorValidationColor,delete Qe.settings.borderRadius,delete Qe.settings.borderSize,delete Qe.settings.formPadding,delete Qe.settings.inputPadding,delete Qe.settings.borderColor,delete Qe.settings.backgroundImageUrl,delete Qe.settings.backgroundImageDisplay,delete Qe.settings.fontFamily,delete Qe.settings.closeButton,Qe}function dn(e){return{type:"TOGGLE_SIDEBAR",toggleTo:e}}function pn(e){return{type:"TOGGLE_INSERTER_SIDEBAR",value:e}}function mn(e){return e?{type:"ENABLE_FORM"}:{type:"DISABLE_FORM"}}function*fn(e){yield{type:"STORE_LOCALLY",key:"mailpoet_form_view_options",value:e},yield{type:"TOGGLE_FULLSCREEN",toggleTo:e}}function hn(e){return{type:"CHANGE_FORM_BLOCKS",blocks:e}}function gn(e){return{type:"CHANGE_FORM_NAME",name:e}}function vn(){return{type:"DELETE_CUSTOM_FIELD_STARTED"}}function bn(e,t){return{type:"DELETE_CUSTOM_FIELD_DONE",customFieldId:e,clientId:t}}function yn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return{type:"DELETE_CUSTOM_FIELD_FAILED",message:e}}function xn(e){return{type:"CHANGE_FORM_STYLES",styles:e}}function wn(){return{type:"CUSTOM_FIELD_EDITED"}}function Cn(e,t){return{type:"SAVE_CUSTOM_FIELD_DONE",customFieldId:e,response:t}}function _n(){return{type:"SAVE_CUSTOM_FIELD_STARTED"}}function Sn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return{type:"SAVE_CUSTOM_FIELD_FAILED",message:e}}function kn(e){return{type:"CREATE_CUSTOM_FIELD_DONE",response:e}}function In(e){return{type:"CREATE_CUSTOM_FIELD_STARTED",customField:e}}function En(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return{type:"CREATE_CUSTOM_FIELD_FAILED",message:e}}function Tn(e){return{type:"CHANGE_FORM_SETTINGS",settings:e}}function*An(e){yield{type:"SAVE_FORM_DONE",formId:e},yield{type:"ENSURE_BROWSER_URL",formId:e}}function Dn(){return{type:"SAVE_FORM_STARTED"}}function Ln(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return{type:"SAVE_FORM_FAILED",message:e}}function Pn(e){return"placement_settings"===e&&(0,rn.dispatch)("core/block-editor").clearSelectedBlock(),{type:"CHANGE_ACTIVE_SIDEBAR",sidebar:e}}function*Fn(e){const t=(0,rn.select)("mailpoet-form-editor").getFormData();null!==t.id&&(yield{type:"STORE_LOCALLY",key:`mailpoet_form_preview_settings${t.id}`,value:e}),yield{type:"CHANGE_PREVIEW_SETTINGS",settings:e}}function*Nn(e){const t={...(0,rn.select)("mailpoet-form-editor").getPreviewSettings(),formType:e};return yield*Fn(t),Pn("placement_settings")}function*jn(){yield{type:"SHOW_PREVIEW"},yield Pn("default");const e=(0,rn.select)("mailpoet-form-editor").getAllAvailableCustomFields(),t=(0,rn.select)("mailpoet-form-editor").getFormData(),n=(0,rn.select)("mailpoet-form-editor").getFormBlocks(),r=cn(L.w0.fontSizes,L.w0.colors,L.w0.gradients,e),{success:i,error:o}=yield{type:"CALL_API",endpoint:"forms",action:"previewEditor",data:{...un(t),body:r(n)}};return i?{type:"PREVIEW_DATA_SAVED"}:{type:"PREVIEW_DATA_NOT_SAVED",error:o}}function Rn(){return{type:"HIDE_PREVIEW"}}function On(e){return{type:"REMOVE_NOTICE",id:e}}function Mn(e){return{type:"SWITCH_DEFAULT_SIDEBAR_TAB",id:e}}function Bn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:"TOGGLE_SIDEBAR_PANEL",id:e,toggleTo:t}}function*Wn(){yield{type:"SAVE_FORM"}}function*zn(e){yield{type:"SAVE_CUSTOM_FIELD",...e}}function*Hn(e,t){yield{type:"CREATE_CUSTOM_FIELD",clientId:t,data:e}}function*Zn(e,t){yield{type:"DELETE_CUSTOM_FIELD",customFieldId:e,clientId:t}}function*Un(e){yield{type:"BLOCKS_CHANGED_IN_BLOCK_EDITOR",blocks:e}}function*Vn(e){yield{type:"APPLY_STYLES_TO_ALL_TEXT_INPUTS",styles:e}}function Gn(){return{type:"HISTORY_UNDO"}}function qn(){return{type:"HISTORY_REDO"}}function*$n(){yield{type:"TUTORIAL_DISMISS"},yield{type:"TUTORIAL_DISMISSED"}}const Yn=(e,t)=>e.reduce(((e,n)=>e||(n.name===t?n:Array.isArray(n.innerBlocks)&&n.innerBlocks.length?Yn(n.innerBlocks,t):null)),null),Kn=(e,t)=>{if(!e||!e.settings||!Array.isArray(e.settings.segments))throw new Error("formData.settings.segments are expected to be an array.");if(!Array.isArray(t))throw new Error("formBlocks are expected to be an array.");const n=Yn(t,"mailpoet-form/segment-select"),r=[];n&&0!==n.attributes.values.length||e.settings.segments&&0!==e.settings.segments.length||r.push("missing-lists"),n&&0===n.attributes.values.length&&r.push("missing-lists-in-custom-segments-block");const i=Yn(t,"mailpoet-form/email-input"),o=Yn(t,"mailpoet-form/submit-button");return i||r.push("missing-email-input"),o||r.push("missing-submit"),r},Xn=e=>{let t=e.editorHistory,n=e.editorHistoryOffset;const r=((e,t)=>{const n=e[e.length-1],r=Date.now();if(void 0!==n&&r-n.time<1e3&&e.length>1)return e.pop(),{blocks:t.formBlocks,data:t.formData,time:n.time};const i={blocks:t.formBlocks,data:t.formData,time:r};return void 0!==n&&(0,oe.isEqual)(n.data,i.data)&&(0,oe.isEqual)(n.blocks,i.blocks)?null:i})(t,e);if(null===r)return e;if(0!==e.editorHistoryOffset){const r=e.editorHistory.length-(e.editorHistoryOffset+1);n=0,t=t.slice(0,r)}return t.length>=100&&t.shift(),t.push(r),{...e,editorHistory:t,editorHistoryOffset:n}},Jn=(e,t)=>{let n=e.editorHistoryOffset;0===n&&Xn(e),n+=t;const r=e.editorHistory.length-(n+1);let i,o;if(void 0===e.editorHistory[r])return e;{const t=e.editorHistory[r];i=t.blocks,o=t.data}return{...e,editorHistoryOffset:n,formBlocks:i,formData:o}},Qn=(er=j.x,(e,t)=>{const n=e.notices.filter((e=>"custom-field"!==e.id)),r=(0,oe.trim)(t.customField.name),i=e.customFields.find((e=>e.name===r));return i&&n.push({id:"custom-field",content:er.I18n.t("customFieldWithNameExists").replace("[name]",r),isDismissible:!0,status:"error"}),{...e,isCustomFieldCreating:!i,notices:n}});var er;const tr=(e=>t=>{const n=t.notices.filter((e=>!["missing-lists-in-custom-segments-block","save-form","missing-lists","missing-block"].includes(e.id))),r=t.formErrors.includes("missing-lists")||t.formErrors.includes("missing-lists-in-custom-segments-block"),i=[...t.sidebar.openedPanels];r&&(n.push({id:"missing-lists",content:e.I18n.t("settingsPleaseSelectList"),isDismissible:!0,status:"error"}),i.includes("basic-settings")||i.push("basic-settings"));const o=t.formErrors.includes("missing-email-input"),a=t.formErrors.includes("missing-submit");return(o||a)&&n.push({id:"missing-block",content:e.I18n.t("missingObligatoryBlock"),isDismissible:!0,status:"error"}),{...t,isFormSaving:!r,sidebar:{...t.sidebar,activeTab:r?"form":t.sidebar.activeTab,openedPanels:i},notices:n}})(j.x),nr=(e,t)=>{switch(t.type){case"ENABLE_FORM":return(e=>({...e,formData:{...e.formData,hasUnsavedChanges:!0,status:"enabled"}}))(e);case"DISABLE_FORM":return(e=>({...e,formData:{...e.formData,hasUnsavedChanges:!0,status:"disabled"}}))(e);case"TOGGLE_FULLSCREEN":return((e,t)=>({...e,fullscreenStatus:t.toggleTo}))(e,t);case"CREATE_CUSTOM_FIELD_DONE":return((e,t)=>{const n=e.notices.filter((e=>"custom-field"!==e.id));n.push({id:"custom-field",content:j.x.I18n.t("customFieldSaved"),isDismissible:!0,status:"success"});const r=[...e.customFields];return r.push(t.response),{...e,isCustomFieldCreating:!1,notices:n,customFields:r}})(e,t);case"CREATE_CUSTOM_FIELD_FAILED":return((e,t)=>{const n=e.notices.filter((e=>"custom-field"!==e.id));return n.push({id:"custom-field",content:t.message,isDismissible:!0,status:"error"}),{...e,isCustomFieldCreating:!1,notices:n}})(e,t);case"CREATE_CUSTOM_FIELD_STARTED":return Qn(e,t);case"CHANGE_FORM_BLOCKS":return((e,t)=>{const n={...e,formBlocks:t.blocks};return{...n,hasUnsavedChanges:!0,formErrors:Kn(n.formData,n.formBlocks)}})(e,t);case"CHANGE_FORM_NAME":return((e,t)=>({...e,formData:{...e.formData,hasUnsavedChanges:!0,name:t.name}}))(e,t);case"CHANGE_FORM_SETTINGS":return((e,t)=>{const n={...e,formData:{...e.formData,settings:t.settings}};return{...n,hasUnsavedChanges:!0,formErrors:Kn(n.formData,n.formBlocks)}})(e,t);case"CHANGE_FORM_STYLES":return((e,t)=>({...e,formData:{...e.formData,styles:t.styles,hasUnsavedChanges:!0}}))(e,t);case"CHANGE_PREVIEW_SETTINGS":return((e,t)=>{let{settings:n}=t;return{...e,previewSettings:n}})(e,t);case"CUSTOM_FIELD_EDITED":return(e=>({...e,hasUnsavedChanges:!0}))(e);case"REMOVE_NOTICE":return((e,t)=>({...e,notices:[...e.notices].filter((e=>e.id!==t.id))}))(e,t);case"SHOW_PREVIEW":return(e=>({...e,isPreviewShown:!0}))(e);case"HIDE_PREVIEW":return(e=>({...e,isPreviewShown:!1,isPreviewReady:!1}))(e);case"PREVIEW_DATA_NOT_SAVED":return(e=>({...e,isPreviewReady:!1}))(e);case"PREVIEW_DATA_SAVED":return(e=>({...e,isPreviewReady:!0}))(e);case"SAVE_FORM_DONE":return((e,t)=>{const n=e.notices.filter((e=>"save-form"!==e.id));return n.push({id:"save-form",content:`${j.x.I18n.t("formSaved")} ${j.x.I18n.t("formSavedAppendix")}`,isDismissible:!0,status:"success"}),{...e,formData:{...e.formData,id:parseInt(t.formId,10)},isFormSaving:!1,hasUnsavedChanges:!1,notices:n}})(e,t);case"SAVE_FORM_FAILED":return((e,t)=>{const n=e.notices.filter((e=>"save-form"!==e.id));return n.push({id:"save-form",content:t.message,isDismissible:!0,status:"error"}),{...e,isFormSaving:!1,notices:n}})(e,t);case"SAVE_FORM_STARTED":return tr(e);case"SAVE_CUSTOM_FIELD_DONE":return((e,t)=>{const n=e.notices.filter((e=>"custom-field"!==e.id));n.push({id:"custom-field",content:j.x.I18n.t("customFieldSaved"),isDismissible:!0,status:"success"});const r=e.customFields.map((e=>e.id===t.customFieldId?t.response:e));return{...e,isCustomFieldSaving:!1,notices:n,customFields:r}})(e,t);case"SAVE_CUSTOM_FIELD_FAILED":return((e,t)=>{const n=e.notices.filter((e=>"custom-field"!==e.id));return n.push({id:"custom-field",content:t.message,isDismissible:!0,status:"error"}),{...e,isCustomFieldSaving:!1,notices:n}})(e,t);case"SAVE_CUSTOM_FIELD_STARTED":return(e=>{const t=e.notices.filter((e=>"custom-field"!==e.id));return{...e,isCustomFieldSaving:!0,notices:t}})(e);case"SWITCH_DEFAULT_SIDEBAR_TAB":return((e,t)=>({...e,sidebar:{...e.sidebar,activeTab:t.id}}))(e,t);case"TOGGLE_SIDEBAR":return((e,t)=>({...e,sidebarOpened:t.toggleTo}))(e,t);case"TOGGLE_INSERTER_SIDEBAR":return((e,t)=>{let n;return n=t.value?!0===t.value?{rootClientId:void 0,insertionIndex:void 0}:t.value:null,{...e,inserterPanel:n}})(e,t);case"TOGGLE_SIDEBAR_PANEL":return((e,t)=>{let n;!0===t.toggleTo&&(n="opened"),!1===t.toggleTo&&(n="closed");const r=[...e.sidebar.openedPanels],i=((e,t,n)=>{const r=e.includes(t);let i=n;return void 0===i&&(i=r?"closed":"opened"),r&&"closed"===i?"close":r||"opened"!==i?null:"open"})(r,t.id,n);return"open"===i?r.push(t.id):"close"===i&&(0,oe.remove)(r,(e=>e===t.id)),{...e,sidebar:{...e.sidebar,openedPanels:r}}})(e,t);case"DELETE_CUSTOM_FIELD_STARTED":return(e=>{const t=e.notices.filter((e=>"custom-field"!==e.id));return{...e,...t,isCustomFieldDeleting:!0}})(e);case"DELETE_CUSTOM_FIELD_DONE":return((e,t)=>{const n=e.customFields.filter((e=>e.id!==t.customFieldId)),r=e.formBlocks.filter((e=>e.clientId!==t.clientId));return{...e,formBlocks:r,isCustomFieldDeleting:!1,customFields:n}})(e,t);case"DELETE_CUSTOM_FIELD_FAILED":return((e,t)=>{const n=e.notices.filter((e=>"custom-field"!==e.id));return n.push({id:"custom-field",content:t.message,isDismissible:!0,status:"error"}),{...e,isCustomFieldSaving:!1,notices:n}})(e,t);case"CHANGE_ACTIVE_SIDEBAR":return((e,t)=>({...e,sidebar:{...e.sidebar,activeSidebar:t.sidebar}}))(e,t);case"HISTORY_UNDO":return(e=>Jn(e,1))(e);case"HISTORY_REDO":return(e=>Jn(e,-1))(e);case"TUTORIAL_DISMISSED":return(e=>({...e,tutorialSeen:!0}))(e);default:return e}},rr=(e,t)=>"CHANGE_FORM_BLOCKS"===t.type||"CHANGE_FORM_NAME"===t.type||"CHANGE_FORM_SETTINGS"===t.type||"CHANGE_FORM_STYLES"===t.type?Xn(e):e,ir=e=>function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=rr(t,n);return nr(r,n)},or=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return e.reduce(((e,r)=>e.length?e:Array.isArray(r.innerBlocks)&&r.innerBlocks.length?(n.push(r),r.innerBlocks.find((e=>e.clientId===t))?n:or(r.innerBlocks,t,n)):[]),[])},ar={isFormSaved:e=>"number"==typeof e.formData.id,isFormEnabled:e=>"enabled"===e.formData.status,isFullscreenEnabled:e=>e.fullscreenStatus,isInserterOpened:e=>!!e.inserterPanel,getInserterPanelInsertPoint:e=>e.inserterPanel,getSidebarOpened:e=>e.sidebarOpened,getFormName:e=>e.formData.name,getFormData:e=>e.formData,getFormStyles:e=>e.formData.styles,getFormExports:e=>Object.fromEntries(Object.entries(e.formExports).map((t=>{let[n,r]=t;return[n,r.replace(":form_id:",`${e.formData.id}`)]}))),getFormSettings:e=>e.formData.settings,getAllAvailableSegments:e=>e.segments,getAllAvailableCustomFields:e=>e.customFields,getAllAvailablePages:e=>e.allWpPages.map((e=>({id:e.id,title:e.name}))),getIsFormSaving:e=>e.isFormSaving,getIsPreviewShown:e=>e.isPreviewShown,getIsPreviewReady:e=>e.isPreviewReady,getPreviewSettings(e){if(e.previewSettings)return e.previewSettings;const t={displayType:"desktop",formType:"others"},n=e.formData.settings;return n.formPlacement.belowPosts.enabled&&(t.formType="below_posts"),n.formPlacement.popup.enabled&&(t.formType="popup"),n.formPlacement.fixedBar.enabled&&(t.formType="fixed_bar"),n.formPlacement.slideIn.enabled&&(t.formType="slide_in"),t},getFormWidth(e,t){const n=e.formData.settings;switch(t){case"below_posts":return n.formPlacement.belowPosts.styles.width;case"popup":return n.formPlacement.popup.styles.width;case"slide_in":return n.formPlacement.slideIn.styles.width;case"fixed_bar":return n.formPlacement.fixedBar.styles.width;case"others":return n.formPlacement.others.styles.width;default:throw Error(`Invalid form display type ${t}`)}},getIsCustomFieldSaving:e=>e.isCustomFieldSaving,getIsCustomFieldDeleting:e=>e.isCustomFieldDeleting,getDismissibleNotices:e=>e.notices.filter((e=>!0===e.isDismissible)),getNonDismissibleNotices:e=>e.notices.filter((e=>!1===e.isDismissible)),getNotice:(e,t)=>e.notices.find((e=>e.id===t)),getFormErrors:e=>e.formErrors,getDefaultSidebarActiveTab:e=>e.sidebar.activeTab,getSidebarOpenedPanels:e=>e.sidebar.openedPanels,getFormBlocks:e=>e.formBlocks,getDateSettingsData:e=>e.dateSettingData,getIsCustomFieldCreating:e=>e.isCustomFieldCreating,hasUnsavedChanges:e=>e.hasUnsavedChanges,getEditorUrl:e=>e.editorUrl,getPreviewPageUrl:e=>e.previewPageUrl,getCloseIconsUrl:e=>e.closeIconsUrl,getAllCustomFonts:e=>e.customFonts,getActiveSidebar:e=>e.sidebar.activeSidebar,getAllWPPosts:e=>e.allWpPosts,getAllWPPages:e=>e.allWpPages,getAllWPCategories:e=>e.allWpCategories,getAllWPTags:e=>e.allWpTags,getAllWooCommerceProducts:e=>e.allWooCommerceProducts,getAllWooCommerceCategories:e=>e.allWooCommerceCategories,getAllWooCommerceTags:e=>e.allWooCommerceTags,getTutorialSeen:e=>e.tutorialSeen,getFormEditorUrl:e=>e.formEditorUrl,getTutorialUrl:e=>e.tutorialUrl,getClosestParentAttribute:(e,t,n)=>or(e.formBlocks,t).reduce(((e,t)=>t.attributes&&void 0!==t.attributes[n]?t.attributes[n]:e),null),hasEditorUndo(e){let t=e.editorHistory.length;return e.editorHistory.length>1&&(t-=1),t>0&&t>e.editorHistoryOffset},hasEditorRedo:e=>e.editorHistoryOffset>0,isUserAdministrator:e=>e.user.isAdministrator};function lr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var sr=function e(t,n){function r(e,r,i){if("undefined"!=typeof document){"number"==typeof(i=lr({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in i)i[a]&&(o+="; "+a,!0!==i[a]&&(o+="="+i[a].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+o}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},i=0;i<n.length;i++){var o=n[i].split("="),a=o.slice(1).join("=");try{var l=decodeURIComponent(o[0]);if(r[l]=t.read(a,l),e===l)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",lr({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,lr({},this.attributes,t))},withConverter:function(t){return e(lr({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"}),cr=sr,ur=n(74996),dr=n(44794),pr=n(88245),mr=n.n(pr);function fr(e,t){return`${e}-${mr()(t.name,{lower:!0}).replace(/[^a-z0-9]+/g,"").replace(/-$/,"")}`}const hr=(0,q.jsxs)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,q.jsx)(Y.y$,{d:"M0,0h24v24H0V0z",fill:"none"}),(0,q.jsx)(Y.y$,{d:"M20,4H4C2.9,4,2,4.9,2,6v12c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V6C22,4.9,21.1,4,20,4z M20,18H4V6h16V18z"}),(0,q.jsx)(Y.UL,{x:"6",y:"10",width:"2",height:"2"}),(0,q.jsx)(Y.UL,{x:"6",y:"14",width:"8",height:"2"}),(0,q.jsx)(Y.UL,{x:"16",y:"14",width:"2",height:"2"}),(0,q.jsx)(Y.UL,{x:"10",y:"10",width:"8",height:"2"})]});var gr=n(73136),vr=n.n(gr),br=n(54600);function yr(e){let{isBusy:t,onDelete:n}=e;const r=(0,a.useCallback)((()=>{window.confirm(j.x.I18n.t("customFieldDeleteConfirm"))&&n()}),[n]);return(0,q.jsx)(O.Z,{isDestructive:!0,isLink:!0,isBusy:t,onClick:r,className:"button-on-top",children:j.x.I18n.t("customFieldDeleteCTA")})}function xr(e){let{label:t,mandatory:n,dateType:r,dateFormat:i,defaultToday:o,dateSettings:l,isSaving:s,onSave:c,isDeleting:u,onCustomFieldDelete:d,onChange:p}=e;const[m,f]=(0,a.useState)(t),[h,g]=(0,a.useState)(n),[v,b]=(0,a.useState)(o),[y,x]=(0,a.useState)(r),[w,C]=(0,a.useState)(i),_=(0,a.useMemo)((()=>({label:m,mandatory:h,dateType:y,dateFormat:w,defaultToday:v})),[m,h,y,w,v]),S=h!==n||v!==o||y!==r||w!==i||m!==t;return(0,a.useEffect)((()=>{p&&p(_,S)}),[_,p,S]),(0,q.jsxs)("div",{className:"custom-field-settings",children:[(0,q.jsx)(br.Z,{label:j.x.I18n.t("label"),value:m,"data-automation-id":"settings_custom_date_label_input",onChange:f}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("blockMandatory"),checked:h,onChange:g}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("customFieldDefaultToday"),checked:v,onChange:b}),(0,q.jsx)(de.Z,{label:j.x.I18n.t("customFieldDateType"),"data-automation-id":"settings_custom_date_type",value:y,onChange:e=>{x(e);const t=l.dateFormats[e];C(t[0])},options:l.dateTypes}),(()=>{const e=l.dateFormats[y];return Array.isArray(e)&&1===e.length?null:(0,q.jsx)(de.Z,{label:j.x.I18n.t("customFieldDateFormat"),"data-automation-id":"settings_custom_date_format",value:w,onChange:e=>C(e),options:e.map((e=>({value:e,label:e})))})})(),c?(0,q.jsx)(O.Z,{isPrimary:!0,onClick:()=>c({mandatory:h,dateType:y,dateFormat:w,defaultToday:v,label:m}),isBusy:s,disabled:s||!S,className:"button-on-top","data-automation-id":"custom_field_save",children:j.x.I18n.t("customFieldSaveCTA")}):null,d?(0,q.jsx)(yr,{isBusy:s||u,onDelete:d}):null]})}yr.propTypes={isBusy:U().bool,onDelete:U().func},yr.defaultProps={isBusy:!1,onDelete:()=>{}},xr.propTypes={mandatory:U().bool,label:U().string,dateType:U().string,dateFormat:U().string,defaultToday:U().bool,onSave:U().func,isSaving:U().bool,dateSettings:U().shape({dateTypes:U().arrayOf(U().shape({label:U().string,value:U().string})),dateFormats:U().objectOf(U().arrayOf(U().string)),months:U().arrayOf(U().string)}).isRequired,isDeleting:U().bool,onCustomFieldDelete:U().func,onChange:U().func},xr.defaultProps={label:"",mandatory:!1,isSaving:!1,dateType:null,dateFormat:null,defaultToday:!1,isDeleting:!1,onCustomFieldDelete:null,onSave:null,onChange:null};const wr=e=>{const t=e.label?e.label:"";return e.mandatory?`${t} *`:t};function Cr(e){const t=[];void 0!==e.placeholder&&t.push((0,q.jsx)("option",{value:"",children:e.placeholder},0));const n=vr()().year();for(let e=n;e>=n-100;e-=1)t.push((0,q.jsx)("option",{value:e,children:e},e));return(0,q.jsx)("select",{name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange,className:p()({mailpoet_date_year:e.addDefaultClasses}),children:t})}function _r(e){const t=[];void 0!==e.placeholder&&t.push((0,q.jsx)("option",{value:"",children:e.placeholder},0));for(let n=1;n<=12;n+=1)t.push((0,q.jsx)("option",{value:n,children:e.monthNames[n-1]},n));return(0,q.jsx)("select",{name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange,className:p()({mailpoet_date_month:e.addDefaultClasses}),children:t})}function Sr(e){const t=[];void 0!==e.placeholder&&t.push((0,q.jsx)("option",{value:"",children:e.placeholder},0));for(let e=1;e<=31;e+=1)t.push((0,q.jsx)("option",{value:e,children:e},e));return(0,q.jsx)("select",{name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange,className:p()({mailpoet_date_day:e.addDefaultClasses}),children:t})}Cr.propTypes={name:U().string.isRequired,placeholder:U().string.isRequired,onValueChange:U().func.isRequired,year:U().oneOfType([U().string,U().number]).isRequired,addDefaultClasses:U().bool.isRequired},_r.propTypes={name:U().string.isRequired,placeholder:U().string.isRequired,onValueChange:U().func.isRequired,month:U().oneOfType([U().string,U().number]).isRequired,monthNames:U().arrayOf(U().string).isRequired,addDefaultClasses:U().bool.isRequired},Sr.propTypes={name:U().string.isRequired,placeholder:U().string.isRequired,onValueChange:U().func.isRequired,day:U().oneOfType([U().string,U().number]).isRequired,addDefaultClasses:U().bool.isRequired};class kr extends a.Component{constructor(e){super(e),this.state={year:"",month:"",day:""},this.onValueChange=this.onValueChange.bind(this)}componentDidMount(){this.extractDateParts()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&this.extractDateParts()}onValueChange(e){const t=e.target.name.match(/(.*?)\[(.*?)\]/);let n=null,r=null;if(null!==t&&3===t.length){[,n,r]=t;const i=Number(e.target.value);this.setState({[`${r}`]:i},(()=>{this.props.onValueChange({target:{name:n,value:this.formatValue()}})}))}}formatValue(){let e;switch(this.props.field.params.date_type){case"year_month_day":e={year:this.state.year,month:this.state.month,day:this.state.day};break;case"year_month":e={year:this.state.year,month:this.state.month};break;case"month":e={month:this.state.month};break;case"year":e={year:this.state.year};break;default:e={value:"invalid type"}}return e}extractDateParts(){const e=void 0!==this.props.item[this.props.field.name]?this.props.item[this.props.field.name].trim():"";if(""===e)return;const t=vr()(e);this.setState({year:t.format("YYYY"),month:t.format("M"),day:t.format("D")})}render(){const e=window.mailpoet_month_names||[];let t=(window.mailpoet_date_formats||{})[this.props.field.params.date_type][0];this.props.field.params.date_format&&(t=this.props.field.params.date_format);const n=t.split("/").map((t=>{switch(t){case"YYYY":return(0,q.jsx)(Cr,{onValueChange:this.onValueChange,name:this.props.field.name,addDefaultClasses:this.props.addDefaultClasses,year:this.state.year,placeholder:this.props.field.year_placeholder},"year");case"MM":return(0,q.jsx)(_r,{onValueChange:this.onValueChange,name:this.props.field.name,addDefaultClasses:this.props.addDefaultClasses,month:this.state.month,monthNames:e,placeholder:this.props.field.month_placeholder},"month");case"DD":return(0,q.jsx)(Sr,{onValueChange:this.onValueChange,name:this.props.field.name,addDefaultClasses:this.props.addDefaultClasses,day:this.state.day,placeholder:this.props.field.day_placeholder},"day");default:return(0,q.jsx)("div",{children:"Invalid date type"})}}));return(0,q.jsx)("div",{children:n})}}function Ir(e){let{children:t,className:n}=e;return(0,q.jsx)("div",{className:p()("mailpoet_paragraph",n),children:t})}function Er(e,t){switch(e){case"checkbox":return{label:t.label,required:t.mandatory?"1":"",values:[{is_checked:t.isChecked?"1":"",value:t.checkboxLabel}]};case"date":return{label:t.label,required:t.mandatory?"1":"",date_type:t.dateType,date_format:t.dateFormat,is_default_today:t.defaultToday?"1":""};case"radio":case"select":return{required:t.mandatory?"1":"",label:t.label,values:t.values.map((e=>{const t={value:e.name};return e.isChecked?t.is_checked="1":t.is_checked="",t}))};case"text":return{required:t.mandatory?"1":"",validate:t.validate,label:t.label};case"textarea":return{required:t.mandatory?"1":"",validate:t.validate,lines:t.lines?t.lines:"1",label:t.label};default:throw new Error(`Invalid custom field type ${e}!`)}}function Tr(e){let{attributes:t,setAttributes:n,clientId:r}=e;const i=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldSaving()),[]),o=(0,f.Z)((e=>e("mailpoet-form-editor").getDateSettingsData()),[]),a=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldDeleting()),[]),{saveCustomField:l,deleteCustomField:s,customFieldEdited:c}=(0,h.Z)("mailpoet-form-editor"),u=(0,q.jsx)(L.Af,{children:(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("customFieldSettings"),initialOpen:!0,children:(0,q.jsx)(xr,{label:t.label,mandatory:t.mandatory,dateSettings:o,defaultToday:t.defaultToday,dateFormat:t.dateFormat,dateType:t.dateType,isSaving:i,onSave:e=>l({customFieldId:t.customFieldId,data:{params:Er("date",e)},onFinish:()=>n({mandatory:e.mandatory,dateType:e.dateType,dateFormat:e.dateFormat,defaultToday:e.defaultToday,label:e.label})}),onCustomFieldDelete:()=>s(t.customFieldId,r),isDeleting:a,onChange:(e,t)=>t&&c()})})})});return(0,q.jsx)(Ir,{className:t.className,children:(0,q.jsxs)("div",{className:"mailpoet_custom_date",children:[u,(0,q.jsx)("label",{className:"mailpoet_date_label","data-automation-id":"editor_custom_date_label",htmlFor:r,children:wr(t)}),(0,q.jsx)(kr,{field:{name:r,day_placeholder:j.x.I18n.t("customFieldDay"),month_placeholder:j.x.I18n.t("customFieldMonth"),year_placeholder:j.x.I18n.t("customFieldYear"),params:{date_type:t.dateType,date_format:t.dateFormat}},item:{[r]:t.defaultToday?vr()().format("YYYY-MM-DD"):""},addDefaultClasses:!0,onValueChange:()=>{}})]})})}function Ar(e){return{title:e.name,description:"",icon:hr,category:"custom-fields",attributes:{label:{type:"string",default:e.name},mandatory:{type:"boolean",default:!!e.params.required&&!!e.params.required},defaultToday:{type:"boolean",default:!1},dateType:{type:"string",default:e.params.date_type},dateFormat:{type:"string",default:e.params.date_format},customFieldId:{type:"string",default:e.id}},supports:{html:!1,multiple:!1},edit:Tr,save:()=>null}}function Dr(e){const t=parseInt(e,10);if(!Number.isNaN(t))return t}kr.propTypes={item:U().object.isRequired,field:U().shape({name:U().string,day_placeholder:U().string,month_placeholder:U().string,year_placeholder:U().string,params:U().object}).isRequired,onValueChange:U().func.isRequired,addDefaultClasses:U().bool},kr.defaultProps={addDefaultClasses:!1},Ir.propTypes={children:U().node.isRequired,className:U().string},Ir.defaultProps={className:""},Tr.propTypes={attributes:U().shape({label:U().string.isRequired,dateFormat:U().string.isRequired,dateType:U().string.isRequired,defaultToday:U().bool,mandatory:U().bool.isRequired,customFieldId:U().number.isRequired,className:U().string}).isRequired,clientId:U().string.isRequired,setAttributes:U().func.isRequired};const Lr={fullWidth:!0,inheritFromTheme:!0},Pr={fullWidth:!1,inheritFromTheme:!0},Fr=e=>{if(!e)return Pr;const t={fullWidth:"1"===e.full_width||!0===e.full_width,inheritFromTheme:!(0,oe.has)(e,"bold")};return t.inheritFromTheme||(t.bold="1"===e.bold||!0===e.bold,(0,oe.has)(e,"background_color")&&e.background_color&&(t.backgroundColor=e.background_color),(0,oe.has)(e,"gradient")&&e.gradient&&(t.gradient=e.gradient),(0,oe.has)(e,"border_size")&&void 0!==e.border_size&&(t.borderSize=Number(e.border_size)),(0,oe.has)(e,"font_size")&&void 0!==e.font_size&&(t.fontSize=Number(e.font_size)),(0,oe.has)(e,"font_color")&&e.font_color&&(t.fontColor=e.font_color),(0,oe.has)(e,"border_radius")&&void 0!==e.border_radius&&(t.borderRadius=Number(e.border_radius)),(0,oe.has)(e,"border_color")&&e.border_color&&(t.borderColor=e.border_color),(0,oe.has)(e,"padding")&&void 0!==e.padding&&(t.padding=Number(e.padding)),(0,oe.has)(e,"font_family")&&e.font_family&&(t.fontFamily=e.font_family)),t},Nr=(e,t)=>{const n=e.find((e=>e.color===t));return n?n.slug:void 0},jr=(e,t)=>{const n=e.find((e=>e.gradient===t));return n?n.slug:void 0},Rr=(e,t)=>{let n=0;t&&(n=Dr(t),void 0===n&&(n=2));const r=e.find((e=>e.size===n));return r?r.slug:void 0};function Or(e){let{label:t,mandatory:n,validate:r,isSaving:i,onSave:o,isDeleting:l,onCustomFieldDelete:s,onChange:c,fieldType:u}=e;const[d,p]=(0,a.useState)(t),[m,f]=(0,a.useState)(n),[h,g]=(0,a.useState)(r),v=(0,a.useMemo)((()=>({label:d,mandatory:m,validate:h})),[d,m,h]),b=m!==n||h!==r||d!==t;return(0,a.useEffect)((()=>{c&&c(v,b)}),[v,c,b,u]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(br.Z,{label:j.x.I18n.t("label"),value:d,"data-automation-id":"settings_custom_text_label_input",onChange:p}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("blockMandatory"),checked:m,onChange:f}),(0,q.jsx)(de.Z,{label:`${j.x.I18n.t("customFieldValidateFor")}:`,"data-automation-id":"settings_custom_text_input_validation_type",options:[{label:j.x.I18n.t("customFieldValidateNothing"),value:""},{label:j.x.I18n.t("customFieldValidateNumbersOnly"),value:"number"},{label:j.x.I18n.t("customFieldValidateAlphanumerical"),value:"alphanum"},{label:j.x.I18n.t("customFieldValidatePhoneNumber"),value:"phone"}],value:h,onChange:g}),o?(0,q.jsx)(O.Z,{isPrimary:!0,onClick:()=>o(v),isBusy:i,disabled:i||l||!b,className:"button-on-top","data-automation-id":"custom_field_save",children:j.x.I18n.t("customFieldSaveCTA")}):null,s?(0,q.jsx)(yr,{isBusy:i||l,onDelete:s}):null]})}function Mr(e){let{styles:t,onChange:n}=e;const r=(0,a.useRef)(t),i=r.current,{applyStylesToAllTextInputs:o}=(0,h.Z)("mailpoet-form-editor"),l=(e,t)=>{const i={...r.current};i[e]=t,n(i),r.current=i};return(0,q.jsx)(ae.Z,{className:"mailpoet-automation-input-styles-panel",children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("formSettingsStyles"),initialOpen:!1,children:(0,q.jsxs)("div",{className:"mailpoet-styles-settings","data-automation-id":"input_styles_settings",children:[(0,q.jsx)(se.Z,{label:j.x.I18n.t("formSettingsDisplayFullWidth"),checked:i.fullWidth,onChange:(0,oe.partial)(l,"fullWidth")}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("formSettingsInheritStyleFromTheme"),checked:i.inheritFromTheme,onChange:e=>{if(e)return void l("inheritFromTheme",e);const t={...r.current};t.backgroundColor="#ffffff",t.bold=!1,t.borderRadius=0,t.borderSize=1,t.borderColor="#313131",t.inheritFromTheme=e,n(t),r.current=t},className:"mailpoet-automation-inherit-theme-toggle"}),i.inheritFromTheme?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Re,{title:j.x.I18n.t("formSettingsColor"),settings:[{label:j.x.I18n.t("formSettingsStylesFont"),colorValue:i.fontColor,onColorChange:(0,oe.partial)(l,"fontColor")},{label:j.x.I18n.t("formSettingsStylesBackground"),colorValue:i.backgroundColor,onColorChange:(0,oe.partial)(l,"backgroundColor")},{label:j.x.I18n.t("formSettingsBorder"),colorValue:i.borderColor,onColorChange:(0,oe.partial)(l,"borderColor")}]}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("formSettingsBold"),checked:i.bold||!1,onChange:(0,oe.partial)(l,"bold"),className:"mailpoet-automation-styles-bold-toggle"}),(0,q.jsx)(xe.Z,{label:j.x.I18n.t("formSettingsBorderSize"),value:void 0===i.borderSize?1:i.borderSize,min:0,max:10,allowReset:!0,onChange:(0,oe.partial)(l,"borderSize"),className:"mailpoet-automation-styles-border-size"}),(0,q.jsx)(xe.Z,{label:j.x.I18n.t("formSettingsBorderRadius"),value:void 0===i.borderRadius?1:i.borderRadius,min:0,max:40,allowReset:!0,onChange:(0,oe.partial)(l,"borderRadius")})]}),(0,q.jsx)("div",{children:(0,q.jsx)(O.Z,{isPrimary:!0,onClick:()=>o(i),"data-automation-id":"styles_apply_to_all",children:j.x.I18n.t("formSettingsApplyToAll")})})]})})})}Or.propTypes={label:U().string,mandatory:U().bool,validate:U().string,onSave:U().func,isSaving:U().bool,isDeleting:U().bool,onCustomFieldDelete:U().func,onChange:U().func,fieldType:U().string},Or.defaultProps={label:"",mandatory:!1,fieldType:"",isSaving:!1,validate:"",isDeleting:!1,onCustomFieldDelete:null,onSave:null,onChange:null};const Br=U().shape({fullWidth:U().bool.isRequired,inheritFromTheme:U().bool.isRequired,bold:U().bool,backgroundColor:U().string,borderSize:U().number,borderRadius:U().number,borderColor:U().string});function Wr(e){return e===we.Right?"0 0 0 auto":e===we.Center?"0 auto":"auto 0"}function zr(e){let{label:t,labelWithinInput:n,name:r,mandatory:i,styles:o,className:l}=e;const s=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),c=(0,a.useRef)(null),u=`${r}_${Math.random().toString(36).substring(2,15)}`,[d,p]=(0,a.useState)(""),m=o.inheritFromTheme?{}:{fontWeight:o.bold?"bold":"inherit"},h=o.inheritFromTheme?{}:{borderRadius:o.borderRadius?`${o.borderRadius}px`:0,borderWidth:void 0!==o.borderSize?`${o.borderSize}px`:"1px",borderColor:o.borderColor||"initial",borderStyle:"solid"};void 0!==s.inputPadding&&(h.padding=s.inputPadding),void 0!==s.inputPadding&&(h.padding=s.inputPadding),void 0!==s.alignment&&(h.textAlign=s.alignment,h.margin=Wr(h.textAlign)),o.fullWidth&&(h.width="100%"),o.backgroundColor&&!o.inheritFromTheme&&(h.backgroundColor=o.backgroundColor);const g={};return o.fontColor&&!o.inheritFromTheme&&(h.color=o.fontColor,n&&(g.color=o.fontColor)),(0,q.jsxs)(Ir,{className:l,children:[n?null:(0,q.jsx)("label",{className:"mailpoet_text_label","data-automation-id":`editor_${r}_label`,htmlFor:u,style:m,children:wr({label:t,mandatory:i})}),(e=>{let t=`#${u}::placeholder {`;return void 0!==g.color&&(t+=`color: ${g.color};`),s.fontFamily&&(t+=`font-family: ${s.fontFamily};`),t+="}",(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("style",{children:t}),(0,q.jsx)("input",{id:u,ref:c,className:"mailpoet_text",type:"text",name:r,value:d,onChange:()=>p(""),placeholder:e,"data-automation-id":`editor_${r}_input`,style:h,autoComplete:"off"})]})})(n?wr({label:t,mandatory:i}):"")]})}function Hr(e){let{attributes:t,setAttributes:n,clientId:r}=e;const i=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldSaving()),[]),o=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldDeleting()),[]),{saveCustomField:a,deleteCustomField:l,customFieldEdited:s}=(0,h.Z)("mailpoet-form-editor"),c=(0,q.jsxs)(L.Af,{children:[(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("customFieldSettings"),initialOpen:!0,children:(0,q.jsx)(Or,{updateAttributes:e=>n(e),customFieldId:t.customFieldId,label:t.label,mandatory:t.mandatory,validate:t.validate,isSaving:i,onSave:e=>{a({customFieldId:t.customFieldId,data:{params:Er("text",e)},onFinish:()=>n({mandatory:e.mandatory,validate:e.validate,label:e.label})})},onCustomFieldDelete:()=>l(t.customFieldId,r),isDeleting:o,onChange:(e,t)=>t&&s()})})}),(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("customFieldsFormSettings"),initialOpen:!0,children:(0,q.jsx)(se.Z,{label:j.x.I18n.t("displayLabelWithinInput"),checked:t.labelWithinInput,onChange:e=>n({labelWithinInput:e})})})}),(0,q.jsx)(Mr,{styles:t.styles,onChange:e=>n({styles:e})})]});return(0,q.jsxs)(q.Fragment,{children:[c,(0,q.jsx)(zr,{className:t.className,name:"custom_text",mandatory:t.mandatory,labelWithinInput:t.labelWithinInput,label:t.label,styles:t.styles})]})}function Zr(e){return{title:e.name,description:"",icon:hr,category:"custom-fields",attributes:{label:{type:"string",default:e.name},labelWithinInput:{type:"boolean",default:!0},mandatory:{type:"boolean",default:!!e.params.required&&!!e.params.required},validate:{type:"string",default:e.params.validate?e.params.validate:""},customFieldId:{type:"string",default:e.id},styles:{type:"object",default:Lr}},supports:{html:!1,multiple:!1},edit:Hr,save:()=>null}}function Ur(e){let{name:t,attributes:n,setAttributes:r,clientId:i}=e;const o=`${t.replace(/[^a-zA-Z]/g,"")}_${Math.random().toString(36).substring(2,15)}`,l=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),s=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldSaving()),[]),c=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldDeleting()),[]),[u,d]=(0,a.useState)(""),{saveCustomField:p,deleteCustomField:m,customFieldEdited:g}=(0,h.Z)("mailpoet-form-editor"),v=(0,q.jsxs)(L.Af,{children:[(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("customFieldSettings"),initialOpen:!0,children:(0,q.jsx)(Or,{label:n.label,mandatory:n.mandatory,validate:n.validate,isSaving:s,onSave:e=>p({customFieldId:n.customFieldId,data:{params:Er("textarea",e)},onFinish:()=>r({mandatory:e.mandatory,validate:e.validate,lines:e.lines,label:e.label})}),onCustomFieldDelete:()=>m(n.customFieldId,i),isDeleting:c,onChange:(e,t)=>t&&g()})})}),(0,q.jsx)(ae.Z,{children:(0,q.jsxs)(le.Z,{title:j.x.I18n.t("formSettings"),initialOpen:!0,children:[(0,q.jsx)(se.Z,{label:j.x.I18n.t("displayLabelWithinInput"),checked:n.labelWithinInput,onChange:e=>r({labelWithinInput:e})}),(0,q.jsx)(de.Z,{label:`${j.x.I18n.t("customFieldNumberOfLines")}:`,"data-automation-id":"settings_custom_text_area_number_of_lines",value:n.lines,options:[{label:j.x.I18n.t("customField1Line"),value:"1"},{label:j.x.I18n.t("customField2Lines"),value:"2"},{label:j.x.I18n.t("customField3Lines"),value:"3"},{label:j.x.I18n.t("customField4Lines"),value:"4"},{label:j.x.I18n.t("customField5Lines"),value:"5"}],onChange:e=>r({lines:e})})]})}),(0,q.jsx)(Mr,{styles:n.styles,onChange:e=>r({styles:e})})]}),b=n.styles.inheritFromTheme?{}:{fontWeight:n.styles.bold?"bold":"inherit"},y=n.styles.inheritFromTheme?{}:{borderRadius:n.styles.borderRadius?`${n.styles.borderRadius}px`:0,borderWidth:void 0!==n.styles.borderSize?`${n.styles.borderSize}px`:"1px",borderColor:n.styles.borderColor||"initial",borderStyle:"solid"};n.styles.fullWidth&&(y.width="100%"),n.styles.backgroundColor&&!n.styles.inheritFromTheme&&(y.backgroundColor=n.styles.backgroundColor),void 0!==l.inputPadding&&(y.padding=l.inputPadding),void 0!==l.alignment&&(y.textAlign=l.alignment,y.margin=Wr(y.textAlign)),y.resize="none";const x={};n.styles.fontColor&&!n.styles.inheritFromTheme&&(y.color=n.styles.fontColor,n.labelWithinInput&&(x.color=n.styles.fontColor));const w=(0,a.useRef)(null),C=e=>{let t=`#${o}::placeholder {`;return void 0!==x.color&&(t+=`color: ${x.color};`),l.fontFamily&&(t+=`font-family: ${l.fontFamily};`),t+="}",(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("style",{children:t}),(0,q.jsx)("textarea",{id:o,ref:w,className:"mailpoet_textarea",name:"custom_text","data-automation-id":"editor_custom_textarea_input",rows:n.lines,style:y,onChange:()=>d(""),placeholder:e,value:u})]})};return(0,q.jsxs)(Ir,{className:n.className,children:[v,n.labelWithinInput?C(wr(n)):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("label",{className:"mailpoet_textarea_label","data-automation-id":"editor_custom_text_label",htmlFor:o,style:b,children:wr(n)}),C("")]})]})}function Vr(e){return{title:e.name,description:"",icon:hr,category:"custom-fields",attributes:{label:{type:"string",default:e.name},labelWithinInput:{type:"boolean",default:!0},mandatory:{type:"boolean",default:!!e.params.required&&!!e.params.required},validate:{type:"string",default:e.params.validate?e.params.validate:""},lines:{type:"string",default:"1"},customFieldId:{type:"string",default:e.id},styles:{type:"object",default:Lr}},supports:{html:!1,multiple:!1},edit:Ur,save:()=>null}}Mr.propTypes={styles:Br.isRequired,onChange:U().func.isRequired},zr.propTypes={label:U().string.isRequired,labelWithinInput:U().bool.isRequired,name:U().string.isRequired,mandatory:U().bool.isRequired,className:U().string,styles:Br.isRequired},zr.defaultProps={className:""},Hr.propTypes={attributes:U().shape({label:U().string.isRequired,validate:U().string,labelWithinInput:U().bool.isRequired,mandatory:U().bool.isRequired,customFieldId:U().number.isRequired,styles:Br.isRequired,className:U().string}).isRequired,setAttributes:U().func.isRequired,clientId:U().string.isRequired},Ur.propTypes={attributes:U().shape({label:U().string.isRequired,customFieldId:U().number.isRequired,validate:U().string,labelWithinInput:U().bool.isRequired,mandatory:U().bool.isRequired,lines:U().string,styles:Br.isRequired,className:U().string}).isRequired,setAttributes:U().func.isRequired,clientId:U().string.isRequired,name:U().string.isRequired};var Gr=n(68379),qr=n(61004),$r=n(4979),Yr=a.createContext(null),Kr=function(e){e()},Xr=function(){return Kr},Jr={notify:function(){}},Qr=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=Jr,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return Boolean(this.unsubscribe)},t.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=function(){var e=Xr(),t=null,n=null;return{clear:function(){t=null,n=null},notify:function(){e((function(){for(var e=t;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],n=t;n;)e.push(n),n=n.next;return e},subscribe:function(e){var r=!0,i=n={callback:e,next:null,prev:n};return i.prev?i.prev.next=i:t=i,function(){r&&null!==t&&(r=!1,i.next?i.next.prev=i.prev:n=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}())},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=Jr)},e}(),ei=function(e){var t=e.store,n=e.context,r=e.children,i=(0,a.useMemo)((function(){var e=new Qr(t);return e.onStateChange=e.notifyNestedSubs,{store:t,subscription:e}}),[t]),o=(0,a.useMemo)((function(){return t.getState()}),[t]);(0,a.useEffect)((function(){var e=i.subscription;return e.trySubscribe(),o!==t.getState()&&e.notifyNestedSubs(),function(){e.tryUnsubscribe(),e.onStateChange=null}}),[i,o]);var l=n||Yr;return a.createElement(l.Provider,{value:i},r)},ti=n(64996),ni=n(26095),ri=n.n(ni),ii=n(65566),oi="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?a.useLayoutEffect:a.useEffect,ai=[],li=[null,null];function si(e,t){var n=e[1];return[t.payload,n+1]}function ci(e,t,n){oi((function(){return e.apply(void 0,t)}),n)}function ui(e,t,n,r,i,o,a){e.current=r,t.current=i,n.current=!1,o.current&&(o.current=null,a())}function di(e,t,n,r,i,o,a,l,s,c){if(e){var u=!1,d=null,p=function(){if(!u){var e,n,p=t.getState();try{e=r(p,i.current)}catch(e){n=e,d=e}n||(d=null),e===o.current?a.current||s():(o.current=e,l.current=e,a.current=!0,c({type:"STORE_UPDATED",payload:{error:n}}))}};return n.onStateChange=p,n.trySubscribe(),p(),function(){if(u=!0,n.tryUnsubscribe(),n.onStateChange=null,d)throw d}}}var pi=function(){return[null,0]};function mi(e,t){void 0===t&&(t={});var n=t,r=n.getDisplayName,i=void 0===r?function(e){return"ConnectAdvanced("+e+")"}:r,o=n.methodName,l=void 0===o?"connectAdvanced":o,s=n.renderCountProp,c=void 0===s?void 0:s,u=n.shouldHandleStateChanges,d=void 0===u||u,p=n.storeKey,m=void 0===p?"store":p,f=(n.withRef,n.forwardRef),h=void 0!==f&&f,g=n.context,v=void 0===g?Yr:g,b=(0,ti.Z)(n,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"]),y=v;return function(t){var n=t.displayName||t.name||"Component",r=i(n),o=(0,Ce.Z)({},b,{getDisplayName:i,methodName:l,renderCountProp:c,shouldHandleStateChanges:d,storeKey:m,displayName:r,wrappedComponentName:n,WrappedComponent:t}),s=b.pure,u=s?a.useMemo:function(e){return e()};function p(n){var r=(0,a.useMemo)((function(){var e=n.forwardedRef,t=(0,ti.Z)(n,["forwardedRef"]);return[n.context,e,t]}),[n]),i=r[0],l=r[1],s=r[2],c=(0,a.useMemo)((function(){return i&&i.Consumer&&(0,ii.isContextConsumer)(a.createElement(i.Consumer,null))?i:y}),[i,y]),p=(0,a.useContext)(c),m=Boolean(n.store)&&Boolean(n.store.getState)&&Boolean(n.store.dispatch);Boolean(p)&&Boolean(p.store);var f=m?n.store:p.store,h=(0,a.useMemo)((function(){return function(t){return e(t.dispatch,o)}(f)}),[f]),g=(0,a.useMemo)((function(){if(!d)return li;var e=new Qr(f,m?null:p.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[f,m,p]),v=g[0],b=g[1],x=(0,a.useMemo)((function(){return m?p:(0,Ce.Z)({},p,{subscription:v})}),[m,p,v]),w=(0,a.useReducer)(si,ai,pi),C=w[0][0],_=w[1];if(C&&C.error)throw C.error;var S=(0,a.useRef)(),k=(0,a.useRef)(s),I=(0,a.useRef)(),E=(0,a.useRef)(!1),T=u((function(){return I.current&&s===k.current?I.current:h(f.getState(),s)}),[f,C,s]);ci(ui,[k,S,E,s,T,I,b]),ci(di,[d,f,v,h,k,S,E,I,b,_],[f,v,h]);var A=(0,a.useMemo)((function(){return a.createElement(t,(0,Ce.Z)({},T,{ref:l}))}),[l,t,T]);return(0,a.useMemo)((function(){return d?a.createElement(c.Provider,{value:x},A):A}),[c,A,x])}var f=s?a.memo(p):p;if(f.WrappedComponent=t,f.displayName=r,h){var g=a.forwardRef((function(e,t){return a.createElement(f,(0,Ce.Z)({},e,{forwardedRef:t}))}));return g.displayName=r,g.WrappedComponent=t,ri()(g,t)}return ri()(f,t)}}function fi(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function hi(e,t){if(fi(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var i=0;i<n.length;i++)if(!Object.prototype.hasOwnProperty.call(t,n[i])||!fi(e[n[i]],t[n[i]]))return!1;return!0}function gi(e){return function(t,n){var r=e(t,n);function i(){return r}return i.dependsOnOwnProps=!1,i}}function vi(e){return null!==e.dependsOnOwnProps&&void 0!==e.dependsOnOwnProps?Boolean(e.dependsOnOwnProps):1!==e.length}function bi(e,t){return function(t,n){n.displayName;var r=function(e,t){return r.dependsOnOwnProps?r.mapToProps(e,t):r.mapToProps(e)};return r.dependsOnOwnProps=!0,r.mapToProps=function(t,n){r.mapToProps=e,r.dependsOnOwnProps=vi(e);var i=r(t,n);return"function"==typeof i&&(r.mapToProps=i,r.dependsOnOwnProps=vi(i),i=r(t,n)),i},r}}var yi=[function(e){return"function"==typeof e?bi(e):void 0},function(e){return e?void 0:gi((function(e){return{dispatch:e}}))},function(e){return e&&"object"==typeof e?gi((function(t){return(0,$r.DE)(e,t)})):void 0}],xi=[function(e){return"function"==typeof e?bi(e):void 0},function(e){return e?void 0:gi((function(){return{}}))}];function wi(e,t,n){return(0,Ce.Z)({},n,{},e,{},t)}var Ci=[function(e){return"function"==typeof e?function(e){return function(t,n){n.displayName;var r,i=n.pure,o=n.areMergedPropsEqual,a=!1;return function(t,n,l){var s=e(t,n,l);return a?i&&o(s,r)||(r=s):(a=!0,r=s),r}}}(e):void 0},function(e){return e?void 0:function(){return wi}}];function _i(e,t,n,r){return function(i,o){return n(e(i,o),t(r,o),o)}}function Si(e,t,n,r,i){var o,a,l,s,c,u=i.areStatesEqual,d=i.areOwnPropsEqual,p=i.areStatePropsEqual,m=!1;return function(i,f){return m?function(i,m){var f,h,g=!d(m,a),v=!u(i,o);return o=i,a=m,g&&v?(l=e(o,a),t.dependsOnOwnProps&&(s=t(r,a)),c=n(l,s,a)):g?(e.dependsOnOwnProps&&(l=e(o,a)),t.dependsOnOwnProps&&(s=t(r,a)),c=n(l,s,a)):v?(f=e(o,a),h=!p(f,l),l=f,h&&(c=n(l,s,a)),c):c}(i,f):(l=e(o=i,a=f),s=t(r,a),c=n(l,s,a),m=!0,c)}}function ki(e,t){var n=t.initMapStateToProps,r=t.initMapDispatchToProps,i=t.initMergeProps,o=(0,ti.Z)(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),a=n(e,o),l=r(e,o),s=i(e,o);return(o.pure?Si:_i)(a,l,s,e,o)}function Ii(e,t,n){for(var r=t.length-1;r>=0;r--){var i=t[r](e);if(i)return i}return function(t,r){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function Ei(e,t){return e===t}function Ti(e){var t=void 0===e?{}:e,n=t.connectHOC,r=void 0===n?mi:n,i=t.mapStateToPropsFactories,o=void 0===i?xi:i,a=t.mapDispatchToPropsFactories,l=void 0===a?yi:a,s=t.mergePropsFactories,c=void 0===s?Ci:s,u=t.selectorFactory,d=void 0===u?ki:u;return function(e,t,n,i){void 0===i&&(i={});var a=i,s=a.pure,u=void 0===s||s,p=a.areStatesEqual,m=void 0===p?Ei:p,f=a.areOwnPropsEqual,h=void 0===f?hi:f,g=a.areStatePropsEqual,v=void 0===g?hi:g,b=a.areMergedPropsEqual,y=void 0===b?hi:b,x=(0,ti.Z)(a,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),w=Ii(e,o,"mapStateToProps"),C=Ii(t,l,"mapDispatchToProps"),_=Ii(n,c,"mergeProps");return r(d,(0,Ce.Z)({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:w,initMapDispatchToProps:C,initMergeProps:_,pure:u,areStatesEqual:m,areOwnPropsEqual:h,areStatePropsEqual:v,areMergedPropsEqual:y},x))}}var Ai,Di=Ti();Ai=l.unstable_batchedUpdates,Kr=Ai;var Li=n(73384),Pi=n(34986),Fi=function(e){var t=e.top,n=e.right,r=e.bottom,i=e.left;return{top:t,right:n,bottom:r,left:i,width:n-i,height:r-t,x:i,y:t,center:{x:(n+i)/2,y:(r+t)/2}}},Ni=function(e,t){return{top:e.top-t.top,left:e.left-t.left,bottom:e.bottom+t.bottom,right:e.right+t.right}},ji=function(e,t){return{top:e.top+t.top,left:e.left+t.left,bottom:e.bottom-t.bottom,right:e.right-t.right}},Ri={top:0,right:0,bottom:0,left:0},Oi=function(e){var t=e.borderBox,n=e.margin,r=void 0===n?Ri:n,i=e.border,o=void 0===i?Ri:i,a=e.padding,l=void 0===a?Ri:a,s=Fi(Ni(t,r)),c=Fi(ji(t,o)),u=Fi(ji(c,l));return{marginBox:s,borderBox:Fi(t),paddingBox:c,contentBox:u,margin:r,border:o,padding:l}},Mi=function(e){var t=e.slice(0,-2);if("px"!==e.slice(-2))return 0;var n=Number(t);return isNaN(n)&&(0,Pi.Z)(!1),n},Bi=function(e,t){var n,r,i=e.borderBox,o=e.border,a=e.margin,l=e.padding,s=(r=t,{top:(n=i).top+r.y,left:n.left+r.x,bottom:n.bottom+r.y,right:n.right+r.x});return Oi({borderBox:s,border:o,margin:a,padding:l})},Wi=function(e,t){return void 0===t&&(t={x:window.pageXOffset,y:window.pageYOffset}),Bi(e,t)},zi=function(e,t){var n={top:Mi(t.marginTop),right:Mi(t.marginRight),bottom:Mi(t.marginBottom),left:Mi(t.marginLeft)},r={top:Mi(t.paddingTop),right:Mi(t.paddingRight),bottom:Mi(t.paddingBottom),left:Mi(t.paddingLeft)},i={top:Mi(t.borderTopWidth),right:Mi(t.borderRightWidth),bottom:Mi(t.borderBottomWidth),left:Mi(t.borderLeftWidth)};return Oi({borderBox:e,margin:n,padding:r,border:i})},Hi=function(e){var t=e.getBoundingClientRect(),n=window.getComputedStyle(e);return zi(t,n)},Zi=n(84471),Ui=function(e){var t=[],n=null,r=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];t=i,n||(n=requestAnimationFrame((function(){n=null,e.apply(void 0,t)})))};return r.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},r};function Vi(e,t){}function Gi(){}function qi(e,t,n){var r=t.map((function(t){var r,i,o=(r=n,i=t.options,(0,Ce.Z)({},r,{},i));return e.addEventListener(t.eventName,t.fn,o),function(){e.removeEventListener(t.eventName,t.fn,o)}}));return function(){r.forEach((function(e){e()}))}}Vi.bind(null,"warn"),Vi.bind(null,"error");function $i(e){this.message=e}function Yi(e,t){if(!e)throw new $i("Invariant failed")}$i.prototype.toString=function(){return this.message};var Ki=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).callbacks=null,t.unbind=Gi,t.onWindowError=function(e){var n=t.getCallbacks();n.isDragging()&&n.tryAbort(),e.error instanceof $i&&e.preventDefault()},t.getCallbacks=function(){if(!t.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return t.callbacks},t.setCallbacks=function(e){t.callbacks=e},t}(0,qr.Z)(t,e);var n=t.prototype;return n.componentDidMount=function(){this.unbind=qi(window,[{eventName:"error",fn:this.onWindowError}])},n.componentDidCatch=function(e){if(!(e instanceof $i))throw e;this.setState({})},n.componentWillUnmount=function(){this.unbind()},n.render=function(){return this.props.children(this.setCallbacks)},t}(a.Component),Xi=function(e){return e+1},Ji=function(e,t){var n=e.droppableId===t.droppableId,r=Xi(e.index),i=Xi(t.index);return n?"\n      You have moved the item from position "+r+"\n      to position "+i+"\n    ":"\n    You have moved the item from position "+r+"\n    in list "+e.droppableId+"\n    to list "+t.droppableId+"\n    in position "+i+"\n  "},Qi=function(e,t,n){return t.droppableId===n.droppableId?"\n      The item "+e+"\n      has been combined with "+n.draggableId:"\n      The item "+e+"\n      in list "+t.droppableId+"\n      has been combined with "+n.draggableId+"\n      in list "+n.droppableId+"\n    "},eo=function(e){return"\n  The item has returned to its starting position\n  of "+Xi(e.index)+"\n"},to=function(e){return"\n  You have lifted an item in position "+Xi(e.source.index)+"\n"},no=function(e){var t=e.destination;if(t)return Ji(e.source,t);var n=e.combine;return n?Qi(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},ro=function(e){if("CANCEL"===e.reason)return"\n      Movement cancelled.\n      "+eo(e.source)+"\n    ";var t=e.destination,n=e.combine;return t?"\n      You have dropped the item.\n      "+Ji(e.source,t)+"\n    ":n?"\n      You have dropped the item.\n      "+Qi(e.draggableId,e.source,n)+"\n    ":"\n    The item has been dropped while not over a drop area.\n    "+eo(e.source)+"\n  "},io={x:0,y:0},oo=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},ao=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},lo=function(e,t){return e.x===t.x&&e.y===t.y},so=function(e){return{x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}},co=function(e,t,n){var r;return void 0===n&&(n=0),(r={})[e]=t,r["x"===e?"y":"x"]=n,r},uo=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},po=function(e,t){return Math.min.apply(Math,t.map((function(t){return uo(e,t)})))},mo=function(e){return function(t){return{x:e(t.x),y:e(t.y)}}},fo=function(e,t){return{top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}},ho=function(e){return[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}]},go=function(e,t){return t&&t.shouldClipSubject?function(e,t){var n=Fi({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n}(t.pageMarginBox,e):Fi(e)},vo=function(e){var t=e.page,n=e.withPlaceholder,r=e.axis,i=e.frame,o=function(e,t){return t?fo(e,t.scroll.diff.displacement):e}(t.marginBox,i),a=function(e,t,n){var r;return n&&n.increasedBy?(0,Ce.Z)({},e,((r={})[t.end]=e[t.end]+n.increasedBy[t.line],r)):e}(o,r,n);return{page:t,withPlaceholder:n,active:go(a,i)}},bo=function(e,t){e.frame||Yi(!1);var n=e.frame,r=ao(t,n.scroll.initial),i=so(r),o=(0,Ce.Z)({},n,{scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:i},max:n.scroll.max}}),a=vo({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:o});return(0,Ce.Z)({},e,{frame:o,subject:a})};function yo(e){return Object.values?Object.values(e):Object.keys(e).map((function(t){return e[t]}))}function xo(e,t){if(e.findIndex)return e.findIndex(t);for(var n=0;n<e.length;n++)if(t(e[n]))return n;return-1}function wo(e,t){if(e.find)return e.find(t);var n=xo(e,t);return-1!==n?e[n]:void 0}function Co(e){return Array.prototype.slice.call(e)}var _o=(0,Zi.default)((function(e){return e.reduce((function(e,t){return e[t.descriptor.id]=t,e}),{})})),So=(0,Zi.default)((function(e){return e.reduce((function(e,t){return e[t.descriptor.id]=t,e}),{})})),ko=(0,Zi.default)((function(e){return yo(e)})),Io=(0,Zi.default)((function(e){return yo(e)})),Eo=(0,Zi.default)((function(e,t){var n=Io(t).filter((function(t){return e===t.descriptor.droppableId})).sort((function(e,t){return e.descriptor.index-t.descriptor.index}));return n}));function To(e){return e.at&&"REORDER"===e.at.type?e.at.destination:null}function Ao(e){return e.at&&"COMBINE"===e.at.type?e.at.combine:null}var Do=(0,Zi.default)((function(e,t){return t.filter((function(t){return t.descriptor.id!==e.descriptor.id}))})),Lo=function(e,t){return e.descriptor.droppableId===t.descriptor.id},Po={point:io,value:0},Fo={invisible:{},visible:{},all:[]},No={displaced:Fo,displacedBy:Po,at:null},jo=function(e,t){return function(n){return e<=n&&n<=t}},Ro=function(e){var t=jo(e.top,e.bottom),n=jo(e.left,e.right);return function(r){if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;var i=t(r.top)||t(r.bottom),o=n(r.left)||n(r.right);if(i&&o)return!0;var a=r.top<e.top&&r.bottom>e.bottom,l=r.left<e.left&&r.right>e.right;return!(!a||!l)||a&&o||l&&i}},Oo=function(e){var t=jo(e.top,e.bottom),n=jo(e.left,e.right);return function(e){return t(e.top)&&t(e.bottom)&&n(e.left)&&n(e.right)}},Mo={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},Bo={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},Wo=function(e){var t=e.target,n=e.destination,r=e.viewport,i=e.withDroppableDisplacement,o=e.isVisibleThroughFrameFn,a=i?function(e,t){var n=t.frame?t.frame.scroll.diff.displacement:io;return fo(e,n)}(t,n):t;return function(e,t,n){return!!t.subject.active&&n(t.subject.active)(e)}(a,n,o)&&function(e,t,n){return n(t)(e)}(a,r,o)},zo=function(e){return Wo((0,Ce.Z)({},e,{isVisibleThroughFrameFn:Oo}))};function Ho(e){var t=e.afterDragging,n=e.destination,r=e.displacedBy,i=e.viewport,o=e.forceShouldAnimate,a=e.last;return t.reduce((function(e,t){var l,s=function(e,t){var n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return Fi(Ni(n,r))}(t,r),c=t.descriptor.id;if(e.all.push(c),l={target:s,destination:n,viewport:i,withDroppableDisplacement:!0},!Wo((0,Ce.Z)({},l,{isVisibleThroughFrameFn:Ro})))return e.invisible[t.descriptor.id]=!0,e;var u=function(e,t,n){if("boolean"==typeof n)return n;if(!t)return!0;var r=t.invisible,i=t.visible;if(r[e])return!1;var o=i[e];return!o||o.shouldAnimate}(c,a,o),d={draggableId:c,shouldAnimate:u};return e.visible[c]=d,e}),{all:[],visible:{},invisible:{}})}function Zo(e){var t=e.insideDestination,n=e.inHomeList,r=e.displacedBy,i=e.destination,o=function(e,t){if(!e.length)return 0;var n=e[e.length-1].descriptor.index;return t.inHomeList?n:n+1}(t,{inHomeList:n});return{displaced:Fo,displacedBy:r,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:o}}}}function Uo(e){var t=e.draggable,n=e.insideDestination,r=e.destination,i=e.viewport,o=e.displacedBy,a=e.last,l=e.index,s=e.forceShouldAnimate,c=Lo(t,r);if(null==l)return Zo({insideDestination:n,inHomeList:c,displacedBy:o,destination:r});var u=wo(n,(function(e){return e.descriptor.index===l}));if(!u)return Zo({insideDestination:n,inHomeList:c,displacedBy:o,destination:r});var d=Do(t,n),p=n.indexOf(u);return{displaced:Ho({afterDragging:d.slice(p),destination:r,displacedBy:o,last:a,viewport:i.frame,forceShouldAnimate:s}),displacedBy:o,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:l}}}}function Vo(e,t){return Boolean(t.effected[e])}var Go=function(e,t){return t.margin[e.start]+t.borderBox[e.size]/2},qo=function(e,t,n){return t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2},$o=function(e){var t=e.axis,n=e.moveRelativeTo,r=e.isMoving;return co(t.line,n.marginBox[t.end]+Go(t,r),qo(t,n.marginBox,r))},Yo=function(e){var t=e.axis,n=e.moveRelativeTo,r=e.isMoving;return co(t.line,n.marginBox[t.start]-function(e,t){return t.margin[e.end]+t.borderBox[e.size]/2}(t,r),qo(t,n.marginBox,r))},Ko=function(e,t){var n=e.frame;return n?oo(t,n.scroll.diff.displacement):t},Xo=function(e){var t=function(e){var t=e.impact,n=e.draggable,r=e.droppable,i=e.draggables,o=e.afterCritical,a=n.page.borderBox.center,l=t.at;return r&&l?"REORDER"===l.type?function(e){var t=e.impact,n=e.draggable,r=e.draggables,i=e.droppable,o=e.afterCritical,a=Eo(i.descriptor.id,r),l=n.page,s=i.axis;if(!a.length)return function(e){var t=e.axis,n=e.moveInto,r=e.isMoving;return co(t.line,n.contentBox[t.start]+Go(t,r),qo(t,n.contentBox,r))}({axis:s,moveInto:i.page,isMoving:l});var c=t.displaced,u=t.displacedBy,d=c.all[0];if(d){var p=r[d];if(Vo(d,o))return Yo({axis:s,moveRelativeTo:p.page,isMoving:l});var m=Bi(p.page,u.point);return Yo({axis:s,moveRelativeTo:m,isMoving:l})}var f=a[a.length-1];if(f.descriptor.id===n.descriptor.id)return l.borderBox.center;if(Vo(f.descriptor.id,o)){var h=Bi(f.page,so(o.displacedBy.point));return $o({axis:s,moveRelativeTo:h,isMoving:l})}return $o({axis:s,moveRelativeTo:f.page,isMoving:l})}({impact:t,draggable:n,draggables:i,droppable:r,afterCritical:o}):function(e){var t=e.afterCritical,n=e.impact,r=e.draggables,i=Ao(n);i||Yi(!1);var o=i.draggableId,a=r[o].page.borderBox.center,l=function(e){var t=e.displaced,n=e.afterCritical,r=e.combineWith,i=e.displacedBy,o=Boolean(t.visible[r]||t.invisible[r]);return Vo(r,n)?o?io:so(i.point):o?i.point:io}({displaced:n.displaced,afterCritical:t,combineWith:o,displacedBy:n.displacedBy});return oo(a,l)}({impact:t,draggables:i,afterCritical:o}):a}(e),n=e.droppable;return n?Ko(n,t):t},Jo=function(e,t){var n=ao(t,e.scroll.initial),r=so(n);return{frame:Fi({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:n,displacement:r}}}};function Qo(e,t){return e.map((function(e){return t[e]}))}var ea=function(e){var t,n,r=e.pageBorderBoxCenter,i=e.draggable,o=(t=e.viewport,n=r,oo(t.scroll.diff.displacement,n)),a=ao(o,i.page.borderBox.center);return oo(i.client.borderBox.center,a)},ta=function(e){var t=e.draggable,n=e.destination,r=e.newPageBorderBoxCenter,i=e.viewport,o=e.withDroppableDisplacement,a=e.onlyOnMainAxis,l=void 0!==a&&a,s=ao(r,t.page.borderBox.center),c={target:fo(t.page.borderBox,s),destination:n,withDroppableDisplacement:o,viewport:i};return l?function(e){return Wo((0,Ce.Z)({},e,{isVisibleThroughFrameFn:(t=e.destination.axis,function(e){var n=jo(e.top,e.bottom),r=jo(e.left,e.right);return function(e){return t===Mo?n(e.top)&&n(e.bottom):r(e.left)&&r(e.right)}})}));var t}(c):zo(c)},na=function(e){var t=e.isMovingForward,n=e.draggable,r=e.destination,i=e.draggables,o=e.previousImpact,a=e.viewport,l=e.previousPageBorderBoxCenter,s=e.previousClientSelection,c=e.afterCritical;if(!r.isEnabled)return null;var u=Eo(r.descriptor.id,i),d=Lo(n,r),p=function(e){var t=e.isMovingForward,n=e.draggable,r=e.destination,i=e.insideDestination,o=e.previousImpact;if(!r.isCombineEnabled)return null;if(!To(o))return null;function a(e){var t={type:"COMBINE",combine:{draggableId:e,droppableId:r.descriptor.id}};return(0,Ce.Z)({},o,{at:t})}var l=o.displaced.all,s=l.length?l[0]:null;if(t)return s?a(s):null;var c=Do(n,i);if(!s)return c.length?a(c[c.length-1].descriptor.id):null;var u=xo(c,(function(e){return e.descriptor.id===s}));-1===u&&Yi(!1);var d=u-1;return d<0?null:a(c[d].descriptor.id)}({isMovingForward:t,draggable:n,destination:r,insideDestination:u,previousImpact:o})||function(e){var t=e.isMovingForward,n=e.isInHomeList,r=e.draggable,i=e.draggables,o=e.destination,a=e.insideDestination,l=e.previousImpact,s=e.viewport,c=e.afterCritical,u=l.at;if(u||Yi(!1),"REORDER"===u.type){var d=function(e){var t=e.isMovingForward,n=e.isInHomeList,r=e.insideDestination,i=e.location;if(!r.length)return null;var o=i.index,a=t?o+1:o-1,l=r[0].descriptor.index,s=r[r.length-1].descriptor.index;return a<l||a>(n?s:s+1)?null:a}({isMovingForward:t,isInHomeList:n,location:u.destination,insideDestination:a});return null==d?null:Uo({draggable:r,insideDestination:a,destination:o,viewport:s,last:l.displaced,displacedBy:l.displacedBy,index:d})}var p=function(e){var t=e.isMovingForward,n=e.draggables,r=e.combine,i=e.afterCritical;if(!e.destination.isCombineEnabled)return null;var o=r.draggableId,a=n[o].descriptor.index;return Vo(o,i)?t?a:a-1:t?a+1:a}({isMovingForward:t,destination:o,displaced:l.displaced,draggables:i,combine:u.combine,afterCritical:c});return null==p?null:Uo({draggable:r,insideDestination:a,destination:o,viewport:s,last:l.displaced,displacedBy:l.displacedBy,index:p})}({isMovingForward:t,isInHomeList:d,draggable:n,draggables:i,destination:r,insideDestination:u,previousImpact:o,viewport:a,afterCritical:c});if(!p)return null;var m=Xo({impact:p,draggable:n,droppable:r,draggables:i,afterCritical:c});if(ta({draggable:n,destination:r,newPageBorderBoxCenter:m,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:ea({pageBorderBoxCenter:m,draggable:n,viewport:a}),impact:p,scrollJumpRequest:null};var f=ao(m,l),h=function(e){var t=e.impact,n=e.viewport,r=e.destination,i=e.draggables,o=e.maxScrollChange,a=Jo(n,oo(n.scroll.current,o)),l=r.frame?bo(r,oo(r.frame.scroll.current,o)):r,s=t.displaced,c=Ho({afterDragging:Qo(s.all,i),destination:r,displacedBy:t.displacedBy,viewport:a.frame,last:s,forceShouldAnimate:!1}),u=Ho({afterDragging:Qo(s.all,i),destination:l,displacedBy:t.displacedBy,viewport:n.frame,last:s,forceShouldAnimate:!1}),d={},p={},m=[s,c,u];return s.all.forEach((function(e){var t=function(e,t){for(var n=0;n<t.length;n++){var r=t[n].visible[e];if(r)return r}return null}(e,m);t?p[e]=t:d[e]=!0})),(0,Ce.Z)({},t,{displaced:{all:s.all,invisible:d,visible:p}})}({impact:p,viewport:a,destination:r,draggables:i,maxScrollChange:f});return{clientSelection:s,impact:h,scrollJumpRequest:f}},ra=function(e){var t=e.subject.active;return t||Yi(!1),t},ia=function(e,t){var n=e.page.borderBox.center;return Vo(e.descriptor.id,t)?ao(n,t.displacedBy.point):n},oa=function(e,t){var n=e.page.borderBox;return Vo(e.descriptor.id,t)?fo(n,so(t.displacedBy.point)):n},aa=(0,Zi.default)((function(e,t){var n=t[e.line];return{value:n,point:co(e.line,n)}})),la=function(e,t){return(0,Ce.Z)({},e,{scroll:(0,Ce.Z)({},e.scroll,{max:t})})},sa=function(e,t,n){var r=e.frame;Lo(t,e)&&Yi(!1),e.subject.withPlaceholder&&Yi(!1);var i=aa(e.axis,t.displaceBy).point,o=function(e,t,n){var r=e.axis;if("virtual"===e.descriptor.mode)return co(r.line,t[r.line]);var i=e.subject.page.contentBox[r.size],o=Eo(e.descriptor.id,n).reduce((function(e,t){return e+t.client.marginBox[r.size]}),0)+t[r.line]-i;return o<=0?null:co(r.line,o)}(e,i,n),a={placeholderSize:i,increasedBy:o,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!r){var l=vo({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:e.frame});return(0,Ce.Z)({},e,{subject:l})}var s=o?oo(r.scroll.max,o):r.scroll.max,c=la(r,s),u=vo({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:c});return(0,Ce.Z)({},e,{subject:u,frame:c})},ca=function(e){var t=e.at;return t?"REORDER"===t.type?t.destination.droppableId:t.combine.droppableId:null},ua=function(e){var t=e.state,n=e.type,r=function(e,t){var n=ca(e);return n?t[n]:null}(t.impact,t.dimensions.droppables),i=Boolean(r),o=t.dimensions.droppables[t.critical.droppable.id],a=r||o,l=a.axis.direction,s="vertical"===l&&("MOVE_UP"===n||"MOVE_DOWN"===n)||"horizontal"===l&&("MOVE_LEFT"===n||"MOVE_RIGHT"===n);if(s&&!i)return null;var c="MOVE_DOWN"===n||"MOVE_RIGHT"===n,u=t.dimensions.draggables[t.critical.draggable.id],d=t.current.page.borderBoxCenter,p=t.dimensions,m=p.draggables,f=p.droppables;return s?na({isMovingForward:c,previousPageBorderBoxCenter:d,draggable:u,destination:a,draggables:m,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,afterCritical:t.afterCritical}):function(e){var t=e.isMovingForward,n=e.previousPageBorderBoxCenter,r=e.draggable,i=e.isOver,o=e.draggables,a=e.droppables,l=e.viewport,s=e.afterCritical,c=function(e){var t=e.isMovingForward,n=e.pageBorderBoxCenter,r=e.source,i=e.droppables,o=e.viewport,a=r.subject.active;if(!a)return null;var l=r.axis,s=jo(a[l.start],a[l.end]),c=ko(i).filter((function(e){return e!==r})).filter((function(e){return e.isEnabled})).filter((function(e){return Boolean(e.subject.active)})).filter((function(e){return Ro(o.frame)(ra(e))})).filter((function(e){var n=ra(e);return t?a[l.crossAxisEnd]<n[l.crossAxisEnd]:n[l.crossAxisStart]<a[l.crossAxisStart]})).filter((function(e){var t=ra(e),n=jo(t[l.start],t[l.end]);return s(t[l.start])||s(t[l.end])||n(a[l.start])||n(a[l.end])})).sort((function(e,n){var r=ra(e)[l.crossAxisStart],i=ra(n)[l.crossAxisStart];return t?r-i:i-r})).filter((function(e,t,n){return ra(e)[l.crossAxisStart]===ra(n[0])[l.crossAxisStart]}));if(!c.length)return null;if(1===c.length)return c[0];var u=c.filter((function(e){return jo(ra(e)[l.start],ra(e)[l.end])(n[l.line])}));return 1===u.length?u[0]:u.length>1?u.sort((function(e,t){return ra(e)[l.start]-ra(t)[l.start]}))[0]:c.sort((function(e,t){var r=po(n,ho(ra(e))),i=po(n,ho(ra(t)));return r!==i?r-i:ra(e)[l.start]-ra(t)[l.start]}))[0]}({isMovingForward:t,pageBorderBoxCenter:n,source:i,droppables:a,viewport:l});if(!c)return null;var u=Eo(c.descriptor.id,o),d=function(e){var t=e.pageBorderBoxCenter,n=e.viewport,r=e.destination,i=e.afterCritical,o=e.insideDestination.filter((function(e){return zo({target:oa(e,i),destination:r,viewport:n.frame,withDroppableDisplacement:!0})})).sort((function(e,n){var o=uo(t,Ko(r,ia(e,i))),a=uo(t,Ko(r,ia(n,i)));return o<a?-1:a<o?1:e.descriptor.index-n.descriptor.index}));return o[0]||null}({pageBorderBoxCenter:n,viewport:l,destination:c,insideDestination:u,afterCritical:s}),p=function(e){var t=e.previousPageBorderBoxCenter,n=e.moveRelativeTo,r=e.insideDestination,i=e.draggable,o=e.draggables,a=e.destination,l=e.viewport,s=e.afterCritical;if(!n){if(r.length)return null;var c={displaced:Fo,displacedBy:Po,at:{type:"REORDER",destination:{droppableId:a.descriptor.id,index:0}}},u=Xo({impact:c,draggable:i,droppable:a,draggables:o,afterCritical:s}),d=Lo(i,a)?a:sa(a,i,o);return ta({draggable:i,destination:d,newPageBorderBoxCenter:u,viewport:l.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?c:null}var p,m=Boolean(t[a.axis.line]<=n.page.borderBox.center[a.axis.line]),f=(p=n.descriptor.index,n.descriptor.id===i.descriptor.id||m?p:p+1);return Uo({draggable:i,insideDestination:r,destination:a,viewport:l,displacedBy:aa(a.axis,i.displaceBy),last:Fo,index:f})}({previousPageBorderBoxCenter:n,destination:c,draggable:r,draggables:o,moveRelativeTo:d,insideDestination:u,viewport:l,afterCritical:s});if(!p)return null;var m=Xo({impact:p,draggable:r,droppable:c,draggables:o,afterCritical:s});return{clientSelection:ea({pageBorderBoxCenter:m,draggable:r,viewport:l}),impact:p,scrollJumpRequest:null}}({isMovingForward:c,previousPageBorderBoxCenter:d,draggable:u,isOver:a,draggables:m,droppables:f,viewport:t.viewport,afterCritical:t.afterCritical})};function da(e){return"DRAGGING"===e.phase||"COLLECTING"===e.phase}function pa(e){var t=jo(e.top,e.bottom),n=jo(e.left,e.right);return function(e){return t(e.y)&&n(e.x)}}var ma=function(e,t){return Fi(fo(e,t))};function fa(e){var t=e.displaced,n=e.id;return Boolean(t.visible[n]||t.invisible[n])}var ha=function(e){var t=e.pageOffset,n=e.draggable,r=e.draggables,i=e.droppables,o=e.previousImpact,a=e.viewport,l=e.afterCritical,s=ma(n.page.borderBox,t),c=function(e){var t=e.pageBorderBox,n=e.draggable,r=e.droppables,i=ko(r).filter((function(e){if(!e.isEnabled)return!1;var n,r,i=e.subject.active;if(!i)return!1;if(r=i,!((n=t).left<r.right&&n.right>r.left&&n.top<r.bottom&&n.bottom>r.top))return!1;if(pa(i)(t.center))return!0;var o=e.axis,a=i.center[o.crossAxisLine],l=t[o.crossAxisStart],s=t[o.crossAxisEnd],c=jo(i[o.crossAxisStart],i[o.crossAxisEnd]),u=c(l),d=c(s);return!u&&!d||(u?l<a:s>a)}));return i.length?1===i.length?i[0].descriptor.id:function(e){var t=e.pageBorderBox,n=e.candidates,r=e.draggable.page.borderBox.center,i=n.map((function(e){var n=e.axis,i=co(e.axis.line,t.center[n.line],e.page.borderBox.center[n.crossAxisLine]);return{id:e.descriptor.id,distance:uo(r,i)}})).sort((function(e,t){return t.distance-e.distance}));return i[0]?i[0].id:null}({pageBorderBox:t,draggable:n,candidates:i}):null}({pageBorderBox:s,draggable:n,droppables:i});if(!c)return No;var u=i[c],d=Eo(u.descriptor.id,r),p=function(e,t){var n=e.frame;return n?ma(t,n.scroll.diff.value):t}(u,s);return function(e){var t=e.draggable,n=e.pageBorderBoxWithDroppableScroll,r=e.previousImpact,i=e.destination,o=e.insideDestination,a=e.afterCritical;if(!i.isCombineEnabled)return null;var l=i.axis,s=aa(i.axis,t.displaceBy),c=s.value,u=n[l.start],d=n[l.end],p=wo(Do(t,o),(function(e){var t=e.descriptor.id,n=e.page.borderBox,i=n[l.size]/4,o=Vo(t,a),s=fa({displaced:r.displaced,id:t});return o?s?d>n[l.start]+i&&d<n[l.end]-i:u>n[l.start]-c+i&&u<n[l.end]-c-i:s?d>n[l.start]+c+i&&d<n[l.end]+c-i:u>n[l.start]+i&&u<n[l.end]-i}));return p?{displacedBy:s,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:p.descriptor.id,droppableId:i.descriptor.id}}}:null}({pageBorderBoxWithDroppableScroll:p,draggable:n,previousImpact:o,destination:u,insideDestination:d,afterCritical:l})||function(e){var t=e.pageBorderBoxWithDroppableScroll,n=e.draggable,r=e.destination,i=e.insideDestination,o=e.last,a=e.viewport,l=e.afterCritical,s=r.axis,c=aa(r.axis,n.displaceBy),u=c.value,d=t[s.start],p=t[s.end],m=wo(Do(n,i),(function(e){var t=e.descriptor.id,n=e.page.borderBox.center[s.line],r=Vo(t,l),i=fa({displaced:o,id:t});return r?i?p<=n:d<n-u:i?p<=n+u:d<n})),f=function(e){var t=e.draggable,n=e.closest;return n?e.inHomeList&&n.descriptor.index>t.descriptor.index?n.descriptor.index-1:n.descriptor.index:null}({draggable:n,closest:m,inHomeList:Lo(n,r)});return Uo({draggable:n,insideDestination:i,destination:r,viewport:a,last:o,displacedBy:c,index:f})}({pageBorderBoxWithDroppableScroll:p,draggable:n,destination:u,insideDestination:d,last:o.displaced,viewport:a,afterCritical:l})},ga=function(e,t){var n;return(0,Ce.Z)({},e,((n={})[t.descriptor.id]=t,n))},va=function(e){var t=e.state,n=e.clientSelection,r=e.dimensions,i=e.viewport,o=e.impact,a=e.scrollJumpRequest,l=i||t.viewport,s=r||t.dimensions,c=n||t.current.client.selection,u=ao(c,t.initial.client.selection),d={offset:u,selection:c,borderBoxCenter:oo(t.initial.client.borderBoxCenter,u)},p={selection:oo(d.selection,l.scroll.current),borderBoxCenter:oo(d.borderBoxCenter,l.scroll.current),offset:oo(d.offset,l.scroll.diff.value)},m={client:d,page:p};if("COLLECTING"===t.phase)return(0,Ce.Z)({phase:"COLLECTING"},t,{dimensions:s,viewport:l,current:m});var f=s.draggables[t.critical.draggable.id],h=o||ha({pageOffset:p.offset,draggable:f,draggables:s.draggables,droppables:s.droppables,previousImpact:t.impact,viewport:l,afterCritical:t.afterCritical}),g=function(e){var t=e.draggable,n=e.draggables,r=e.droppables,i=e.impact,o=function(e){var t=e.previousImpact,n=e.impact,r=e.droppables,i=ca(t),o=ca(n);if(!i)return r;if(i===o)return r;var a=r[i];if(!a.subject.withPlaceholder)return r;var l=function(e){var t=e.subject.withPlaceholder;t||Yi(!1);var n=e.frame;if(!n){var r=vo({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return(0,Ce.Z)({},e,{subject:r})}var i=t.oldFrameMaxScroll;i||Yi(!1);var o=la(n,i),a=vo({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null});return(0,Ce.Z)({},e,{subject:a,frame:o})}(a);return ga(r,l)}({previousImpact:e.previousImpact,impact:i,droppables:r}),a=ca(i);if(!a)return o;var l=r[a];if(Lo(t,l))return o;if(l.subject.withPlaceholder)return o;var s=sa(l,t,n);return ga(o,s)}({draggable:f,impact:h,previousImpact:t.impact,draggables:s.draggables,droppables:s.droppables});return(0,Ce.Z)({},t,{current:m,dimensions:{draggables:s.draggables,droppables:g},impact:h,viewport:l,scrollJumpRequest:a||null,forceShouldAnimate:!a&&null})},ba=function(e){var t=e.impact,n=e.viewport,r=e.draggables,i=e.destination,o=e.forceShouldAnimate,a=t.displaced,l=function(e,t){return e.map((function(e){return t[e]}))}(a.all,r),s=Ho({afterDragging:l,destination:i,displacedBy:t.displacedBy,viewport:n.frame,forceShouldAnimate:o,last:a});return(0,Ce.Z)({},t,{displaced:s})},ya=function(e){var t=e.impact,n=e.draggable,r=e.droppable,i=e.draggables,o=e.viewport,a=e.afterCritical,l=Xo({impact:t,draggable:n,draggables:i,droppable:r,afterCritical:a});return ea({pageBorderBoxCenter:l,draggable:n,viewport:o})},xa=function(e){var t=e.state,n=e.dimensions,r=e.viewport;"SNAP"!==t.movementMode&&Yi(!1);var i=t.impact,o=r||t.viewport,a=n||t.dimensions,l=a.draggables,s=a.droppables,c=l[t.critical.draggable.id],u=ca(i);u||Yi(!1);var d=s[u],p=ba({impact:i,viewport:o,destination:d,draggables:l}),m=ya({impact:p,draggable:c,droppable:d,draggables:l,viewport:o,afterCritical:t.afterCritical});return va({impact:p,clientSelection:m,state:t,dimensions:a,viewport:o})},wa=function(e){var t=e.draggable,n=e.home,r=e.draggables,i=e.viewport,o=aa(n.axis,t.displaceBy),a=Eo(n.descriptor.id,r),l=a.indexOf(t);-1===l&&Yi(!1);var s,c=a.slice(l+1),u=c.reduce((function(e,t){return e[t.descriptor.id]=!0,e}),{}),d={inVirtualList:"virtual"===n.descriptor.mode,displacedBy:o,effected:u};return{impact:{displaced:Ho({afterDragging:c,destination:n,displacedBy:o,last:null,viewport:i.frame,forceShouldAnimate:!1}),displacedBy:o,at:{type:"REORDER",destination:(s=t.descriptor,{index:s.index,droppableId:s.droppableId})}},afterCritical:d}},Ca=function(e){return"SNAP"===e.movementMode},_a=function(e,t,n){var r=function(e,t){return{draggables:e.draggables,droppables:ga(e.droppables,t)}}(e.dimensions,t);return!Ca(e)||n?va({state:e,dimensions:r}):xa({state:e,dimensions:r})};function Sa(e){return e.isDragging&&"SNAP"===e.movementMode?(0,Ce.Z)({phase:"DRAGGING"},e,{scrollJumpRequest:null}):e}var ka={phase:"IDLE",completed:null,shouldFlush:!1},Ia=function(e,t){if(void 0===e&&(e=ka),"FLUSH"===t.type)return(0,Ce.Z)({},ka,{shouldFlush:!0});if("INITIAL_PUBLISH"===t.type){"IDLE"!==e.phase&&Yi(!1);var n=t.payload,r=n.critical,i=n.clientSelection,o=n.viewport,a=n.dimensions,l=n.movementMode,s=a.draggables[r.draggable.id],c=a.droppables[r.droppable.id],u={selection:i,borderBoxCenter:s.client.borderBox.center,offset:io},d={client:u,page:{selection:oo(u.selection,o.scroll.initial),borderBoxCenter:oo(u.selection,o.scroll.initial),offset:oo(u.selection,o.scroll.diff.value)}},p=ko(a.droppables).every((function(e){return!e.isFixedOnPage})),m=wa({draggable:s,home:c,draggables:a.draggables,viewport:o}),f=m.impact;return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:l,dimensions:a,initial:d,current:d,isWindowScrollAllowed:p,impact:f,afterCritical:m.afterCritical,onLiftImpact:f,viewport:o,scrollJumpRequest:null,forceShouldAnimate:null}}if("COLLECTION_STARTING"===t.type)return"COLLECTING"===e.phase||"DROP_PENDING"===e.phase?e:("DRAGGING"!==e.phase&&Yi(!1),(0,Ce.Z)({phase:"COLLECTING"},e,{phase:"COLLECTING"}));if("PUBLISH_WHILE_DRAGGING"===t.type)return"COLLECTING"!==e.phase&&"DROP_PENDING"!==e.phase&&Yi(!1),function(e){var t=e.state,n=e.published,r=n.modified.map((function(e){var n=t.dimensions.droppables[e.droppableId];return bo(n,e.scroll)})),i=(0,Ce.Z)({},t.dimensions.droppables,{},_o(r)),o=So(function(e){var t=e.additions,n=e.updatedDroppables,r=e.viewport,i=r.scroll.diff.value;return t.map((function(e){var t=e.descriptor.droppableId,o=function(e){var t=e.frame;return t||Yi(!1),t}(n[t]),a=o.scroll.diff.value,l=function(e){var t=e.draggable,n=e.offset,r=e.initialWindowScroll,i=Bi(t.client,n),o=Wi(i,r);return(0,Ce.Z)({},t,{placeholder:(0,Ce.Z)({},t.placeholder,{client:i}),client:i,page:o})}({draggable:e,offset:oo(i,a),initialWindowScroll:r.scroll.initial});return l}))}({additions:n.additions,updatedDroppables:i,viewport:t.viewport})),a=(0,Ce.Z)({},t.dimensions.draggables,{},o);n.removals.forEach((function(e){delete a[e]}));var l={droppables:i,draggables:a},s=ca(t.impact),c=s?l.droppables[s]:null,u=l.draggables[t.critical.draggable.id],d=l.droppables[t.critical.droppable.id],p=wa({draggable:u,home:d,draggables:a,viewport:t.viewport}),m=p.impact,f=p.afterCritical,h=c&&c.isCombineEnabled?t.impact:m,g=ha({pageOffset:t.current.page.offset,draggable:l.draggables[t.critical.draggable.id],draggables:l.draggables,droppables:l.droppables,previousImpact:h,viewport:t.viewport,afterCritical:f}),v=(0,Ce.Z)({phase:"DRAGGING"},t,{phase:"DRAGGING",impact:g,onLiftImpact:m,dimensions:l,afterCritical:f,forceShouldAnimate:!1});return"COLLECTING"===t.phase?v:(0,Ce.Z)({phase:"DROP_PENDING"},v,{phase:"DROP_PENDING",reason:t.reason,isWaiting:!1})}({state:e,published:t.payload});if("MOVE"===t.type){if("DROP_PENDING"===e.phase)return e;da(e)||Yi(!1);var h=t.payload.client;return lo(h,e.current.client.selection)?e:va({state:e,clientSelection:h,impact:Ca(e)?e.impact:null})}if("UPDATE_DROPPABLE_SCROLL"===t.type){if("DROP_PENDING"===e.phase)return Sa(e);if("COLLECTING"===e.phase)return Sa(e);da(e)||Yi(!1);var g=t.payload,v=g.id,b=g.newScroll,y=e.dimensions.droppables[v];if(!y)return e;var x=bo(y,b);return _a(e,x,!1)}if("UPDATE_DROPPABLE_IS_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;da(e)||Yi(!1);var w=t.payload,C=w.id,_=w.isEnabled,S=e.dimensions.droppables[C];S||Yi(!1),S.isEnabled===_&&Yi(!1);var k=(0,Ce.Z)({},S,{isEnabled:_});return _a(e,k,!0)}if("UPDATE_DROPPABLE_IS_COMBINE_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;da(e)||Yi(!1);var I=t.payload,E=I.id,T=I.isCombineEnabled,A=e.dimensions.droppables[E];A||Yi(!1),A.isCombineEnabled===T&&Yi(!1);var D=(0,Ce.Z)({},A,{isCombineEnabled:T});return _a(e,D,!0)}if("MOVE_BY_WINDOW_SCROLL"===t.type){if("DROP_PENDING"===e.phase||"DROP_ANIMATING"===e.phase)return e;da(e)||Yi(!1),e.isWindowScrollAllowed||Yi(!1);var L=t.payload.newScroll;if(lo(e.viewport.scroll.current,L))return Sa(e);var P=Jo(e.viewport,L);return Ca(e)?xa({state:e,viewport:P}):va({state:e,viewport:P})}if("UPDATE_VIEWPORT_MAX_SCROLL"===t.type){if(!da(e))return e;var F=t.payload.maxScroll;if(lo(F,e.viewport.scroll.max))return e;var N=(0,Ce.Z)({},e.viewport,{scroll:(0,Ce.Z)({},e.viewport.scroll,{max:F})});return(0,Ce.Z)({phase:"DRAGGING"},e,{viewport:N})}if("MOVE_UP"===t.type||"MOVE_DOWN"===t.type||"MOVE_LEFT"===t.type||"MOVE_RIGHT"===t.type){if("COLLECTING"===e.phase||"DROP_PENDING"===e.phase)return e;"DRAGGING"!==e.phase&&Yi(!1);var j=ua({state:e,type:t.type});return j?va({state:e,impact:j.impact,clientSelection:j.clientSelection,scrollJumpRequest:j.scrollJumpRequest}):e}if("DROP_PENDING"===t.type){var R=t.payload.reason;return"COLLECTING"!==e.phase&&Yi(!1),(0,Ce.Z)({phase:"DROP_PENDING"},e,{phase:"DROP_PENDING",isWaiting:!0,reason:R})}if("DROP_ANIMATE"===t.type){var O=t.payload,M=O.completed,B=O.dropDuration,W=O.newHomeClientOffset;return"DRAGGING"!==e.phase&&"DROP_PENDING"!==e.phase&&Yi(!1),{phase:"DROP_ANIMATING",completed:M,dropDuration:B,newHomeClientOffset:W,dimensions:e.dimensions}}return"DROP_COMPLETE"===t.type?{phase:"IDLE",completed:t.payload.completed,shouldFlush:!1}:e},Ea=function(e){return{type:"PUBLISH_WHILE_DRAGGING",payload:e}},Ta=function(){return{type:"COLLECTION_STARTING",payload:null}},Aa=function(e){return{type:"UPDATE_DROPPABLE_SCROLL",payload:e}},Da=function(e){return{type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}},La=function(e){return{type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}},Pa=function(e){return{type:"MOVE",payload:e}},Fa=function(){return{type:"MOVE_UP",payload:null}},Na=function(){return{type:"MOVE_DOWN",payload:null}},ja=function(){return{type:"MOVE_RIGHT",payload:null}},Ra=function(){return{type:"MOVE_LEFT",payload:null}},Oa=function(e){return{type:"DROP_COMPLETE",payload:e}},Ma=function(e){return{type:"DROP",payload:e}},Ba="cubic-bezier(.2,1,.1,1)",Wa=0,za=.7,Ha=.75,Za="0.2s cubic-bezier(0.2, 0, 0, 1)",Ua={fluid:"opacity "+Za,snap:"transform "+Za+", opacity "+Za,drop:function(e){var t=e+"s "+Ba;return"transform "+t+", opacity "+t},outOfTheWay:"transform "+Za,placeholder:"height "+Za+", width "+Za+", margin "+Za},Va=function(e){return lo(e,io)?null:"translate("+e.x+"px, "+e.y+"px)"},Ga=Va,qa=.33,$a=function(e){var t=e.getState,n=e.dispatch;return function(e){return function(r){if("DROP"===r.type){var i=t(),o=r.payload.reason;if("COLLECTING"!==i.phase){if("IDLE"!==i.phase){"DROP_PENDING"===i.phase&&i.isWaiting&&Yi(!1),"DRAGGING"!==i.phase&&"DROP_PENDING"!==i.phase&&Yi(!1);var a=i.critical,l=i.dimensions,s=l.draggables[i.critical.draggable.id],c=function(e){var t=e.draggables,n=e.reason,r=e.lastImpact,i=e.home,o=e.viewport,a=e.onLiftImpact;return r.at&&"DROP"===n?"REORDER"===r.at.type?{impact:r,didDropInsideDroppable:!0}:{impact:(0,Ce.Z)({},r,{displaced:Fo}),didDropInsideDroppable:!0}:{impact:ba({draggables:t,impact:a,destination:i,viewport:o,forceShouldAnimate:!0}),didDropInsideDroppable:!1}}({reason:o,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),u=c.impact,d=c.didDropInsideDroppable,p=d?To(u):null,m=d?Ao(u):null,f={index:a.draggable.index,droppableId:a.droppable.id},h={draggableId:s.descriptor.id,type:s.descriptor.type,source:f,reason:o,mode:i.movementMode,destination:p,combine:m},g=function(e){var t=e.impact,n=e.draggable,r=e.dimensions,i=e.viewport,o=e.afterCritical,a=r.draggables,l=r.droppables,s=ca(t),c=s?l[s]:null,u=l[n.descriptor.droppableId],d=ya({impact:t,draggable:n,draggables:a,afterCritical:o,droppable:c||u,viewport:i});return ao(d,n.client.borderBox.center)}({impact:u,draggable:s,dimensions:l,viewport:i.viewport,afterCritical:i.afterCritical}),v={critical:i.critical,afterCritical:i.afterCritical,result:h,impact:u};if(!lo(i.current.client.offset,g)||Boolean(h.combine)){var b=function(e){var t=e.reason,n=uo(e.current,e.destination);if(n<=0)return qa;if(n>=1500)return.55;var r=qa+n/1500*.22000000000000003;return Number(("CANCEL"===t?.6*r:r).toFixed(2))}({current:i.current.client.offset,destination:g,reason:o});n({type:"DROP_ANIMATE",payload:{newHomeClientOffset:g,dropDuration:b,completed:v}})}else n(Oa({completed:v}))}}else n(function(e){return{type:"DROP_PENDING",payload:e}}({reason:o}))}else e(r)}}},Ya=function(){return{x:window.pageXOffset,y:window.pageYOffset}};var Ka=function(e){var t=function(e){var t=e.onWindowScroll,n=Ui((function(){t(Ya())})),r=function(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(t){t.target!==window&&t.target!==window.document||e()}}}(n),i=Gi;function o(){return i!==Gi}return{start:function(){o()&&Yi(!1),i=qi(window,[r])},stop:function(){o()||Yi(!1),n.cancel(),i(),i=Gi},isActive:o}}({onWindowScroll:function(t){e.dispatch({type:"MOVE_BY_WINDOW_SCROLL",payload:{newScroll:t}})}});return function(e){return function(n){t.isActive()||"INITIAL_PUBLISH"!==n.type||t.start(),t.isActive()&&function(e){return"DROP_COMPLETE"===e.type||"DROP_ANIMATE"===e.type||"FLUSH"===e.type}(n)&&t.stop(),e(n)}}},Xa=function(e,t){t()},Ja=function(e,t){return{draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t}},Qa=function(e,t,n,r){if(e){var i=function(e){var t=!1,n=!1,r=setTimeout((function(){n=!0})),i=function(i){t||n||(t=!0,e(i),clearTimeout(r))};return i.wasCalled=function(){return t},i}(n);e(t,{announce:i}),i.wasCalled()||n(r(t))}else n(r(t))},el=function(e,t){var n=function(e,t){var n,r=(n=[],{add:function(e){var t=setTimeout((function(){return function(e){var t=xo(n,(function(t){return t.timerId===e}));-1===t&&Yi(!1),n.splice(t,1)[0].callback()}(t)})),r={timerId:t,callback:e};n.push(r)},flush:function(){if(n.length){var e=[].concat(n);n.length=0,e.forEach((function(e){clearTimeout(e.timerId),e.callback()}))}}}),i=null,o=function(n){i||Yi(!1),i=null,Xa(0,(function(){return Qa(e().onDragEnd,n,t,ro)}))};return{beforeCapture:function(t,n){i&&Yi(!1),Xa(0,(function(){var r=e().onBeforeCapture;r&&r({draggableId:t,mode:n})}))},beforeStart:function(t,n){i&&Yi(!1),Xa(0,(function(){var r=e().onBeforeDragStart;r&&r(Ja(t,n))}))},start:function(n,o){i&&Yi(!1);var a=Ja(n,o);i={mode:o,lastCritical:n,lastLocation:a.source,lastCombine:null},r.add((function(){Xa(0,(function(){return Qa(e().onDragStart,a,t,to)}))}))},update:function(n,o){var a=To(o),l=Ao(o);i||Yi(!1);var s=!function(e,t){if(e===t)return!0;var n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r}(n,i.lastCritical);s&&(i.lastCritical=n);var c,u,d=(u=a,!(null==(c=i.lastLocation)&&null==u||null!=c&&null!=u&&c.droppableId===u.droppableId&&c.index===u.index));d&&(i.lastLocation=a);var p=!function(e,t){return null==e&&null==t||null!=e&&null!=t&&e.draggableId===t.draggableId&&e.droppableId===t.droppableId}(i.lastCombine,l);if(p&&(i.lastCombine=l),s||d||p){var m=(0,Ce.Z)({},Ja(n,i.mode),{combine:l,destination:a});r.add((function(){Xa(0,(function(){return Qa(e().onDragUpdate,m,t,no)}))}))}},flush:function(){i||Yi(!1),r.flush()},drop:o,abort:function(){if(i){var e=(0,Ce.Z)({},Ja(i.lastCritical,i.mode),{combine:null,destination:null,reason:"CANCEL"});o(e)}}}}(e,t);return function(e){return function(t){return function(r){if("BEFORE_INITIAL_CAPTURE"!==r.type){if("INITIAL_PUBLISH"===r.type){var i=r.payload.critical;return n.beforeStart(i,r.payload.movementMode),t(r),void n.start(i,r.payload.movementMode)}if("DROP_COMPLETE"===r.type){var o=r.payload.completed.result;return n.flush(),t(r),void n.drop(o)}if(t(r),"FLUSH"!==r.type){var a=e.getState();"DRAGGING"===a.phase&&n.update(a.critical,a.impact)}else n.abort()}else n.beforeCapture(r.payload.draggableId,r.payload.movementMode)}}}},tl=function(e){return function(t){return function(n){if("DROP_ANIMATION_FINISHED"===n.type){var r=e.getState();"DROP_ANIMATING"!==r.phase&&Yi(!1),e.dispatch(Oa({completed:r.completed}))}else t(n)}}},nl=function(e){var t=null,n=null;return function(r){return function(i){if("FLUSH"!==i.type&&"DROP_COMPLETE"!==i.type&&"DROP_ANIMATION_FINISHED"!==i.type||(n&&(cancelAnimationFrame(n),n=null),t&&(t(),t=null)),r(i),"DROP_ANIMATE"===i.type){var o={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){"DROP_ANIMATING"===e.getState().phase&&e.dispatch({type:"DROP_ANIMATION_FINISHED",payload:null})}};n=requestAnimationFrame((function(){n=null,t=qi(window,[o])}))}}}},rl=function(e){return function(t){return function(n){if(t(n),"PUBLISH_WHILE_DRAGGING"===n.type){var r=e.getState();"DROP_PENDING"===r.phase&&(r.isWaiting||e.dispatch(Ma({reason:r.reason})))}}}},il=$r.qC,ol=function(e){var t=e.scrollHeight,n=e.scrollWidth,r=e.height,i=e.width,o=ao({x:n,y:t},{x:i,y:r});return{x:Math.max(0,o.x),y:Math.max(0,o.y)}},al=function(){var e=document.documentElement;return e||Yi(!1),e},ll=function(){var e=al();return ol({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})};function sl(e,t,n){return n.descriptor.id!==t.id&&n.descriptor.type===t.type&&"virtual"===e.droppable.getById(n.descriptor.droppableId).descriptor.mode}var cl,ul,dl=function(e,t){var n=null,r=function(e){var t=e.registry,n=e.callbacks,r={additions:{},removals:{},modified:{}},i=null,o=function(){i||(n.collectionStarting(),i=requestAnimationFrame((function(){i=null;var e=r,o=e.additions,a=e.removals,l=e.modified,s=Object.keys(o).map((function(e){return t.draggable.getById(e).getDimension(io)})).sort((function(e,t){return e.descriptor.index-t.descriptor.index})),c=Object.keys(l).map((function(e){return{droppableId:e,scroll:t.droppable.getById(e).callbacks.getScrollWhileDragging()}})),u={additions:s,removals:Object.keys(a),modified:c};r={additions:{},removals:{},modified:{}},n.publish(u)})))};return{add:function(e){var t=e.descriptor.id;r.additions[t]=e,r.modified[e.descriptor.droppableId]=!0,r.removals[t]&&delete r.removals[t],o()},remove:function(e){var t=e.descriptor;r.removals[t.id]=!0,r.modified[t.droppableId]=!0,r.additions[t.id]&&delete r.additions[t.id],o()},stop:function(){i&&(cancelAnimationFrame(i),i=null,r={additions:{},removals:{},modified:{}})}}}({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),i=function(t){n||Yi(!1);var i=n.critical.draggable;"ADDITION"===t.type&&sl(e,i,t.value)&&r.add(t.value),"REMOVAL"===t.type&&sl(e,i,t.value)&&r.remove(t.value)},o={updateDroppableIsEnabled:function(r,i){e.droppable.exists(r)||Yi(!1),n&&t.updateDroppableIsEnabled({id:r,isEnabled:i})},updateDroppableIsCombineEnabled:function(r,i){n&&(e.droppable.exists(r)||Yi(!1),t.updateDroppableIsCombineEnabled({id:r,isCombineEnabled:i}))},scrollDroppable:function(t,r){n&&e.droppable.getById(t).callbacks.scroll(r)},updateDroppableScroll:function(r,i){n&&(e.droppable.exists(r)||Yi(!1),t.updateDroppableScroll({id:r,newScroll:i}))},startPublishing:function(t){n&&Yi(!1);var r=e.draggable.getById(t.draggableId),o=e.droppable.getById(r.descriptor.droppableId),a={draggable:r.descriptor,droppable:o.descriptor},l=e.subscribe(i);return n={critical:a,unsubscribe:l},function(e){var t,n,r,i,o,a,l,s=e.critical,c=e.scrollOptions,u=e.registry,d=(t=Ya(),n=ll(),r=t.y,i=t.x,a=(o=al()).clientWidth,l=o.clientHeight,{frame:Fi({top:r,left:i,right:i+a,bottom:r+l}),scroll:{initial:t,current:t,max:n,diff:{value:io,displacement:io}}}),p=d.scroll.current,m=s.droppable,f=u.droppable.getAllByType(m.type).map((function(e){return e.callbacks.getDimensionAndWatchScroll(p,c)})),h=u.draggable.getAllByType(s.draggable.type).map((function(e){return e.getDimension(p)}));return{dimensions:{draggables:So(h),droppables:_o(f)},critical:s,viewport:d}}({critical:a,registry:e,scrollOptions:t.scrollOptions})},stopPublishing:function(){if(n){r.stop();var t=n.critical.droppable;e.droppable.getAllByType(t.type).forEach((function(e){return e.callbacks.dragStopped()})),n.unsubscribe(),n=null}}};return o},pl=function(e,t){return"IDLE"===e.phase||"DROP_ANIMATING"===e.phase&&e.completed.result.draggableId!==t&&"DROP"===e.completed.result.reason},ml=function(e){window.scrollBy(e.x,e.y)},fl=(0,Zi.default)((function(e){return ko(e).filter((function(e){return!!e.isEnabled&&!!e.frame}))})),hl=function(e){return Math.pow(e,2)},gl=function(e){var t=e.startOfRange,n=e.endOfRange,r=e.current,i=n-t;return 0===i?0:(r-t)/i},vl=360,bl=1200,yl=function(e){var t=e.distanceToEdge,n=e.thresholds,r=e.dragStartTime,i=e.shouldUseTimeDampening,o=function(e,t){if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return 28;if(e===t.startScrollingFrom)return 1;var n=gl({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),r=28*hl(1-n);return Math.ceil(r)}(t,n);return 0===o?0:i?Math.max(function(e,t){var n=t,r=bl,i=Date.now()-n;if(i>=bl)return e;if(i<vl)return 1;var o=gl({startOfRange:vl,endOfRange:r,current:i}),a=e*hl(o);return Math.ceil(a)}(o,r),1):o},xl=function(e){var t=e.container,n=e.distanceToEdges,r=e.dragStartTime,i=e.axis,o=e.shouldUseTimeDampening,a=function(e,t){return{startScrollingFrom:.25*e[t.size],maxScrollValueAt:.05*e[t.size]}}(t,i);return n[i.end]<n[i.start]?yl({distanceToEdge:n[i.end],thresholds:a,dragStartTime:r,shouldUseTimeDampening:o}):-1*yl({distanceToEdge:n[i.start],thresholds:a,dragStartTime:r,shouldUseTimeDampening:o})},wl=mo((function(e){return 0===e?0:e})),Cl=function(e){var t=e.dragStartTime,n=e.container,r=e.subject,i=e.center,o=e.shouldUseTimeDampening,a={top:i.y-n.top,right:n.right-i.x,bottom:n.bottom-i.y,left:i.x-n.left},l=xl({container:n,distanceToEdges:a,dragStartTime:t,axis:Mo,shouldUseTimeDampening:o}),s=xl({container:n,distanceToEdges:a,dragStartTime:t,axis:Bo,shouldUseTimeDampening:o}),c=wl({x:s,y:l});if(lo(c,io))return null;var u=function(e){var t=e.container,n=e.subject,r=e.proposedScroll,i=n.height>t.height,o=n.width>t.width;return o||i?o&&i?null:{x:o?0:r.x,y:i?0:r.y}:r}({container:n,subject:r,proposedScroll:c});return u?lo(u,io)?null:u:null},_l=mo((function(e){return 0===e?0:e>0?1:-1})),Sl=(cl=function(e,t){return e<0?e:e>t?e-t:0},function(e){var t=e.current,n=e.max,r=e.change,i=oo(t,r),o={x:cl(i.x,n.x),y:cl(i.y,n.y)};return lo(o,io)?null:o}),kl=function(e){var t=e.max,n=e.current,r=e.change,i={x:Math.max(n.x,t.x),y:Math.max(n.y,t.y)},o=_l(r),a=Sl({max:i,current:n,change:o});return!a||0!==o.x&&0===a.x||0!==o.y&&0===a.y},Il=function(e,t){return kl({current:e.scroll.current,max:e.scroll.max,change:t})},El=function(e,t){var n=e.frame;return!!n&&kl({current:n.scroll.current,max:n.scroll.max,change:t})},Tl=function(e){var t=e.state,n=e.dragStartTime,r=e.shouldUseTimeDampening,i=e.scrollWindow,o=e.scrollDroppable,a=t.current.page.borderBoxCenter,l=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){var s=function(e){var t=e.viewport,n=e.subject,r=e.center,i=e.shouldUseTimeDampening,o=Cl({dragStartTime:e.dragStartTime,container:t.frame,subject:n,center:r,shouldUseTimeDampening:i});return o&&Il(t,o)?o:null}({dragStartTime:n,viewport:t.viewport,subject:l,center:a,shouldUseTimeDampening:r});if(s)return void i(s)}var c=function(e){var t=e.center,n=e.destination,r=e.droppables;if(n){var i=r[n];return i.frame?i:null}var o=function(e,t){var n=wo(fl(t),(function(t){return t.frame||Yi(!1),pa(t.frame.pageMarginBox)(e)}));return n}(t,r);return o}({center:a,destination:ca(t.impact),droppables:t.dimensions.droppables});if(c){var u=function(e){var t=e.droppable,n=e.subject,r=e.center,i=e.dragStartTime,o=e.shouldUseTimeDampening,a=t.frame;if(!a)return null;var l=Cl({dragStartTime:i,container:a.pageMarginBox,subject:n,center:r,shouldUseTimeDampening:o});return l&&El(t,l)?l:null}({dragStartTime:n,droppable:c,subject:l,center:a,shouldUseTimeDampening:r});u&&o(c.descriptor.id,u)}},Al=function(e){var t=e.move,n=e.scrollDroppable,r=e.scrollWindow;return function(e){var i=e.scrollJumpRequest;if(i){var o=ca(e.impact);o||Yi(!1);var a=function(e,t){if(!El(e,t))return t;var r=function(e,t){var n=e.frame;return n&&El(e,t)?Sl({current:n.scroll.current,max:n.scroll.max,change:t}):null}(e,t);if(!r)return n(e.descriptor.id,t),null;var i=ao(t,r);return n(e.descriptor.id,i),ao(t,i)}(e.dimensions.droppables[o],i);if(a){var l=e.viewport,s=function(e,t,n){if(!e)return n;if(!Il(t,n))return n;var i=function(e,t){if(!Il(e,t))return null;var n=e.scroll.max,r=e.scroll.current;return Sl({current:r,max:n,change:t})}(t,n);if(!i)return r(n),null;var o=ao(n,i);return r(o),ao(n,o)}(e.isWindowScrollAllowed,l,a);s&&function(e,n){var r=oo(e.current.client.selection,n);t({client:r})}(e,s)}}}},Dl={base:ul="data-rbd-drag-handle",draggableId:ul+"-draggable-id",contextId:ul+"-context-id"},Ll=function(){var e="data-rbd-draggable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),Pl=function(){var e="data-rbd-droppable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),Fl="data-rbd-scroll-container-context-id",Nl=function(e,t){return e.map((function(e){var n=e.styles[t];return n?e.selector+" { "+n+" }":""})).join(" ")},jl="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?a.useLayoutEffect:a.useEffect,Rl=function(){var e=document.querySelector("head");return e||Yi(!1),e},Ol=function(e){var t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};var Ml=function(e){return e&&e.ownerDocument?e.ownerDocument.defaultView:window};function Bl(e){return e instanceof Ml(e).HTMLElement}function Wl(){var e={draggables:{},droppables:{}},t=[];function n(e){t.length&&t.forEach((function(t){return t(e)}))}function r(t){return e.draggables[t]||null}var i={register:function(t){e.draggables[t.descriptor.id]=t,n({type:"ADDITION",value:t})},update:function(t,n){var r=e.draggables[n.descriptor.id];r&&r.uniqueId===t.uniqueId&&(delete e.draggables[n.descriptor.id],e.draggables[t.descriptor.id]=t)},unregister:function(t){var i=t.descriptor.id,o=r(i);o&&t.uniqueId===o.uniqueId&&(delete e.draggables[i],n({type:"REMOVAL",value:t}))},getById:function(e){var t=r(e);return t||Yi(!1),t},findById:r,exists:function(e){return Boolean(r(e))},getAllByType:function(t){return yo(e.draggables).filter((function(e){return e.descriptor.type===t}))}};function o(t){return e.droppables[t]||null}var a={register:function(t){e.droppables[t.descriptor.id]=t},unregister:function(t){var n=o(t.descriptor.id);n&&t.uniqueId===n.uniqueId&&delete e.droppables[t.descriptor.id]},getById:function(e){var t=o(e);return t||Yi(!1),t},findById:o,exists:function(e){return Boolean(o(e))},getAllByType:function(t){return yo(e.droppables).filter((function(e){return e.descriptor.type===t}))}};return{draggable:i,droppable:a,subscribe:function(e){return t.push(e),function(){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}},clean:function(){e.draggables={},e.droppables={},t.length=0}}}var zl=a.createContext(null),Hl=function(){var e=document.body;return e||Yi(!1),e},Zl={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},Ul=0,Vl={separator:"::"};function Gl(e,t){return void 0===t&&(t=Vl),(0,Li.Ye)((function(){return""+e+t.separator+Ul++}),[t.separator,e])}var ql=a.createContext(null);function $l(e){var t=(0,a.useRef)(e);return(0,a.useEffect)((function(){t.current=e})),t}var Yl,Kl,Xl=((Yl={})[13]=!0,Yl[9]=!0,Yl),Jl=function(e){Xl[e.keyCode]&&e.preventDefault()},Ql=function(){var e="visibilitychange";return"undefined"==typeof document?e:wo([e,"ms"+e,"webkit"+e,"moz"+e,"o"+e],(function(e){return"on"+e in document}))||e}(),es={type:"IDLE"};function ts(){}var ns=((Kl={})[34]=!0,Kl[33]=!0,Kl[36]=!0,Kl[35]=!0,Kl);var rs={type:"IDLE"},is={input:!0,button:!0,textarea:!0,select:!0,option:!0,optgroup:!0,video:!0,audio:!0};function os(e,t){if(null==t)return!1;if(Boolean(is[t.tagName.toLowerCase()]))return!0;var n=t.getAttribute("contenteditable");return"true"===n||""===n||t!==e&&os(e,t.parentElement)}function as(e,t){var n=t.target;return!!Bl(n)&&os(e,n)}var ls=function(e){return Fi(e.getBoundingClientRect()).center},ss=function(){var e="matches";return"undefined"==typeof document?e:wo([e,"msMatchesSelector","webkitMatchesSelector"],(function(e){return e in Element.prototype}))||e}();function cs(e,t){return null==e?null:e[ss](t)?e:cs(e.parentElement,t)}function us(e,t){return e.closest?e.closest(t):cs(e,t)}function ds(e){e.preventDefault()}function ps(e){var t=e.expected,n=e.phase,r=e.isLockActive;return e.shouldWarn,!!r()&&t===n}function ms(e){var t=e.lockAPI,n=e.store,r=e.registry,i=e.draggableId;if(t.isClaimed())return!1;var o=r.draggable.findById(i);return!!o&&!!o.options.isEnabled&&!!pl(n.getState(),i)}var fs=[function(e){var t=(0,a.useRef)(es),n=(0,a.useRef)(Gi),r=(0,Li.Ye)((function(){return{eventName:"mousedown",fn:function(t){if(!t.defaultPrevented&&0===t.button&&!(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)){var r=e.findClosestDraggableId(t);if(r){var i=e.tryGetLock(r,l,{sourceEvent:t});if(i){t.preventDefault();var o={x:t.clientX,y:t.clientY};n.current(),u(i,o)}}}}}}),[e]),i=(0,Li.Ye)((function(){return{eventName:"webkitmouseforcewillbegin",fn:function(t){if(!t.defaultPrevented){var n=e.findClosestDraggableId(t);if(n){var r=e.findOptionsForDraggable(n);r&&(r.shouldRespectForcePress||e.canGetLock(n)&&t.preventDefault())}}}}}),[e]),o=(0,Li.I4)((function(){n.current=qi(window,[i,r],{passive:!1,capture:!0})}),[i,r]),l=(0,Li.I4)((function(){"IDLE"!==t.current.type&&(t.current=es,n.current(),o())}),[o]),s=(0,Li.I4)((function(){var e=t.current;l(),"DRAGGING"===e.type&&e.actions.cancel({shouldBlockNextClick:!0}),"PENDING"===e.type&&e.actions.abort()}),[l]),c=(0,Li.I4)((function(){var e=function(e){var t=e.cancel,n=e.completed,r=e.getPhase,i=e.setPhase;return[{eventName:"mousemove",fn:function(e){var t=e.button,n=e.clientX,o=e.clientY;if(0===t){var a={x:n,y:o},l=r();if("DRAGGING"===l.type)return e.preventDefault(),void l.actions.move(a);if("PENDING"!==l.type&&Yi(!1),s=l.point,c=a,Math.abs(c.x-s.x)>=5||Math.abs(c.y-s.y)>=5){var s,c;e.preventDefault();var u=l.actions.fluidLift(a);i({type:"DRAGGING",actions:u})}}}},{eventName:"mouseup",fn:function(e){var i=r();"DRAGGING"===i.type?(e.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),n()):t()}},{eventName:"mousedown",fn:function(e){"DRAGGING"===r().type&&e.preventDefault(),t()}},{eventName:"keydown",fn:function(e){if("PENDING"!==r().type)return 27===e.keyCode?(e.preventDefault(),void t()):void Jl(e);t()}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(){"PENDING"===r().type&&t()}},{eventName:"webkitmouseforcedown",fn:function(e){var n=r();"IDLE"===n.type&&Yi(!1),n.actions.shouldRespectForcePress()?t():e.preventDefault()}},{eventName:Ql,fn:t}]}({cancel:s,completed:l,getPhase:function(){return t.current},setPhase:function(e){t.current=e}});n.current=qi(window,e,{capture:!0,passive:!1})}),[s,l]),u=(0,Li.I4)((function(e,n){"IDLE"!==t.current.type&&Yi(!1),t.current={type:"PENDING",point:n,actions:e},c()}),[c]);jl((function(){return o(),function(){n.current()}}),[o])},function(e){var t=(0,a.useRef)(ts),n=(0,Li.Ye)((function(){return{eventName:"keydown",fn:function(n){if(!n.defaultPrevented&&32===n.keyCode){var i=e.findClosestDraggableId(n);if(i){var o=e.tryGetLock(i,s,{sourceEvent:n});if(o){n.preventDefault();var a=!0,l=o.snapLift();t.current(),t.current=qi(window,function(e,t){function n(){t(),e.cancel()}return[{eventName:"keydown",fn:function(r){return 27===r.keyCode?(r.preventDefault(),void n()):32===r.keyCode?(r.preventDefault(),t(),void e.drop()):40===r.keyCode?(r.preventDefault(),void e.moveDown()):38===r.keyCode?(r.preventDefault(),void e.moveUp()):39===r.keyCode?(r.preventDefault(),void e.moveRight()):37===r.keyCode?(r.preventDefault(),void e.moveLeft()):void(ns[r.keyCode]?r.preventDefault():Jl(r))}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:Ql,fn:n}]}(l,s),{capture:!0,passive:!1})}}}function s(){a||Yi(!1),a=!1,t.current(),r()}}}}),[e]),r=(0,Li.I4)((function(){t.current=qi(window,[n],{passive:!1,capture:!0})}),[n]);jl((function(){return r(),function(){t.current()}}),[r])},function(e){var t=(0,a.useRef)(rs),n=(0,a.useRef)(Gi),r=(0,Li.I4)((function(){return t.current}),[]),i=(0,Li.I4)((function(e){t.current=e}),[]),o=(0,Li.Ye)((function(){return{eventName:"touchstart",fn:function(t){if(!t.defaultPrevented){var r=e.findClosestDraggableId(t);if(r){var i=e.tryGetLock(r,s,{sourceEvent:t});if(i){var o=t.touches[0],a={x:o.clientX,y:o.clientY};n.current(),p(i,a)}}}}}}),[e]),l=(0,Li.I4)((function(){n.current=qi(window,[o],{capture:!0,passive:!1})}),[o]),s=(0,Li.I4)((function(){var e=t.current;"IDLE"!==e.type&&("PENDING"===e.type&&clearTimeout(e.longPressTimerId),i(rs),n.current(),l())}),[l,i]),c=(0,Li.I4)((function(){var e=t.current;s(),"DRAGGING"===e.type&&e.actions.cancel({shouldBlockNextClick:!0}),"PENDING"===e.type&&e.actions.abort()}),[s]),u=(0,Li.I4)((function(){var e={capture:!0,passive:!1},t={cancel:c,completed:s,getPhase:r},i=qi(window,function(e){var t=e.cancel,n=e.completed,r=e.getPhase;return[{eventName:"touchmove",options:{capture:!1},fn:function(e){var n=r();if("DRAGGING"===n.type){n.hasMoved=!0;var i=e.touches[0],o={x:i.clientX,y:i.clientY};e.preventDefault(),n.actions.move(o)}else t()}},{eventName:"touchend",fn:function(e){var i=r();"DRAGGING"===i.type?(e.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),n()):t()}},{eventName:"touchcancel",fn:function(e){"DRAGGING"===r().type?(e.preventDefault(),t()):t()}},{eventName:"touchforcechange",fn:function(e){var n=r();"IDLE"===n.type&&Yi(!1);var i=e.touches[0];if(i&&i.force>=.15){var o=n.actions.shouldRespectForcePress();if("PENDING"!==n.type)return o?n.hasMoved?void e.preventDefault():void t():void e.preventDefault();o&&t()}}},{eventName:Ql,fn:t}]}(t),e),o=qi(window,function(e){var t=e.cancel,n=e.getPhase;return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:function(e){e.preventDefault()}},{eventName:"keydown",fn:function(e){"DRAGGING"===n().type?(27===e.keyCode&&e.preventDefault(),t()):t()}},{eventName:Ql,fn:t}]}(t),e);n.current=function(){i(),o()}}),[c,r,s]),d=(0,Li.I4)((function(){var e=r();"PENDING"!==e.type&&Yi(!1);var t=e.actions.fluidLift(e.point);i({type:"DRAGGING",actions:t,hasMoved:!1})}),[r,i]),p=(0,Li.I4)((function(e,t){"IDLE"!==r().type&&Yi(!1);var n=setTimeout(d,120);i({type:"PENDING",point:t,actions:e,longPressTimerId:n}),u()}),[u,r,i,d]);jl((function(){return l(),function(){n.current();var e=r();"PENDING"===e.type&&(clearTimeout(e.longPressTimerId),i(rs))}}),[r,l,i]),jl((function(){return qi(window,[{eventName:"touchmove",fn:function(){},options:{capture:!1,passive:!1}}])}),[])}];function hs(e){var t=e.contextId,n=e.store,r=e.registry,i=e.customSensors,o=e.enableDefaultSensors,l=[].concat(o?fs:[],i||[]),s=(0,a.useState)((function(){return function(){var e=null;function t(){e||Yi(!1),e=null}return{isClaimed:function(){return Boolean(e)},isActive:function(t){return t===e},claim:function(t){e&&Yi(!1);var n={abandon:t};return e=n,n},release:t,tryAbandon:function(){e&&(e.abandon(),t())}}}()}))[0],c=(0,Li.I4)((function(e,t){e.isDragging&&!t.isDragging&&s.tryAbandon()}),[s]);jl((function(){var e=n.getState();return n.subscribe((function(){var t=n.getState();c(e,t),e=t}))}),[s,n,c]),jl((function(){return s.tryAbandon}),[s.tryAbandon]);for(var u=(0,Li.I4)((function(e){return ms({lockAPI:s,registry:r,store:n,draggableId:e})}),[s,r,n]),d=(0,Li.I4)((function(e,i,o){return function(e){var t=e.lockAPI,n=e.contextId,r=e.store,i=e.registry,o=e.draggableId,a=e.forceSensorStop,l=e.sourceEvent;if(!ms({lockAPI:t,store:r,registry:i,draggableId:o}))return null;var s=i.draggable.getById(o),c=function(e,t){var n="["+Ll.contextId+'="'+e+'"]',r=wo(Co(document.querySelectorAll(n)),(function(e){return e.getAttribute(Ll.id)===t}));return r&&Bl(r)?r:null}(n,s.descriptor.id);if(!c)return null;if(l&&!s.options.canDragInteractiveElements&&as(c,l))return null;var u=t.claim(a||Gi),d="PRE_DRAG";function p(){return s.options.shouldRespectForcePress}function m(){return t.isActive(u)}var f=function(e,t){ps({expected:e,phase:d,isLockActive:m,shouldWarn:!0})&&r.dispatch(t())}.bind(null,"DRAGGING");function h(e){function n(){t.release(),d="COMPLETED"}function i(t,i){if(void 0===i&&(i={shouldBlockNextClick:!1}),e.cleanup(),i.shouldBlockNextClick){var o=qi(window,[{eventName:"click",fn:ds,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(o)}n(),r.dispatch(Ma({reason:t}))}return"PRE_DRAG"!==d&&(n(),"PRE_DRAG"!==d&&Yi(!1)),r.dispatch(function(e){return{type:"LIFT",payload:e}}(e.liftActionArgs)),d="DRAGGING",(0,Ce.Z)({isActive:function(){return ps({expected:"DRAGGING",phase:d,isLockActive:m,shouldWarn:!1})},shouldRespectForcePress:p,drop:function(e){return i("DROP",e)},cancel:function(e){return i("CANCEL",e)}},e.actions)}var g={isActive:function(){return ps({expected:"PRE_DRAG",phase:d,isLockActive:m,shouldWarn:!1})},shouldRespectForcePress:p,fluidLift:function(e){var t=Ui((function(e){f((function(){return Pa({client:e})}))})),n=h({liftActionArgs:{id:o,clientSelection:e,movementMode:"FLUID"},cleanup:function(){return t.cancel()},actions:{move:t}});return(0,Ce.Z)({},n,{move:t})},snapLift:function(){var e={moveUp:function(){return f(Fa)},moveRight:function(){return f(ja)},moveDown:function(){return f(Na)},moveLeft:function(){return f(Ra)}};return h({liftActionArgs:{id:o,clientSelection:ls(c),movementMode:"SNAP"},cleanup:Gi,actions:e})},abort:function(){ps({expected:"PRE_DRAG",phase:d,isLockActive:m,shouldWarn:!0})&&t.release()}};return g}({lockAPI:s,registry:r,contextId:t,store:n,draggableId:e,forceSensorStop:i,sourceEvent:o&&o.sourceEvent?o.sourceEvent:null})}),[t,s,r,n]),p=(0,Li.I4)((function(e){return function(e,t){var n=function(e,t){var n,r=t.target;if(!((n=r)instanceof Ml(n).Element))return null;var i=function(e){return"["+Dl.contextId+'="'+e+'"]'}(e),o=us(r,i);return o&&Bl(o)?o:null}(e,t);return n?n.getAttribute(Dl.draggableId):null}(t,e)}),[t]),m=(0,Li.I4)((function(e){var t=r.draggable.findById(e);return t?t.options:null}),[r.draggable]),f=(0,Li.I4)((function(){s.isClaimed()&&(s.tryAbandon(),"IDLE"!==n.getState().phase&&n.dispatch({type:"FLUSH",payload:null}))}),[s,n]),h=(0,Li.I4)(s.isClaimed,[s]),g=(0,Li.Ye)((function(){return{canGetLock:u,tryGetLock:d,findClosestDraggableId:p,findOptionsForDraggable:m,tryReleaseLock:f,isLockClaimed:h}}),[u,d,p,m,f,h]),v=0;v<l.length;v++)l[v](g)}function gs(e){return e.current||Yi(!1),e.current}function vs(e){var t=e.contextId,n=e.setCallbacks,r=e.sensors,i=e.nonce,o=e.dragHandleUsageInstructions,l=(0,a.useRef)(null),s=$l(e),c=(0,Li.I4)((function(){return function(e){return{onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}}(s.current)}),[s]),u=function(e){var t=(0,Li.Ye)((function(){return function(e){return"rbd-announcement-"+e}(e)}),[e]),n=(0,a.useRef)(null);return(0,a.useEffect)((function(){var e=document.createElement("div");return n.current=e,e.id=t,e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),(0,Ce.Z)(e.style,Zl),Hl().appendChild(e),function(){setTimeout((function(){var t=Hl();t.contains(e)&&t.removeChild(e),e===n.current&&(n.current=null)}))}}),[t]),(0,Li.I4)((function(e){var t=n.current;t&&(t.textContent=e)}),[])}(t),d=function(e){var t=e.contextId,n=e.text,r=Gl("hidden-text",{separator:"-"}),i=(0,Li.Ye)((function(){return"rbd-hidden-text-"+(e={contextId:t,uniqueId:r}).contextId+"-"+e.uniqueId;var e}),[r,t]);return(0,a.useEffect)((function(){var e=document.createElement("div");return e.id=i,e.textContent=n,e.style.display="none",Hl().appendChild(e),function(){var t=Hl();t.contains(e)&&t.removeChild(e)}}),[i,n]),i}({contextId:t,text:o}),p=function(e,t){var n=(0,Li.Ye)((function(){return function(e){var t,n,r=function(e){return function(t){return"["+t+'="'+e+'"]'}}(e),i=(t="\n      cursor: -webkit-grab;\n      cursor: grab;\n    ",{selector:r(Dl.contextId),styles:{always:"\n          -webkit-touch-callout: none;\n          -webkit-tap-highlight-color: rgba(0,0,0,0);\n          touch-action: manipulation;\n        ",resting:t,dragging:"pointer-events: none;",dropAnimating:t}}),o=[(n="\n      transition: "+Ua.outOfTheWay+";\n    ",{selector:r(Ll.contextId),styles:{dragging:n,dropAnimating:n,userCancel:n}}),i,{selector:r(Pl.contextId),styles:{always:"overflow-anchor: none;"}},{selector:"body",styles:{dragging:"\n        cursor: grabbing;\n        cursor: -webkit-grabbing;\n        user-select: none;\n        -webkit-user-select: none;\n        -moz-user-select: none;\n        -ms-user-select: none;\n        overflow-anchor: none;\n      "}}];return{always:Nl(o,"always"),resting:Nl(o,"resting"),dragging:Nl(o,"dragging"),dropAnimating:Nl(o,"dropAnimating"),userCancel:Nl(o,"userCancel")}}(e)}),[e]),r=(0,a.useRef)(null),i=(0,a.useRef)(null),o=(0,Li.I4)((0,Zi.default)((function(e){var t=i.current;t||Yi(!1),t.textContent=e})),[]),l=(0,Li.I4)((function(e){var t=r.current;t||Yi(!1),t.textContent=e}),[]);jl((function(){(r.current||i.current)&&Yi(!1);var a=Ol(t),s=Ol(t);return r.current=a,i.current=s,a.setAttribute("data-rbd-always",e),s.setAttribute("data-rbd-dynamic",e),Rl().appendChild(a),Rl().appendChild(s),l(n.always),o(n.resting),function(){var e=function(e){var t=e.current;t||Yi(!1),Rl().removeChild(t),e.current=null};e(r),e(i)}}),[t,l,o,n.always,n.resting,e]);var s=(0,Li.I4)((function(){return o(n.dragging)}),[o,n.dragging]),c=(0,Li.I4)((function(e){o("DROP"!==e?n.userCancel:n.dropAnimating)}),[o,n.dropAnimating,n.userCancel]),u=(0,Li.I4)((function(){i.current&&o(n.resting)}),[o,n.resting]);return(0,Li.Ye)((function(){return{dragging:s,dropping:c,resting:u}}),[s,c,u])}(t,i),m=(0,Li.I4)((function(e){gs(l).dispatch(e)}),[]),f=(0,Li.Ye)((function(){return(0,$r.DE)({publishWhileDragging:Ea,updateDroppableScroll:Aa,updateDroppableIsEnabled:Da,updateDroppableIsCombineEnabled:La,collectionStarting:Ta},m)}),[m]),h=function(){var e=(0,Li.Ye)(Wl,[]);return(0,a.useEffect)((function(){return function(){requestAnimationFrame(e.clean)}}),[e]),e}(),g=(0,Li.Ye)((function(){return dl(h,f)}),[h,f]),v=(0,Li.Ye)((function(){return function(e){var t=e.scrollDroppable,n=e.scrollWindow,r=e.move,i=function(e){var t=e.scrollDroppable,n=Ui(e.scrollWindow),r=Ui(t),i=null,o=function(e){i||Yi(!1);var t=i,o=t.shouldUseTimeDampening,a=t.dragStartTime;Tl({state:e,scrollWindow:n,scrollDroppable:r,dragStartTime:a,shouldUseTimeDampening:o})};return{start:function(e){i&&Yi(!1);var t=Date.now(),n=!1,r=function(){n=!0};Tl({state:e,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:r,scrollDroppable:r}),i={dragStartTime:t,shouldUseTimeDampening:n},n&&o(e)},stop:function(){i&&(n.cancel(),r.cancel(),i=null)},scroll:o}}({scrollWindow:n,scrollDroppable:t}),o=Al({move:r,scrollWindow:n,scrollDroppable:t});return{scroll:function(e){"DRAGGING"===e.phase&&("FLUID"!==e.movementMode?e.scrollJumpRequest&&o(e):i.scroll(e))},start:i.start,stop:i.stop}}((0,Ce.Z)({scrollWindow:ml,scrollDroppable:g.scrollDroppable},(0,$r.DE)({move:Pa},m)))}),[g.scrollDroppable,m]),b=function(e){var t=(0,a.useRef)({}),n=(0,a.useRef)(null),r=(0,a.useRef)(null),i=(0,a.useRef)(!1),o=(0,Li.I4)((function(e,n){var r={id:e,focus:n};return t.current[e]=r,function(){var n=t.current;n[e]!==r&&delete n[e]}}),[]),l=(0,Li.I4)((function(t){var n=function(e,t){var n="["+Dl.contextId+'="'+e+'"]',r=Co(document.querySelectorAll(n));if(!r.length)return null;var i=wo(r,(function(e){return e.getAttribute(Dl.draggableId)===t}));return i&&Bl(i)?i:null}(e,t);n&&n!==document.activeElement&&n.focus()}),[e]),s=(0,Li.I4)((function(e,t){n.current===e&&(n.current=t)}),[]),c=(0,Li.I4)((function(){r.current||i.current&&(r.current=requestAnimationFrame((function(){r.current=null;var e=n.current;e&&l(e)})))}),[l]),u=(0,Li.I4)((function(e){n.current=null;var t=document.activeElement;t&&t.getAttribute(Dl.draggableId)===e&&(n.current=e)}),[]);return jl((function(){return i.current=!0,function(){i.current=!1;var e=r.current;e&&cancelAnimationFrame(e)}}),[]),(0,Li.Ye)((function(){return{register:o,tryRecordFocus:u,tryRestoreFocusRecorded:c,tryShiftRecord:s}}),[o,u,c,s])}(t),y=(0,Li.Ye)((function(){return function(e){var t,n=e.dimensionMarshal,r=e.focusMarshal,i=e.styleMarshal,o=e.getResponders,a=e.announce,l=e.autoScroller;return(0,$r.MT)(Ia,il((0,$r.md)((t=i,function(){return function(e){return function(n){"INITIAL_PUBLISH"===n.type&&t.dragging(),"DROP_ANIMATE"===n.type&&t.dropping(n.payload.completed.result.reason),"FLUSH"!==n.type&&"DROP_COMPLETE"!==n.type||t.resting(),e(n)}}}),function(e){return function(){return function(t){return function(n){"DROP_COMPLETE"!==n.type&&"FLUSH"!==n.type&&"DROP_ANIMATE"!==n.type||e.stopPublishing(),t(n)}}}}(n),function(e){return function(t){var n=t.getState,r=t.dispatch;return function(t){return function(i){if("LIFT"===i.type){var o=i.payload,a=o.id,l=o.clientSelection,s=o.movementMode,c=n();"DROP_ANIMATING"===c.phase&&r(Oa({completed:c.completed})),"IDLE"!==n().phase&&Yi(!1),r({type:"FLUSH",payload:null}),r({type:"BEFORE_INITIAL_CAPTURE",payload:{draggableId:a,movementMode:s}});var u={draggableId:a,scrollOptions:{shouldPublishImmediately:"SNAP"===s}},d=e.startPublishing(u),p=d.critical,m=d.dimensions,f=d.viewport;r({type:"INITIAL_PUBLISH",payload:{critical:p,dimensions:m,clientSelection:l,movementMode:s,viewport:f}})}else t(i)}}}}(n),$a,tl,nl,rl,function(e){return function(t){return function(n){return function(r){if(function(e){return"DROP_COMPLETE"===e.type||"DROP_ANIMATE"===e.type||"FLUSH"===e.type}(r))return e.stop(),void n(r);if("INITIAL_PUBLISH"===r.type){n(r);var i=t.getState();return"DRAGGING"!==i.phase&&Yi(!1),void e.start(i)}n(r),e.scroll(t.getState())}}}}(l),Ka,function(e){var t=!1;return function(){return function(n){return function(r){if("INITIAL_PUBLISH"===r.type)return t=!0,e.tryRecordFocus(r.payload.critical.draggable.id),n(r),void e.tryRestoreFocusRecorded();if(n(r),t){if("FLUSH"===r.type)return t=!1,void e.tryRestoreFocusRecorded();if("DROP_COMPLETE"===r.type){t=!1;var i=r.payload.completed.result;i.combine&&e.tryShiftRecord(i.draggableId,i.combine.draggableId),e.tryRestoreFocusRecorded()}}}}}}(r),el(o,a))))}({announce:u,autoScroller:v,dimensionMarshal:g,focusMarshal:b,getResponders:c,styleMarshal:p})}),[u,v,g,b,c,p]);l.current=y;var x=(0,Li.I4)((function(){var e=gs(l);"IDLE"!==e.getState().phase&&e.dispatch({type:"FLUSH",payload:null})}),[]),w=(0,Li.I4)((function(){var e=gs(l).getState();return e.isDragging||"DROP_ANIMATING"===e.phase}),[]);n((0,Li.Ye)((function(){return{isDragging:w,tryAbort:x}}),[w,x]));var C=(0,Li.I4)((function(e){return pl(gs(l).getState(),e)}),[]),_=(0,Li.I4)((function(){return da(gs(l).getState())}),[]),S=(0,Li.Ye)((function(){return{marshal:g,focus:b,contextId:t,canLift:C,isMovementAllowed:_,dragHandleUsageInstructionsId:d,registry:h}}),[t,g,d,b,C,_,h]);return hs({contextId:t,store:y,registry:h,customSensors:r,enableDefaultSensors:!1!==e.enableDefaultSensors}),(0,a.useEffect)((function(){return x}),[x]),a.createElement(ql.Provider,{value:S},a.createElement(ei,{context:zl,store:y},e.children))}var bs=0;function ys(e){var t=(0,Li.Ye)((function(){return""+bs++}),[]),n=e.dragHandleUsageInstructions||"\n  Press space bar to start a drag.\n  When dragging you can use the arrow keys to move the item around and escape to cancel.\n  Some screen readers may require you to be in focus mode or to use your pass through key\n";return a.createElement(Ki,null,(function(r){return a.createElement(vs,{nonce:e.nonce,contextId:t,setCallbacks:r,dragHandleUsageInstructions:n,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd},e.children)}))}var xs=function(e){return function(t){return e===t}},ws=xs("scroll"),Cs=xs("auto"),_s=(xs("visible"),function(e,t){return t(e.overflowX)||t(e.overflowY)}),Ss=function e(t){return null==t||t===document.body||t===document.documentElement?null:function(e){var t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return _s(n,ws)||_s(n,Cs)}(t)?t:e(t.parentElement)},ks=function(e){return{x:e.scrollLeft,y:e.scrollTop}},Is=function e(t){return!!t&&("fixed"===window.getComputedStyle(t).position||e(t.parentElement))},Es={passive:!1},Ts={passive:!0},As=function(e){return e.shouldPublishImmediately?Es:Ts};function Ds(e){var t=(0,a.useContext)(e);return t||Yi(!1),t}var Ls=function(e){return e&&e.env.closestScrollable||null};function Ps(){}var Fs={width:0,height:0,margin:{top:0,right:0,bottom:0,left:0}},Ns=a.memo((function(e){var t=(0,a.useRef)(null),n=(0,Li.I4)((function(){t.current&&(clearTimeout(t.current),t.current=null)}),[]),r=e.animate,i=e.onTransitionEnd,o=e.onClose,l=e.contextId,s=(0,a.useState)("open"===e.animate),c=s[0],u=s[1];(0,a.useEffect)((function(){return c?"open"!==r?(n(),u(!1),Ps):t.current?Ps:(t.current=setTimeout((function(){t.current=null,u(!1)})),n):Ps}),[r,c,n]);var d=(0,Li.I4)((function(e){"height"===e.propertyName&&(i(),"close"===r&&o())}),[r,o,i]),p=function(e){var t=e.isAnimatingOpenOnMount,n=e.placeholder,r=e.animate,i=function(e){var t=e.placeholder;return e.isAnimatingOpenOnMount||"close"===e.animate?Fs:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin}}({isAnimatingOpenOnMount:t,placeholder:n,animate:r});return{display:n.display,boxSizing:"border-box",width:i.width,height:i.height,marginTop:i.margin.top,marginRight:i.margin.right,marginBottom:i.margin.bottom,marginLeft:i.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:"none"!==r?Ua.placeholder:null}}({isAnimatingOpenOnMount:c,animate:e.animate,placeholder:e.placeholder});return a.createElement(e.placeholder.tagName,{style:p,"data-rbd-placeholder-context-id":l,onTransitionEnd:d,ref:e.innerRef})})),js=a.createContext(null),Rs=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).state={isVisible:Boolean(t.props.on),data:t.props.on,animate:t.props.shouldAnimate&&t.props.on?"open":"none"},t.onClose=function(){"close"===t.state.animate&&t.setState({isVisible:!1})},t}return(0,qr.Z)(t,e),t.getDerivedStateFromProps=function(e,t){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:t.isVisible?{isVisible:!0,data:t.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:Boolean(e.on),data:e.on,animate:"none"}},t.prototype.render=function(){if(!this.state.isVisible)return null;var e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)},t}(a.PureComponent),Os=function(e,t){return t?Ua.drop(t.duration):e?Ua.snap:Ua.fluid},Ms=function(e,t){return e?t?Wa:za:null};function Bs(e){return"DRAGGING"===e.type?function(e){var t=e.dimension.client,n=e.offset,r=e.combineWith,i=e.dropping,o=Boolean(r),a=function(e){return null!=e.forceShouldAnimate?e.forceShouldAnimate:"SNAP"===e.mode}(e),l=Boolean(i),s=l?function(e,t){var n=Va(e);return n?t?n+" scale("+Ha+")":n:null}(n,o):Ga(n);return{position:"fixed",top:t.marginBox.top,left:t.marginBox.left,boxSizing:"border-box",width:t.borderBox.width,height:t.borderBox.height,transition:Os(a,i),transform:s,opacity:Ms(o,l),zIndex:l?4500:5e3,pointerEvents:"none"}}(e):{transform:Ga((t=e).offset),transition:t.shouldAnimateDisplacement?null:"none"};var t}function Ws(e){e.preventDefault()}var zs=function(e,t){return e===t},Hs=function(e){var t=e.combine,n=e.destination;return n?n.droppableId:t?t.droppableId:null};function Zs(e){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}var Us={mapped:{type:"SECONDARY",offset:io,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:Zs(null)}},Vs=Di((function(){var e,t,n,r=(e=(0,Zi.default)((function(e,t){return{x:e,y:t}})),t=(0,Zi.default)((function(e,t,n,r,i){return{isDragging:!0,isClone:t,isDropAnimating:Boolean(i),dropAnimation:i,mode:e,draggingOver:n,combineWith:r,combineTargetFor:null}})),n=(0,Zi.default)((function(e,n,r,i,o,a,l){return{mapped:{type:"DRAGGING",dropping:null,draggingOver:o,combineWith:a,mode:n,offset:e,dimension:r,forceShouldAnimate:l,snapshot:t(n,i,o,a,null)}}})),function(r,i){if(r.isDragging){if(r.critical.draggable.id!==i.draggableId)return null;var o=r.current.client.offset,a=r.dimensions.draggables[i.draggableId],l=ca(r.impact),s=(u=r.impact).at&&"COMBINE"===u.at.type?u.at.combine.draggableId:null,c=r.forceShouldAnimate;return n(e(o.x,o.y),r.movementMode,a,i.isClone,l,s,c)}var u;if("DROP_ANIMATING"===r.phase){var d=r.completed;if(d.result.draggableId!==i.draggableId)return null;var p=i.isClone,m=r.dimensions.draggables[i.draggableId],f=d.result,h=f.mode,g=Hs(f),v=function(e){return e.combine?e.combine.draggableId:null}(f),b={duration:r.dropDuration,curve:Ba,moveTo:r.newHomeClientOffset,opacity:v?Wa:null,scale:v?Ha:null};return{mapped:{type:"DRAGGING",offset:r.newHomeClientOffset,dimension:m,dropping:b,draggingOver:g,combineWith:v,mode:h,forceShouldAnimate:null,snapshot:t(h,p,g,v,b)}}}return null}),i=function(){var e=(0,Zi.default)((function(e,t){return{x:e,y:t}})),t=(0,Zi.default)(Zs),n=(0,Zi.default)((function(e,n,r){return void 0===n&&(n=null),{mapped:{type:"SECONDARY",offset:e,combineTargetFor:n,shouldAnimateDisplacement:r,snapshot:t(n)}}})),r=function(e){return e?n(io,e,!0):null},i=function(t,i,o,a){var l=o.displaced.visible[t],s=Boolean(a.inVirtualList&&a.effected[t]),c=Ao(o),u=c&&c.draggableId===t?i:null;if(!l){if(!s)return r(u);if(o.displaced.invisible[t])return null;var d=so(a.displacedBy.point),p=e(d.x,d.y);return n(p,u,!0)}if(s)return r(u);var m=o.displacedBy.point,f=e(m.x,m.y);return n(f,u,l.shouldAnimate)};return function(e,t){if(e.isDragging)return e.critical.draggable.id===t.draggableId?null:i(t.draggableId,e.critical.draggable.id,e.impact,e.afterCritical);if("DROP_ANIMATING"===e.phase){var n=e.completed;return n.result.draggableId===t.draggableId?null:i(t.draggableId,n.result.draggableId,n.impact,n.afterCritical)}return null}}();return function(e,t){return r(e,t)||i(e,t)||Us}}),{dropAnimationFinished:function(){return{type:"DROP_ANIMATION_FINISHED",payload:null}}},null,{context:zl,pure:!0,areStatePropsEqual:zs})((function(e){var t=(0,a.useRef)(null),n=(0,Li.I4)((function(e){t.current=e}),[]),r=(0,Li.I4)((function(){return t.current}),[]),i=Ds(ql),o=i.contextId,l=i.dragHandleUsageInstructionsId,s=i.registry,c=Ds(js),u=c.type,d=c.droppableId,p=(0,Li.Ye)((function(){return{id:e.draggableId,index:e.index,type:u,droppableId:d}}),[e.draggableId,e.index,u,d]),m=e.children,f=e.draggableId,h=e.isEnabled,g=e.shouldRespectForcePress,v=e.canDragInteractiveElements,b=e.isClone,y=e.mapped,x=e.dropAnimationFinished;b||function(e){var t=Gl("draggable"),n=e.descriptor,r=e.registry,i=e.getDraggableRef,o=e.canDragInteractiveElements,l=e.shouldRespectForcePress,s=e.isEnabled,c=(0,Li.Ye)((function(){return{canDragInteractiveElements:o,shouldRespectForcePress:l,isEnabled:s}}),[o,s,l]),u=(0,Li.I4)((function(e){var t=i();return t||Yi(!1),function(e,t,n){void 0===n&&(n=io);var r=window.getComputedStyle(t),i=t.getBoundingClientRect(),o=zi(i,r),a=Wi(o,n);return{descriptor:e,placeholder:{client:o,tagName:t.tagName.toLowerCase(),display:r.display},displaceBy:{x:o.marginBox.width,y:o.marginBox.height},client:o,page:a}}(n,t,e)}),[n,i]),d=(0,Li.Ye)((function(){return{uniqueId:t,descriptor:n,options:c,getDimension:u}}),[n,u,c,t]),p=(0,a.useRef)(d),m=(0,a.useRef)(!0);jl((function(){return r.draggable.register(p.current),function(){return r.draggable.unregister(p.current)}}),[r.draggable]),jl((function(){if(m.current)m.current=!1;else{var e=p.current;p.current=d,r.draggable.update(d,e)}}),[d,r.draggable])}((0,Li.Ye)((function(){return{descriptor:p,registry:s,getDraggableRef:r,canDragInteractiveElements:v,shouldRespectForcePress:g,isEnabled:h}}),[p,s,r,v,g,h]));var w=(0,Li.Ye)((function(){return h?{tabIndex:0,role:"button","aria-describedby":l,"data-rbd-drag-handle-draggable-id":f,"data-rbd-drag-handle-context-id":o,draggable:!1,onDragStart:Ws}:null}),[o,l,f,h]),C=(0,Li.I4)((function(e){"DRAGGING"===y.type&&y.dropping&&"transform"===e.propertyName&&x()}),[x,y]),_=(0,Li.Ye)((function(){var e=Bs(y),t="DRAGGING"===y.type&&y.dropping?C:null;return{innerRef:n,draggableProps:{"data-rbd-draggable-context-id":o,"data-rbd-draggable-id":f,style:e,onTransitionEnd:t},dragHandleProps:w}}),[o,w,f,y,C,n]),S=(0,Li.Ye)((function(){return{draggableId:p.id,type:p.type,source:{index:p.index,droppableId:p.droppableId}}}),[p.droppableId,p.id,p.index,p.type]);return m(_,y.snapshot,S)}));function Gs(e){return Ds(js).isUsingCloneFor!==e.draggableId||e.isClone?a.createElement(Vs,e):null}function qs(e){var t="boolean"!=typeof e.isDragDisabled||!e.isDragDisabled,n=Boolean(e.disableInteractiveElementBlocking),r=Boolean(e.shouldRespectForcePress);return a.createElement(Gs,(0,Ce.Z)({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:n,shouldRespectForcePress:r}))}var $s=function(e,t){return e===t.droppable.type},Ys=function(e,t){return t.draggables[e.draggable.id]},Ks={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:function(){return document.body||Yi(!1),document.body}},Xs=Di((function(){var e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t=(0,Ce.Z)({},e,{shouldAnimatePlaceholder:!1}),n=(0,Zi.default)((function(e){return{draggableId:e.id,type:e.type,source:{index:e.index,droppableId:e.droppableId}}})),r=(0,Zi.default)((function(r,i,o,a,l,s){var c=l.descriptor.id;if(l.descriptor.droppableId===r){var u=s?{render:s,dragging:n(l.descriptor)}:null,d={isDraggingOver:o,draggingOverWith:o?c:null,draggingFromThisWith:c,isUsingPlaceholder:!0};return{placeholder:l.placeholder,shouldAnimatePlaceholder:!1,snapshot:d,useClone:u}}if(!i)return t;if(!a)return e;var p={isDraggingOver:o,draggingOverWith:c,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:l.placeholder,shouldAnimatePlaceholder:!0,snapshot:p,useClone:null}}));return function(n,i){var o=i.droppableId,a=i.type,l=!i.isDropDisabled,s=i.renderClone;if(n.isDragging){var c=n.critical;if(!$s(a,c))return t;var u=Ys(c,n.dimensions),d=ca(n.impact)===o;return r(o,l,d,d,u,s)}if("DROP_ANIMATING"===n.phase){var p=n.completed;if(!$s(a,p.critical))return t;var m=Ys(p.critical,n.dimensions);return r(o,l,Hs(p.result)===o,ca(p.impact)===o,m,s)}if("IDLE"===n.phase&&n.completed&&!n.shouldFlush){var f=n.completed;if(!$s(a,f.critical))return t;var h=ca(f.impact)===o,g=Boolean(f.impact.at&&"COMBINE"===f.impact.at.type),v=f.critical.droppable.id===o;return h?g?e:t:v?e:t}return t}}),{updateViewportMaxScroll:function(e){return{type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}}},null,{context:zl,pure:!0,areStatePropsEqual:zs})((function(e){var t=(0,a.useContext)(ql);t||Yi(!1);var n=t.contextId,r=t.isMovementAllowed,i=(0,a.useRef)(null),o=(0,a.useRef)(null),s=e.children,c=e.droppableId,u=e.type,d=e.mode,p=e.direction,m=e.ignoreContainerClipping,f=e.isDropDisabled,h=e.isCombineEnabled,g=e.snapshot,v=e.useClone,b=e.updateViewportMaxScroll,y=e.getContainerForClone,x=(0,Li.I4)((function(){return i.current}),[]),w=(0,Li.I4)((function(e){i.current=e}),[]),C=((0,Li.I4)((function(){return o.current}),[]),(0,Li.I4)((function(e){o.current=e}),[])),_=(0,Li.I4)((function(){r()&&b({maxScroll:ll()})}),[r,b]);!function(e){var t=(0,a.useRef)(null),n=Ds(ql),r=Gl("droppable"),i=n.registry,o=n.marshal,l=$l(e),s=(0,Li.Ye)((function(){return{id:e.droppableId,type:e.type,mode:e.mode}}),[e.droppableId,e.mode,e.type]),c=(0,a.useRef)(s),u=(0,Li.Ye)((function(){return(0,Zi.default)((function(e,n){t.current||Yi(!1);var r={x:e,y:n};o.updateDroppableScroll(s.id,r)}))}),[s.id,o]),d=(0,Li.I4)((function(){var e=t.current;return e&&e.env.closestScrollable?ks(e.env.closestScrollable):io}),[]),p=(0,Li.I4)((function(){var e=d();u(e.x,e.y)}),[d,u]),m=(0,Li.Ye)((function(){return Ui(p)}),[p]),f=(0,Li.I4)((function(){var e=t.current,n=Ls(e);e&&n||Yi(!1),e.scrollOptions.shouldPublishImmediately?p():m()}),[m,p]),h=(0,Li.I4)((function(e,r){t.current&&Yi(!1);var i=l.current,o=i.getDroppableRef();o||Yi(!1);var a=function(e){return{closestScrollable:Ss(e),isFixedOnPage:Is(e)}}(o),c={ref:o,descriptor:s,env:a,scrollOptions:r};t.current=c;var u=function(e){var t=e.ref,n=e.descriptor,r=e.env,i=e.windowScroll,o=e.direction,a=e.isDropDisabled,l=e.isCombineEnabled,s=e.shouldClipSubject,c=r.closestScrollable,u=function(e,t){var n=Hi(e);if(!t)return n;if(e!==t)return n;var r=n.paddingBox.top-t.scrollTop,i=n.paddingBox.left-t.scrollLeft,o=r+t.scrollHeight,a=i+t.scrollWidth,l=Ni({top:r,right:a,bottom:o,left:i},n.border);return Oi({borderBox:l,margin:n.margin,border:n.border,padding:n.padding})}(t,c),d=Wi(u,i),p=function(){if(!c)return null;var e=Hi(c),t={scrollHeight:c.scrollHeight,scrollWidth:c.scrollWidth};return{client:e,page:Wi(e,i),scroll:ks(c),scrollSize:t,shouldClipSubject:s}}(),m=function(e){var t=e.descriptor,n=e.isEnabled,r=e.isCombineEnabled,i=e.isFixedOnPage,o=e.direction,a=e.client,l=e.page,s=e.closest,c=function(){if(!s)return null;var e=s.scrollSize,t=s.client,n=ol({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,height:t.paddingBox.height,width:t.paddingBox.width});return{pageMarginBox:s.page.marginBox,frameClient:t,scrollSize:e,shouldClipSubject:s.shouldClipSubject,scroll:{initial:s.scroll,current:s.scroll,max:n,diff:{value:io,displacement:io}}}}(),u="vertical"===o?Mo:Bo;return{descriptor:t,isCombineEnabled:r,isFixedOnPage:i,axis:u,isEnabled:n,client:a,page:l,frame:c,subject:vo({page:l,withPlaceholder:null,axis:u,frame:c})}}({descriptor:n,isEnabled:!a,isCombineEnabled:l,isFixedOnPage:r.isFixedOnPage,direction:o,client:u,page:d,closest:p});return m}({ref:o,descriptor:s,env:a,windowScroll:e,direction:i.direction,isDropDisabled:i.isDropDisabled,isCombineEnabled:i.isCombineEnabled,shouldClipSubject:!i.ignoreContainerClipping}),d=a.closestScrollable;return d&&(d.setAttribute(Fl,n.contextId),d.addEventListener("scroll",f,As(c.scrollOptions))),u}),[n.contextId,s,f,l]),g=(0,Li.I4)((function(){var e=t.current,n=Ls(e);return e&&n||Yi(!1),ks(n)}),[]),v=(0,Li.I4)((function(){var e=t.current;e||Yi(!1);var n=Ls(e);t.current=null,n&&(m.cancel(),n.removeAttribute(Fl),n.removeEventListener("scroll",f,As(e.scrollOptions)))}),[f,m]),b=(0,Li.I4)((function(e){var n=t.current;n||Yi(!1);var r=Ls(n);r||Yi(!1),r.scrollTop+=e.y,r.scrollLeft+=e.x}),[]),y=(0,Li.Ye)((function(){return{getDimensionAndWatchScroll:h,getScrollWhileDragging:g,dragStopped:v,scroll:b}}),[v,h,g,b]),x=(0,Li.Ye)((function(){return{uniqueId:r,descriptor:s,callbacks:y}}),[y,s,r]);jl((function(){return c.current=x.descriptor,i.droppable.register(x),function(){t.current&&v(),i.droppable.unregister(x)}}),[y,s,v,x,o,i.droppable]),jl((function(){t.current&&o.updateDroppableIsEnabled(c.current.id,!e.isDropDisabled)}),[e.isDropDisabled,o]),jl((function(){t.current&&o.updateDroppableIsCombineEnabled(c.current.id,e.isCombineEnabled)}),[e.isCombineEnabled,o])}({droppableId:c,type:u,mode:d,direction:p,isDropDisabled:f,isCombineEnabled:h,ignoreContainerClipping:m,getDroppableRef:x});var S=a.createElement(Rs,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},(function(e){var t=e.onClose,r=e.data,i=e.animate;return a.createElement(Ns,{placeholder:r,onClose:t,innerRef:C,animate:i,contextId:n,onTransitionEnd:_})})),k=(0,Li.Ye)((function(){return{innerRef:w,placeholder:S,droppableProps:{"data-rbd-droppable-id":c,"data-rbd-droppable-context-id":n}}}),[n,c,S,w]),I=v?v.dragging.draggableId:null,E=(0,Li.Ye)((function(){return{droppableId:c,type:u,isUsingCloneFor:I}}),[c,I,u]);return a.createElement(js.Provider,{value:E},s(k,g),function(){if(!v)return null;var e=v.dragging,t=v.render,n=a.createElement(Gs,{draggableId:e.draggableId,index:e.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(function(n,r){return t(n,r,e)}));return l.createPortal(n,y())}())}));function Js(e){let{value:t,remove:n,onUpdate:r,onCheck:i,index:o}=e;return(0,q.jsxs)("div",{className:"mailpoet-form-segments-settings-list","data-automation-id":"custom_field_value_settings",children:[(0,q.jsx)("input",{type:"checkbox",defaultChecked:t.isChecked||!1,onChange:e=>i(t.id,e.target.checked)},`check-${t.id}`),(0,q.jsx)("input",{type:"text",value:t.name,"data-automation-id":"custom_field_value_settings_value",onChange:e=>r(t.id,e.target.value)}),0!==o&&(0,q.jsx)(Gr.Z,{icon:"no-alt",color:"#900",className:"mailpoet-form-segments-segment-remove",onClick:(0,oe.partial)(n,t.id)})]},t.id)}function Qs(e){let{values:t,update:n,remove:r,onReorder:i}=e;const[o,l]=(0,a.useState)(t);if((0,a.useEffect)((()=>{l(t)}),[t]),0===o.length)return null;const s=(e,t)=>{const r=o.find((t=>t.id===e));r.name=t,n(r)},c=(e,t)=>{const r=o.find((t=>t.id===e));if(t){const e=o.find((e=>e.isChecked));e&&(delete e.isChecked,n(e)),r.isChecked=!0}else delete r.isChecked;n(r)};return(0,q.jsx)("div",{className:"mailpoet-dnd-items-list",children:(0,q.jsx)(ys,{onDragEnd:e=>{const t=e.source.index,n=e.destination.index,r=[...o],[a]=r.splice(t,1);r.splice(n,0,a),l(r),i(r)},children:(0,q.jsx)(Xs,{droppableId:"droppable",children:e=>(0,q.jsxs)("div",{...e.droppableProps,ref:e.innerRef,children:[o.map(((e,t)=>(0,q.jsx)(qs,{draggableId:e.id,index:t,children:n=>(0,q.jsx)("div",{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,children:(0,q.jsx)(Js,{index:t,value:e,remove:r,onCheck:c,onUpdate:s},`inner${e.id}`)})},e.id))),e.placeholder]})})})})}function ec(e){let{label:t,mandatory:n,values:r,isSaving:i,onSave:o,isDeleting:l,onCustomFieldDelete:s,onChange:c,useDragAndDrop:u}=e;const[d,p]=(0,a.useState)(t),[m,f]=(0,a.useState)(n),[h,g]=(0,a.useState)(JSON.parse(JSON.stringify(r))),v=(0,a.useMemo)((()=>({label:d,mandatory:m,values:h,isValid:(0,oe.reduce)(h,((e,t)=>!(0,oe.isEmpty)(t.name)&&e),!0)})),[d,m,h]),b=m!==n||!(0,oe.isEqualWith)(r,h)||d!==t;return(0,a.useEffect)((()=>{c&&c(v,b)}),[v,c,b]),(0,q.jsxs)("div",{className:"custom-field-settings","data-automation-id":"custom_field_settings",children:[(0,q.jsx)(br.Z,{label:j.x.I18n.t("label"),value:d,"data-automation-id":"settings_custom_text_label_input",onChange:p}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("blockMandatory"),checked:m,onChange:f}),(0,q.jsx)(Qs,{remove:e=>{g(h.filter((t=>e!==t.id)))},update:e=>{g(h.map((t=>e.id!==t.id?t:e)))},values:h,onReorder:g,useDragAndDrop:u}),(0,q.jsx)(O.Z,{isLink:!0,onClick:()=>g([...h,{id:`${1e3*Math.random()}-${Date.now()}`,name:`Option ${h.length+1}`}]),className:"button-on-top","data-automation-id":"custom_field_values_add_item",children:j.x.I18n.t("customFieldAddItem")}),(0,q.jsx)("br",{}),o?(0,q.jsx)(O.Z,{isPrimary:!0,onClick:()=>o({mandatory:m,values:h,label:d}),isBusy:i,disabled:i||!b,className:"button-on-top","data-automation-id":"custom_field_save",children:j.x.I18n.t("customFieldSaveCTA")}):null,s?(0,q.jsx)(yr,{isBusy:i||l,onDelete:s}):null]})}function tc(e){let{attributes:t,setAttributes:n,clientId:r}=e;const i=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldSaving()),[]),o=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldDeleting()),[]),{saveCustomField:a,deleteCustomField:l,customFieldEdited:s}=(0,h.Z)("mailpoet-form-editor"),c=(0,q.jsxs)(L.Af,{children:[(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("customFieldSettings"),initialOpen:!0,children:(0,q.jsx)(ec,{label:t.label,mandatory:t.mandatory,values:t.values,isSaving:i,onSave:e=>a({customFieldId:t.customFieldId,data:{params:Er("radio",e)},onFinish:()=>n({mandatory:e.mandatory,values:e.values,label:e.label})}),onCustomFieldDelete:()=>l(t.customFieldId,r),isDeleting:o,onChange:(e,t)=>t&&s()})})}),(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("formSettings"),initialOpen:!0,children:(0,q.jsx)(se.Z,{label:j.x.I18n.t("displayLabel"),checked:!t.hideLabel,onChange:e=>n({hideLabel:!e})})})})]});return(0,q.jsxs)(Ir,{className:t.className,children:[c,(0,q.jsx)("span",{className:"mailpoet_radio_label","data-automation-id":"editor_custom_field_radio_buttons_block",children:t.hideLabel?null:wr(t)}),Array.isArray(t.values)&&t.values.map((e=>(0,q.jsx)("div",{children:(0,q.jsxs)("label",{children:[(0,q.jsx)("input",{type:"radio",disabled:!0,checked:e.isChecked||!1,className:"mailpoet_radio"}),e.name]})},e.id)))]})}let nc,rc;Xs.defaultProps=Ks,Js.propTypes={value:U().shape({name:U().string.isRequired,id:U().string.isRequired,isChecked:U().bool}).isRequired,onUpdate:U().func.isRequired,onCheck:U().func.isRequired,index:U().number.isRequired,remove:U().func.isRequired},Qs.propTypes={values:U().arrayOf(U().shape({name:U().string.isRequired,id:U().string.isRequired}).isRequired).isRequired,update:U().func.isRequired,remove:U().func.isRequired,onReorder:U().func.isRequired},ec.propTypes={label:U().string,mandatory:U().bool,values:U().arrayOf(U().shape({name:U().string.isRequired,id:U().string.isRequired})),onSave:U().func,isSaving:U().bool,isDeleting:U().bool,onCustomFieldDelete:U().func,onChange:U().func,useDragAndDrop:U().bool},ec.defaultProps={label:"",mandatory:!1,isSaving:!1,values:[],isDeleting:!1,onCustomFieldDelete:null,onSave:null,onChange:null,useDragAndDrop:!0},tc.propTypes={attributes:U().shape({label:U().string.isRequired,customFieldId:U().number.isRequired,values:U().arrayOf(U().shape({name:U().string.isRequired,id:U().string.isRequired,isChecked:U().bool})),mandatory:U().bool.isRequired,hideLabel:U().bool,className:U().string}).isRequired,setAttributes:U().func.isRequired,clientId:U().string.isRequired},function(e){e.Divider="divider",e.Spacer="spacer"}(nc||(nc={})),function(e){e.Solid="solid",e.Dashed="dashed",e.Dotted="dotted"}(rc||(rc={}));const ic={className:void 0,height:1,type:nc.Divider,style:rc.Solid,dividerHeight:1,dividerWidth:100,color:"black"},oc=()=>`${Math.random().toString()}-${Date.now()}`,ac=e=>e.map((e=>{const t={name:e.value,id:oc()};return(0,oe.has)(e,"is_checked")&&e.is_checked&&(t.isChecked=!0),t})),lc=(e,t,n)=>{const r=t.find((t=>t.id===parseInt(e.id,10)));if(!r)return null;const i={...n,name:fr({text:"mailpoet-form/custom-text",textarea:"mailpoet-form/custom-textarea",radio:"mailpoet-form/custom-radio",checkbox:"mailpoet-form/custom-checkbox",select:"mailpoet-form/custom-select",date:"mailpoet-form/custom-date"}[r.type],r)};return i.attributes.customFieldId=r.id,e.params&&((0,oe.has)(e.params,"validate")&&e.params.validate&&(i.attributes.validate=e.params.validate),(0,oe.has)(e.params,"hide_label")&&(i.attributes.hideLabel=!!e.params.hide_label),(0,oe.has)(e.params,"lines")&&(i.attributes.lines=e.params.lines),(0,oe.has)(e.params,"date_type")&&(i.attributes.dateType=e.params.date_type),(0,oe.has)(e.params,"date_format")&&(i.attributes.dateFormat=e.params.date_format),(0,oe.has)(e.params,"is_default_today")&&(i.attributes.defaultToday=!!e.params.is_default_today),(0,oe.has)(e.params,"values")&&Array.isArray(e.params.values)&&(i.attributes.values=ac(e.params.values))),"text"!==r.type&&"textarea"!==r.type||(i.attributes.styles=Fr(e.styles)),i},sc=function(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];const o=cc(t,n,r,i),a={clientId:oc(),name:`core/${e.type}`,isValid:!0,attributes:{style:{color:{}}},innerBlocks:o(e.body?e.body:[])},l=Nr(n,e.params.text_color),s=Nr(n,e.params.background_color),c=jr(r,e.params.gradient);return(0,oe.has)(e.params,"width")&&(a.attributes.width=Number.isNaN(Number(e.params.width))?e.params.width:`${e.params.width}%`),(0,oe.has)(e.params,"vertical_alignment")&&(a.attributes.verticalAlignment=e.params.vertical_alignment),(0,oe.has)(e.params,"text_color")&&(a.attributes.textColor=l,a.attributes.style.color.text=l?void 0:e.params.text_color),(0,oe.has)(e.params,"background_color")&&(a.attributes.backgroundColor=s,a.attributes.style.color.background=s?void 0:e.params.background_color),(0,oe.has)(e.params,"gradient")&&(a.attributes.gradient=c,a.attributes.style.color.gradient=c?void 0:e.params.gradient),(0,oe.has)(e.params,"class_name")&&e.params.class_name&&(a.attributes.className=e.params.class_name),(0,oe.has)(e.params,"padding")&&(a.attributes.style.spacing={padding:e.params.padding}),(0,oe.has)(e.params,"is_stacked_on_mobile")&&(a.attributes.isStackedOnMobile="1"===e.params.is_stacked_on_mobile),"columns"!==e.type||(0,oe.has)(e.params,"is_stacked_on_mobile")||(a.attributes.isStackedOnMobile=!0),a},cc=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(!Array.isArray(r))throw new Error("Mapper expects customFields to be an array.");const i=i=>{if(!Array.isArray(i))throw new Error("Mapper expects form body to be an array.");return i.map((i=>{var o,a,l,s,c,u,d,p,m,f,h,g,v,b,y,x,w,C,_,S,k,I,E,T,A,D,L,P,F,N;if(["column","columns"].includes(i.type))return sc(i,e,t,n,r);const j={clientId:`${i.id}_${oc()}`,isValid:!0,innerBlocks:[],attributes:{labelWithinInput:!1,mandatory:!1,className:null}};if(["heading","paragraph"].includes(i.type)&&(j.attributes.style={color:{},typography:{fontSize:void 0,lineHeight:void 0}}),i.params&&(0,oe.has)(i.params,"class_name")&&(j.attributes.className=i.params.class_name),i.params&&(0,oe.has)(i.params,"required")&&(j.attributes.mandatory=!!i.params.required),i.params&&(0,oe.has)(i.params,"label_within")&&(j.attributes.labelWithinInput=!!i.params.label_within),i.params&&(j.attributes.label=i.params.label?i.params.label:""),i.params&&(0,oe.has)(i.params,"text_color")){const e=Nr(t,i.params.text_color);j.attributes.textColor=e,["heading","paragraph"].includes(i.type)&&!e?j.attributes.style.color.text=i.params.text_color:e||(j.attributes.customTextColor=i.params.text_color)}if(i.params&&(0,oe.has)(i.params,"background_color")){const e=Nr(t,i.params.background_color);j.attributes.backgroundColor=e,["heading","paragraph"].includes(i.type)&&!e?j.attributes.style.color.background=i.params.background_color:e||(j.attributes.customBackgroundColor=i.params.background_color)}if(i.params&&(0,oe.has)(i.params,"font_size")){const t=Rr(e,i.params.font_size);j.attributes.fontSize=t,j.attributes.style.typography.fontSize=t?void 0:Dr(i.params.font_size)}i.params&&(0,oe.has)(i.params,"line_height")&&(j.attributes.style.typography.lineHeight=i.params.line_height);let R=2;switch(i.id){case"email":return{...j,name:"mailpoet-form/email-input",attributes:{...j.attributes,styles:Fr(i.styles)}};case"heading":return i.params&&(0,oe.has)(i.params,"level")&&(R=Dr(i.params.level),void 0===R&&(R=2)),{...j,attributes:{...j.attributes,content:(null===(o=i.params)||void 0===o?void 0:o.content)||"",level:R,textAlign:null===(a=i.params)||void 0===a?void 0:a.align,anchor:null===(l=i.params)||void 0===l?void 0:l.anchor,className:null===(s=i.params)||void 0===s?void 0:s.class_name},name:"core/heading"};case"paragraph":return{...j,attributes:{...j.attributes,content:(null===(c=i.params)||void 0===c?void 0:c.content)||"",align:null===(u=i.params)||void 0===u?void 0:u.align,className:null===(d=i.params)||void 0===d?void 0:d.class_name,dropCap:"1"===(null===(p=i.params)||void 0===p?void 0:p.drop_cap)},name:"core/paragraph"};case"image":return{...j,name:"core/image",attributes:{className:(null===(m=i.params)||void 0===m?void 0:m.class_name)||"",align:null===(f=i.params)||void 0===f?void 0:f.align,url:null===(h=i.params)||void 0===h?void 0:h.url,alt:null===(g=i.params)||void 0===g?void 0:g.alt,title:null===(v=i.params)||void 0===v?void 0:v.title,caption:null===(b=i.params)||void 0===b?void 0:b.caption,linkDestination:null===(y=i.params)||void 0===y?void 0:y.link_destination,link:null===(x=i.params)||void 0===x?void 0:x.link,href:null===(w=i.params)||void 0===w?void 0:w.href,linkClass:null===(C=i.params)||void 0===C?void 0:C.link_class,rel:null===(_=i.params)||void 0===_?void 0:_.rel,linkTarget:null===(S=i.params)||void 0===S?void 0:S.link_target,id:null===(k=i.params)||void 0===k?void 0:k.id,sizeSlug:null===(I=i.params)||void 0===I?void 0:I.size_slug,width:null===(E=i.params)||void 0===E?void 0:E.width,height:null===(T=i.params)||void 0===T?void 0:T.height}};case"first_name":return{...j,name:"mailpoet-form/first-name-input",attributes:{...j.attributes,styles:Fr(i.styles)}};case"last_name":return{...j,name:"mailpoet-form/last-name-input",attributes:{...j.attributes,styles:Fr(i.styles)}};case"segments":return i.params&&(0,oe.has)(i.params,"values")&&Array.isArray(i.params.values)?j.attributes.values=i.params.values.map((e=>({id:e.id,isChecked:"1"===e.is_checked||void 0}))):j.attributes.values=[],{...j,name:"mailpoet-form/segment-select"};case"submit":return{...j,name:"mailpoet-form/submit-button",attributes:{...j.attributes,styles:Fr(i.styles)}};case"divider":return delete j.attributes.label,{...j,name:"mailpoet-form/divider",attributes:{className:j.attributes.className,height:Dr((null===(A=i.params)||void 0===A?void 0:A.height)??ic.height),type:(null===(D=i.params)||void 0===D?void 0:D.type)??ic.type,style:(null===(L=i.params)||void 0===L?void 0:L.style)??ic.style,dividerHeight:Dr((null===(P=i.params)||void 0===P?void 0:P.divider_height)??ic.dividerHeight),dividerWidth:Dr((null===(F=i.params)||void 0===F?void 0:F.divider_width)??ic.dividerWidth),color:(null===(N=i.params)||void 0===N?void 0:N.color)??ic.color}};case"html":return{...j,name:"mailpoet-form/html",attributes:{className:j.attributes.className,content:i.params&&i.params.text?i.params.text:"",nl2br:!(!i.params||!i.params.nl2br||!i.params.nl2br)}};default:return Number.isInteger(parseInt(i.id,10))?lc(i,r,j):null}})).filter(Boolean)};return i};function uc(e){return{title:e.name,description:"",icon:hr,category:"custom-fields",attributes:{label:{type:"string",default:e.name},hideLabel:{type:"boolean",default:!1},mandatory:{type:"boolean",default:!!e.params.required&&!!e.params.required},values:{type:"array",default:e.params.values?ac(e.params.values):[]},customFieldId:{type:"string",default:e.id}},supports:{html:!1,multiple:!1},edit:tc,save:()=>null}}function dc(e){let{label:t,mandatory:n,isSaving:r,onSave:i,isChecked:o,checkboxLabel:l,isDeleting:s,onCustomFieldDelete:c,onChange:u}=e;const[d,p]=(0,a.useState)(t),[m,f]=(0,a.useState)(n),[h,g]=(0,a.useState)(o),[v,b]=(0,a.useState)(l),y=m!==n||h!==o||d!==t||v!==l,x=(0,a.useMemo)((()=>({mandatory:m,isChecked:h,label:d,checkboxLabel:v,isValid:!(0,oe.isEmpty)(v)})),[d,m,h,v]);return(0,a.useEffect)((()=>{u(x,y)}),[x,u,y]),(0,q.jsxs)("div",{className:"custom-field-settings",children:[(0,q.jsx)(br.Z,{label:j.x.I18n.t("label"),value:d,"data-automation-id":"settings_custom_text_label_input",onChange:p}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("blockMandatory"),checked:m,onChange:f}),(0,q.jsxs)(ce.ZP,{children:[(0,q.jsx)("input",{type:"checkbox",checked:h,onChange:e=>g(!!e.target.checked)}),(0,q.jsx)("input",{value:v,"data-automation-id":"settings_custom_checkbox_value",type:"text",onChange:e=>b(e.target.value)})]}),i?(0,q.jsx)(O.Z,{isPrimary:!0,onClick:()=>i(x),isBusy:r,disabled:r||!y,className:"button-on-top","data-automation-id":"custom_field_save",children:j.x.I18n.t("customFieldSaveCTA")}):null,c?(0,q.jsx)(yr,{isBusy:r||s,onDelete:c}):null]})}function pc(e){let{attributes:t,setAttributes:n,clientId:r}=e;const i=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldSaving()),[]),o=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldDeleting()),[]),{saveCustomField:a,deleteCustomField:l,customFieldEdited:s}=(0,h.Z)("mailpoet-form-editor"),c=()=>{if(Array.isArray(t.values)){const e=t.values[0];if(e)return e.name}return""},u=()=>{let e=!1;if(Array.isArray(t.values)){const n=t.values[0];n&&n.isChecked&&(e=!0)}return e},d=(0,q.jsxs)(L.Af,{children:[(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("customFieldSettings"),initialOpen:!0,children:(0,q.jsx)(dc,{label:t.label,mandatory:t.mandatory,isSaving:i,isChecked:u(),checkboxLabel:c(),onSave:e=>a({customFieldId:t.customFieldId,data:{params:Er("checkbox",e)},onFinish:()=>n({mandatory:e.mandatory,label:e.label,values:[{isChecked:e.isChecked,name:e.checkboxLabel}]})}),onCustomFieldDelete:()=>l(t.customFieldId,r),isDeleting:o,onChange:(e,t)=>t&&s()})})}),(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("formSettings"),initialOpen:!0,children:(0,q.jsx)(se.Z,{label:j.x.I18n.t("displayLabel"),checked:!t.hideLabel,onChange:e=>n({hideLabel:!e})})})})]});let p=c();return t.mandatory&&(p+=" *"),(0,q.jsxs)(Ir,{className:t.className,children:[d,(0,q.jsx)("span",{className:"mailpoet_checkbox_label","data-automation-id":"editor_custom_field_checkbox_block",children:t.hideLabel||!t.label?null:t.label}),(0,q.jsx)("div",{children:(0,q.jsxs)("label",{children:[(0,q.jsx)("input",{type:"checkbox",disabled:!0,checked:u(),className:"mailpoet_checkbox"}),(0,q.jsx)("span",{dangerouslySetInnerHTML:{__html:p}})]})})]})}function mc(e){return{title:e.name,description:"",icon:hr,category:"custom-fields",attributes:{label:{type:"string",default:e.name},hideLabel:{type:"boolean",default:!1},values:{type:"array",default:e.params.values?ac(e.params.values):[]},mandatory:{type:"boolean",default:!!e.params.required&&!!e.params.required},customFieldId:{type:"string",default:e.id}},supports:{html:!1,multiple:!1},edit:pc,save:()=>null}}function fc(e){let{attributes:t,setAttributes:n,clientId:r}=e;const i=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),o=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldSaving()),[]),a=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldDeleting()),[]),{saveCustomField:l,deleteCustomField:s,customFieldEdited:c}=(0,h.Z)("mailpoet-form-editor"),u=(0,q.jsxs)(L.Af,{children:[(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("customFieldSettings"),initialOpen:!0,children:(0,q.jsx)(ec,{label:t.label,mandatory:t.mandatory,values:t.values,isSaving:o,onSave:e=>l({customFieldId:t.customFieldId,data:{params:Er("select",e)},onFinish:()=>n({mandatory:e.mandatory,values:e.values,label:e.label})}),onCustomFieldDelete:()=>s(t.customFieldId,r),isDeleting:a,onChange:(e,t)=>t&&c()})})}),(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("formSettings"),initialOpen:!0,children:(0,q.jsx)(se.Z,{label:j.x.I18n.t("displayLabelWithinInput"),checked:t.labelWithinInput,onChange:e=>n({labelWithinInput:e})})})})]});return(0,q.jsxs)(Ir,{className:t.className,children:[u,(0,q.jsxs)("div",{className:"mailpoet_custom_select","data-automation-id":"custom_select_block",children:[t.labelWithinInput?null:(0,q.jsx)("label",{className:"mailpoet_select_label",htmlFor:r,children:wr(t)}),(()=>{let e=t.labelWithinInput?wr(t):"-";const n=[{label:e}];!Array.isArray(t.values)&&t.values.length||t.values.forEach((r=>{n.push({label:r.name}),!t.labelWithinInput&&r.isChecked&&(e=r.name)}));const o={};return void 0!==i.inputPadding&&(o.padding=i.inputPadding),void 0!==i.alignment&&(o.textAlign=i.alignment,o.margin=Wr(o.textAlign)),i.fontFamily&&(o.fontFamily=i.fontFamily),(0,q.jsx)("select",{style:o,className:"mailpoet_select",id:r,value:e,readOnly:!0,children:n.map(((e,t)=>(0,q.jsx)("option",{value:e.label,disabled:0===t,children:e.label},e.label)))})})()]})]})}function hc(e){return{title:e.name,description:"",icon:hr,category:"custom-fields",attributes:{label:{type:"string",default:e.name},labelWithinInput:{type:"boolean",default:!0},mandatory:{type:"boolean",default:!!e.params.required&&!!e.params.required},values:{type:"array",default:e.params.values?ac(e.params.values):[]},customFieldId:{type:"string",default:e.id}},supports:{html:!1,multiple:!1},edit:fc,save:()=>null}}function gc(e){return{date:{name:"mailpoet-form/custom-date",settings:Ar(e)},text:{name:"mailpoet-form/custom-text",settings:Zr(e)},textarea:{name:"mailpoet-form/custom-textarea",settings:Vr(e)},radio:{name:"mailpoet-form/custom-radio",settings:uc(e)},checkbox:{name:"mailpoet-form/custom-checkbox",settings:mc(e)},select:{name:"mailpoet-form/custom-select",settings:hc(e)}}}dc.propTypes={label:U().string,mandatory:U().bool,onSave:U().func,isSaving:U().bool,isChecked:U().bool,checkboxLabel:U().string,isDeleting:U().bool,onCustomFieldDelete:U().func,onChange:U().func},dc.defaultProps={label:"",mandatory:!1,onSave:null,isSaving:!1,isChecked:!1,checkboxLabel:"",isDeleting:!1,onCustomFieldDelete:null,onChange:()=>{}},pc.propTypes={attributes:U().shape({label:U().string.isRequired,customFieldId:U().number.isRequired,mandatory:U().bool.isRequired,hideLabel:U().bool,className:U().string,values:U().arrayOf(U().shape({name:U().string.isRequired,isChecked:U().bool}))}).isRequired,setAttributes:U().func.isRequired,clientId:U().string.isRequired},fc.propTypes={attributes:U().shape({customFieldId:U().number.isRequired,labelWithinInput:U().bool.isRequired,label:U().string.isRequired,values:U().arrayOf(U().shape({name:U().string.isRequired,isChecked:U().bool,id:U().string.isRequired})),mandatory:U().bool.isRequired,className:U().string}).isRequired,setAttributes:U().func.isRequired,clientId:U().string.isRequired};const vc=(0,q.jsxs)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,q.jsx)(Y.y$,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,q.jsx)(Y.y$,{d:"M19 13H5v-2h14v2z"})]}),bc={title:j.x.I18n.t("blockDivider"),description:null,icon:vc,category:"design",attributes:{height:{type:"number",default:ic.height},type:{type:"string",default:ic.type},style:{type:"string",default:ic.style},dividerHeight:{type:"number",default:ic.dividerHeight},dividerWidth:{type:"number",default:ic.dividerWidth},color:{type:"string",default:ic.color}},supports:{html:!1,multiple:!0},edit:function(e){let{attributes:t,setAttributes:n}=e;const r=t.dividerHeight??ic.dividerHeight,i=t.dividerWidth??ic.dividerWidth,o=t.height??ic.height,a=(0,q.jsxs)("div",{className:"mailpoet-styles-settings",children:[(0,q.jsx)(de.Z,{label:j.x.I18n.t("blockDividerStyle"),"data-automation-id":"settings_divider_style",value:t.style,onChange:e=>n({style:e}),options:[{value:rc.Solid,label:j.x.I18n.t("blockDividerStyleSolid")},{value:rc.Dashed,label:j.x.I18n.t("blockDividerStyleDashed")},{value:rc.Dotted,label:j.x.I18n.t("blockDividerStyleDotted")}]}),(0,q.jsx)(xe.Z,{label:j.x.I18n.t("blockDividerDividerHeight"),className:"mailpoet-automation-styles-divider-height",value:r,min:1,max:40,allowReset:!0,onChange:e=>{let t=o;void 0!==e&&(t=Math.max(e,o)),n({dividerHeight:e,height:t})}}),(0,q.jsx)(xe.Z,{label:j.x.I18n.t("blockDividerDividerWidth"),className:"mailpoet-automation-styles-divider-width",value:i,min:1,max:100,allowReset:!0,onChange:e=>n({dividerWidth:e})}),(0,q.jsx)(Re,{title:j.x.I18n.t("formSettingsColor"),settings:[{label:j.x.I18n.t("blockDividerBackground"),colorValue:t.color,onColorChange:e=>n({color:e})}]})]}),l={};return t.type===nc.Divider&&(l.borderTopStyle=t.style,l.borderTopWidth=r,l.borderTopColor=t.color,l.height=r,l.width=`${i}%`),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(L.Af,{children:(0,q.jsx)(ae.Z,{children:(0,q.jsxs)(le.Z,{title:j.x.I18n.t("formSettingsStyles"),initialOpen:!0,children:[(0,q.jsx)(xe.Z,{label:j.x.I18n.t("blockSpacerHeight"),className:"mailpoet-automation-spacer-height-size",value:o,min:1,max:400,allowReset:!0,onChange:e=>{let t=r;t=void 0!==e?Math.min(e,r):1,n({height:e,dividerHeight:t})}}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("blockSpacerEnableDivider"),className:"mailpoet-automation-divider-togle-enable",checked:t.type===nc.Divider,onChange:e=>n({type:e?nc.Divider:nc.Spacer})}),t.type===nc.Divider&&a]})})}),(0,q.jsx)("div",{className:p()("mailpoet_spacer",t.className),"data-automation-id":"editor_spacer_block",style:{height:o,display:"flex",flexDirection:"column",alignItems:"center",width:"100%",justifyContent:"center"},children:(0,q.jsx)("div",{className:"mailpoet_divider","data-automation-id":"editor_divider_block",style:l})})]})},save:()=>null};function yc(e){let{attributes:t,setAttributes:n}=e;const r=(0,q.jsxs)(L.Af,{children:[(0,q.jsx)(ae.Z,{children:(0,q.jsxs)(le.Z,{title:j.x.I18n.t("formSettings"),initialOpen:!0,children:[(0,q.jsx)(br.Z,{label:j.x.I18n.t("label"),value:t.label,"data-automation-id":"settings_email_label_input",onChange:e=>n({label:e})}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("displayLabelWithinInput"),checked:t.labelWithinInput,onChange:e=>n({labelWithinInput:e})})]})}),(0,q.jsx)(Mr,{styles:t.styles,onChange:e=>n({styles:e})})]});return(0,q.jsxs)(q.Fragment,{children:[r,(0,q.jsx)(zr,{className:t.className,name:"email",label:t.label,labelWithinInput:!!t.labelWithinInput,mandatory:!0,styles:t.styles})]})}yc.propTypes={attributes:U().shape({label:U().string.isRequired,labelWithinInput:U().bool.isRequired,className:U().string,styles:Br.isRequired}).isRequired,setAttributes:U().func.isRequired};const xc=(0,q.jsxs)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,q.jsx)(Y.y$,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,q.jsx)(Y.G,{children:(0,q.jsx)(Y.y$,{fill:"#32373C",d:"m18.82592,6.5l-14,0c-0.8,0 -1.5,0.7 -1.5,1.5l0,8c0,0.8 0.7,1.5 1.5,1.5l14,0c0.8,0 1.5,-0.7 1.5,-1.5l0,-8c0,-0.8 -0.7,-1.5 -1.5,-1.5zm-1.2,1l-5.8,4.9l-5.8,-4.9l11.6,0zm1.7,8.5c0,0.3 -0.2,0.5 -0.5,0.5l-14,0c-0.3,0 -0.5,-0.2 -0.5,-0.5l0,-8c0,-0.2 0.1,-0.4 0.3,-0.4l6.9,5.9c0.1,0.1 0.2,0.1 0.3,0.1s0.2,0 0.3,-0.1l6.9,-5.9c0.2,0.1 0.3,0.2 0.3,0.4l0,8z"})})]}),wc={title:j.x.I18n.t("blockEmail"),description:j.x.I18n.t("blockEmailDescription"),icon:xc,category:"obligatory",attributes:{label:{type:"string",default:j.x.I18n.t("blockEmail")},labelWithinInput:{type:"boolean",default:!0},styles:{type:"object",default:Lr}},supports:{html:!1,inserter:!1,multiple:!1},edit:yc,save:()=>null};function Cc(e){let{styles:t,onChange:n,formInputPadding:r,formFontFamily:i}=e;const o=(0,a.useRef)(t),l=o.current,s=(e,t)=>{const r={...o.current};r[e]=t,n(r),o.current=r};return(0,q.jsx)(ae.Z,{className:"mailpoet-automation-input-styles-panel",children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("formSettingsStyles"),initialOpen:!1,children:(0,q.jsxs)("div",{className:"mailpoet-styles-settings","data-automation-id":"input_styles_settings",children:[(0,q.jsx)(se.Z,{label:j.x.I18n.t("formSettingsDisplayFullWidth"),checked:l.fullWidth,onChange:(0,oe.partial)(s,"fullWidth")}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("formSettingsInheritStyleFromTheme"),checked:l.inheritFromTheme,onChange:e=>{if(e)return void s("inheritFromTheme",e);const t={...o.current};t.backgroundColor="#eeeeee",t.bold=!1,t.borderRadius=0,t.borderSize=1,t.borderColor="#313131",t.fontColor="#313131",t.fontSize=void 0,t.padding=r,t.inheritFromTheme=e,n(t),o.current=t},className:"mailpoet-automation-inherit-theme-toggle"}),l.inheritFromTheme?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Re,{title:j.x.I18n.t("formSettingsColor"),settings:[{label:j.x.I18n.t("formSettingsStylesBackground"),colorValue:t.backgroundColor,gradientValue:t.gradient,onColorChange:(0,oe.partial)(s,"backgroundColor"),onGradientChange:(0,oe.partial)(s,"gradient")},{label:j.x.I18n.t("formSettingsStylesFont"),colorValue:t.fontColor,onColorChange:(0,oe.partial)(s,"fontColor")},{label:j.x.I18n.t("formSettingsBorder"),colorValue:l.borderColor,onColorChange:(0,oe.partial)(s,"borderColor")}]}),(0,q.jsx)(Me,{value:t.fontSize,onChange:(0,oe.partial)(s,"fontSize")}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("formSettingsBold"),checked:l.bold||!1,onChange:(0,oe.partial)(s,"bold"),className:"mailpoet-automation-styles-bold-toggle"}),(0,q.jsx)(et,{name:j.x.I18n.t("formSettingsStylesFontFamily"),value:t.fontFamily||i,onChange:(0,oe.partial)(s,"fontFamily")}),(0,q.jsx)(xe.Z,{label:j.x.I18n.t("formSettingsInputPadding"),value:void 0!==l.padding?l.padding:r,min:0,max:30,allowReset:!0,onChange:(0,oe.partial)(s,"padding")}),(0,q.jsx)(xe.Z,{label:j.x.I18n.t("formSettingsBorderSize"),value:void 0!==l.borderSize?l.borderSize:1,min:0,max:10,allowReset:!0,onChange:(0,oe.partial)(s,"borderSize"),className:"mailpoet-automation-styles-border-size"}),(0,q.jsx)(xe.Z,{label:j.x.I18n.t("formSettingsBorderRadius"),value:void 0!==l.borderRadius?l.borderRadius:0,min:0,max:40,allowReset:!0,onChange:(0,oe.partial)(s,"borderRadius")})]})]})})})}const _c=(0,q.jsxs)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,q.jsx)(Y.y$,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,q.jsx)(Y.G,{children:(0,q.jsx)(Y.y$,{d:"M19 6H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 10H5V8h14v8z"})})]}),Sc={title:j.x.I18n.t("blockSubmit"),description:j.x.I18n.t("blockSubmitDescription"),icon:_c,category:"obligatory",attributes:{label:{type:"string",default:j.x.I18n.t("blockSubmitLabel")},styles:{type:"object",default:{fullWidth:!0,inheritFromTheme:!0}}},supports:{html:!1,inserter:!1,multiple:!1},edit:function(e){let{attributes:t,setAttributes:n}=e;const r=(0,f.Z)((e=>e("mailpoet-form-editor").getFormSettings()),[]),i=(0,q.jsxs)(L.Af,{children:[(0,q.jsx)(ae.Z,{children:(0,q.jsx)(le.Z,{title:j.x.I18n.t("formSettings"),initialOpen:!0,children:(0,q.jsx)(br.Z,{label:j.x.I18n.t("label"),value:t.label,onChange:e=>n({label:e}),"data-automation-id":"settings_submit_label_input"})})}),(0,q.jsx)(Cc,{onChange:e=>n({styles:e}),styles:t.styles,formInputPadding:r.inputPadding,formFontFamily:r.fontFamily})]}),o=t.styles.inheritFromTheme?{}:{fontWeight:t.styles.bold?"bold":"inherit",borderRadius:void 0!==t.styles.borderRadius?`${t.styles.borderRadius}px`:0,borderWidth:void 0!==t.styles.borderSize?`${t.styles.borderSize}px`:"1px",borderColor:t.styles.borderColor||"transparent",borderStyle:"solid",fontSize:t.styles.fontSize?`${t.styles.fontSize}px`:"inherit",color:t.styles.fontColor||"inherit"};t.styles.fullWidth&&(o.width="100%"),void 0===t.styles.padding||t.styles.inheritFromTheme?void 0!==r.inputPadding&&(o.padding=r.inputPadding):o.padding=t.styles.padding,t.styles.backgroundColor&&!t.styles.inheritFromTheme&&(o.backgroundColor=t.styles.backgroundColor),t.styles.backgroundColor&&!t.styles.inheritFromTheme&&(o.backgroundColor=t.styles.backgroundColor),t.styles.gradient&&!t.styles.inheritFromTheme&&(o.backgroundColor=void 0,o.background=t.styles.gradient),t.styles.fontFamily&&!t.styles.inheritFromTheme&&(o.fontFamily=t.styles.fontFamily);const a=p()("mailpoet_submit",{button:t.styles.inheritFromTheme});return(0,q.jsxs)(Ir,{className:t.className,children:[i,(0,q.jsx)("input",{className:a,type:"submit",value:t.label,"data-automation-id":"editor_submit_input",style:o})]})},save:()=>null},kc=(0,q.jsxs)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,q.jsx)(Y.y$,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,q.jsx)(Y.G,{children:(0,q.jsx)(Y.y$,{d:"M19 6H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 10H5V8h14v8z"})})]});function Ic(e){let{attributes:t,setAttributes:n}=e;const r=(0,q.jsxs)(L.Af,{children:[(0,q.jsx)(ae.Z,{children:(0,q.jsxs)(le.Z,{title:j.x.I18n.t("formSettings"),initialOpen:!0,children:[(0,q.jsx)(br.Z,{label:j.x.I18n.t("label"),value:t.label,"data-automation-id":"settings_first_name_label_input",onChange:e=>n({label:e})}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("displayLabelWithinInput"),checked:t.labelWithinInput,onChange:e=>n({labelWithinInput:e}),className:"mailpoet-automation-label-within-input-toggle"}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("blockMandatory"),checked:t.mandatory,onChange:e=>n({mandatory:e})})]})}),(0,q.jsx)(Mr,{styles:t.styles,onChange:e=>n({styles:e})})]});return(0,q.jsxs)(q.Fragment,{children:[r,(0,q.jsx)(zr,{className:t.className,name:"first_name",mandatory:t.mandatory,labelWithinInput:t.labelWithinInput,label:t.label,styles:t.styles})]})}Ic.propTypes={attributes:U().shape({label:U().string.isRequired,labelWithinInput:U().bool.isRequired,mandatory:U().bool.isRequired,className:U().string,styles:Br.isRequired}).isRequired,setAttributes:U().func.isRequired};const Ec={title:j.x.I18n.t("blockFirstName"),description:j.x.I18n.t("blockFirstNameDescription"),icon:kc,category:"fields",attributes:{label:{type:"string",default:j.x.I18n.t("blockFirstName")},labelWithinInput:{type:"boolean",default:!0},mandatory:{type:"boolean",default:!1},styles:{type:"object",default:Lr}},supports:{html:!1,multiple:!1},edit:Ic,save:()=>null},Tc=(0,q.jsxs)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,q.jsx)(Y.y$,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,q.jsx)(Y.G,{children:(0,q.jsx)(Y.y$,{d:"M19 6H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 10H5V8h14v8z"})})]});function Ac(e){let{attributes:t,setAttributes:n}=e;const r=(0,q.jsxs)(L.Af,{children:[(0,q.jsx)(ae.Z,{children:(0,q.jsxs)(le.Z,{title:j.x.I18n.t("formSettings"),initialOpen:!0,children:[(0,q.jsx)(br.Z,{label:j.x.I18n.t("label"),value:t.label,"data-automation-id":"settings_last_name_label_input",onChange:e=>n({label:e})}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("displayLabelWithinInput"),checked:t.labelWithinInput,onChange:e=>n({labelWithinInput:e})}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("blockMandatory"),checked:t.mandatory,onChange:e=>n({mandatory:e})})]})}),(0,q.jsx)(Mr,{styles:t.styles,onChange:e=>n({styles:e})})]});return(0,q.jsxs)(q.Fragment,{children:[r,(0,q.jsx)(zr,{className:t.className,name:"last_name",mandatory:t.mandatory,labelWithinInput:t.labelWithinInput,label:t.label,styles:t.styles})]})}Ac.propTypes={attributes:U().shape({label:U().string.isRequired,labelWithinInput:U().bool.isRequired,mandatory:U().bool.isRequired,className:U().string,styles:Br.isRequired}).isRequired,setAttributes:U().func.isRequired};const Dc={title:j.x.I18n.t("blockLastName"),description:j.x.I18n.t("blockLastNameDescription"),icon:Tc,category:"fields",attributes:{label:{type:"string",default:j.x.I18n.t("blockLastName")},labelWithinInput:{type:"boolean",default:!0},mandatory:{type:"boolean",default:!1},styles:{type:"object",default:Lr}},supports:{html:!1,multiple:!1},edit:Ac,save:()=>null},Lc=(0,q.jsx)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)(Y.G,{children:(0,q.jsx)(Y.y$,{d:"M9 19h12v-2H9v2zm0-6h12v-2H9v2zm0-8v2h12V5H9zm-4-.5c-.828 0-1.5.672-1.5 1.5S4.172 7.5 5 7.5 6.5 6.828 6.5 6 5.828 4.5 5 4.5zm0 6c-.828 0-1.5.672-1.5 1.5s.672 1.5 1.5 1.5 1.5-.672 1.5-1.5-.672-1.5-1.5-1.5zm0 6c-.828 0-1.5.672-1.5 1.5s.672 1.5 1.5 1.5 1.5-.672 1.5-1.5-.672-1.5-1.5-1.5z"})})});var Pc=n(11345),Fc=n(59113);function Nc(e){let{segment:t,removeSegment:n,onCheck:r}=e;return(0,q.jsxs)("div",{className:"mailpoet-form-segments-settings-list",children:[(0,q.jsx)(Fc.C,{label:t.name,defaultChecked:!!t.isChecked,onChange:(0,oe.partial)(r,t.id)},`check-${t.id}`),(0,q.jsx)(Gr.Z,{icon:"no-alt",color:"#900",className:"mailpoet-form-segments-segment-remove",onClick:(0,oe.partial)(n,t.id)})]},t.id)}function jc(e){let{segments:t,updateSegment:n,removeSegment:r,onSegmentsReorder:i}=e;const[o,l]=(0,a.useState)(t);if((0,a.useEffect)((()=>{l(t)}),[t]),0===o.length)return null;const s=(e,t)=>{const r=o.find((t=>t.id===e));r.isChecked=t,n(r)};return(0,q.jsx)(ys,{onDragEnd:e=>{const t=e.source.index,n=e.destination.index,r=[...o],[a]=r.splice(t,1);r.splice(n,0,a),l(r),i(r)},children:(0,q.jsx)(Xs,{droppableId:"droppable",children:e=>(0,q.jsxs)("div",{...e.droppableProps,ref:e.innerRef,children:[o.map(((e,t)=>(0,q.jsx)(qs,{draggableId:e.id,index:t,children:n=>(0,q.jsx)("div",{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,children:(0,q.jsx)(Nc,{index:t,segment:e,onCheck:s,removeSegment:r},e.id)})},e.id))),e.placeholder]})})})}Nc.propTypes={segment:U().shape({name:U().string.isRequired,isChecked:U().bool,id:U().string.isRequired}).isRequired,onCheck:U().func.isRequired,removeSegment:U().func.isRequired},jc.propTypes={segments:U().arrayOf(U().shape({name:U().string.isRequired,isChecked:U().bool,id:U().string.isRequired}).isRequired).isRequired,updateSegment:U().func.isRequired,removeSegment:U().func.isRequired,onSegmentsReorder:U().func.isRequired};const Rc=(e,t)=>e.find((e=>e.id===t));function Oc(e){let{label:t,onLabelChanged:n,segmentsAddedIntoSelection:r,addSegmentIntoSelection:i,setNewSelection:o}=e;const a=(0,f.Z)((e=>e("mailpoet-form-editor").getAllAvailableSegments()),[]),l=a.map((e=>({label:e.name,value:e.id}))).filter((e=>!Rc(r,e.value)));return(0,q.jsx)(L.Af,{children:(0,q.jsx)(ae.Z,{children:(0,q.jsxs)(le.Z,{title:j.x.I18n.t("formSettings"),initialOpen:!0,children:[(0,q.jsx)(Pc.Z,{children:(0,q.jsx)(br.Z,{label:j.x.I18n.t("label"),value:t,"data-automation-id":"settings_first_name_label_input",onChange:n})}),(0,q.jsx)(Pc.Z,{children:l.length?(0,q.jsx)(de.Z,{label:`${j.x.I18n.t("blockSegmentSelectListLabel")}:`,"data-automation-id":"select_list_selections_list",options:[{label:j.x.I18n.t("settingsPleaseSelectList"),value:null},...l],onChange:e=>{const t=Rc(a,e);i({name:t.name,isChecked:!1,id:e})}}):null}),(0,q.jsx)(jc,{segments:r,updateSegment:e=>{o(r.map((t=>e.id!==t?t:e)))},removeSegment:e=>{o(r.filter((t=>e!==t.id)))},onSegmentsReorder:o})]})})})}function Mc(e){let{attributes:t,setAttributes:n}=e;const r=(0,f.Z)((e=>e("mailpoet-form-editor").getAllAvailableSegments()),[]),i=(0,a.useMemo)((()=>t.values.map((e=>{const t={...e},n=r.find((t=>parseInt(t.id,10)===parseInt(e.id,10)));return t.name=n?n.name:"",t}))),[t.values,r]),o=e=>e.map((e=>{const t={...e};return delete t.name,t}));return(0,q.jsxs)(Ir,{className:t.className,children:[(0,q.jsx)(Oc,{label:t.label,onLabelChanged:e=>n({label:e}),segmentsAddedIntoSelection:i,setNewSelection:e=>n({values:o(e)}),addSegmentIntoSelection:e=>n({values:o([...t.values,e])})}),(0,q.jsx)("span",{className:"mailpoet_segment_label","data-automation-id":"mailpoet_list_selection_block",children:t.label}),0===t.values.length?(0,q.jsx)("p",{className:"mailpoet_error",children:j.x.I18n.t("blockSegmentSelectNoLists")}):i.map((e=>(0,q.jsxs)("label",{className:"mailpoet_checkbox_label",children:[(0,q.jsx)("input",{type:"checkbox",disabled:!0,checked:!!e.isChecked,className:"mailpoet_checkbox"},e.id),e.name]},e.id)))]})}Oc.propTypes={label:U().string.isRequired,onLabelChanged:U().func.isRequired,addSegmentIntoSelection:U().func.isRequired,setNewSelection:U().func.isRequired,segmentsAddedIntoSelection:U().arrayOf(U().shape({name:U().string.isRequired,isChecked:U().bool,id:U().string.isRequired}).isRequired).isRequired},Mc.propTypes={attributes:U().shape({label:U().string.isRequired,className:U().string,values:U().arrayOf(U().shape({isChecked:U().bool,id:U().string.isRequired})).isRequired}).isRequired,setAttributes:U().func.isRequired};const Bc={title:j.x.I18n.t("blockSegmentSelect"),description:j.x.I18n.t("blockLastNameDescription"),icon:Lc,category:"fields",attributes:{label:{type:"string",default:j.x.I18n.t("blockSegmentSelectLabel")},values:{type:"array",default:[]}},supports:{html:!1,multiple:!1},edit:Mc,save:()=>null},Wc=(0,q.jsx)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,q.jsx)(Y.y$,{d:"M4.5,11h-2V9H1v6h1.5v-2.5h2V15H6V9H4.5V11z M7,10.5h1.5V15H10v-4.5h1.5V9H7V10.5z M14.5,10l-1-1H12v6h1.5v-3.9  l1,1l1-1V15H17V9h-1.5L14.5,10z M19.5,13.5V9H18v6h5v-1.5H19.5z"})});var zc=n(48925);function Hc(e){let{attributes:t,setAttributes:n,clientId:r}=e;const i=(0,L.yu)("color.palette"),{fontColor:o,fontSize:l,alignment:s,fontFamily:c}=(0,f.Z)((e=>{const t=e("mailpoet-form-editor").getFormSettings(),n=an(i,e("mailpoet-form-editor").getClosestParentAttribute(r,"backgroundColor"),e("mailpoet-form-editor").getClosestParentAttribute(r,"customBackgroundColor")),o=an(i,e("mailpoet-form-editor").getClosestParentAttribute(r,"textColor"),e("mailpoet-form-editor").getClosestParentAttribute(r,"customTextColor"));return{backgroundColor:n||t.backgroundColor,fontColor:o||t.fontColor,fontSize:t.fontSize,alignment:t.alignment,fontFamily:t.fontFamily}}),[]),[u,d]=(0,a.useState)(t.content),p=(0,a.useCallback)((0,oe.debounce)((e=>{d(e)}),300),[]),m=(0,q.jsx)(L.Af,{children:(0,q.jsx)(ae.Z,{children:(0,q.jsxs)(le.Z,{title:j.x.I18n.t("formSettings"),initialOpen:!0,children:[(0,q.jsx)(pe.Z,{label:j.x.I18n.t("blockCustomHtmlContentLabel"),value:t.content,"data-automation-id":"settings_custom_html_content",rows:4,onChange:e=>{n({content:e}),p(e)}}),(0,q.jsx)(se.Z,{label:j.x.I18n.t("blockCustomHtmlNl2br"),checked:t.nl2br,onChange:e=>n({nl2br:e})})]})})}),h=t.nl2br?["body { white-space: pre-line; }"]:[];h.push(` body {font-family: ${getComputedStyle(document.body).fontFamily};}`),o?h.push(` body {color: ${o};}`):h.push(` body {color: ${getComputedStyle(document.body).color};}`),l?h.push(` body {font-size: ${l}px }`):h.push(` body {font-size: ${getComputedStyle(document.body).fontSize};}`),s&&h.push(` body {text-align: ${s}}`),c&&h.push(` body {font-family: "${c}"}`);const g=`${u}_${h}`;return(0,q.jsxs)(Ir,{className:t.className,children:[m,(0,q.jsx)("div",{className:"mailpoet-html-block-editor-content-wrapper",children:(0,q.jsx)(zc.Z,{html:u,styles:h},g)})]})}Hc.propTypes={attributes:U().shape({content:U().string.isRequired,nl2br:U().bool.isRequired,className:U().string}).isRequired,setAttributes:U().func.isRequired,clientId:U().string.isRequired};const Zc={title:j.x.I18n.t("blockCustomHtml"),description:j.x.I18n.t("blockCustomHtmlDescription"),icon:Wc,category:"fields",attributes:{content:{type:"string",default:j.x.I18n.t("blockCustomHtmlDefault")},nl2br:{type:"boolean",default:!0}},supports:{html:!1,multiple:!0},edit:Hc,save:()=>null},Uc=(0,q.jsx)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 694 694",children:(0,q.jsx)(Y.G,{children:(0,q.jsx)(Y.y$,{d:"m 347,44.407738 c 25.64881,0 46.33333,21.800595 46.33333,47.96131 V 299.03869 h 195.26191 c 24.82143,0 45.50595,21.8006 45.50595,47.96131 0,27.03274 -20.68452,48.83333 -45.50595,48.83333 H 393.33333 v 205.79762 c 0,26.16072 -20.68452,47.96131 -46.33333,47.96131 -24.82143,0 -45.50595,-21.80059 -45.50595,-47.96131 V 395.83333 H 105.40476 c -24.821427,0 -45.50595,-21.80059 -45.50595,-48.83333 0,-26.16071 20.684523,-47.96131 45.50595,-47.96131 H 301.49405 V 92.369048 c 0,-26.160715 20.68452,-47.96131 45.50595,-47.96131 z",fillRule:"evenodd",clipRule:"evenodd"})})});var Vc=n(2302);const Gc=[{value:"text",label:j.x.I18n.t("customFieldTypeText")},{value:"textarea",label:j.x.I18n.t("customFieldTypeTextarea")},{value:"radio",label:j.x.I18n.t("customFieldTypeRadio")},{value:"checkbox",label:j.x.I18n.t("customFieldTypeCheckbox")},{value:"select",label:j.x.I18n.t("customFieldTypeSelect")},{value:"date",label:j.x.I18n.t("customFieldTypeDate")}];function qc(e){let{dateSettings:t,onSubmit:n}=e;const[r,i]=(0,a.useState)("text"),[o,l]=(0,a.useState)(null),[s,c]=(0,a.useState)({}),u=o&&!(0,oe.isEmpty)(s)&&!1!==s.isValid,d=t.dateTypes[0].value,p=t.dateFormats[d][0];return(0,q.jsxs)("div",{className:"mailpoet_custom_field_add_form","data-automation-id":"create_custom_field_form",children:[(0,q.jsx)("hr",{}),(0,q.jsx)(de.Z,{label:j.x.I18n.t("selectCustomFieldType"),options:Gc,"data-automation-id":"create_custom_field_type_select",onChange:e=>{c({}),i(e)}}),(0,q.jsx)(br.Z,{label:j.x.I18n.t("customFieldName"),onChange:l,"data-automation-id":"create_custom_field_name_input"}),(0,q.jsx)("hr",{}),(()=>{switch(r){case"checkbox":return(0,q.jsx)(dc,{mandatory:!!s.mandatory&&s.mandatory,isChecked:!!s.isChecked&&s.isChecked,checkboxLabel:s.checkboxLabel?s.checkboxLabel:"",onChange:c});case"date":return(0,q.jsx)(xr,{dateSettings:t,mandatory:!!s.mandatory&&s.mandatory,dateFormat:s.dateFormat?s.dateFormat:p,dateType:s.dateType?s.dateType:d,defaultToday:!!s.defaultToday&&s.defaultToday,onChange:c});case"radio":case"select":return(0,q.jsx)(ec,{mandatory:!!s.mandatory&&s.mandatory,values:s.values?s.values:[{name:"",id:Math.random().toString()}],onChange:c});default:return(0,q.jsx)(Or,{mandatory:!!s.mandatory&&s.mandatory,validate:s.validate?s.validate:"",fieldType:r,onChange:c})}})(),(0,q.jsx)(O.Z,{isSecondary:!0,disabled:!u,"data-automation-id":"create_custom_field_submit",onClick:()=>{const e={name:o,type:r,params:Er(r,s)};n(e)},children:j.x.I18n.t("blockCreateButton")})]})}function $c(e){let{clientId:t}=e;const{createCustomField:n}=(0,h.Z)("mailpoet-form-editor"),r=(0,f.Z)((e=>e("mailpoet-form-editor").getDateSettingsData()),[]),i=(0,f.Z)((e=>e("mailpoet-form-editor").getIsCustomFieldCreating()),[]);return(0,q.jsx)(Vc.Z,{icon:(0,q.jsx)(L.wD,{icon:Uc,showColors:!0}),label:j.x.I18n.t("blockAddCustomFieldFormHeading"),className:"mailpoet_custom_field_add_placeholder",children:i?(0,q.jsx)($t.ZP,{}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("p",{children:j.x.I18n.t("blockAddCustomFieldDescription")}),(0,q.jsx)(qc,{onSubmit:e=>{n(e,t)},dateSettings:r})]})})}qc.propTypes={dateSettings:U().shape({dateTypes:U().arrayOf(U().shape({label:U().string,value:U().string})),dateFormats:U().objectOf(U().arrayOf(U().string)),months:U().arrayOf(U().string)}).isRequired,onSubmit:U().func.isRequired},$c.propTypes={clientId:U().string.isRequired};const Yc={title:j.x.I18n.t("blockAddCustomField"),description:j.x.I18n.t("blockAddCustomFieldDescription"),icon:Uc,category:"custom-fields",attributes:{},supports:{html:!1,multiple:!1},edit:$c,save:()=>null};var Kc=(0,a.createElement)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(Y.y$,{d:"M19 6H6c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-4.1 1.5v10H10v-10h4.9zM5.5 17V8c0-.3.2-.5.5-.5h2.5v10H6c-.3 0-.5-.2-.5-.5zm14 0c0 .3-.2.5-.5.5h-2.6v-10H19c.3 0 .5.2.5.5v9z"}));function Xc(e){let t,{doc:n}=Xc;n||(n=document.implementation.createHTMLDocument(""),Xc.doc=n),n.body.innerHTML=e;for(const e of n.body.firstChild.classList)if(t=e.match(/^layout-column-(\d+)$/))return Number(t[1])-1}var Jc=[{attributes:{verticalAlignment:{type:"string"},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},customTextColor:{type:"string"},textColor:{type:"string"}},migrate:e=>{if(!e.customTextColor&&!e.customBackgroundColor)return e;const t={color:{}};return e.customTextColor&&(t.color.text=e.customTextColor),e.customBackgroundColor&&(t.color.background=e.customBackgroundColor),{...(0,oe.omit)(e,["customTextColor","customBackgroundColor"]),style:t,isStackedOnMobile:!0}},save(e){let{attributes:t}=e;const{verticalAlignment:n,backgroundColor:r,customBackgroundColor:i,textColor:o,customTextColor:l}=t,s=(0,L.Gd)("background-color",r),c=(0,L.Gd)("color",o),u=p()({"has-background":r||i,"has-text-color":o||l,[s]:s,[c]:c,[`are-vertically-aligned-${n}`]:n}),d={backgroundColor:s?void 0:i,color:c?void 0:l};return(0,a.createElement)("div",{className:u||void 0,style:d},(0,a.createElement)(L.gv.Content,null))}},{attributes:{columns:{type:"number",default:2}},isEligible:(e,t)=>!!t.some((e=>/layout-column-\d+/.test(e.originalContent)))&&t.some((e=>void 0!==Xc(e.originalContent))),migrate(e,t){const n=t.reduce(((e,t)=>{const{originalContent:n}=t;let r=Xc(n);return void 0===r&&(r=0),e[r]||(e[r]=[]),e[r].push(t),e}),[]).map((e=>(0,ur.j4)("core/column",{},e)));return[{...(0,oe.omit)(e,["columns"]),isStackedOnMobile:!0},n]},save(e){let{attributes:t}=e;const{columns:n}=t;return(0,a.createElement)("div",{className:`has-${n}-columns`},(0,a.createElement)(L.gv.Content,null))}},{attributes:{columns:{type:"number",default:2}},migrate:(e,t)=>[e={...(0,oe.omit)(e,["columns"]),isStackedOnMobile:!0},t],save(e){let{attributes:t}=e;const{verticalAlignment:n,columns:r}=t,i=p()(`has-${r}-columns`,{[`are-vertically-aligned-${n}`]:n});return(0,a.createElement)("div",{className:i},(0,a.createElement)(L.gv.Content,null))}}],Qc=n(99318),eu=n(19006);const tu=e=>{const t=parseFloat(e);return Number.isFinite(t)?parseFloat(t.toFixed(2)):void 0};function nu(e,t){const{width:n=100/t}=e.attributes;return tu(n)}function ru(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length;return e.reduce(((e,n)=>e+nu(n,t)),0)}function iu(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length;return e.reduce(((e,n)=>{const r=nu(n,t);return Object.assign(e,{[n.clientId]:r})}),{})}function ou(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length;const r=ru(e,n);return(0,oe.mapValues)(iu(e,n),(e=>tu(t*e/r)))}function au(e,t){return e.map((e=>(0,oe.merge)({},e,{attributes:{width:`${t[e.clientId]}%`}})))}const lu=["core/column"],su=(0,eu.Z)(((e,t,n)=>({updateAlignment(r){const{clientId:i,setAttributes:o}=t,{updateBlockAttributes:a}=e(L.t2),{getBlockOrder:l}=n.select(L.t2);o({verticalAlignment:r}),l(i).forEach((e=>{a(e,{verticalAlignment:r})}))},updateColumns(r,i){const{clientId:o}=t,{replaceInnerBlocks:a}=e(L.t2),{getBlocks:l}=n.select(L.t2);let s=l(o);const c=s.every((e=>{var t;const n=e.attributes.width;return Number.isFinite(null!=n&&null!==(t=n.endsWith)&&void 0!==t&&t.call(n,"%")?parseFloat(n):n)})),u=i>r;if(u&&c){const e=tu(100/i);s=[...au(s,ou(s,100-e)),...(0,oe.times)(i-r,(()=>(0,ur.j4)("core/column",{width:`${e}%`})))]}else u?s=[...s,...(0,oe.times)(i-r,(()=>(0,ur.j4)("core/column")))]:(s=s.slice(0,-(r-i)),c&&(s=au(s,ou(s,100))));a(o,s)}})))((function(e){let{attributes:t,setAttributes:n,updateAlignment:r,updateColumns:i,clientId:o}=e;const{isStackedOnMobile:l,verticalAlignment:s}=t,{count:c}=(0,f.Z)((e=>({count:e(L.t2).getBlockCount(o)})),[o]),u=p()({[`are-vertically-aligned-${s}`]:s,"is-not-stacked-on-mobile":!l}),d=(0,L.Wo)({className:u}),m=(0,L.fh)(d,{allowedBlocks:lu,orientation:"horizontal",renderAppender:!1});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.Zp,null,(0,a.createElement)(L.nZ,{onChange:r,value:s})),(0,a.createElement)(L.Af,null,(0,a.createElement)(le.Z,null,(0,a.createElement)(xe.Z,{label:(0,b.__)("Columns"),value:c,onChange:e=>i(c,e),min:1,max:Math.max(6,c)}),c>6&&(0,a.createElement)(Qc.Z,{status:"warning",isDismissible:!1},(0,b.__)("This column count exceeds the recommended amount and may cause visual breakage.")),(0,a.createElement)(se.Z,{label:(0,b.__)("Stack on mobile"),checked:l,onChange:()=>n({isStackedOnMobile:!l})}))),(0,a.createElement)("div",m))}));function cu(e){let{clientId:t,name:n,setAttributes:r}=e;const{blockType:i,defaultVariation:o,variations:l}=(0,f.Z)((e=>{const{getBlockVariations:t,getBlockType:r,getDefaultBlockVariation:i}=e(ur.h);return{blockType:r(n),defaultVariation:i(n,"block"),variations:t(n,"block")}}),[n]),{replaceInnerBlocks:s}=(0,h.Z)(L.t2),c=(0,L.Wo)();return(0,a.createElement)("div",c,(0,a.createElement)(L.G6,{icon:(0,oe.get)(i,["icon","src"]),label:(0,oe.get)(i,["title"]),variations:l,onSelect:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o;e.attributes&&r(e.attributes),e.innerBlocks&&s(t,(0,ur.ne)(e.innerBlocks),!0)},allowSkip:!0}))}var uu=[{name:"one-column-full",title:(0,b.__)("100"),description:(0,b.__)("One column"),icon:(0,a.createElement)(Y.Wj,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(Y.y$,{fillRule:"evenodd",clipRule:"evenodd",d:"m39.0625 14h-30.0625v20.0938h30.0625zm-30.0625-2c-1.10457 0-2 .8954-2 2v20.0938c0 1.1045.89543 2 2 2h30.0625c1.1046 0 2-.8955 2-2v-20.0938c0-1.1046-.8954-2-2-2z"})),innerBlocks:[["core/column"]],scope:["block"]},{name:"two-columns-equal",title:(0,b.__)("50 / 50"),description:(0,b.__)("Two columns; equal split"),icon:(0,a.createElement)(Y.Wj,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(Y.y$,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H25V34H39ZM23 34H9V14H23V34Z"})),isDefault:!0,innerBlocks:[["core/column"],["core/column"]],scope:["block"]},{name:"two-columns-one-third-two-thirds",title:(0,b.__)("33 / 66"),description:(0,b.__)("Two columns; one-third, two-thirds split"),icon:(0,a.createElement)(Y.Wj,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(Y.y$,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H20V34H39ZM18 34H9V14H18V34Z"})),innerBlocks:[["core/column",{width:"33.33%"}],["core/column",{width:"66.66%"}]],scope:["block"]},{name:"two-columns-two-thirds-one-third",title:(0,b.__)("66 / 33"),description:(0,b.__)("Two columns; two-thirds, one-third split"),icon:(0,a.createElement)(Y.Wj,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(Y.y$,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H30V34H39ZM28 34H9V14H28V34Z"})),innerBlocks:[["core/column",{width:"66.66%"}],["core/column",{width:"33.33%"}]],scope:["block"]},{name:"three-columns-equal",title:(0,b.__)("33 / 33 / 33"),description:(0,b.__)("Three columns; equal split"),icon:(0,a.createElement)(Y.Wj,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(Y.y$,{fillRule:"evenodd",d:"M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM28.5 34h-9V14h9v20zm2 0V14H39v20h-8.5zm-13 0H9V14h8.5v20z"})),innerBlocks:[["core/column"],["core/column"],["core/column"]],scope:["block"]},{name:"three-columns-wider-center",title:(0,b.__)("25 / 50 / 25"),description:(0,b.__)("Three columns; wide center column"),icon:(0,a.createElement)(Y.Wj,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(Y.y$,{fillRule:"evenodd",d:"M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM31 34H17V14h14v20zm2 0V14h6v20h-6zm-18 0H9V14h6v20z"})),innerBlocks:[["core/column",{width:"25%"}],["core/column",{width:"50%"}],["core/column",{width:"25%"}]],scope:["block"]}];const du={from:[{type:"block",isMultiBlock:!0,blocks:["*"],__experimentalConvert:e=>{const t=+(100/e.length).toFixed(2),n=e.map((e=>{let{name:n,attributes:r,innerBlocks:i}=e;return["core/column",{width:`${t}%`},[[n,{...r},i]]]}));return(0,ur.j4)("core/columns",{},(0,ur.ne)(n))},isMatch:e=>{let{length:t}=e;return t&&t<=6}},{type:"block",blocks:["core/media-text"],priority:1,transform:(e,t)=>{const{align:n,backgroundColor:r,textColor:i,style:o,mediaAlt:a,mediaId:l,mediaPosition:s,mediaSizeSlug:c,mediaType:u,mediaUrl:d,mediaWidth:p,verticalAlignment:m}=e;let f;f="image"!==u&&u?["core/video",{id:l,src:d}]:["core/image",{id:l,alt:a,url:d,sizeSlug:c,href:e.href,linkClass:e.linkClass,linkDestination:e.linkDestination,linkTarget:e.linkTarget,rel:e.rel}];const h=[["core/column",{width:`${p}%`},[f]],["core/column",{width:100-p+"%"},t]];return"right"===s&&h.reverse(),(0,ur.j4)("core/columns",{align:n,backgroundColor:r,textColor:i,style:o,verticalAlignment:m},(0,ur.ne)(h))}}]};var pu=du;const mu={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:2,name:"core/columns",title:"Columns",category:"design",description:"Display content in multiple columns, with blocks added to each column.",textdomain:"default",attributes:{verticalAlignment:{type:"string"},isStackedOnMobile:{type:"boolean",default:!0}},supports:{anchor:!0,align:["wide","full"],html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{blockGap:{__experimentalDefault:"2em"},margin:["top","bottom"],padding:!0,__experimentalDefaultControls:{padding:!0}},__experimentalLayout:{allowSwitching:!1,allowInheriting:!1,allowEditing:!1,default:{type:"flex",flexWrap:"nowrap"}},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,radius:!0,style:!0,width:!0}}},editorStyle:"wp-block-columns-editor",style:"wp-block-columns"},{name:fu}=mu,hu={icon:Kc,variations:uu,example:{viewportWidth:600,innerBlocks:[{name:"core/column",innerBlocks:[{name:"core/paragraph",attributes:{content:(0,b.__)("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et eros eu felis.")}},{name:"core/image",attributes:{url:"https://s.w.org/images/core/5.3/Windbuchencom.jpg"}},{name:"core/paragraph",attributes:{content:(0,b.__)("Suspendisse commodo neque lacus, a dictum orci interdum et.")}}]},{name:"core/column",innerBlocks:[{name:"core/paragraph",attributes:{content:(0,b.__)("Etiam et egestas lorem. Vivamus sagittis sit amet dolor quis lobortis. Integer sed fermentum arcu, id vulputate lacus. Etiam fermentum sem eu quam hendrerit.")}},{name:"core/paragraph",attributes:{content:(0,b.__)("Nam risus massa, ullamcorper consectetur eros fermentum, porta aliquet ligula. Sed vel mauris nec enim.")}}]}]},deprecated:Jc,edit:e=>{const{clientId:t}=e,n=(0,f.Z)((e=>e(L.t2).getBlocks(t).length>0),[t])?su:cu;return(0,a.createElement)(n,e)},save:function(e){let{attributes:t}=e;const{isStackedOnMobile:n,verticalAlignment:r}=t,i=p()({[`are-vertically-aligned-${r}`]:r,"is-not-stacked-on-mobile":!n}),o=L.Wo.save({className:i}),l=L.fh.save(o);return(0,a.createElement)("div",l)},transforms:pu},gu="core/columns",vu={name:gu,examples:null,deprecated:null,save:()=>null},bu={...mu,...hu,...vu,category:"design",supports:{...mu.supports,anchor:!1}};var yu=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M19 6H6c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zM6 17.5c-.3 0-.5-.2-.5-.5V8c0-.3.2-.5.5-.5h3v10H6zm13.5-.5c0 .3-.2.5-.5.5h-3v-10h3c.3 0 .5.2.5.5v9z"}));var xu=[{attributes:{verticalAlignment:{type:"string"},width:{type:"number",min:0,max:100}},isEligible(e){let{width:t}=e;return isFinite(t)},migrate:e=>({...e,width:`${e.width}%`}),save(e){let{attributes:t}=e;const{verticalAlignment:n,width:r}=t,i=p()({[`is-vertically-aligned-${n}`]:n}),o={flexBasis:r+"%"};return(0,a.createElement)("div",{className:i,style:o},(0,a.createElement)(L.gv.Content,null))}}],wu=n(47869),Cu=n(71608);const _u={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:2,name:"core/column",title:"Column",category:"text",parent:["core/columns"],description:"A single column within a columns block.",textdomain:"default",attributes:{verticalAlignment:{type:"string"},width:{type:"string"},allowedBlocks:{type:"array"},templateLock:{type:["string","boolean"],enum:["all","insert",!1]}},supports:{anchor:!0,reusable:!1,html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{blockGap:!0,padding:!0,__experimentalDefaultControls:{padding:!0}},__experimentalBorder:{color:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,style:!0,width:!0}},__experimentalLayout:!0}},{name:Su}=_u,ku={icon:yu,edit:function(e){let{attributes:{verticalAlignment:t,width:n,templateLock:r=!1,allowedBlocks:i},setAttributes:o,clientId:l}=e;const s=p()("block-core-columns",{[`is-vertically-aligned-${t}`]:t}),c=(0,wu.nj)({availableUnits:(0,L.yu)("spacing.units")||["%","px","em","rem","vw"]}),{columnsIds:u,hasChildBlocks:d,rootClientId:m}=(0,f.Z)((e=>{const{getBlockOrder:t,getBlockRootClientId:n}=e(L.t2),r=n(l);return{hasChildBlocks:t(l).length>0,rootClientId:r,columnsIds:t(r)}}),[l]),{updateBlockAttributes:g}=(0,h.Z)(L.t2),v=Number.isFinite(n)?n+"%":n,y=(0,L.Wo)({className:s,style:v?{flexBasis:v}:void 0}),x=u.length,w=u.indexOf(l)+1,C=(0,b.sprintf)((0,b.__)("%1$s (%2$d of %3$d)"),y["aria-label"],w,x),_=(0,L.fh)({...y,"aria-label":C},{templateLock:r,allowedBlocks:i,renderAppender:d?void 0:L.gv.ButtonBlockAppender});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.Zp,null,(0,a.createElement)(L.nZ,{onChange:e=>{o({verticalAlignment:e}),g(m,{verticalAlignment:null})},value:t})),(0,a.createElement)(L.Af,null,(0,a.createElement)(le.Z,{title:(0,b.__)("Column settings")},(0,a.createElement)(Cu.ZP,{label:(0,b.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",value:n||"",onChange:e=>{e=0>parseFloat(e)?"0":e,o({width:e})},units:c}))),(0,a.createElement)("div",_))},save:function(e){let{attributes:t}=e;const{verticalAlignment:n,width:r}=t,i=p()({[`is-vertically-aligned-${n}`]:n});let o;if(r&&/\d/.test(r)){let e=Number.isFinite(r)?r+"%":r;if(!Number.isFinite(r)&&null!=r&&r.endsWith("%")){const t=1e12;e=Math.round(Number.parseFloat(r)*t)/t+"%"}o={flexBasis:e}}const l=L.Wo.save({className:i,style:o}),s=L.fh.save(l);return(0,a.createElement)("div",s)},deprecated:xu},Iu="core/column",Eu={name:Iu,examples:null,deprecated:null,save:()=>null},Tu={..._u,...ku,...Eu,category:"design",supports:{..._u.supports,anchor:!1}};var Au=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M6.2 5.2v13.4l5.8-4.8 5.8 4.8V5.2z"}));const Du={className:!1,anchor:!0},Lu={align:{type:"string"},content:{type:"string",source:"html",selector:"h1,h2,h3,h4,h5,h6",default:""},level:{type:"number",default:2},placeholder:{type:"string"}},Pu=e=>{if(!e.customTextColor)return e;const t={color:{text:e.customTextColor}};return{...(0,oe.omit)(e,["customTextColor"]),style:t}},Fu=["left","right","center"],Nu=e=>{const{align:t,...n}=e;return Fu.includes(t)?{...n,textAlign:t}:e};var ju=[{supports:{align:["wide","full"],anchor:!0,className:!1,color:{link:!0},fontSize:!0,lineHeight:!0,__experimentalSelector:{"core/heading/h1":"h1","core/heading/h2":"h2","core/heading/h3":"h3","core/heading/h4":"h4","core/heading/h5":"h5","core/heading/h6":"h6"},__unstablePasteTextInline:!0},attributes:Lu,isEligible:e=>{let{align:t}=e;return Fu.includes(t)},migrate:Nu,save(e){let{attributes:t}=e;const{align:n,content:r,level:i}=t,o="h"+i,l=p()({[`has-text-align-${n}`]:n});return(0,a.createElement)(o,L.Wo.save({className:l}),(0,a.createElement)(L.Ho.Content,{value:r}))}},{supports:Du,attributes:{...Lu,customTextColor:{type:"string"},textColor:{type:"string"}},migrate:e=>Pu(Nu(e)),save(e){let{attributes:t}=e;const{align:n,content:r,customTextColor:i,level:o,textColor:l}=t,s="h"+o,c=(0,L.Gd)("color",l),u=p()({[c]:c,"has-text-color":l||i,[`has-text-align-${n}`]:n});return(0,a.createElement)(L.Ho.Content,{className:u||void 0,tagName:s,style:{color:c?void 0:i},value:r})}},{attributes:{...Lu,customTextColor:{type:"string"},textColor:{type:"string"}},migrate:e=>Pu(Nu(e)),save(e){let{attributes:t}=e;const{align:n,content:r,customTextColor:i,level:o,textColor:l}=t,s="h"+o,c=(0,L.Gd)("color",l),u=p()({[c]:c,[`has-text-align-${n}`]:n});return(0,a.createElement)(L.Ho.Content,{className:u||void 0,tagName:s,style:{color:c?void 0:i},value:r})},supports:Du},{supports:Du,attributes:{...Lu,customTextColor:{type:"string"},textColor:{type:"string"}},migrate:e=>Pu(Nu(e)),save(e){let{attributes:t}=e;const{align:n,level:r,content:i,textColor:o,customTextColor:l}=t,s="h"+r,c=(0,L.Gd)("color",o),u=p()({[c]:c});return(0,a.createElement)(L.Ho.Content,{className:u||void 0,tagName:s,style:{textAlign:n,color:c?void 0:l},value:i})}}],Ru=n(12518),Ou=n(51160);function Mu(e){let{level:t,isPressed:n=!1}=e;const r={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return r.hasOwnProperty(t)?(0,a.createElement)(Y.Wj,{width:"24",height:"24",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",isPressed:n},(0,a.createElement)(Y.y$,{d:r[t]})):null}const Bu=[1,2,3,4,5,6],Wu={className:"block-library-heading-level-dropdown"};function zu(e){let{selectedLevel:t,onChange:n}=e;return(0,a.createElement)(Ou.Z,{popoverProps:Wu,icon:(0,a.createElement)(Mu,{level:t}),label:(0,b.__)("Change heading level"),controls:Bu.map((e=>{{const r=e===t;return{icon:(0,a.createElement)(Mu,{level:e,isPressed:r}),label:(0,b.sprintf)((0,b.__)("Heading %d"),e),isActive:r,onClick(){n(e)},role:"menuitemradio"}}}))})}var Hu=n(25454),Zu=n.n(Hu);const Uu={},Vu=(e,t)=>{const n=(e=>Zu()((e=>{const t=document.createElement("div");return t.innerHTML=e,t.innerText})(e)).replace(/[^\p{L}\p{N}]+/gu,"-").toLowerCase().replace(/(^-+)|(-+$)/g,""))(t);if(""===n)return null;delete Uu[e];let r=n,i=0;for(;Object.values(Uu).includes(r);)i+=1,r=n+"-"+i;return r},Gu=(e,t)=>{Uu[e]=t};const{name:qu}={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:2,name:"core/heading",title:"Heading",category:"text",description:"Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.",keywords:["title","subtitle"],textdomain:"default",attributes:{textAlign:{type:"string"},content:{type:"string",source:"html",selector:"h1,h2,h3,h4,h5,h6",default:"",__experimentalRole:"content"},level:{type:"number",default:2},placeholder:{type:"string"}},supports:{align:["wide","full"],anchor:!0,className:!1,color:{link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalDefaultControls:{fontSize:!0,fontAppearance:!0,textTransform:!0}},__experimentalSelector:"h1,h2,h3,h4,h5,h6",__unstablePasteTextInline:!0,__experimentalSlashInserter:!0},editorStyle:"wp-block-heading-editor",style:"wp-block-heading"};var $u={from:[{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:e=>e.map((e=>{let{content:t,anchor:n,align:r}=e;return(0,ur.j4)(qu,{content:t,anchor:n,textAlign:r})}))},{type:"raw",selector:"h1,h2,h3,h4,h5,h6",schema:e=>{let{phrasingContentSchema:t,isPaste:n}=e;const r={children:t,attributes:n?[]:["style","id"]};return{h1:r,h2:r,h3:r,h4:r,h5:r,h6:r}},transform(e){const t=(0,ur.DJ)(qu,e.outerHTML),{textAlign:n}=e.style||{};var r;return t.level=(r=e.nodeName,Number(r.substr(1))),"left"!==n&&"center"!==n&&"right"!==n||(t.align=n),(0,ur.j4)(qu,t)}},...[1,2,3,4,5,6].map((e=>({type:"prefix",prefix:Array(e+1).join("#"),transform:t=>(0,ur.j4)(qu,{level:e,content:t})}))),...[1,2,3,4,5,6].map((e=>({type:"enter",regExp:new RegExp(`^/(h|H)${e}$`),transform:t=>(0,ur.j4)(qu,{level:e,content:t})})))],to:[{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:e=>e.map((e=>{let{content:t,textAlign:n}=e;return(0,ur.j4)("core/paragraph",{content:t,align:n})}))}]};const Yu={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:2,name:"core/heading",title:"Heading",category:"text",description:"Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.",keywords:["title","subtitle"],textdomain:"default",attributes:{textAlign:{type:"string"},content:{type:"string",source:"html",selector:"h1,h2,h3,h4,h5,h6",default:"",__experimentalRole:"content"},level:{type:"number",default:2},placeholder:{type:"string"}},supports:{align:["wide","full"],anchor:!0,className:!1,color:{link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalDefaultControls:{fontSize:!0,fontAppearance:!0,textTransform:!0}},__experimentalSelector:"h1,h2,h3,h4,h5,h6",__unstablePasteTextInline:!0,__experimentalSlashInserter:!0},editorStyle:"wp-block-heading-editor",style:"wp-block-heading"},{name:Ku}=Yu,Xu={icon:Au,example:{attributes:{content:(0,b.__)("Code is Poetry"),level:2}},__experimentalLabel(e,t){let{context:n}=t;const{content:r,level:i}=e;return"list-view"===n&&r?r:"accessibility"===n?(0,oe.isEmpty)(r)?(0,b.sprintf)((0,b.__)("Level %s. Empty."),i):(0,b.sprintf)((0,b.__)("Level %1$s. %2$s"),i,r):void 0},transforms:$u,deprecated:ju,merge:(e,t)=>({content:(e.content||"")+(t.content||"")}),edit:function(e){let{attributes:t,setAttributes:n,mergeBlocks:r,onReplace:i,style:o,clientId:l}=e;const{textAlign:s,content:c,level:u,placeholder:d,anchor:m}=t,g="h"+u,v=(0,L.Wo)({className:p()({[`has-text-align-${s}`]:s}),style:o}),{canGenerateAnchors:y}=(0,f.Z)((e=>{const{getGlobalBlockCount:t,getSettings:n}=e(L.t2);return{canGenerateAnchors:!!n().generateAnchors||t("core/table-of-contents")>0}}),[]),{__unstableMarkNextChangeAsNotPersistent:x}=(0,h.Z)(L.t2);return(0,a.useEffect)((()=>{if(y)return!m&&c&&(x(),n({anchor:Vu(l,c)})),Gu(l,m),()=>Gu(l,null)}),[m,c,l,y]),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.Zp,{group:"block"},(0,a.createElement)(zu,{selectedLevel:u,onChange:e=>n({level:e})}),(0,a.createElement)(L.aE,{value:s,onChange:e=>{n({textAlign:e})}})),(0,a.createElement)(L.Ho,(0,Ce.Z)({identifier:"content",tagName:g,value:c,onChange:e=>{const t={content:e};!y||m&&e&&Vu(l,c)!==m||(t.anchor=Vu(l,e)),n(t)},onMerge:r,onSplit:(e,n)=>{let r;var i;return r=n||e?(0,ur.j4)("core/heading",{...t,content:e}):(0,ur.j4)(null!==(i=(0,ur.UT)())&&void 0!==i?i:"core/heading"),n&&(r.clientId=l),r},onReplace:i,onRemove:()=>i([]),"aria-label":(0,b.__)("Heading text"),placeholder:d||(0,b.__)("Heading"),textAlign:s},Ru.Z.isNative&&{deleteEnter:!0},v)))},save:function(e){let{attributes:t}=e;const{textAlign:n,content:r,level:i}=t,o="h"+i,l=p()({[`has-text-align-${n}`]:n});return(0,a.createElement)(o,L.Wo.save({className:l}),(0,a.createElement)(L.Ho.Content,{value:r}))}},Ju="core/heading",Qu={name:Ju,examples:null,deprecated:null,save:()=>null},ed={...Yu,...Xu,...Qu,category:"design",supports:{...Yu.supports,html:!1}};var td=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M18.3 4H9.9v-.1l-.9.2c-2.3.4-4 2.4-4 4.8s1.7 4.4 4 4.8l.7.1V20h1.5V5.5h2.9V20h1.5V5.5h2.7V4z"})),nd=n(21075);const rd={className:!1},id={align:{type:"string"},content:{type:"string",source:"html",selector:"p",default:""},dropCap:{type:"boolean",default:!1},placeholder:{type:"string"},textColor:{type:"string"},backgroundColor:{type:"string"},fontSize:{type:"string"},direction:{type:"string",enum:["ltr","rtl"]},style:{type:"object"}},od=e=>{if(!e.customTextColor&&!e.customBackgroundColor&&!e.customFontSize)return e;const t={};return(e.customTextColor||e.customBackgroundColor)&&(t.color={}),e.customTextColor&&(t.color.text=e.customTextColor),e.customBackgroundColor&&(t.color.background=e.customBackgroundColor),e.customFontSize&&(t.typography={fontSize:e.customFontSize}),{...(0,oe.omit)(e,["customTextColor","customBackgroundColor","customFontSize"]),style:t}};var ad=[{supports:rd,attributes:{...(0,oe.omit)(id,["style"]),customTextColor:{type:"string"},customBackgroundColor:{type:"string"},customFontSize:{type:"number"}},migrate:od,save(e){let{attributes:t}=e;const{align:n,content:r,dropCap:i,backgroundColor:o,textColor:l,customBackgroundColor:s,customTextColor:c,fontSize:u,customFontSize:d,direction:m}=t,f=(0,L.Gd)("color",l),h=(0,L.Gd)("background-color",o),g=(0,L.rS)(u),v=p()({"has-text-color":l||c,"has-background":o||s,"has-drop-cap":i,[`has-text-align-${n}`]:n,[g]:g,[f]:f,[h]:h}),b={backgroundColor:h?void 0:s,color:f?void 0:c,fontSize:g?void 0:d};return(0,a.createElement)(L.Ho.Content,{tagName:"p",style:b,className:v||void 0,value:r,dir:m})}},{supports:rd,attributes:{...(0,oe.omit)(id,["style"]),customTextColor:{type:"string"},customBackgroundColor:{type:"string"},customFontSize:{type:"number"}},migrate:od,save(e){let{attributes:t}=e;const{align:n,content:r,dropCap:i,backgroundColor:o,textColor:l,customBackgroundColor:s,customTextColor:c,fontSize:u,customFontSize:d,direction:m}=t,f=(0,L.Gd)("color",l),h=(0,L.Gd)("background-color",o),g=(0,L.rS)(u),v=p()({"has-text-color":l||c,"has-background":o||s,"has-drop-cap":i,[g]:g,[f]:f,[h]:h}),b={backgroundColor:h?void 0:s,color:f?void 0:c,fontSize:g?void 0:d,textAlign:n};return(0,a.createElement)(L.Ho.Content,{tagName:"p",style:b,className:v||void 0,value:r,dir:m})}},{supports:rd,attributes:{...(0,oe.omit)(id,["style"]),customTextColor:{type:"string"},customBackgroundColor:{type:"string"},customFontSize:{type:"number"},width:{type:"string"}},migrate:od,save(e){let{attributes:t}=e;const{width:n,align:r,content:i,dropCap:o,backgroundColor:l,textColor:s,customBackgroundColor:c,customTextColor:u,fontSize:d,customFontSize:m}=t,f=(0,L.Gd)("color",s),h=(0,L.Gd)("background-color",l),g=d&&`is-${d}-text`,v=p()({[`align${n}`]:n,"has-background":l||c,"has-drop-cap":o,[g]:g,[f]:f,[h]:h}),b={backgroundColor:h?void 0:c,color:f?void 0:u,fontSize:g?void 0:m,textAlign:r};return(0,a.createElement)(L.Ho.Content,{tagName:"p",style:b,className:v||void 0,value:i})}},{supports:rd,attributes:(0,oe.omit)({...id,fontSize:{type:"number"}},["style"]),save(e){let{attributes:t}=e;const{width:n,align:r,content:i,dropCap:o,backgroundColor:l,textColor:s,fontSize:c}=t,u=p()({[`align${n}`]:n,"has-background":l,"has-drop-cap":o}),d={backgroundColor:l,color:s,fontSize:c,textAlign:r};return(0,a.createElement)("p",{style:d,className:u||void 0},i)},migrate:e=>od((0,oe.omit)({...e,customFontSize:Number.isFinite(e.fontSize)?e.fontSize:void 0,customTextColor:e.textColor&&"#"===e.textColor[0]?e.textColor:void 0,customBackgroundColor:e.backgroundColor&&"#"===e.backgroundColor[0]?e.backgroundColor:void 0}))},{supports:rd,attributes:{...id,content:{type:"string",source:"html",default:""}},save(e){let{attributes:t}=e;return(0,a.createElement)(nd.Z,null,t.content)},migrate:e=>e}],ld=n(73783),sd=n(29334),cd=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,a.createElement)(Y.y$,{d:"M5.52 2h7.43c.55 0 1 .45 1 1s-.45 1-1 1h-1v13c0 .55-.45 1-1 1s-1-.45-1-1V5c0-.55-.45-1-1-1s-1 .45-1 1v12c0 .55-.45 1-1 1s-1-.45-1-1v-5.96h-.43C3.02 11.04 1 9.02 1 6.52S3.02 2 5.52 2zM14 14l5-4-5-4v8z"})),ud=n(39917);function dd(e){const{batch:t}=(0,ke.Z)(),{moveBlocksToPosition:n,replaceInnerBlocks:r,duplicateBlocks:i,insertBlock:o}=(0,h.Z)(L.t2),{getBlockRootClientId:l,getBlockIndex:s,getBlockOrder:c,getBlockName:u,getBlock:d,getNextBlockClientId:p}=(0,f.Z)(L.t2),m=(0,a.useRef)(e);return m.current=e,(0,ud.Z)((e=>{function a(e){if(e.defaultPrevented)return;if(e.keyCode!==X.ENTER)return;const{content:a,clientId:f}=m.current;if(a.length)return;const h=l(f);if(!(0,ur.zb)(u(h),"__experimentalOnEnter",!1))return;const g=c(h);e.preventDefault();const v=g.indexOf(f);if(v===g.length-1)return void n([f],h,l(h),s(h)+1);const b=d(h);t((()=>{i([h]);const e=s(h);r(h,b.innerBlocks.slice(0,v)),r(p(h),b.innerBlocks.slice(v+1)),o((0,ur.j4)("core/paragraph"),e+1,l(h),!0)}))}return e.addEventListener("keydown",a),()=>{e.removeEventListener("keydown",a)}}),[])}function pd(e){let{direction:t,setDirection:n}=e;return(0,b.isRTL)()&&(0,a.createElement)(ld.Z,{icon:cd,title:(0,b._x)("Left to right","editor button"),isActive:"ltr"===t,onClick:()=>{n("ltr"===t?void 0:"ltr")}})}const{name:md}={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:2,name:"core/paragraph",title:"Paragraph",category:"text",description:"Start with the basic building block of all narrative.",keywords:["text"],textdomain:"default",attributes:{align:{type:"string"},content:{type:"string",source:"html",selector:"p",default:"",__experimentalRole:"content"},dropCap:{type:"boolean",default:!1},placeholder:{type:"string"},direction:{type:"string",enum:["ltr","rtl"]}},supports:{anchor:!0,className:!1,color:{link:!0,__experimentalDefaultControls:{background:!0,text:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalDefaultControls:{fontSize:!0}},__experimentalSelector:"p",__unstablePasteTextInline:!0},editorStyle:"wp-block-paragraph-editor",style:"wp-block-paragraph"};var fd={from:[{type:"raw",priority:20,selector:"p",schema:e=>{let{phrasingContentSchema:t,isPaste:n}=e;return{p:{children:t,attributes:n?[]:["style","id"]}}},transform(e){const t=(0,ur.DJ)(md,e.outerHTML),{textAlign:n}=e.style||{};return"left"!==n&&"center"!==n&&"right"!==n||(t.align=n),(0,ur.j4)(md,t)}}]};const hd={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:2,name:"core/paragraph",title:"Paragraph",category:"text",description:"Start with the basic building block of all narrative.",keywords:["text"],textdomain:"default",attributes:{align:{type:"string"},content:{type:"string",source:"html",selector:"p",default:"",__experimentalRole:"content"},dropCap:{type:"boolean",default:!1},placeholder:{type:"string"},direction:{type:"string",enum:["ltr","rtl"]}},supports:{anchor:!0,className:!1,color:{link:!0,__experimentalDefaultControls:{background:!0,text:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalDefaultControls:{fontSize:!0}},__experimentalSelector:"p",__unstablePasteTextInline:!0},editorStyle:"wp-block-paragraph-editor",style:"wp-block-paragraph"},{name:gd}=hd,vd={icon:td,example:{attributes:{content:(0,b.__)("In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing."),style:{typography:{fontSize:28}},dropCap:!0}},__experimentalLabel(e,t){let{context:n}=t;if("accessibility"===n){const{content:t}=e;return(0,oe.isEmpty)(t)?(0,b.__)("Empty"):t}},transforms:fd,deprecated:ad,merge:(e,t)=>({content:(e.content||"")+(t.content||"")}),edit:function(e){let{attributes:t,mergeBlocks:n,onReplace:r,onRemove:i,setAttributes:o,clientId:l}=e;const{align:s,content:c,direction:u,dropCap:d,placeholder:m}=t,f=(0,L.yu)("typography.dropCap"),h=(0,L.Wo)({ref:dd({clientId:l,content:c}),className:p()({"has-drop-cap":d,[`has-text-align-${s}`]:s}),style:{direction:u}});return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.Zp,{group:"block"},(0,a.createElement)(L.aE,{value:s,onChange:e=>o({align:e})}),(0,a.createElement)(pd,{direction:u,setDirection:e=>o({direction:e})})),f&&(0,a.createElement)(L.Af,{__experimentalGroup:"typography"},(0,a.createElement)(sd.Z,{hasValue:()=>!!d,label:(0,b.__)("Drop cap"),onDeselect:()=>o({dropCap:void 0}),resetAllFilter:()=>({dropCap:void 0}),panelId:l},(0,a.createElement)(se.Z,{label:(0,b.__)("Drop cap"),checked:!!d,onChange:()=>o({dropCap:!d}),help:d?(0,b.__)("Showing large initial letter."):(0,b.__)("Toggle to show a large initial letter.")}))),(0,a.createElement)(L.Ho,(0,Ce.Z)({identifier:"content",tagName:"p"},h,{value:c,onChange:e=>o({content:e}),onSplit:(e,n)=>{let r;(n||e)&&(r={...t,content:e});const i=(0,ur.j4)("core/paragraph",r);return n&&(i.clientId=l),i},onMerge:n,onReplace:r,onRemove:i,"aria-label":c?(0,b.__)("Paragraph block"):(0,b.__)("Empty block; start writing or type forward slash to choose a block"),"data-empty":!c,placeholder:m||(0,b.__)("Type / to choose a block"),__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0})))},save:function(e){let{attributes:t}=e;const{align:n,content:r,dropCap:i,direction:o}=t,l=p()({"has-drop-cap":i,[`has-text-align-${n}`]:n});return(0,a.createElement)("p",L.Wo.save({className:l,dir:o}),(0,a.createElement)(L.Ho.Content,{value:r}))}},bd="core/paragraph",yd={name:bd,examples:null,deprecated:null,save:()=>null},xd={...hd,...vd,...yd,category:"design",supports:{...hd.supports,html:!1,anchor:!1}};var wd=(0,a.createElement)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(Y.y$,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"}));const Cd={align:{type:"string"},url:{type:"string",source:"attribute",selector:"img",attribute:"src"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},caption:{type:"string",source:"html",selector:"figcaption"},title:{type:"string",source:"attribute",selector:"img",attribute:"title"},href:{type:"string",source:"attribute",selector:"figure > a",attribute:"href"},rel:{type:"string",source:"attribute",selector:"figure > a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure > a",attribute:"class"},id:{type:"number"},width:{type:"number"},height:{type:"number"},sizeSlug:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure > a",attribute:"target"}},_d={anchor:!0,color:{__experimentalDuotone:"img",text:!1,background:!1},__experimentalBorder:{radius:!0,__experimentalDefaultControls:{radius:!0}}},Sd=[{attributes:Cd,supports:_d,save(e){let{attributes:t}=e;const{url:n,alt:r,caption:i,align:o,href:l,rel:s,linkClass:c,width:u,height:d,id:m,linkTarget:f,sizeSlug:h,title:g}=t,v=(0,oe.isEmpty)(s)?void 0:s,b=p()({[`align${o}`]:o,[`size-${h}`]:h,"is-resized":u||d}),y=(0,a.createElement)("img",{src:n,alt:r,className:m?`wp-image-${m}`:null,width:u,height:d,title:g}),x=(0,a.createElement)(a.Fragment,null,l?(0,a.createElement)("a",{className:c,href:l,target:f,rel:v},y):y,!L.Ho.isEmpty(i)&&(0,a.createElement)(L.Ho.Content,{tagName:"figcaption",value:i}));return(0,a.createElement)("figure",L.Wo.save({className:b}),x)}},{attributes:{...Cd,title:{type:"string",source:"attribute",selector:"img",attribute:"title"},sizeSlug:{type:"string"}},supports:_d,save(e){let{attributes:t}=e;const{url:n,alt:r,caption:i,align:o,href:l,rel:s,linkClass:c,width:u,height:d,id:m,linkTarget:f,sizeSlug:h,title:g}=t,v=(0,oe.isEmpty)(s)?void 0:s,b=p()({[`align${o}`]:o,[`size-${h}`]:h,"is-resized":u||d}),y=(0,a.createElement)("img",{src:n,alt:r,className:m?`wp-image-${m}`:null,width:u,height:d,title:g}),x=(0,a.createElement)(a.Fragment,null,l?(0,a.createElement)("a",{className:c,href:l,target:f,rel:v},y):y,!L.Ho.isEmpty(i)&&(0,a.createElement)(L.Ho.Content,{tagName:"figcaption",value:i}));return"left"===o||"right"===o||"center"===o?(0,a.createElement)("div",L.Wo.save(),(0,a.createElement)("figure",{className:b},x)):(0,a.createElement)("figure",L.Wo.save({className:b}),x)}},{attributes:Cd,save(e){let{attributes:t}=e;const{url:n,alt:r,caption:i,align:o,href:l,width:s,height:c,id:u}=t,d=p()({[`align${o}`]:o,"is-resized":s||c}),m=(0,a.createElement)("img",{src:n,alt:r,className:u?`wp-image-${u}`:null,width:s,height:c});return(0,a.createElement)("figure",{className:d},l?(0,a.createElement)("a",{href:l},m):m,!L.Ho.isEmpty(i)&&(0,a.createElement)(L.Ho.Content,{tagName:"figcaption",value:i}))}},{attributes:Cd,save(e){let{attributes:t}=e;const{url:n,alt:r,caption:i,align:o,href:l,width:s,height:c,id:u}=t,d=(0,a.createElement)("img",{src:n,alt:r,className:u?`wp-image-${u}`:null,width:s,height:c});return(0,a.createElement)("figure",{className:o?`align${o}`:null},l?(0,a.createElement)("a",{href:l},d):d,!L.Ho.isEmpty(i)&&(0,a.createElement)(L.Ho.Content,{tagName:"figcaption",value:i}))}},{attributes:Cd,save(e){let{attributes:t}=e;const{url:n,alt:r,caption:i,align:o,href:l,width:s,height:c}=t,u=s||c?{width:s,height:c}:{},d=(0,a.createElement)("img",(0,Ce.Z)({src:n,alt:r},u));let p={};return s?p={width:s}:"left"!==o&&"right"!==o||(p={maxWidth:"50%"}),(0,a.createElement)("figure",{className:o?`align${o}`:null,style:p},l?(0,a.createElement)("a",{href:l},d):d,!L.Ho.isEmpty(i)&&(0,a.createElement)(L.Ho.Content,{tagName:"figcaption",value:i}))}}];var kd=Sd,Id=n(20297),Ed=n(22449),Td=n(95322),Ad=n(5114),Dd=n(43627),Ld=n(75349),Pd=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M16.5 7.8v7H18v-7c0-1-.8-1.8-1.8-1.8h-7v1.5h7c.2 0 .3.1.3.3zm-8.7 8.7c-.1 0-.2-.1-.2-.2V2H6v4H2v1.5h4v8.8c0 1 .8 1.8 1.8 1.8h8.8v4H18v-4h4v-1.5H7.8z"})),Fd=n(4059),Nd=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12-9.8c.4 0 .8-.3.9-.7l1.1-3h3.6l.5 1.7h1.9L13 9h-2.2l-3.4 9.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v12H20V6c0-1.1-.9-2-2-2zm-6 7l1.4 3.9h-2.7L12 11z"}));const jd=[{ratio:"2.33",className:"wp-embed-aspect-21-9"},{ratio:"2.00",className:"wp-embed-aspect-18-9"},{ratio:"1.78",className:"wp-embed-aspect-16-9"},{ratio:"1.33",className:"wp-embed-aspect-4-3"},{ratio:"1.00",className:"wp-embed-aspect-1-1"},{ratio:"0.56",className:"wp-embed-aspect-9-16"},{ratio:"0.50",className:"wp-embed-aspect-1-2"}],Rd="wp-embed";var Od=n(41779),Md=n.n(Od),Bd=n(35721),Wd=n.n(Bd);const{name:zd}={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:2,name:"core/embed",title:"Embed",category:"embed",description:"Add a block that displays content pulled from other sites, like Twitter or YouTube.",textdomain:"default",attributes:{url:{type:"string"},caption:{type:"string",source:"html",selector:"figcaption"},type:{type:"string"},providerNameSlug:{type:"string"},allowResponsive:{type:"boolean",default:!0},responsive:{type:"boolean",default:!1},previewable:{type:"boolean",default:!0}},supports:{align:!0,__experimentalStyle:{spacing:{margin:"0 0 1em 0"}}},editorStyle:"wp-block-embed-editor",style:"wp-block-embed"},Hd=e=>{var t;return null===(t=(0,ur.Nr)(zd))||void 0===t?void 0:t.find((t=>{let{patterns:n}=t;return function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).some((t=>e.match(t)))}(e,n)}))},Zd=e=>e&&e.includes('class="wp-embedded-content"'),Ud=e=>{if(!e)return e;const t=jd.reduce(((e,t)=>{let{className:n}=t;return e[n]=!1,e}),{"wp-has-aspect-ratio":!1});return Md()(e,t)};function Vd(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!n)return Ud(t);const r=document.implementation.createHTMLDocument("");r.body.innerHTML=e;const i=r.body.querySelector("iframe");if(i&&i.height&&i.width){const e=(i.width/i.height).toFixed(2);for(let n=0;n<jd.length;n++){const r=jd[n];if(e>=r.ratio)return e-r.ratio>.1?Ud(t):Md()(Ud(t),r.className,"wp-has-aspect-ratio")}}return t}Wd()((function(e,t,n,r){let i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];if(!e)return{};const o={};let{type:a="rich"}=e;const{html:l,provider_name:s}=e,c=(0,oe.kebabCase)((s||t).toLowerCase());return Zd(l)&&(a=Rd),(l||"photo"===a)&&(o.type=a,o.providerNameSlug=c),o.className=Vd(l,n,r&&i),o}));const Gd="none",qd="media",$d="attachment",Yd="custom",Kd=["image"];function Xd(e){var t,n;let{temporaryURL:r,attributes:i,setAttributes:o,isSelected:l,insertBlocksAfter:s,onReplace:c,onSelectImage:u,onSelectURL:d,onUploadError:p,containerRef:g,context:v,clientId:y}=e;const{url:x="",alt:w,caption:C,align:_,id:S,href:k,rel:I,linkClass:T,linkDestination:A,title:D,width:P,height:F,linkTarget:N,sizeSlug:j}=i,R=(0,a.useRef)(),O=(0,a.useRef)(),M=(0,Ad.Z)(x),{allowResize:B=!0}=v,{getBlock:W}=(0,f.Z)(L.t2),{image:z,multiImageSelection:H}=(0,f.Z)((e=>{const{getMedia:t}=e(m.h),{getMultiSelectedBlockClientIds:n,getBlockName:r}=e(L.t2),i=n();return{image:S&&l?t(S,{context:"view"}):null,multiImageSelection:i.length&&i.every((e=>"core/image"===r(e)))}}),[S,l]),{canInsertCover:Z,imageEditing:U,imageSizes:V,maxWidth:G,mediaUpload:q}=(0,f.Z)((e=>{const{getBlockRootClientId:t,getSettings:n,canInsertBlockType:r}=e(L.t2),i=t(y);return{...(0,oe.pick)(n(),["imageEditing","imageSizes","maxWidth","mediaUpload"]),canInsertCover:r("core/cover",i)}}),[y]),{replaceBlocks:$,toggleSelection:Y}=(0,h.Z)(L.t2),{createErrorNotice:K,createSuccessNotice:X}=(0,h.Z)(nn.h),J=(0,Dd.Z)("medium"),Q=(0,oe.includes)(["wide","full"],_),[{loadedNaturalWidth:ee,loadedNaturalHeight:te},ne]=(0,a.useState)({}),[re,ie]=(0,a.useState)(!1),[ae,se]=(0,a.useState)(),ce=function(e,t){const[n,r]=(0,a.useState)();function i(){r(e.current.clientWidth)}return(0,a.useEffect)(i,t),(0,a.useEffect)((()=>{const{defaultView:t}=e.current.ownerDocument;return t.addEventListener("resize",i),()=>{t.removeEventListener("resize",i)}}),[]),n}(g,[_]),ue=B&&!(Q&&J),de=(0,oe.map)((0,oe.filter)(V,(e=>{let{slug:t}=e;return(0,oe.get)(z,["media_details","sizes",t,"source_url"])})),(e=>{let{name:t,slug:n}=e;return{value:n,label:t}}));(0,a.useEffect)((()=>{Jd(S,x)&&l&&!ae&&window.fetch(x).then((e=>e.blob())).then((e=>se(e))).catch((()=>{}))}),[S,x,l,ae]),(0,a.useEffect)((()=>{x&&!M&&l&&O.current.focus()}),[x,M]);const{naturalWidth:me,naturalHeight:fe}=(0,a.useMemo)((()=>{var e,t;return{naturalWidth:(null===(e=R.current)||void 0===e?void 0:e.naturalWidth)||ee||void 0,naturalHeight:(null===(t=R.current)||void 0===t?void 0:t.naturalHeight)||te||void 0}}),[ee,te,null===(t=R.current)||void 0===t?void 0:t.complete]);(0,a.useEffect)((()=>{l||ie(!1)}),[l]);const he=S&&me&&fe&&U,ge=!H&&he&&!re,ve=(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.Zp,{group:"block"},(0,a.createElement)(L.Dh,{value:_,onChange:function(e){const t=["wide","full"].includes(e)?{width:void 0,height:void 0}:{};o({...t,align:e})}}),!H&&!re&&(0,a.createElement)(L.n_,{url:k||"",onChangeUrl:function(e){o(e)},linkDestination:A,mediaUrl:z&&z.source_url||x,mediaLink:z&&z.link,linkTarget:N,linkClass:T,rel:I}),ge&&(0,a.createElement)(ld.Z,{onClick:()=>ie(!0),icon:Pd,label:(0,b.__)("Crop")}),ae&&(0,a.createElement)(ld.Z,{onClick:function(){q({filesList:[ae],onFileChange(e){let[t]=e;u(t),(0,E.Gu)(t.url)||(se(),X((0,b.__)("Image uploaded."),{type:"snackbar"}))},allowedTypes:Kd,onError(e){K(e,{type:"snackbar"})}})},icon:Fd.Z,label:(0,b.__)("Upload external image")}),!H&&Z&&(0,a.createElement)(ld.Z,{icon:Nd,label:(0,b.__)("Add text over image"),onClick:function(){$(y,(0,ur.m4)(W(y),"core/cover"))}})),!H&&!re&&(0,a.createElement)(L.Zp,{group:"other"},(0,a.createElement)(L.mS,{mediaId:S,mediaURL:x,allowedTypes:Kd,accept:"image/*",onSelect:u,onSelectURL:d,onError:p})),(0,a.createElement)(L.Af,null,(0,a.createElement)(le.Z,{title:(0,b.__)("Settings")},!H&&(0,a.createElement)(pe.Z,{label:(0,b.__)("Alt text (alternative text)"),value:w,onChange:function(e){o({alt:e})},help:(0,a.createElement)(a.Fragment,null,(0,a.createElement)(Ed.Z,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree"},(0,b.__)("Describe the purpose of the image")),(0,b.__)("Leave empty if the image is purely decorative."))}),(0,a.createElement)(L.lf,{onChangeImage:function(e){const t=(0,oe.get)(z,["media_details","sizes",e,"source_url"]);if(!t)return null;o({url:t,width:void 0,height:void 0,sizeSlug:e})},onChange:e=>o(e),slug:j,width:P,height:F,imageSizeOptions:de,isResizable:ue,imageWidth:me,imageHeight:fe}))),(0,a.createElement)(L.Af,{__experimentalGroup:"advanced"},(0,a.createElement)(br.Z,{label:(0,b.__)("Title attribute"),value:D||"",onChange:function(e){o({title:e})},help:(0,a.createElement)(a.Fragment,null,(0,b.__)("Describe the role of this image on the page."),(0,a.createElement)(Ed.Z,{href:"https://www.w3.org/TR/html52/dom.html#the-title-attribute"},(0,b.__)("(Note: many devices and browsers do not display this text.)")))}))),be=(0,Ld.v)(x);let ye;ye=w||(be?(0,b.sprintf)((0,b.__)("This image has an empty alt attribute; its file name is %s"),be):(0,b.__)("This image has an empty alt attribute"));const xe=(0,L.P1)(i),we=null===(n=i.className)||void 0===n?void 0:n.includes("is-style-rounded"),Ce=!!xe.className||!(0,oe.isEmpty)(xe.style);let _e,Se,ke=(0,a.createElement)(a.Fragment,null,(0,a.createElement)("img",{src:r||x,alt:ye,onError:()=>function(){const e=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{preview:r,attributes:i={}}=e,{url:o,providerNameSlug:a,type:l,...s}=i;if(!o||!(0,ur.ck)(zd))return;const c=Hd(o),u="wordpress"===a||l===Rd;if(!u&&c&&(c.attributes.providerNameSlug!==a||!a))return(0,ur.j4)(zd,{url:o,...s,...c.attributes});const d=null===(t=(0,ur.Nr)(zd))||void 0===t?void 0:t.find((e=>{let{name:t}=e;return"wordpress"===t}));return d&&r&&Zd(r.html)&&!u?(0,ur.j4)(zd,{url:o,...d.attributes,...n}):void 0}({attributes:{url:x}});void 0!==e&&c(e)}(),onLoad:e=>{var t,n;ne({loadedNaturalWidth:null===(t=e.target)||void 0===t?void 0:t.naturalWidth,loadedNaturalHeight:null===(n=e.target)||void 0===n?void 0:n.naturalHeight})},ref:R,className:xe.className,style:xe.style}),r&&(0,a.createElement)($t.ZP,null));if(ce&&me&&fe){const e=me>ce,t=fe/me;_e=e?ce:me,Se=e?ce*t:fe}if(he&&re)ke=(0,a.createElement)(L.C9,{borderProps:we?void 0:xe,url:x,width:P,height:F,clientWidth:ce,naturalHeight:fe,naturalWidth:me});else if(ue&&_e){const e=P||_e,t=F||Se,n=me/fe,r=me<fe?20:20*n,i=fe<me?20:20/n,s=2.5*G;let c=!1,u=!1;"center"===_?(c=!0,u=!0):(0,b.isRTL)()?"left"===_?c=!0:u=!0:"right"===_?u=!0:c=!0,ke=(0,a.createElement)(Td.Z,{size:{width:null!=P?P:"auto",height:F&&!Ce?F:"auto"},showHandle:l,minWidth:r,maxWidth:s,minHeight:i,maxHeight:s/n,lockAspectRatio:!0,enable:{top:!1,right:c,bottom:!0,left:u},onResizeStart:function(){Y(!1)},onResizeStop:(n,r,i,a)=>{Y(!0),o({width:parseInt(e+a.width,10),height:parseInt(t+a.height,10)})}},ke)}else ke=(0,a.createElement)("div",{style:{width:P,height:F}},ke);return(0,a.createElement)(L.JZ,{id:S,url:x,naturalWidth:me,naturalHeight:fe,clientWidth:ce,onSaveImage:e=>o(e),isEditing:re,onFinishEditing:()=>ie(!1)},!r&&ve,ke,(!L.Ho.isEmpty(C)||l)&&(0,a.createElement)(L.Ho,{className:(0,L.F6)("caption"),ref:O,tagName:"figcaption","aria-label":(0,b.__)("Image caption text"),placeholder:(0,b.__)("Add caption"),value:C,onChange:e=>o({caption:e}),inlineToolbar:!0,__unstableOnSplitAtEnd:()=>s((0,ur.j4)((0,ur.UT)()))}))}const Jd=(e,t)=>t&&!e&&!(0,E.Gu)(t);var Qd=(0,Id.Z)((function(e){let{attributes:t,setAttributes:n,isSelected:r,className:i,noticeUI:o,insertBlocksAfter:l,noticeOperations:s,onReplace:c,context:u,clientId:d}=e;const{url:m="",alt:h,caption:g,align:v,id:y,width:x,height:w,sizeSlug:C}=t,[_,S]=(0,a.useState)(),k=(0,a.useRef)();(0,a.useEffect)((()=>{k.current=h}),[h]);const I=(0,a.useRef)();(0,a.useEffect)((()=>{I.current=g}),[g]);const T=(0,a.useRef)(),{imageDefaultSize:A,mediaUpload:D}=(0,f.Z)((e=>{const{getSettings:t}=e(L.t2);return(0,oe.pick)(t(),["imageDefaultSize","mediaUpload"])}),[]);function P(e){s.removeAllNotices(),s.createErrorNotice(e),n({src:void 0,id:void 0,url:void 0}),S(void 0)}function F(e){var r,i,o,a,l,s;if(!e||!e.url)return void n({url:void 0,alt:void 0,id:void 0,title:void 0,caption:void 0});if((0,E.Gu)(e.url))return void S(e.url);S();let c,u=((e,t)=>{const n=(0,oe.pick)(e,["alt","id","link","caption"]);return n.url=(0,oe.get)(e,["sizes",t,"url"])||(0,oe.get)(e,["media_details","sizes",t,"source_url"])||e.url,n})(e,A);var d,p;I.current&&!(0,oe.get)(u,["caption"])&&(u=(0,oe.omit)(u,["caption"])),c=e.id&&e.id===y?{url:m}:{width:void 0,height:void 0,sizeSlug:(d=e,p=A,(0,oe.has)(d,["sizes",p,"url"])||(0,oe.has)(d,["media_details","sizes",p,"source_url"])?A:"full")};let f,h=t.linkDestination;if(!h)switch((null===(r=window)||void 0===r||null===(i=r.wp)||void 0===i||null===(o=i.media)||void 0===o||null===(a=o.view)||void 0===a||null===(l=a.settings)||void 0===l||null===(s=l.defaultProps)||void 0===s?void 0:s.link)||Gd){case"file":case qd:h=qd;break;case"post":case $d:h=$d;break;case Yd:h=Yd;break;case Gd:h=Gd}switch(h){case qd:f=e.url;break;case $d:f=e.link}u.href=f,n({...u,...c,linkDestination:h})}function N(e){e!==m&&n({url:e,id:void 0,width:void 0,height:void 0,sizeSlug:A})}let j=((e,t)=>!e&&(0,E.Gu)(t))(y,m);(0,a.useEffect)((()=>{if(!j)return;const e=(0,E.TR)(m);e&&D({filesList:[e],onFileChange:e=>{let[t]=e;F(t)},allowedTypes:Kd,onError:e=>{j=!1,P(e)}})}),[]),(0,a.useEffect)((()=>{j?S(m):(0,E.Vg)(_)}),[j,m]);const R=Jd(y,m)?m:void 0,O=!!m&&(0,a.createElement)("img",{alt:(0,b.__)("Edit image"),title:(0,b.__)("Edit image"),className:"edit-image-preview",src:m}),M=(0,L.P1)(t),B=p()(i,{"is-transient":_,"is-resized":!!x||!!w,[`size-${C}`]:C,"has-custom-border":!!M.className||!(0,oe.isEmpty)(M.style)}),W=(0,L.Wo)({ref:T,className:B});return(0,a.createElement)("figure",W,(_||m)&&(0,a.createElement)(Xd,{temporaryURL:_,attributes:t,setAttributes:n,isSelected:r,insertBlocksAfter:l,onReplace:c,onSelectImage:F,onSelectURL:N,onUploadError:P,containerRef:T,context:u,clientId:d}),!m&&(0,a.createElement)(L.Zp,{group:"block"},(0,a.createElement)(L.Dh,{value:v,onChange:function(e){const t=["wide","full"].includes(e)?{width:void 0,height:void 0}:{};n({...t,align:e})}})),(0,a.createElement)(L.om,{icon:(0,a.createElement)(L.wD,{icon:wd}),onSelect:F,onSelectURL:N,notices:o,onError:P,accept:"image/*",allowedTypes:Kd,value:{id:y,src:R},mediaPreview:O,disableMediaButtons:_||m}))}));function ep(e,t){const{body:n}=document.implementation.createHTMLDocument("");n.innerHTML=e;const{firstElementChild:r}=n;if(r&&"A"===r.nodeName)return r.getAttribute(t)||void 0}const tp={img:{attributes:["src","alt","title"],classes:["alignleft","aligncenter","alignright","alignnone",/^wp-image-\d+$/]}},np={from:[{type:"raw",isMatch:e=>"FIGURE"===e.nodeName&&!!e.querySelector("img"),schema:e=>{let{phrasingContentSchema:t}=e;return{figure:{require:["img"],children:{...tp,a:{attributes:["href","rel","target"],children:tp},figcaption:{children:t}}}}},transform:e=>{const t=e.className+" "+e.querySelector("img").className,n=/(?:^|\s)align(left|center|right)(?:$|\s)/.exec(t),r=""===e.id?void 0:e.id,i=n?n[1]:void 0,o=/(?:^|\s)wp-image-(\d+)(?:$|\s)/.exec(t),a=o?Number(o[1]):void 0,l=e.querySelector("a"),s=l&&l.href?"custom":void 0,c=l&&l.href?l.href:void 0,u=l&&l.rel?l.rel:void 0,d=l&&l.className?l.className:void 0,p=(0,ur.DJ)("core/image",e.outerHTML,{align:i,id:a,linkDestination:s,href:c,rel:u,linkClass:d,anchor:r});return(0,ur.j4)("core/image",p)}},{type:"files",isMatch(e){if(e.some((e=>0===e.type.indexOf("image/")))&&e.some((e=>0!==e.type.indexOf("image/")))){const{createErrorNotice:e}=(0,rn.dispatch)(nn.h);e((0,b.__)("If uploading to a gallery all files need to be image formats"),{id:"gallery-transform-invalid-file"})}return(0,oe.every)(e,(e=>0===e.type.indexOf("image/")))},transform:e=>e.map((e=>(0,ur.j4)("core/image",{url:(0,E.ZR)(e)})))},{type:"shortcode",tag:"caption",attributes:{url:{type:"string",source:"attribute",attribute:"src",selector:"img"},alt:{type:"string",source:"attribute",attribute:"alt",selector:"img"},caption:{shortcode:function(e,t){let{shortcode:n}=t;const{body:r}=document.implementation.createHTMLDocument("");r.innerHTML=n.content;let i=r.querySelector("img");for(;i&&i.parentNode&&i.parentNode!==r;)i=i.parentNode;return i&&i.parentNode.removeChild(i),r.innerHTML.trim()}},href:{shortcode:(e,t)=>{let{shortcode:n}=t;return ep(n.content,"href")}},rel:{shortcode:(e,t)=>{let{shortcode:n}=t;return ep(n.content,"rel")}},linkClass:{shortcode:(e,t)=>{let{shortcode:n}=t;return ep(n.content,"class")}},id:{type:"number",shortcode:e=>{let{named:{id:t}}=e;if(t)return parseInt(t.replace("attachment_",""),10)}},align:{type:"string",shortcode:e=>{let{named:{align:t="alignnone"}}=e;return t.replace("align","")}}}}]};var rp=np;const ip={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:2,name:"core/image",title:"Image",category:"media",usesContext:["allowResize","imageCrop","fixedHeight"],description:"Insert an image to make a visual statement.",keywords:["img","photo","picture"],textdomain:"default",attributes:{align:{type:"string"},url:{type:"string",source:"attribute",selector:"img",attribute:"src"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},caption:{type:"string",source:"html",selector:"figcaption"},title:{type:"string",source:"attribute",selector:"img",attribute:"title"},href:{type:"string",source:"attribute",selector:"figure > a",attribute:"href"},rel:{type:"string",source:"attribute",selector:"figure > a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure > a",attribute:"class"},id:{type:"number"},width:{type:"number"},height:{type:"number"},sizeSlug:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure > a",attribute:"target"}},supports:{anchor:!0,color:{__experimentalDuotone:"img",text:!1,background:!1},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSelector:"img, .wp-block-image__crop-area",__experimentalSkipSerialization:!0,__experimentalDefaultControls:{color:!0,radius:!0,width:!0}},__experimentalStyle:{spacing:{margin:"0 0 1em 0"}}},styles:[{name:"default",label:"Default",isDefault:!0},{name:"rounded",label:"Rounded"}],editorStyle:"wp-block-image-editor",style:"wp-block-image"},{name:op}=ip,ap={icon:wd,example:{attributes:{sizeSlug:"large",url:"https://s.w.org/images/core/5.3/MtBlanc1.jpg",caption:(0,b.__)("Mont Blanc appears—still, snowy, and serene.")}},__experimentalLabel(e,t){let{context:n}=t;if("accessibility"===n){const{caption:t,alt:n,url:r}=e;return r?n?n+(t?". "+t:""):t||"":(0,b.__)("Empty")}},getEditWrapperProps:e=>({"data-align":e.align}),transforms:rp,edit:Qd,save:function(e){let{attributes:t}=e;const{url:n,alt:r,caption:i,align:o,href:l,rel:s,linkClass:c,width:u,height:d,id:m,linkTarget:f,sizeSlug:h,title:g}=t,v=(0,oe.isEmpty)(s)?void 0:s,b=(0,L.fG)(t),y=p()({[`align${o}`]:o,[`size-${h}`]:h,"is-resized":u||d,"has-custom-border":!!b.className||!(0,oe.isEmpty)(b.style)}),x=p()(b.className,{[`wp-image-${m}`]:!!m}),w=(0,a.createElement)("img",{src:n,alt:r,className:x||void 0,style:b.style,width:u,height:d,title:g}),C=(0,a.createElement)(a.Fragment,null,l?(0,a.createElement)("a",{className:c,href:l,target:f,rel:v},w):w,!L.Ho.isEmpty(i)&&(0,a.createElement)(L.Ho.Content,{className:(0,L.F6)("caption"),tagName:"figcaption",value:i}));return(0,a.createElement)("figure",L.Wo.save({className:y}),C)},deprecated:kd},lp="core/image",sp={name:lp,examples:null,deprecated:null,save:()=>null},cp={...ip,...ap,...sp,category:"design",supports:{...ip.supports,html:!1,anchor:!1}},up=e=>{const t=gc(e);if(!t[e.type])return null;const n=fr(t[e.type].name,e);return(0,ur.uW)(n,t[e.type].settings),n},dp=e=>{let t=null;return Array.isArray(e.errors)&&e.errors.length>0&&(t=e.errors.map((e=>e.message)),t=t.join(", ")),t},pp=(e,t)=>e.map((e=>{const n=t(e);return e.innerBlocks?{...n,innerBlocks:pp(e.innerBlocks,t)}:n})),mp={async SAVE_FORM(){if((0,rn.select)("mailpoet-form-editor").getIsFormSaving())return;if((0,rn.dispatch)("mailpoet-form-editor").saveFormStarted(),(0,rn.select)("mailpoet-form-editor").getFormErrors().length)return;const e=(0,rn.select)("mailpoet-form-editor").getFormData(),t=(0,rn.select)("mailpoet-form-editor").getFormBlocks(),n=(0,rn.select)("mailpoet-form-editor").getAllAvailableCustomFields(),r=cn(L.w0.fontSizes,L.w0.colors,L.w0.gradients,n),i={...un(e),body:r(t),editor_version:2};await j.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"saveEditor",data:i}).done((e=>{(0,rn.dispatch)("mailpoet-form-editor").saveFormDone(e.data.id),cr.remove(`popup_form_dismissed_${e.data.id}`,{path:"/"})})).fail((e=>{(0,rn.dispatch)("mailpoet-form-editor").saveFormFailed(dp(e))}))},async SAVE_CUSTOM_FIELD(e){(0,rn.dispatch)("mailpoet-form-editor").saveCustomFieldStarted();const t=(0,rn.select)("mailpoet-form-editor").getAllAvailableCustomFields().find((t=>t.id===e.customFieldId)),n={};(0,oe.merge)(n,t,e.data),await j.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:n}).then((n=>{(0,rn.dispatch)("mailpoet-form-editor").saveCustomFieldDone(t.id,n.data),"function"==typeof e.onFinish&&e.onFinish()})).then((()=>{(0,rn.dispatch)("mailpoet-form-editor").saveForm()})).fail((e=>{(0,rn.dispatch)("mailpoet-form-editor").saveCustomFieldFailed(dp(e))}))},async CREATE_CUSTOM_FIELD(e){const{clientId:t,data:n}=e;(0,rn.select)("mailpoet-form-editor").getIsCustomFieldCreating()||((0,rn.dispatch)("mailpoet-form-editor").createCustomFieldStarted(e.data),(0,rn.select)("mailpoet-form-editor").getIsCustomFieldCreating()&&await j.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:n}).then((e=>{const n=e.data;j.x.trackEvent("Forms > Add new custom field",{"Field type":n.type});const r=up(n),i=(0,ur.j4)(r);(0,rn.dispatch)("core/block-editor").replaceBlock(t,i),(0,rn.dispatch)("mailpoet-form-editor").createCustomFieldDone(e.data)})).fail((e=>{(0,rn.dispatch)("mailpoet-form-editor").createCustomFieldFailed(dp(e))})))},async DELETE_CUSTOM_FIELD(e){const{customFieldId:t,clientId:n}=e;(0,rn.dispatch)("mailpoet-form-editor").deleteCustomFieldStarted();const r=(0,rn.select)("mailpoet-form-editor").getAllAvailableCustomFields().find((e=>e.id===t)),i=gc(r);await j.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"delete",data:{id:t}}).then((()=>{j.x.trackEvent("Forms > Delete custom field",{"Field type":r.type}),(0,rn.dispatch)("mailpoet-form-editor").deleteCustomFieldDone(t,n);const e=fr(i[r.type].name,r);(0,ur.ck)(e)&&(0,ur.fg)(e),(0,rn.dispatch)("core/block-editor").removeBlock(n)})).fail((e=>{(0,rn.dispatch)("mailpoet-form-editor").deleteCustomFieldFailed(dp(e))}))},APPLY_STYLES_TO_ALL_TEXT_INPUTS(e){const t=(0,rn.select)("mailpoet-form-editor").getFormBlocks(),n=pp(t,(t=>{const n={...t};return["mailpoet-form/last-name-input","mailpoet-form/first-name-input","mailpoet-form/email-input"].includes(t.name)||t.name.startsWith("mailpoet-form/custom-text")?{...n,attributes:{...n.attributes,styles:e.styles}}:n}));(0,rn.dispatch)("core/block-editor").resetBlocks(n)},async TUTORIAL_DISMISS(){await j.x.Ajax.post({api_version:j.x.apiVersion,endpoint:"user_flags",action:"set",data:{form_editor_tutorial_seen:1}})},BLOCKS_CHANGED_IN_BLOCK_EDITOR(e){const t=e.blocks,n=Yn(t,"mailpoet-form/email-input"),r=Yn(t,"mailpoet-form/submit-button");if(n&&r)return void(0,rn.dispatch)("mailpoet-form-editor").changeFormBlocks(t);const i=(0,rn.select)("mailpoet-form-editor").getFormBlocks(),o=[...t];if(!n){let e=Yn(i,"mailpoet-form/email-input");e||(e=(0,ur.j4)("mailpoet-form/email-input")),o.unshift(e)}if(!r){let e=Yn(i,"mailpoet-form/submit-button");e||(e=(0,ur.j4)("mailpoet-form/submit-button")),o.push(e)}(0,rn.dispatch)("core/block-editor").resetBlocks(o)},STORE_LOCALLY(e){const{key:t,value:n}=e;window.localStorage.setItem(t,JSON.stringify(n))},CALL_API:dr.t,ENSURE_BROWSER_URL(e){const{formId:t}=e;let n=(0,rn.select)("mailpoet-form-editor").getFormEditorUrl();n=`${n}${t}`,window.location.href!==n&&window.history.replaceState(null,"",n)}};function fp(e){var t,n,r,i,o,a,l,s,c,u,d,p,m,f,h,g,v,b,y,x,w,C,_,S,k,I,E,T,A,D,L,P,F,N,j,R,O,M,B,W,z,H,Z,U,V,G,q,$,Y,K,X,J,Q,ee,te,ne,re,ie,oe,ae,le,se,ce,ue,de,pe,me,fe,he,ge,ve,be,ye,xe,we,Ce,_e,Se,ke,Ie,Ee,Te,Ae,De,Le,Pe,Fe,Ne,je,Re,Oe,Me,Be,We,ze,He,Ze,Ue,Ge,Je,Qe,et,tt,nt,rt,it,ot,at,lt,st,ct,ut,dt,pt,mt,ft,ht,gt,vt,bt,yt,xt,wt,Ct,_t,St,kt,It,Et,Tt,At,Dt,Lt,Pt,Ft,Nt,jt,Rt,Ot,Mt,Bt,Wt,zt,Ht;const Zt={...e,settings:{...e.settings,formPlacement:{popup:{enabled:"1"===(null===(t=e.settings.form_placement)||void 0===t||null===(n=t.popup)||void 0===n?void 0:n.enabled),exitIntentEnabled:"1"===(null===(r=e.settings.form_placement)||void 0===r||null===(i=r.popup)||void 0===i?void 0:i.exit_intent_enabled),delay:void 0!==(null===(o=e.settings.form_placement)||void 0===o||null===(a=o.popup)||void 0===a?void 0:a.delay)?Dr(null===(l=e.settings.form_placement)||void 0===l||null===(s=l.popup)||void 0===s?void 0:s.delay):qe.formDelay,cookieExpiration:void 0!==(null===(c=e.settings.form_placement)||void 0===c||null===(u=c.popup)||void 0===u?void 0:u.cookieExpiration)?Dr(null===(d=e.settings.form_placement)||void 0===d||null===(p=d.popup)||void 0===p?void 0:p.cookieExpiration):qe.formCookieExpiration,animation:void 0!==(null===(m=e.settings.form_placement)||void 0===m||null===(f=m.popup)||void 0===f?void 0:f.animation)?null===(h=e.settings.form_placement)||void 0===h||null===(g=h.popup)||void 0===g?void 0:g.animation:qe.animation,styles:{...qe.styles,...null===(v=e.settings.form_placement)||void 0===v||null===(b=v.popup)||void 0===b?void 0:b.styles},categories:(null===(y=e.settings.form_placement)||void 0===y||null===(x=y.popup)||void 0===x?void 0:x.categories)??[],tags:(null===(w=e.settings.form_placement)||void 0===w||null===(C=w.popup)||void 0===C?void 0:C.tags)??[],posts:{all:"1"===(null===(_=e.settings.form_placement)||void 0===_||null===(S=_.popup)||void 0===S||null===(k=S.posts)||void 0===k?void 0:k.all),selected:Array.isArray(null===(I=e.settings.form_placement)||void 0===I||null===(E=I.popup)||void 0===E||null===(T=E.posts)||void 0===T?void 0:T.selected)?null===(A=e.settings.form_placement)||void 0===A||null===(D=A.popup)||void 0===D||null===(L=D.posts)||void 0===L?void 0:L.selected:[]},pages:{all:"1"===(null===(P=e.settings.form_placement)||void 0===P||null===(F=P.popup)||void 0===F||null===(N=F.pages)||void 0===N?void 0:N.all),selected:Array.isArray(null===(j=e.settings.form_placement)||void 0===j||null===(R=j.popup)||void 0===R||null===(O=R.pages)||void 0===O?void 0:O.selected)?null===(M=e.settings.form_placement)||void 0===M||null===(B=M.popup)||void 0===B||null===(W=B.pages)||void 0===W?void 0:W.selected:[]}},fixedBar:{enabled:"1"===(null===(z=e.settings.form_placement)||void 0===z||null===(H=z.fixed_bar)||void 0===H?void 0:H.enabled),delay:void 0!==(null===(Z=e.settings.form_placement)||void 0===Z||null===(U=Z.fixed_bar)||void 0===U?void 0:U.delay)?Dr(null===(V=e.settings.form_placement)||void 0===V||null===(G=V.fixed_bar)||void 0===G?void 0:G.delay):$e.formDelay,cookieExpiration:void 0!==(null===(q=e.settings.form_placement)||void 0===q||null===($=q.fixed_bar)||void 0===$?void 0:$.cookieExpiration)?Dr(null===(Y=e.settings.form_placement)||void 0===Y||null===(K=Y.fixed_bar)||void 0===K?void 0:K.cookieExpiration):$e.formCookieExpiration,animation:(null===(X=e.settings.form_placement)||void 0===X||null===(J=X.fixed_bar)||void 0===J?void 0:J.animation)??$e.animation,styles:{...$e.styles,...null===(Q=e.settings.form_placement)||void 0===Q||null===(ee=Q.fixed_bar)||void 0===ee?void 0:ee.styles},position:(null===(te=e.settings.form_placement)||void 0===te||null===(ne=te.fixed_bar)||void 0===ne?void 0:ne.position)??$e.position,categories:(null===(re=e.settings.form_placement)||void 0===re||null===(ie=re.fixed_bar)||void 0===ie?void 0:ie.categories)??[],tags:(null===(oe=e.settings.form_placement)||void 0===oe||null===(ae=oe.fixed_bar)||void 0===ae?void 0:ae.tags)??[],posts:{all:"1"===(null===(le=e.settings.form_placement)||void 0===le||null===(se=le.fixed_bar)||void 0===se||null===(ce=se.posts)||void 0===ce?void 0:ce.all),selected:Array.isArray(null===(ue=e.settings.form_placement)||void 0===ue||null===(de=ue.fixed_bar)||void 0===de||null===(pe=de.posts)||void 0===pe?void 0:pe.selected)?null===(me=e.settings.form_placement)||void 0===me||null===(fe=me.fixed_bar)||void 0===fe||null===(he=fe.posts)||void 0===he?void 0:he.selected:[]},pages:{all:"1"===(null===(ge=e.settings.form_placement)||void 0===ge||null===(ve=ge.fixed_bar)||void 0===ve||null===(be=ve.pages)||void 0===be?void 0:be.all),selected:Array.isArray(null===(ye=e.settings.form_placement)||void 0===ye||null===(xe=ye.fixed_bar)||void 0===xe||null===(we=xe.pages)||void 0===we?void 0:we.selected)?null===(Ce=e.settings.form_placement)||void 0===Ce||null===(_e=Ce.fixed_bar)||void 0===_e||null===(Se=_e.pages)||void 0===Se?void 0:Se.selected:[]}},belowPosts:{enabled:"1"===(null===(ke=e.settings.form_placement)||void 0===ke||null===(Ie=ke.below_posts)||void 0===Ie?void 0:Ie.enabled),styles:{...Ve,...null===(Ee=e.settings.form_placement)||void 0===Ee||null===(Te=Ee.below_posts)||void 0===Te?void 0:Te.styles},categories:(null===(Ae=e.settings.form_placement)||void 0===Ae||null===(De=Ae.below_posts)||void 0===De?void 0:De.categories)??[],tags:(null===(Le=e.settings.form_placement)||void 0===Le||null===(Pe=Le.below_posts)||void 0===Pe?void 0:Pe.tags)??[],posts:{all:"1"===(null===(Fe=e.settings.form_placement)||void 0===Fe||null===(Ne=Fe.below_posts)||void 0===Ne||null===(je=Ne.posts)||void 0===je?void 0:je.all),selected:Array.isArray(null===(Re=e.settings.form_placement)||void 0===Re||null===(Oe=Re.below_posts)||void 0===Oe||null===(Me=Oe.posts)||void 0===Me?void 0:Me.selected)?null===(Be=e.settings.form_placement)||void 0===Be||null===(We=Be.below_posts)||void 0===We||null===(ze=We.posts)||void 0===ze?void 0:ze.selected:[]},pages:{all:"1"===(null===(He=e.settings.form_placement)||void 0===He||null===(Ze=He.below_posts)||void 0===Ze||null===(Ue=Ze.pages)||void 0===Ue?void 0:Ue.all),selected:Array.isArray(null===(Ge=e.settings.form_placement)||void 0===Ge||null===(Je=Ge.below_posts)||void 0===Je||null===(Qe=Je.pages)||void 0===Qe?void 0:Qe.selected)?null===(et=e.settings.form_placement)||void 0===et||null===(tt=et.below_posts)||void 0===tt||null===(nt=tt.pages)||void 0===nt?void 0:nt.selected:[]}},slideIn:{enabled:"1"===(null===(rt=e.settings.form_placement)||void 0===rt||null===(it=rt.slide_in)||void 0===it?void 0:it.enabled),delay:void 0!==(null===(ot=e.settings.form_placement)||void 0===ot||null===(at=ot.slide_in)||void 0===at?void 0:at.delay)?Dr(null===(lt=e.settings.form_placement)||void 0===lt||null===(st=lt.slide_in)||void 0===st?void 0:st.delay):Ke.formDelay,cookieExpiration:void 0!==(null===(ct=e.settings.form_placement)||void 0===ct||null===(ut=ct.slide_in)||void 0===ut?void 0:ut.cookieExpiration)?Dr(null===(dt=e.settings.form_placement)||void 0===dt||null===(pt=dt.slide_in)||void 0===pt?void 0:pt.cookieExpiration):Ke.formCookieExpiration,position:(null===(mt=e.settings.form_placement)||void 0===mt||null===(ft=mt.slide_in)||void 0===ft?void 0:ft.position)??Ke.position,animation:(null===(ht=e.settings.form_placement)||void 0===ht||null===(gt=ht.slide_in)||void 0===gt?void 0:gt.animation)??Ke.animation,styles:{...Ke.styles,...null===(vt=e.settings.form_placement)||void 0===vt||null===(bt=vt.slide_in)||void 0===bt?void 0:bt.styles},categories:(null===(yt=e.settings.form_placement)||void 0===yt||null===(xt=yt.slide_in)||void 0===xt?void 0:xt.categories)??[],tags:(null===(wt=e.settings.form_placement)||void 0===wt||null===(Ct=wt.slide_in)||void 0===Ct?void 0:Ct.tags)??[],posts:{all:"1"===(null===(_t=e.settings.form_placement)||void 0===_t||null===(St=_t.slide_in)||void 0===St||null===(kt=St.posts)||void 0===kt?void 0:kt.all),selected:Array.isArray(null===(It=e.settings.form_placement)||void 0===It||null===(Et=It.slide_in)||void 0===Et||null===(Tt=Et.posts)||void 0===Tt?void 0:Tt.selected)?null===(At=e.settings.form_placement)||void 0===At||null===(Dt=At.slide_in)||void 0===Dt||null===(Lt=Dt.posts)||void 0===Lt?void 0:Lt.selected:[]},pages:{all:"1"===(null===(Pt=e.settings.form_placement)||void 0===Pt||null===(Ft=Pt.slide_in)||void 0===Ft||null===(Nt=Ft.pages)||void 0===Nt?void 0:Nt.all),selected:Array.isArray(null===(jt=e.settings.form_placement)||void 0===jt||null===(Rt=jt.slide_in)||void 0===Rt||null===(Ot=Rt.pages)||void 0===Ot?void 0:Ot.selected)?null===(Mt=e.settings.form_placement)||void 0===Mt||null===(Bt=Mt.slide_in)||void 0===Bt||null===(Wt=Bt.pages)||void 0===Wt?void 0:Wt.selected:[]}},others:{styles:{...Ye,...null===(zt=e.settings.form_placement)||void 0===zt||null===(Ht=zt.others)||void 0===Ht?void 0:Ht.styles}}},alignment:e.settings.alignment??Xe.alignment,borderRadius:void 0!==e.settings.border_radius?Dr(e.settings.border_radius):Xe.borderRadius,borderSize:void 0!==e.settings.border_size?Dr(e.settings.border_size):Xe.borderSize,formPadding:void 0!==e.settings.form_padding?Dr(e.settings.form_padding):Xe.formPadding,inputPadding:void 0!==e.settings.input_padding?Dr(e.settings.input_padding):Xe.inputPadding,borderColor:e.settings.border_color,fontFamily:e.settings.font_family,fontSize:e.settings.fontSize&&Dr(e.settings.fontSize),successValidationColor:e.settings.success_validation_color,errorValidationColor:e.settings.error_validation_color,backgroundImageUrl:e.settings.background_image_url,backgroundImageDisplay:e.settings.background_image_display,closeButton:e.settings.close_button??Xe.closeButton}};return Zt.settings.formPlacement.belowPosts.styles.width.value=Dr(Zt.settings.formPlacement.belowPosts.styles.width.value),Zt.settings.formPlacement.slideIn.styles.width.value=Dr(Zt.settings.formPlacement.slideIn.styles.width.value),Zt.settings.formPlacement.fixedBar.styles.width.value=Dr(Zt.settings.formPlacement.fixedBar.styles.width.value),Zt.settings.formPlacement.popup.styles.width.value=Dr(Zt.settings.formPlacement.popup.styles.width.value),Zt.settings.formPlacement.others.styles.width.value=Dr(Zt.settings.formPlacement.others.styles.width.value),delete Zt.settings.border_radius,delete Zt.settings.border_size,delete Zt.settings.border_color,delete Zt.settings.input_padding,delete Zt.settings.form_padding,delete Zt.settings.close_button,delete Zt.settings.font_family,delete Zt.settings.background_image_display,delete Zt.settings.background_image_url,Zt}var hp=n(5523),gp=n(4857),vp=n(79496),bp=n(73703);const yp=(0,vp.Z)((0,hp.Z)(((e,t)=>{if((0,ur.zb)(t.name,"multiple",!0))return{};const n=e(L.t2).getBlocks(),r=(0,oe.find)(n,(e=>{let{name:n}=e;return t.name===n}));return{originalBlockClientId:r&&r.clientId!==t.clientId&&r.clientId}})),(0,eu.Z)(((e,t)=>{let{originalBlockClientId:n}=t;return{selectFirst:()=>e(L.t2).selectBlock(n)}}))),xp=(0,bp.o)((e=>yp((t=>{let{originalBlockClientId:n,selectFirst:r,...i}=t;if(!n)return(0,a.createElement)(e,i);const o=(0,ur.ck)(i.name),l=function(e){const t=(0,ur.MC)((0,ur.Xn)("to",e),(e=>{let{type:t,blocks:n}=e;return"block"===t&&1===n.length}));return t?(0,ur.ck)(t.blocks[0]):null}(i.name);return[(0,a.createElement)("div",{key:"invalid-preview",style:{minHeight:"60px"}},(0,a.createElement)(e,(0,Ce.Z)({key:"block-edit"},i))),(0,a.createElement)(L.v3,{key:"multiple-use-warning",actions:[(0,a.createElement)(O.Z,{key:"find-original",variant:"secondary",onClick:r},(0,b.__)("Find original")),(0,a.createElement)(O.Z,{key:"remove",variant:"secondary",onClick:()=>i.onReplace([])},(0,b.__)("Remove")),l&&(0,a.createElement)(O.Z,{key:"transform",variant:"secondary",onClick:()=>i.onReplace((0,ur.j4)(l.name,i.attributes))},(0,b.__)("Transform into:")," ",l.title)]},(0,a.createElement)("strong",null,null==o?void 0:o.title,": "),(0,b.__)("This block can only be used once."))]}))),"withMultipleValidation");(0,gp.KJ)("editor.BlockEdit","core/edit-post/validate-multiple-use/with-multiple-validation",xp);var wp=n(26478),Cp=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M14.7 11.3c1-.6 1.5-1.6 1.5-3 0-2.3-1.3-3.4-4-3.4H7v14h5.8c1.4 0 2.5-.3 3.3-1 .8-.7 1.2-1.7 1.2-2.9.1-1.9-.8-3.1-2.6-3.7zm-5.1-4h2.3c.6 0 1.1.1 1.4.4.3.3.5.7.5 1.2s-.2 1-.5 1.2c-.3.3-.8.4-1.4.4H9.6V7.3zm4.6 9c-.4.3-1 .4-1.7.4H9.6v-3.9h2.9c.7 0 1.3.2 1.7.5.4.3.6.8.6 1.5s-.2 1.2-.6 1.5z"}));const _p="core/bold",Sp=(0,b.__)("Bold"),kp={name:_p,title:Sp,tagName:"strong",className:null,edit(e){let{isActive:t,value:n,onChange:r,onFocus:i}=e;function o(){r((0,wp.h4)(n,{type:_p,title:Sp}))}return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.Wx,{type:"primary",character:"b",onUse:o}),(0,a.createElement)(L.oe,{name:"bold",icon:Cp,title:Sp,onClick:function(){r((0,wp.h4)(n,{type:_p})),i()},isActive:t,shortcutType:"primary",shortcutCharacter:"b"}),(0,a.createElement)(L.kL,{inputType:"formatBold",onInput:o}))}};var Ip=(0,a.createElement)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(Y.y$,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"}));const Ep="core/code",Tp=(0,b.__)("Inline code"),Ap={name:Ep,title:Tp,tagName:"code",className:null,__unstableInputRule(e){const{start:t,text:n}=e;if("`"!==n.slice(t-1,t))return e;const r=n.slice(0,t-1).lastIndexOf("`");if(-1===r)return e;const i=r,o=t-2;return i===o?e:(e=(0,wp.Od)(e,i,i+1),e=(0,wp.Od)(e,o,o+1),e=(0,wp.HI)(e,{type:Ep},i,o))},edit(e){let{value:t,onChange:n,onFocus:r,isActive:i}=e;function o(){n((0,wp.h4)(t,{type:Ep,title:Tp})),r()}return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.Wx,{type:"access",character:"x",onUse:o}),(0,a.createElement)(L.oe,{icon:Ip,title:Tp,onClick:o,isActive:i,role:"menuitemcheckbox"}))}};var Dp=n(86449);const Lp=["image"],Pp="core/image",Fp=(0,b.__)("Inline image"),Np={name:Pp,title:Fp,keywords:[(0,b.__)("photo"),(0,b.__)("media")],object:!0,tagName:"img",className:null,attributes:{className:"class",style:"style",url:"src",alt:"alt"},edit:function(e){let{value:t,onChange:n,onFocus:r,isObjectActive:i,activeObjectAttributes:o,contentRef:l}=e;const[s,c]=(0,a.useState)(!1);function u(){c(!1)}return(0,a.createElement)(L.VA,null,(0,a.createElement)(L.oe,{icon:(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z"})),title:Fp,onClick:function(){c(!0)},isActive:i}),s&&(0,a.createElement)(L.R,{allowedTypes:Lp,onSelect:e=>{let{id:i,url:o,alt:a,width:l}=e;u(),n((0,wp.Qf)(t,{type:Pp,attributes:{className:`wp-image-${i}`,style:`width: ${Math.min(l,150)}px;`,url:o,alt:a}})),r()},onClose:u,render:e=>{let{open:t}=e;return t(),null}}),i&&(0,a.createElement)(jp,{value:t,onChange:n,activeObjectAttributes:o,contentRef:l}))}};function jp(e){let{value:t,onChange:n,activeObjectAttributes:r,contentRef:i}=e;const{style:o}=r,[l,s]=(0,a.useState)(null==o?void 0:o.replace(/\D/g,"")),c=(0,wp.uT)({ref:i,value:t,settings:Np});return(0,a.createElement)(v.Z,{position:"bottom center",focusOnMount:!1,anchorRef:c,className:"block-editor-format-toolbar__image-popover"},(0,a.createElement)("form",{className:"block-editor-format-toolbar__image-container-content",onSubmit:e=>{const i=t.replacements.slice();i[t.start]={type:Pp,attributes:{...r,style:l?`width: ${l}px;`:""}},n({...t,replacements:i}),e.preventDefault()}},(0,a.createElement)(br.Z,{className:"block-editor-format-toolbar__image-container-value",type:"number",label:(0,b.__)("Width"),value:l,min:1,onChange:e=>s(e)}),(0,a.createElement)(O.Z,{icon:Dp.Z,label:(0,b.__)("Apply"),type:"submit"})))}var Rp=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M12.5 5L10 19h1.9l2.5-14z"}));const Op="core/italic",Mp=(0,b.__)("Italic"),Bp={name:Op,title:Mp,tagName:"em",className:null,edit(e){let{isActive:t,value:n,onChange:r,onFocus:i}=e;function o(){r((0,wp.h4)(n,{type:Op,title:Mp}))}return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.Wx,{type:"primary",character:"i",onUse:o}),(0,a.createElement)(L.oe,{name:"italic",icon:Rp,title:Mp,onClick:function(){r((0,wp.h4)(n,{type:Op})),i()},isActive:t,shortcutType:"primary",shortcutCharacter:"i"}),(0,a.createElement)(L.kL,{inputType:"formatItalic",onInput:o}))}};var Wp=n(34960),zp=n(31301),Hp=n(41165),Zp=n(45391),Up=n(45538),Vp=n(72007),Gp=n(55451),qp=n(45366),$p=n(72778),Yp=n(38314),Kp=n(19887),Xp=n(90587),Jp=n(41547),Qp=n(22751),em=n(10957),tm=n(69289),nm=n(31520),rm=n(36471);function im(e){if(!e)return!1;const t=e.trim();if(!t)return!1;if(/^\S+:/.test(t)){const e=(0,$p.E)(t);if(!(0,Yp.M)(e))return!1;if(e.startsWith("http")&&!/^https?:\/\/[^\/\s]/i.test(t))return!1;const n=(0,Kp.C)(t);if(!(0,Xp.x)(n))return!1;const r=(0,Jp.D)(t);if(r&&!(0,Qp.t)(r))return!1;const i=(0,em.W)(t);if(i&&!(0,tm.A)(i))return!1;const o=(0,nm.S)(t);if(o&&!(0,rm.Z)(o))return!1}return!(t.startsWith("#")&&!(0,rm.Z)(t))}function om(e,t,n,r,i){let o=t;const a={forwards:1,backwards:-1}[i]||1,l=-1*a;for(;e[o]&&e[o][r]===n;)o+=a;return o+=l,o}const am=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return e(...r,...n)}},lm=am(om,"backwards"),sm=am(om,"forwards"),cm=new WeakMap;let um=-1;function dm(e){return`link-control-instance-${e}`}var pm=(0,Gp.Z)((function(e){let{isActive:t,activeAttributes:n,addingLink:r,value:i,onChange:o,speak:l,stopAddingLink:s,contentRef:c}=e;const u=function(e,t){let n=e.start,r=e.end;if(t){const t=function(e,t){var n,r,i;let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.start,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.end;const l={start:null,end:null},{formats:s}=e;let c,u;if(null==s||!s.length)return l;const d=s.slice(),p=null===(n=d[o])||void 0===n?void 0:n.find((e=>{let{type:n}=e;return n===t.type})),m=null===(r=d[a])||void 0===r?void 0:r.find((e=>{let{type:n}=e;return n===t.type})),f=null===(i=d[a-1])||void 0===i?void 0:i.find((e=>{let{type:n}=e;return n===t.type}));if(p)c=p,u=o;else if(m)c=m,u=a;else{if(!f)return l;c=f,u=a-1}const h=d[u].indexOf(c),g=[d,u,c,h];return o=lm(...g),a=sm(...g),o=o<0?0:o,{start:o,end:a}}(e,{type:"core/link"});n=t.start,r=t.end+1}return(0,wp.tP)(e,n,r)}(i,t),d=u.text,[p,m]=(0,a.useState)(),{createPageEntity:h,userCanCreatePages:g}=(0,f.Z)((e=>{const{getSettings:t}=e(L.t2),n=t();return{createPageEntity:n.__experimentalCreatePageEntity,userCanCreatePages:n.__experimentalUserCanCreatePages}}),[]),y={url:n.url,type:n.type,id:n.id,opensInNewTab:"_blank"===n.target,title:d,...p},x=(0,wp.uT)({ref:c,value:i,settings:hm}),w=function(e){if(e)return cm.has(e)?dm(cm.get(e)):(um+=1,cm.set(e,um),dm(um))}(x),C=(0,a.useRef)(!!r&&"firstElement");return(0,a.createElement)(v.Z,{anchorRef:x,focusOnMount:C.current,onClose:s,position:"bottom center",__unstableShift:!0},(0,a.createElement)(L.Ml,{key:w,value:y,onChange:function(e){e={...p,...e};const n=y.opensInNewTab!==e.opensInNewTab&&y.url===e.url,r=n&&void 0===e.url;if(m(r?e:void 0),r)return;const a=(0,qp.u)(e.url),c=function(e){let{url:t,type:n,id:r,opensInNewWindow:i}=e;const o={type:"core/link",attributes:{url:t}};return n&&(o.attributes.type=n),r&&(o.attributes.id=r),i&&(o.attributes.target="_blank",o.attributes.rel="noreferrer noopener"),o}({url:a,type:e.type,id:void 0!==e.id&&null!==e.id?String(e.id):void 0,opensInNewWindow:e.opensInNewTab}),u=e.title||a;if((0,wp.zb)(i)&&!t){const e=(0,wp.HI)((0,wp.Ue)({text:u}),c,0,u.length);o((0,wp.$T)(i,e))}else{let e;u===d?e=(0,wp.HI)(i,c):(e=(0,wp.Ue)({text:u}),e=(0,wp.HI)(e,c,0,u.length),e=(0,wp.gx)(i,d,e)),e.start=e.end,e.activeFormats=[],o(e)}n||s(),im(a)?l(t?(0,b.__)("Link edited."):(0,b.__)("Link inserted."),"assertive"):l((0,b.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive")},onRemove:function(){const e=(0,wp.Ir)(i,"core/link");o(e),s(),l((0,b.__)("Link removed."),"assertive")},forceIsEditingLink:r,hasRichPreviews:!0,createSuggestion:h&&async function(e){const t=await h({title:e,status:"draft"});return{id:t.id,type:t.type,title:t.title.rendered,url:t.link,kind:"post-type"}},withCreateSuggestion:g,createSuggestionButtonText:function(e){return(0,Vp.Z)((0,b.sprintf)((0,b.__)("Create Page: <mark>%s</mark>"),e),{mark:(0,a.createElement)("mark",null)})},hasTextControl:!0}))}));const mm="core/link",fm=(0,b.__)("Link"),hm={name:mm,title:fm,tagName:"a",className:null,attributes:{url:"href",type:"data-type",id:"data-id",target:"target"},__unstablePasteRule(e,t){let{html:n,plainText:r}=t;if((0,wp.zb)(e))return e;const i=(n||r).replace(/<[^>]+>/g,"").trim();return(0,Wp.P)(i)?(window.console.log("Created link:\n\n",i),(0,wp.HI)(e,{type:mm,attributes:{url:(0,N.decodeEntities)(i)}})):e},edit:function(e){let{isActive:t,activeAttributes:n,value:r,onChange:i,onFocus:o,contentRef:l}=e;const[s,c]=(0,a.useState)(!1);function u(){const e=(0,wp.FB)((0,wp.tP)(r));e&&(0,Wp.P)(e)&&im(e)?i((0,wp.HI)(r,{type:mm,attributes:{url:e}})):e&&(0,zp.J)(e)?i((0,wp.HI)(r,{type:mm,attributes:{url:`mailto:${e}`}})):c(!0)}function d(){i((0,wp.Ir)(r,mm)),(0,Up.D)((0,b.__)("Link removed."),"assertive")}return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.Wx,{type:"primary",character:"k",onUse:u}),(0,a.createElement)(L.Wx,{type:"primaryShift",character:"k",onUse:d}),t&&(0,a.createElement)(L.oe,{name:"link",icon:Hp.Z,title:(0,b.__)("Unlink"),onClick:d,isActive:t,shortcutType:"primaryShift",shortcutCharacter:"k"}),!t&&(0,a.createElement)(L.oe,{name:"link",icon:Zp.Z,title:fm,onClick:u,isActive:t,shortcutType:"primary",shortcutCharacter:"k"}),(s||t)&&(0,a.createElement)(pm,{addingLink:s,stopAddingLink:function(){c(!1),o()},isActive:t,activeAttributes:n,value:r,onChange:i,contentRef:l}))}};var gm=n(91495);const vm="core/strikethrough",bm=(0,b.__)("Strikethrough"),ym={name:vm,title:bm,tagName:"s",className:null,edit(e){let{isActive:t,value:n,onChange:r,onFocus:i}=e;function o(){r((0,wp.h4)(n,{type:vm,title:bm})),i()}return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.Wx,{type:"access",character:"d",onUse:o}),(0,a.createElement)(L.oe,{icon:gm.Z,title:bm,onClick:o,isActive:t,role:"menuitemcheckbox"}))}},xm="core/underline",wm=(0,b.__)("Underline"),Cm={name:xm,title:wm,tagName:"span",className:null,attributes:{style:"style"},edit(e){let{value:t,onChange:n}=e;const r=()=>{n((0,wp.h4)(t,{type:xm,attributes:{style:"text-decoration: underline;"},title:wm}))};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.Wx,{type:"primary",character:"u",onUse:r}),(0,a.createElement)(L.kL,{inputType:"formatUnderline",onInput:r}))}};var _m=n(47842),Sm=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z"})),km=n(2348);function Im(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.split(";").reduce(((e,t)=>{if(t){const[n,r]=t.split(":");"color"===n&&(e.color=r),"background-color"===n&&r!==Lm&&(e.backgroundColor=r)}return e}),{})}function Em(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return e.split(" ").reduce(((e,n)=>{if(n.startsWith("has-")&&n.endsWith("-color")){const r=n.replace(/^has-/,"").replace(/-color$/,""),i=(0,L.M9)(t,r);e.color=i.color}return e}),{})}function Tm(e,t,n){const r=(0,wp.Ye)(e,t);return r?{...Im(r.attributes.style),...Em(r.attributes.class,n)}:{}}function Am(e){let{name:t,property:n,value:r,onChange:i}=e;const o=(0,f.Z)((e=>{const{getSettings:t}=e(L.t2);return(0,oe.get)(t(),["colors"],[])}),[]),l=(0,a.useCallback)((e=>{i(function(e,t,n,r){const{color:i,backgroundColor:o}={...Tm(e,t,n),...r};if(!i&&!o)return(0,wp.Ir)(e,t);const a=[],l=[],s={};if(o?a.push(["background-color",o].join(":")):a.push(["background-color",Lm].join(":")),i){const e=(0,L.Gr)(n,i);e?l.push((0,L.Gd)("color",e.slug)):a.push(["color",i].join(":"))}return a.length&&(s.style=a.join(";")),l.length&&(s.class=l.join(" ")),(0,wp.HI)(e,{type:t,attributes:s})}(r,t,o,{[n]:e}))}),[o,i,n]),s=(0,a.useMemo)((()=>Tm(r,t,o)),[t,r,o]);return(0,a.createElement)(L.VZ,{value:s[n],onChange:l})}function Dm(e){let{name:t,value:n,onChange:r,onClose:i,contentRef:o}=e;const l=(0,L.ni)((0,wp.uT)({ref:o,value:n,settings:Rm}));return(0,a.createElement)(v.Z,{onClose:i,className:"components-inline-color-popover",anchorRef:l},(0,a.createElement)(km.Z,{tabs:[{name:"color",title:(0,b.__)("Text")},{name:"backgroundColor",title:(0,b.__)("Background")}]},(e=>(0,a.createElement)(Am,{name:t,property:e.name,value:n,onChange:r}))))}const Lm="rgba(0, 0, 0, 0)",Pm="core/text-color",Fm=(0,b.__)("Highlight"),Nm=[];function jm(e,t){const{ownerDocument:n}=e,{defaultView:r}=n,i=r.getComputedStyle(e).getPropertyValue(t);return"background-color"===t&&i===Lm&&e.parentElement?jm(e.parentElement,t):i}const Rm={name:Pm,title:Fm,tagName:"mark",className:"has-inline-color",attributes:{style:"style",class:"class"},__unstableFilterAttributeValue(e,t){if("style"!==e)return t;if(t&&t.includes("background-color"))return t;const n=["background-color",Lm].join(":");return t?[n,t].join(";"):n},edit:function(e){let{value:t,onChange:n,isActive:r,activeAttributes:i,contentRef:o}=e;const l=(0,L.yu)("color.custom"),s=(0,L.yu)("color.palette")||Nm,[c,u]=(0,a.useState)(!1),d=(0,a.useCallback)((()=>u(!0)),[u]),p=(0,a.useCallback)((()=>u(!1)),[u]),m=(0,a.useMemo)((()=>function(e,t){let{color:n,backgroundColor:r}=t;if(n||r)return{color:n||jm(e,"color"),backgroundColor:r===Lm?jm(e,"background-color"):r}}(o.current,Tm(t,Pm,s))),[t,s]),f=!(0,oe.isEmpty)(s)||!l;return f||r?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L.oe,{className:"format-library-text-color-button",isActive:r,icon:(0,a.createElement)(_m.Z,{icon:Sm,style:m}),title:Fm,onClick:f?d:()=>n((0,wp.Ir)(t,Pm)),role:"menuitemcheckbox"}),c&&(0,a.createElement)(Dm,{name:Pm,onClose:p,activeAttributes:i,value:t,onChange:n,contentRef:o})):null}};var Om=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"}));const Mm="core/subscript",Bm=(0,b.__)("Subscript"),Wm={name:Mm,title:Bm,tagName:"sub",className:null,edit(e){let{isActive:t,value:n,onChange:r,onFocus:i}=e;return(0,a.createElement)(L.oe,{icon:Om,title:Bm,onClick:function(){r((0,wp.h4)(n,{type:Mm,title:Bm})),i()},isActive:t,role:"menuitemcheckbox"})}};var zm=(0,a.createElement)(Y.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(Y.y$,{d:"M16.9 10.3l.8-1.3c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.2-.2-.4-.4-.7-.6-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.1 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3l-1.8 2.8h4.3v-1.2h-2.2zm-2.8-3.1h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"}));const Hm="core/superscript",Zm=(0,b.__)("Superscript"),Um={name:Hm,title:Zm,tagName:"sup",className:null,edit(e){let{isActive:t,value:n,onChange:r,onFocus:i}=e;return(0,a.createElement)(L.oe,{icon:zm,title:Zm,onClick:function(){r((0,wp.h4)(n,{type:Hm,title:Zm})),i()},isActive:t,role:"menuitemcheckbox"})}};var Vm=(0,a.createElement)(Y.Wj,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(Y.y$,{d:"M19 6.5H5c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v7zM8 12.8h8v-1.5H8v1.5z"}));const Gm="core/keyboard",qm=(0,b.__)("Keyboard input");[kp,Ap,Np,Bp,hm,ym,Cm,Rm,Wm,Um,{name:Gm,title:qm,tagName:"kbd",className:null,edit(e){let{isActive:t,value:n,onChange:r,onFocus:i}=e;return(0,a.createElement)(L.oe,{icon:Vm,title:qm,onClick:function(){r((0,wp.h4)(n,{type:Gm,title:qm})),i()},isActive:t,role:"menuitemcheckbox"})}}].forEach((e=>{let{name:t,...n}=e;return(0,wp.Sy)(t,n)}));const $m="mailpoet-form/font-selection",Ym=["core/paragraph","core/heading"],Km={name:$m,title:"Font Selection",tagName:"span",className:"mailpoet-has-font",attributes:{style:"style",font:"data-font"},edit:function(e){let{value:t,onChange:n,activeAttributes:r}=e;const i=(0,f.Z)((e=>e("core/block-editor").getSelectedBlock()),[]);return Ym.includes(i.name)?(0,q.jsx)(L.Mv,{children:(0,q.jsx)("div",{className:"mailpoet_toolbar_item",children:(0,q.jsx)(et,{value:r.font,onChange:e=>{n((0,wp.HI)(t,{type:"mailpoet-form/font-selection",attributes:{style:`font-family: ${e}`,font:e}}))},name:j.x.I18n.t("formSettingsStylesFontFamily"),hideLabelFromVision:!0})})}):null}};var Xm=n(22058),Jm=n(29449),Qm=n(15317),ef=n(58125),tf=n(93878),nf=n(20360);function rf(){const e=[{name:"popup",label:j.x.I18n.t("popupCategory")},{name:"slide_in",label:j.x.I18n.t("slideInCategory")},{name:"fixed_bar",label:j.x.I18n.t("fixedBarCategory")},{name:"below_posts",label:j.x.I18n.t("belowPagesCategory")},{name:"others",label:j.x.I18n.t("othersCategory")}],t=(0,f.Z)((e=>e("mailpoet-form-editor-templates").getSelectedCategory()),[]),n=(0,f.Z)((e=>e("mailpoet-form-editor-templates").getTemplates()),[]),r=(0,f.Z)((e=>e("mailpoet-form-editor-templates").getLoading()),[]),i=(0,f.Z)((e=>e("mailpoet-form-editor-templates").getSelectTemplateFailed()),[]),{selectTemplate:o,selectCategory:a}=(0,h.Z)("mailpoet-form-editor-templates");return(0,q.jsxs)(q.Fragment,{children:[e.map((e=>n[e.name].map(((e,t)=>t<4&&(0,q.jsx)("link",{rel:"preload",href:e.thumbnail,as:"image"},`thumbnail_prefetch_${e.id}`))))),(0,q.jsxs)("div",{className:"mailpoet-template-selection-header",children:[(0,q.jsx)(re.X,{level:4,children:j.x.I18n.t("selectTemplate")}),(0,q.jsx)(tf.Button,{automationId:"create_blank_form",onClick:()=>{o("initial_form","Blank template")},children:j.x.I18n.t("createBlankTemplate")})]}),i&&(0,q.jsx)(nf.q,{type:"error",scroll:!0,renderInPlace:!0,children:(0,q.jsx)("p",{children:j.x.I18n.t("createFormError")})}),(0,q.jsxs)("div",{"data-automation-id":"template_selection_list",children:[(0,q.jsx)(Jm.A,{color:"#fff"}),(0,q.jsxs)("div",{className:"mailpoet-templates",children:[(0,q.jsx)(Xm.R,{categories:e,active:t,onSelect:a}),n[t].map((e=>(0,q.jsx)(ef.G,{onSelect:()=>{o(e.id,e.name)},label:e.name,automationId:`select_template_${e.id}`,className:"mailpoet-form-template",children:(0,q.jsx)("div",{className:"mailpoet-template-thumbnail",children:(0,q.jsx)("img",{src:e.thumbnail,alt:e.name,width:"480",height:"317",loading:"lazy"})})},e.id)))]})]}),r&&(0,q.jsx)(Qm.g,{})]})}const of={getTemplates:e=>e.templates,getFormEditorUrl:e=>e.formEditorUrl,getSelectTemplateFailed:e=>e.selectTemplateFailed,getLoading:e=>e.loading,getSelectedCategory:e=>e.activeCategory},af=e=>({...e,selectTemplateFailed:!0,loading:!1}),lf=e=>({...e,selectTemplateFailed:!1,loading:!0}),sf=(e,t)=>({...e,activeCategory:t.category}),cf=e=>function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case"SELECT_TEMPLATE_ERROR":return af(t);case"SELECT_TEMPLATE_START":return lf(t);case"SELECT_CATEGORY":return sf(t,n);default:return t}};function*uf(e,t){yield{type:"SELECT_TEMPLATE_START"},yield{type:"TRACK_EVENT",name:"Forms > Template selected",data:{"Template id":e,"Template name":t},timeout:200};const n=(0,rn.select)("mailpoet-form-editor-templates").getFormEditorUrl();return window.location.href=`${n}${e}`,{}}function df(e){return{type:"SELECT_CATEGORY",category:e}}async function pf(e){const t=e.name,n=e.data,r=e.timeout??0;return j.x.trackEvent(t,n),i=r,new Promise((e=>{setTimeout(e,i)}));var i}let mf;function ff(){return(0,q.jsx)(c.k.Provider,{value:(0,c.S)(window),children:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(u.w,{}),(0,q.jsx)(rf,{})]})})}!function(e){e.Popup="popup",e.SlideIn="slide_in",e.FixedBar="fixed_bar",e.BelowPosts="below_posts",e.Others="others"}(mf||(mf={}));const hf=document.querySelector("#mailpoet_form_edit_templates");function gf(){return(0,q.jsx)(c.k.Provider,{value:(0,c.S)(window),children:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(u.w,{}),(0,q.jsx)(tn,{})]})})}hf&&((()=>{const e={templates:window.mailpoet_templates,formEditorUrl:window.mailpoet_form_edit_url,selectTemplateFailed:!1,loading:!1,activeCategory:mf.Popup},t={selectors:of,actions:i,controls:o,reducer:cf(e),resolvers:{}};(0,rn.registerStore)("mailpoet-form-editor-templates",t)})(),l.render((0,q.jsx)(a.StrictMode,{children:(0,q.jsx)(ff,{})}),hf)),window.addEventListener("DOMContentLoaded",(()=>{const e=document.querySelector("#mailpoet_form_edit");e&&(s.default.use(s.default.createRootURLMiddleware(window.wpApiSettings.root)),s.default.use(s.default.createNonceMiddleware(window.wpApiSettings.nonce)),(0,gp.KJ)("editor.MediaUpload","mailpoet/form-editor/replace-media-upload",(()=>I)),(()=>{const e=window.mailpoet_custom_fields.map((e=>({...e,params:e.params||{}}))),t=cc(L.w0.fontSizes,L.w0.colors,L.w0.gradients,e),n={...window.mailpoet_form_data},i=t(n.body);delete n.body;const o={dateTypes:window.mailpoet_date_types,dateFormats:window.mailpoet_date_formats,months:window.mailpoet_month_names};n.settings.segments=n.settings.segments?n.settings.segments:[];let a,l=null;if(null!==n.id)try{l=JSON.parse(window.localStorage.getItem(`mailpoet_form_preview_settings${n.id}`)),"below_post"===l.formType&&(l.formType="below_posts")}catch(e){}try{a=JSON.parse(window.localStorage.getItem("mailpoet_form_view_options"))}catch(e){a=!1}const s={editorHistory:[],editorHistoryOffset:0,formBlocks:i,formData:fp(n),dateSettingData:o,sidebarOpened:!0,formExports:window.mailpoet_form_exports,formErrors:Kn(n,i),segments:window.mailpoet_form_segments,customFields:e,isFormSaving:!1,isCustomFieldSaving:!1,isCustomFieldCreating:!1,isPreviewShown:!1,isPreviewReady:!1,isCustomFieldDeleting:!1,inserterPanel:null,notices:[],hasUnsavedChanges:!1,sidebar:{activeSidebar:"default",activeTab:"form",openedPanels:["basic-settings"]},previewSettings:l,fullscreenStatus:a,editorUrl:window.location.href,formEditorUrl:window.mailpoet_form_edit_url,previewPageUrl:window.mailpoet_form_preview_page,closeIconsUrl:window.mailpoet_close_icons_url,customFonts:window.mailpoet_custom_fonts,allWpPosts:window.mailpoet_all_wp_posts,allWpPages:window.mailpoet_all_wp_pages,allWpCategories:window.mailpoet_all_wp_categories,allWpTags:window.mailpoet_all_wp_tags,allWooCommerceProducts:window.mailpoet_woocommerce_products,allWooCommerceCategories:window.mailpoet_woocommerce_categories,allWooCommerceTags:window.mailpoet_woocommerce_tags,tutorialSeen:"1"===window.mailpoet_tutorial_seen,tutorialUrl:window.mailpoet_tutorial_url,user:{isAdministrator:window.mailpoet_is_administrator}},c={reducer:ir(s),actions:r,selectors:ar,controls:mp,resolvers:{}};(0,rn.registerStore)("mailpoet-form-editor",c)})(),(()=>{const e=(0,rn.select)("mailpoet-form-editor").getAllAvailableCustomFields();Zc.supports.inserter=(0,rn.select)("mailpoet-form-editor").isUserAdministrator();const t=[{slug:"obligatory",title:""}];t.push({slug:"design",title:j.x.I18n.t("layoutBlocksCategory")}),t.push({slug:"fields",title:j.x.I18n.t("fieldsBlocksCategory")}),t.push({slug:"custom-fields",title:j.x.I18n.t("customFieldsBlocksCategory")}),(0,ur.DG)(t),(0,ur.uW)("mailpoet-form/divider",bc),(0,ur.uW)("mailpoet-form/email-input",wc),(0,ur.uW)("mailpoet-form/submit-button",Sc),(0,ur.uW)("mailpoet-form/first-name-input",Ec),(0,ur.uW)("mailpoet-form/last-name-input",Dc),(0,ur.uW)("mailpoet-form/segment-select",Bc),(0,ur.uW)("mailpoet-form/html",Zc),(0,ur.uW)("mailpoet-form/add-custom-field",Yc),(0,ur.uW)(gu,bu),(0,ur.uW)(Iu,Tu),(0,ur.uW)(bd,xd),(0,ur.uW)(Ju,ed),(0,ur.uW)(lp,cp),Array.isArray(e)&&e.forEach(up)})(),(0,wp.Sy)($m,Km),window.mailpoet_translations.forEach((e=>{var t;const n=JSON.parse(e);n&&null!==(t=n.locale_data)&&void 0!==t&&t.messages&&(0,b.setLocaleData)(n.locale_data.messages)})),l.render((0,q.jsx)(a.StrictMode,{children:(0,q.jsx)(gf,{})}),e))}))},41779:function(e,t){var n;!function(){"use strict";var r=function(){function e(){}function t(e,t){for(var n=t.length,r=0;r<n;++r)i(e,t[r])}e.prototype=Object.create(null);var n={}.hasOwnProperty,r=/\s+/;function i(e,i){if(i){var o=typeof i;"string"===o?function(e,t){for(var n=t.split(r),i=n.length,o=0;o<i;++o)e[n[o]]=!0}(e,i):Array.isArray(i)?t(e,i):"object"===o?function(e,t){if(t.toString===Object.prototype.toString)for(var r in t)n.call(t,r)&&(e[r]=!!t[r]);else e[t.toString()]=!0}(e,i):"number"===o&&function(e,t){e[t]=!0}(e,i)}}return function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=new e;t(o,r);var a=[];for(var l in o)o[l]&&a.push(l);return a.join(" ")}}();e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},70907:function(e){e.exports=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),a=r||i||o,l=a&&(r?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),c=s&&/Qt\/\d+\.\d+/.test(e),u=!o&&/Chrome\//.test(e),d=/Opera\//.test(e),p=/Apple Computer/.test(navigator.vendor),m=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),f=/PhantomJS/.test(e),h=p&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),g=/Android/.test(e),v=h||g||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),b=h||/Mac/.test(t),y=/\bCrOS\b/.test(e),x=/win/i.test(t),w=d&&e.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(d=!1,s=!0);var C=b&&(c||d&&(null==w||w<12.11)),_=n||a&&l>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var k,I=function(e,t){var n=e.className,r=S(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function E(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function T(e,t){return E(e).appendChild(t)}function A(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function D(e,t,n,r){var i=A(e,t,n,r);return i.setAttribute("role","presentation"),i}function L(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function P(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var n=e.className;S(t).test(n)||(e.className+=(n?" ":"")+t)}function N(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!S(n[r]).test(t)&&(t+=" "+n[r]);return t}k=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var j=function(e){e.select()};function R(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function O(e,t,n){for(var r in t||(t={}),e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function M(e,t,n,r,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=r||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||l>=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}h?j=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:a&&(j=function(e){try{e.select()}catch(e){}});var B=function(){this.id=null,this.f=null,this.time=0,this.handler=R(this.onTimeout,this)};function W(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}B.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},B.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};var z={toString:function(){return"CodeMirror.Pass"}},H={scroll:!1},Z={origin:"*mouse"},U={origin:"+move"};function V(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);-1==o&&(o=e.length);var a=o-r;if(o==e.length||i+a>=t)return r+Math.min(a,t-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=t)return r}}var G=[""];function q(e){for(;G.length<=e;)G.push($(G)+" ");return G[e]}function $(e){return e[e.length-1]}function Y(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function K(){}function X(e,t){var n;return Object.create?n=Object.create(e):(K.prototype=e,n=new K),t&&O(t,n),n}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Q(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&Q(e))||t.test(e):Q(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function re(e){return e.charCodeAt(0)>=768&&ne.test(e)}function ie(e,t,n){for(;(n<0?t>0:t<e.length)&&re(e.charAt(t));)t+=n;return t}function oe(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}var ae=null;function le(e,t,n){var r;ae=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:ae=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:ae=i)}return null!=r?r:ae}var se=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,n=/[LRr]/,r=/[Lb1n]/,i=/[1n]/;function o(e,t,n){this.level=e,this.from=t,this.to=n}return function(a,l){var s,c="ltr"==l?"L":"R";if(0==a.length||"ltr"==l&&!e.test(a))return!1;for(var u=a.length,d=[],p=0;p<u;++p)d.push((s=a.charCodeAt(p))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(s):1424<=s&&s<=1524?"R":1536<=s&&s<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(s-1536):1774<=s&&s<=2220?"r":8192<=s&&s<=8203?"w":8204==s?"b":"L");for(var m=0,f=c;m<u;++m){var h=d[m];"m"==h?d[m]=f:f=h}for(var g=0,v=c;g<u;++g){var b=d[g];"1"==b&&"r"==v?d[g]="n":n.test(b)&&(v=b,"r"==b&&(d[g]="R"))}for(var y=1,x=d[0];y<u-1;++y){var w=d[y];"+"==w&&"1"==x&&"1"==d[y+1]?d[y]="1":","!=w||x!=d[y+1]||"1"!=x&&"n"!=x||(d[y]=x),x=w}for(var C=0;C<u;++C){var _=d[C];if(","==_)d[C]="N";else if("%"==_){var S=void 0;for(S=C+1;S<u&&"%"==d[S];++S);for(var k=C&&"!"==d[C-1]||S<u&&"1"==d[S]?"1":"N",I=C;I<S;++I)d[I]=k;C=S-1}}for(var E=0,T=c;E<u;++E){var A=d[E];"L"==T&&"1"==A?d[E]="L":n.test(A)&&(T=A)}for(var D=0;D<u;++D)if(t.test(d[D])){var L=void 0;for(L=D+1;L<u&&t.test(d[L]);++L);for(var P="L"==(D?d[D-1]:c),F=P==("L"==(L<u?d[L]:c))?P?"L":"R":c,N=D;N<L;++N)d[N]=F;D=L-1}for(var j,R=[],O=0;O<u;)if(r.test(d[O])){var M=O;for(++O;O<u&&r.test(d[O]);++O);R.push(new o(0,M,O))}else{var B=O,W=R.length,z="rtl"==l?1:0;for(++O;O<u&&"L"!=d[O];++O);for(var H=B;H<O;)if(i.test(d[H])){B<H&&(R.splice(W,0,new o(1,B,H)),W+=z);var Z=H;for(++H;H<O&&i.test(d[H]);++H);R.splice(W,0,new o(2,Z,H)),W+=z,B=H}else++H;B<O&&R.splice(W,0,new o(1,B,O))}return"ltr"==l&&(1==R[0].level&&(j=a.match(/^\s+/))&&(R[0].from=j[0].length,R.unshift(new o(0,0,j[0].length))),1==$(R).level&&(j=a.match(/\s+$/))&&($(R).to-=j[0].length,R.push(new o(0,u-j[0].length,u)))),"rtl"==l?R.reverse():R}}();function ce(e,t){var n=e.order;return null==n&&(n=e.order=se(e.text,t)),n}var ue=[],de=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||ue).concat(n)}};function pe(e,t){return e._handlers&&e._handlers[t]||ue}function me(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=W(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function fe(e,t){var n=pe(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function he(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),fe(e,n||t.type,e,t),we(t)||t.codemirrorIgnore}function ge(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==W(n,t[r])&&n.push(t[r])}function ve(e,t){return pe(e,t).length>0}function be(e){e.prototype.on=function(e,t){de(this,e,t)},e.prototype.off=function(e,t){me(this,e,t)}}function ye(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function xe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function we(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ce(e){ye(e),xe(e)}function _e(e){return e.target||e.srcElement}function Se(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),b&&e.ctrlKey&&1==t&&(t=3),t}var ke,Ie,Ee=function(){if(a&&l<9)return!1;var e=A("div");return"draggable"in e||"dragDrop"in e}();function Te(e){if(null==ke){var t=A("span","​");T(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ke=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var n=ke?A("span","​"):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Ae(e){if(null!=Ie)return Ie;var t=T(e,document.createTextNode("AخA")),n=k(t,0,1).getBoundingClientRect(),r=k(t,1,2).getBoundingClientRect();return E(e),!(!n||n.left==n.right)&&(Ie=r.right-n.right<3)}var De,Le=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Pe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Fe="oncopy"in(De=A("div"))||(De.setAttribute("oncopy","return;"),"function"==typeof De.oncopy),Ne=null;var je={},Re={};function Oe(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),je[e]=t}function Me(e){if("string"==typeof e&&Re.hasOwnProperty(e))e=Re[e];else if(e&&"string"==typeof e.name&&Re.hasOwnProperty(e.name)){var t=Re[e.name];"string"==typeof t&&(t={name:t}),(e=X(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Me("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Me("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Be(e,t){t=Me(t);var n=je[t.name];if(!n)return Be(e,"text/plain");var r=n(e,t);if(We.hasOwnProperty(t.name)){var i=We[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var We={};function ze(e,t){O(t,We.hasOwnProperty(e)?We[e]:We[e]={})}function He(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Ze(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Ue(e,t,n){return!e.startState||e.startState(t,n)}var Ve=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Ge(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function qe(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,(function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i})),r}function $e(e,t,n){var r=[];return e.iter(t,n,(function(e){r.push(e.text)})),r}function Ye(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ke(e){if(null==e.parent)return null;for(var t=e.parent,n=W(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function Xe(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a].height;if(t<l)break;t-=l}return n+a}function Je(e,t){return t>=e.first&&t<e.first+e.size}function Qe(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,n){if(void 0===n&&(n=null),!(this instanceof et))return new et(e,t,n);this.line=e,this.ch=t,this.sticky=n}function tt(e,t){return e.line-t.line||e.ch-t.ch}function nt(e,t){return e.sticky==t.sticky&&0==tt(e,t)}function rt(e){return et(e.line,e.ch)}function it(e,t){return tt(e,t)<0?t:e}function ot(e,t){return tt(e,t)<0?e:t}function at(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function lt(e,t){if(t.line<e.first)return et(e.first,0);var n=e.first+e.size-1;return t.line>n?et(n,Ge(e,n).text.length):function(e,t){var n=e.ch;return null==n||n>t?et(e.line,t):n<0?et(e.line,0):e}(t,Ge(e,t.line).text.length)}function st(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=lt(e,t[r]);return n}Ve.prototype.eol=function(){return this.pos>=this.string.length},Ve.prototype.sol=function(){return this.pos==this.lineStart},Ve.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ve.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ve.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ve.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ve.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ve.prototype.skipToEnd=function(){this.pos=this.string.length},Ve.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ve.prototype.backUp=function(e){this.pos-=e},Ve.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=M(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?M(this.string,this.lineStart,this.tabSize):0)},Ve.prototype.indentation=function(){return M(this.string,null,this.tabSize)-(this.lineStart?M(this.string,this.lineStart,this.tabSize):0)},Ve.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ve.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ve.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ve.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ve.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ct=function(e,t){this.state=e,this.lookAhead=t},ut=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function dt(e,t,n,r){var i=[e.state.modeGen],o={};xt(e,t.text,e.doc.mode,n,(function(e,t){return i.push(e,t)}),o,r);for(var a=n.state,l=function(r){n.baseTokens=i;var l=e.state.overlays[r],s=1,c=0;n.state=!0,xt(e,t.text,l.mode,n,(function(e,t){for(var n=s;c<e;){var r=i[s];r>e&&i.splice(s,1,e,i[s+1],r),s+=2,c=Math.min(e,r)}if(t)if(l.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;n<s;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"overlay "+t}}),o),n.state=a,n.baseTokens=null,n.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)l(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function pt(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=mt(e,Ke(t)),i=t.text.length>e.options.maxHighlightLength&&He(e.doc.mode,r.state),o=dt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function mt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ut(r,!0,t);var o=function(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=Ge(o,l-1),c=s.stateAfter;if(c&&(!n||l+(c instanceof ct?c.lookAhead:0)<=o.modeFrontier))return l;var u=M(s.text,null,e.options.tabSize);(null==i||r>u)&&(i=l-1,r=u)}return i}(e,t,n),a=o>r.first&&Ge(r,o-1).stateAfter,l=a?ut.fromSaved(r,a,o):new ut(r,Ue(r.mode),o);return r.iter(o,t,(function(n){ft(e,n.text,l);var r=l.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&r<i.viewTo?l.save():null,l.nextLine()})),n&&(r.modeFrontier=l.line),l}function ft(e,t,n,r){var i=e.doc.mode,o=new Ve(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&ht(i,n.state);!o.eol();)gt(i,o,n.state),o.start=o.pos}function ht(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=Ze(e,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function gt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Ze(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ut.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ut.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ut.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ut.fromSaved=function(e,t,n){return t instanceof ct?new ut(e,He(e.mode,t.state),n,t.lookAhead):new ut(e,He(e.mode,t),n)},ut.prototype.save=function(e){var t=!1!==e?He(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ct(t,this.maxLookAhead):t};var vt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function bt(e,t,n,r){var i,o,a=e.doc,l=a.mode,s=Ge(a,(t=lt(a,t)).line),c=mt(e,t.line,n),u=new Ve(s.text,e.options.tabSize,c);for(r&&(o=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=gt(l,u,c.state),r&&o.push(new vt(u,i,He(a.mode,c.state)));return r?o:new vt(u,i,c.state)}function yt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function xt(e,t,n,r,i,o,a){var l=n.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new Ve(t,e.options.tabSize,r),p=e.options.addModeClass&&[null];for(""==t&&yt(ht(n,r.state),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&ft(e,t,r,d.pos),d.pos=t.length,s=null):s=yt(gt(n,d,r.state,p),o),p){var m=p[0].name;m&&(s="m-"+(s?m+" "+s:m))}if(!l||u!=s){for(;c<d.start;)i(c=Math.min(d.start,c+5e3),u);u=s}d.start=d.pos}for(;c<d.pos;){var f=Math.min(d.pos,c+5e3);i(f,u),c=f}}var wt=!1,Ct=!1;function _t(e,t,n){this.marker=e,this.from=t,this.to=n}function St(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function kt(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function It(e,t){if(t.full)return null;var n=Je(e,t.from.line)&&Ge(e,t.from.line).markedSpans,r=Je(e,t.to.line)&&Ge(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,a=0==tt(t.from,t.to),l=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new _t(a,o.from,l?null:o.to))}}return r}(n,i,a),s=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new _t(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return r}(r,o,a),c=1==t.text.length,u=$(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var p=l[d];if(null==p.to){var m=St(s,p.marker);m?c&&(p.to=null==m.to?null:m.to+u):p.to=i}}if(s)for(var f=0;f<s.length;++f){var h=s[f];null!=h.to&&(h.to+=u),null==h.from?St(l,h.marker)||(h.from=u,c&&(l||(l=[])).push(h)):(h.from+=u,c&&(l||(l=[])).push(h))}l&&(l=Et(l)),s&&s!=l&&(s=Et(s));var g=[l];if(!c){var v,b=t.text.length-2;if(b>0&&l)for(var y=0;y<l.length;++y)null==l[y].to&&(v||(v=[])).push(new _t(l[y].marker,null,null));for(var x=0;x<b;++x)g.push(v);g.push(s)}return g}function Et(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Tt(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function At(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Dt(e){return e.inclusiveLeft?-1:0}function Lt(e){return e.inclusiveRight?1:0}function Pt(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=tt(r.from,i.from)||Dt(e)-Dt(t);return o?-o:tt(r.to,i.to)||Lt(e)-Lt(t)||t.id-e.id}function Ft(e,t){var n,r=Ct&&e.markedSpans;if(r)for(var i=void 0,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Pt(n,i.marker)<0)&&(n=i.marker);return n}function Nt(e){return Ft(e,!0)}function jt(e){return Ft(e,!1)}function Rt(e,t){var n,r=Ct&&e.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||Pt(n,o.marker)<0)&&(n=o.marker)}return n}function Ot(e,t,n,r,i){var o=Ge(e,t),a=Ct&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=tt(c.from,n)||Dt(s.marker)-Dt(i),d=tt(c.to,r)||Lt(s.marker)-Lt(i);if(!(u>=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(c.to,n)>=0:tt(c.to,n)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(c.from,r)<=0:tt(c.from,r)<0)))return!0}}}function Mt(e){for(var t;t=Nt(e);)e=t.find(-1,!0).line;return e}function Bt(e,t){var n=Ge(e,t),r=Mt(n);return n==r?t:Ke(r)}function Wt(e,t){if(t>e.lastLine())return t;var n,r=Ge(e,t);if(!zt(e,r))return t;for(;n=jt(r);)r=n.find(1,!0).line;return Ke(r)+1}function zt(e,t){var n=Ct&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i)if((r=n[i]).marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&Ht(e,t,r))return!0}}function Ht(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return Ht(e,r.line,St(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Ht(e,t,i))return!0}function Zt(e){for(var t=0,n=(e=Mt(e)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;o=(n=o).parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==n)break;t+=l.height}return t}function Ut(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=Nt(r);){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=jt(r);){var o=t.find(0,!0);n-=r.text.length-o.from.ch,n+=(r=o.to.line).text.length-o.to.ch}return n}function Vt(e){var t=e.display,n=e.doc;t.maxLine=Ge(n,n.first),t.maxLineLength=Ut(t.maxLine),t.maxLineChanged=!0,n.iter((function(e){var n=Ut(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var Gt=function(e,t,n){this.text=e,At(this,t),this.height=n?n(this):1};function qt(e){e.parent=null,Tt(e)}Gt.prototype.lineNo=function(){return Ke(this)},be(Gt);var $t={},Yt={};function Kt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Yt:$t;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Xt(e,t){var n=D("span",null,null,s?"padding-right: .1px":null),r={pre:D("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=Qt,Ae(e.display.measure)&&(a=ce(o,e.doc.direction))&&(r.addToken=en(r.addToken,a)),r.map=[],nn(o,r,pt(e,o,t!=e.display.externalMeasured&&Ke(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=N(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=N(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Te(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var l=r.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return fe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=N(r.pre.className,r.textClass||"")),r}function Jt(e){var t=A("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Qt(e,t,n,r,i,o,s){if(t){var c,u=e.splitSpaces?function(e,t){if(e.length>1&&!/  /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}(t,e.trailingSpace):t,d=e.cm.state.specialChars,p=!1;if(d.test(t)){c=document.createDocumentFragment();for(var m=0;;){d.lastIndex=m;var f=d.exec(t),h=f?f.index-m:t.length-m;if(h){var g=document.createTextNode(u.slice(m,m+h));a&&l<9?c.appendChild(A("span",[g])):c.appendChild(g),e.map.push(e.pos,e.pos+h,g),e.col+=h,e.pos+=h}if(!f)break;m+=h+1;var v=void 0;if("\t"==f[0]){var b=e.cm.options.tabSize,y=b-e.col%b;(v=c.appendChild(A("span",q(y),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=y}else"\r"==f[0]||"\n"==f[0]?((v=c.appendChild(A("span","\r"==f[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",f[0]),e.col+=1):((v=e.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),a&&l<9?c.appendChild(A("span",[v])):c.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,c=document.createTextNode(u),e.map.push(e.pos,e.pos+t.length,c),a&&l<9&&(p=!0),e.pos+=t.length;if(e.trailingSpace=32==u.charCodeAt(t.length-1),n||r||i||p||o||s){var x=n||"";r&&(x+=r),i&&(x+=i);var w=A("span",[c],x,o);if(s)for(var C in s)s.hasOwnProperty(C)&&"style"!=C&&"class"!=C&&w.setAttribute(C,s[C]);return e.content.appendChild(w)}e.content.appendChild(c)}}function en(e,t){return function(n,r,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var c=n.pos,u=c+r.length;;){for(var d=void 0,p=0;p<t.length&&!((d=t[p]).to>c&&d.from<=c);p++);if(d.to>=u)return e(n,r,i,o,a,l,s);e(n,r.slice(0,d.to-c),i,o,null,l,s),o=null,r=r.slice(d.to-c),c=d.to}}}function tn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function nn(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,c,u,d,p,m=i.length,f=0,h=1,g="",v=0;;){if(v==f){s=c=u=l="",p=null,d=null,v=1/0;for(var b=[],y=void 0,x=0;x<r.length;++x){var w=r[x],C=w.marker;if("bookmark"==C.type&&w.from==f&&C.widgetNode)b.push(C);else if(w.from<=f&&(null==w.to||w.to>f||C.collapsed&&w.to==f&&w.from==f)){if(null!=w.to&&w.to!=f&&v>w.to&&(v=w.to,c=""),C.className&&(s+=" "+C.className),C.css&&(l=(l?l+";":"")+C.css),C.startStyle&&w.from==f&&(u+=" "+C.startStyle),C.endStyle&&w.to==v&&(y||(y=[])).push(C.endStyle,w.to),C.title&&((p||(p={})).title=C.title),C.attributes)for(var _ in C.attributes)(p||(p={}))[_]=C.attributes[_];C.collapsed&&(!d||Pt(d.marker,C)<0)&&(d=w)}else w.from>f&&v>w.from&&(v=w.from)}if(y)for(var S=0;S<y.length;S+=2)y[S+1]==v&&(c+=" "+y[S]);if(!d||d.from==f)for(var k=0;k<b.length;++k)tn(t,0,b[k]);if(d&&(d.from||0)==f){if(tn(t,(null==d.to?m+1:d.to)-f,d.marker,null==d.from),null==d.to)return;d.to==f&&(d=!1)}}if(f>=m)break;for(var I=Math.min(m,v);;){if(g){var E=f+g.length;if(!d){var T=E>I?g.slice(0,I-f):g;t.addToken(t,T,a?a+s:s,u,f+T.length==v?c:"",l,p)}if(E>=I){g=g.slice(I-f),f=I;break}f=E,u=""}g=i.slice(o,o=n[h++]),a=Kt(n[h++],t.cm.options)}}else for(var A=1;A<n.length;A+=2)t.addToken(t,i.slice(o,o=n[A]),Kt(n[A+1],t.cm.options))}function rn(e,t,n){this.line=t,this.rest=function(e){for(var t,n;t=jt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}(t),this.size=this.rest?Ke($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=zt(e,t)}function on(e,t,n){for(var r,i=[],o=t;o<n;o=r){var a=new rn(e.doc,Ge(e.doc,o),o);r=o+a.size,i.push(a)}return i}var an=null;var ln=null;function sn(e,t){var n=pe(e,t);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);an?r=an.delayedCallbacks:ln?r=ln:(r=ln=[],setTimeout(cn,0));for(var o=function(e){r.push((function(){return n[e].apply(null,i)}))},a=0;a<n.length;++a)o(a)}}function cn(){var e=ln;ln=null;for(var t=0;t<e.length;++t)e[t]()}function un(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?mn(e,t):"gutter"==o?hn(e,t,n,r):"class"==o?fn(e,t):"widget"==o&&gn(e,t,r)}t.changes=null}function dn(e){return e.node==e.text&&(e.node=A("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),a&&l<8&&(e.node.style.zIndex=2)),e.node}function pn(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Xt(e,t)}function mn(e,t){var n=t.text.className,r=pn(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,fn(e,t)):n&&(t.text.className=n)}function fn(e,t){(function(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=dn(t);t.background=r.insertBefore(A("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}})(e,t),t.line.wrapClass?dn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function hn(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=dn(t);t.gutterBackground=A("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=dn(t),l=t.gutter=A("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(l.setAttribute("aria-hidden","true"),e.display.input.setUneditable(l),a.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(A("div",Qe(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.display.gutterSpecs.length;++s){var c=e.display.gutterSpecs[s].className,u=o.hasOwnProperty(c)&&o[c];u&&l.appendChild(A("div",[u],"CodeMirror-gutter-elt","left: "+r.gutterLeft[c]+"px; width: "+r.gutterWidth[c]+"px"))}}}function gn(e,t,n){t.alignable&&(t.alignable=null);for(var r=S("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);bn(e,t,n)}function vn(e,t,n,r){var i=pn(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),fn(e,t),hn(e,t,n,r),bn(e,t,r),t.node}function bn(e,t,n){if(yn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)yn(e,t.rest[r],t,n,!1)}function yn(e,t,n,r,i){if(t.widgets)for(var o=dn(n),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=A("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:""));s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),xn(s,c,n,r),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),sn(s,"redraw")}}function xn(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function wn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!L(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),T(t.display.measure,A("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Cn(e,t){for(var n=_e(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function _n(e){return e.lineSpace.offsetTop}function Sn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function kn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=T(e.measure,A("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function In(e){return 50-e.display.nativeBarWidth}function En(e){return e.display.scroller.clientWidth-In(e)-e.display.barWidth}function Tn(e){return e.display.scroller.clientHeight-In(e)-e.display.barHeight}function An(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Ke(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Dn(e,t,n,r){return Fn(e,Pn(e,t),n,r)}function Ln(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ur(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function Pn(e,t){var n=Ke(t),r=Ln(e,n);r&&!r.text?r=null:r&&r.changes&&(un(e,r,n,or(e)),e.curOp.forceUpdate=!0),r||(r=function(e,t){var n=Ke(t=Mt(t)),r=e.display.externalMeasured=new rn(e.doc,t,n);r.lineN=n;var i=r.built=Xt(e,r);return r.text=i.pre,T(e.display.lineMeasure,i.pre),r}(e,t));var i=An(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Fn(e,t,n,r,i){t.before&&(n=-1);var o,s=n+(r||"");return t.cache.hasOwnProperty(s)?o=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,n){var r=e.options.lineWrapping,i=r&&En(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=Rn(t.map,n,r),s=o.node,c=o.start,u=o.end,d=o.collapse;if(3==s.nodeType){for(var p=0;p<4;p++){for(;c&&re(t.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u<o.coverEnd&&re(t.line.text.charAt(o.coverStart+u));)++u;if((i=a&&l<9&&0==c&&u==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():On(k(s,c,u).getClientRects(),r)).left||i.right||0==c)break;u=c,c-=1,d="right"}a&&l<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Ne)return Ne;var t=T(e,A("span","x")),n=t.getBoundingClientRect(),r=k(t,0,1).getBoundingClientRect();return Ne=Math.abs(n.left-r.left)>1}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}(e.display.measure,i))}else{var m;c>0&&(d=r="right"),i=e.options.lineWrapping&&(m=s.getClientRects()).length>1?m["right"==r?m.length-1:0]:s.getBoundingClientRect()}if(a&&l<9&&!c&&(!i||!i.left&&!i.right)){var f=s.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+ir(e.display),top:f.top,bottom:f.bottom}:jn}for(var h=i.top-t.rect.top,g=i.bottom-t.rect.top,v=(h+g)/2,b=t.view.measure.heights,y=0;y<b.length-1&&!(v<b[y]);y++);var x=y?b[y-1]:0,w=b[y],C={left:("right"==d?i.right:i.left)-t.rect.left,right:("left"==d?i.left:i.right)-t.rect.left,top:x,bottom:w};return i.left||i.right||(C.bogus=!0),e.options.singleCursorHeightPerLine||(C.rtop=h,C.rbottom=g),C}(e,t,n,r)).bogus||(t.cache[s]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Nn,jn={left:0,right:0,top:0,bottom:0};function Rn(e,t,n){for(var r,i,o,a,l,s,c=0;c<e.length;c+=3)if(l=e[c],s=e[c+1],t<l?(i=0,o=1,a="left"):t<s?o=1+(i=t-l):(c==e.length-3||t==s&&e[c+3]>t)&&(i=(o=s-l)-1,t>=s&&(a="right")),null!=i){if(r=e[c+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)r=e[2+(c-=3)],a="left";if("right"==n&&i==s-l)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)r=e[(c+=3)+2],a="right";break}return{node:r,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function On(e,t){var n=jn;if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;i>=0&&(n=e[i]).left==n.right;i--);return n}function Mn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Bn(e){e.display.externalMeasure=null,E(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Mn(e.display.view[t])}function Wn(e){Bn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function zn(){return u&&g?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Hn(){return u&&g?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Zn(e){var t=Mt(e).widgets,n=0;if(t)for(var r=0;r<t.length;++r)t[r].above&&(n+=wn(t[r]));return n}function Un(e,t,n,r,i){if(!i){var o=Zn(t);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var a=Zt(t);if("local"==r?a+=_n(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==r?0:Hn());var s=l.left+("window"==r?0:zn());n.left+=s,n.right+=s}return n.top+=a,n.bottom+=a,n}function Vn(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=zn(),i-=Hn();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function Gn(e,t,n,r,i){return r||(r=Ge(e.doc,t.line)),Un(e,r,Dn(e,r,t.ch,i),n)}function qn(e,t,n,r,i,o){function a(t,a){var l=Fn(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,Un(e,r,l,n)}r=r||Ge(e.doc,t.line),i||(i=Pn(e,r));var l=ce(r,e.doc.direction),s=t.ch,c=t.sticky;if(s>=r.text.length?(s=r.text.length,c="before"):s<=0&&(s=0,c="after"),!l)return a("before"==c?s-1:s,"before"==c);function u(e,t,n){return a(n?e-1:e,1==l[t].level!=n)}var d=le(l,s,c),p=ae,m=u(s,d,"before"==c);return null!=p&&(m.other=u(s,p,"before"!=c)),m}function $n(e,t){var n=0;t=lt(e.doc,t),e.options.lineWrapping||(n=ir(e.display)*t.ch);var r=Ge(e.doc,t.line),i=Zt(r)+_n(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Yn(e,t,n,r,i){var o=et(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Kn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return Yn(r.first,0,null,-1,-1);var i=Xe(r,n),o=r.first+r.size-1;if(i>o)return Yn(r.first+r.size-1,Ge(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=Ge(r,i);;){var l=er(e,a,i,t,n),s=Rt(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var c=s.find(1);if(c.line==i)return c;a=Ge(r,i=c.line)}}function Xn(e,t,n,r){r-=Zn(t);var i=t.text.length,o=oe((function(t){return Fn(e,n,t-1).bottom<=r}),i,0);return{begin:o,end:i=oe((function(t){return Fn(e,n,t).top>r}),o,i)}}function Jn(e,t,n,r){return n||(n=Pn(e,t)),Xn(e,t,n,Un(e,t,Fn(e,n,r),"line").top)}function Qn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function er(e,t,n,r,i){i-=Zt(t);var o=Pn(e,t),a=Zn(t),l=0,s=t.text.length,c=!0,u=ce(t,e.doc.direction);if(u){var d=(e.options.lineWrapping?nr:tr)(e,t,n,o,u,r,i);l=(c=1!=d.level)?d.from:d.to-1,s=c?d.to:d.from-1}var p,m,f=null,h=null,g=oe((function(t){var n=Fn(e,o,t);return n.top+=a,n.bottom+=a,!!Qn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(f=t,h=n),!0)}),l,s),v=!1;if(h){var b=r-h.left<h.right-r,y=b==c;g=f+(y?0:1),m=y?"after":"before",p=b?h.left:h.right}else{c||g!=s&&g!=l||g++,m=0==g?"after":g==t.text.length?"before":Fn(e,o,g-(c?1:0)).bottom+a<=i==c?"after":"before";var x=qn(e,et(n,g,m),"line",t,o);p=x.left,v=i<x.top?-1:i>=x.bottom?1:0}return Yn(n,g=ie(t.text,g,1),m,v,r-p)}function tr(e,t,n,r,i,o,a){var l=oe((function(l){var s=i[l],c=1!=s.level;return Qn(qn(e,et(n,c?s.to:s.from,c?"before":"after"),"line",t,r),o,a,!0)}),0,i.length-1),s=i[l];if(l>0){var c=1!=s.level,u=qn(e,et(n,c?s.from:s.to,c?"after":"before"),"line",t,r);Qn(u,o,a,!0)&&u.top>a&&(s=i[l-1])}return s}function nr(e,t,n,r,i,o,a){var l=Xn(e,t,r,a),s=l.begin,c=l.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,d=null,p=0;p<i.length;p++){var m=i[p];if(!(m.from>=c||m.to<=s)){var f=Fn(e,r,1!=m.level?Math.min(c,m.to)-1:Math.max(s,m.from)).right,h=f<o?o-f+1e9:f-o;(!u||d>h)&&(u=m,d=h)}}return u||(u=i[i.length-1]),u.from<s&&(u={from:s,to:u.to,level:u.level}),u.to>c&&(u={from:u.from,to:c,level:u.level}),u}function rr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Nn){Nn=A("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Nn.appendChild(document.createTextNode("x")),Nn.appendChild(A("br"));Nn.appendChild(document.createTextNode("x"))}T(e.measure,Nn);var n=Nn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),E(e.measure),n||1}function ir(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=A("span","xxxxxxxxxx"),n=A("pre",[t],"CodeMirror-line-like");T(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function or(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:ar(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ar(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function lr(e){var t=rr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/ir(e.display)-3);return function(i){if(zt(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function sr(e){var t=e.doc,n=lr(e);t.iter((function(e){var t=n(e);t!=e.height&&Ye(e,t)}))}function cr(e,t,n,r){var i=e.display;if(!n&&"true"==_e(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(e){return null}var s,c=Kn(e,o,a);if(r&&c.xRel>0&&(s=Ge(e.doc,c.line).text).length==c.ch){var u=M(s,s.length,e.options.tabSize)-s.length;c=et(c.line,Math.max(0,Math.round((o-kn(e.display).left)/ir(e.display))-u))}return c}function ur(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if((t-=n[r].size)<0)return r}function dr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ct&&Bt(e.doc,t)<i.viewTo&&mr(e);else if(n<=i.viewFrom)Ct&&Wt(e.doc,n+r)>i.viewFrom?mr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)mr(e);else if(t<=i.viewFrom){var o=fr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):mr(e)}else if(n>=i.viewTo){var a=fr(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):mr(e)}else{var l=fr(e,t,t,-1),s=fr(e,n,n+r,1);l&&s?(i.view=i.view.slice(0,l.index).concat(on(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):mr(e)}var c=i.externalMeasured;c&&(n<c.lineN?c.lineN+=r:t<c.lineN+c.size&&(i.externalMeasured=null))}function pr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[ur(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==W(a,n)&&a.push(n)}}}function mr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function fr(e,t,n,r){var i,o=ur(e,t),a=e.display.view;if(!Ct||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size;if(l!=t){if(r>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,n+=i}for(;Bt(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function hr(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function gr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vr(e,t){void 0===t&&(t=!0);var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=e.options.$customCursor;a&&(t=!0);for(var l=0;l<n.sel.ranges.length;l++)if(t||l!=n.sel.primIndex){var s=n.sel.ranges[l];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var c=s.empty();if(a){var u=a(e,s);u&&br(e,u,i)}else(c||e.options.showCursorWhenSelecting)&&br(e,s.head,i);c||xr(e,s,o)}}return r}function br(e,t,n){var r=qn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(A("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var o=Gn(e,t,"div",null,null),a=o.right-o.left;i.style.width=(a>0?a:e.defaultCharWidth())+"px"}if(r.other){var l=n.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=r.other.left+"px",l.style.top=r.other.top+"px",l.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function yr(e,t){return e.top-t.top||e.left-t.left}function xr(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),a=kn(e.display),l=a.left,s=Math.max(r.sizerWidth,En(e)-r.sizer.offsetLeft)-a.right,c="ltr"==i.direction;function u(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n                             top: "+t+"px; width: "+(null==n?s-e:n)+"px;\n                             height: "+(r-t)+"px"))}function d(t,n,r){var o,a,d=Ge(i,t),p=d.text.length;function m(n,r){return Gn(e,et(t,n),"div",d,r)}function f(t,n,r){var i=Jn(e,d,null,t),o="ltr"==n==("after"==r)?"left":"right";return m("after"==r?i.begin:i.end-(/\s/.test(d.text.charAt(i.end-1))?2:1),o)[o]}var h=ce(d,i.direction);return function(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<n&&a.to>t||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(h,n||0,null==r?p:r,(function(e,t,i,d){var g="ltr"==i,v=m(e,g?"left":"right"),b=m(t-1,g?"right":"left"),y=null==n&&0==e,x=null==r&&t==p,w=0==d,C=!h||d==h.length-1;if(b.top-v.top<=3){var _=(c?x:y)&&C,S=(c?y:x)&&w?l:(g?v:b).left,k=_?s:(g?b:v).right;u(S,v.top,k-S,v.bottom)}else{var I,E,T,A;g?(I=c&&y&&w?l:v.left,E=c?s:f(e,i,"before"),T=c?l:f(t,i,"after"),A=c&&x&&C?s:b.right):(I=c?f(e,i,"before"):l,E=!c&&y&&w?s:v.right,T=!c&&x&&C?l:b.left,A=c?f(t,i,"after"):s),u(I,v.top,E-I,v.bottom),v.bottom<b.top&&u(l,v.bottom,null,b.top),u(T,b.top,A-T,b.bottom)}(!o||yr(v,o)<0)&&(o=v),yr(b,o)<0&&(o=b),(!a||yr(v,a)<0)&&(a=v),yr(b,a)<0&&(a=b)})),{start:o,end:a}}var p=t.from(),m=t.to();if(p.line==m.line)d(p.line,p.ch,m.ch);else{var f=Ge(i,p.line),h=Ge(i,m.line),g=Mt(f)==Mt(h),v=d(p.line,p.ch,g?f.text.length+1:null).end,b=d(m.line,g?0:null,m.ch).start;g&&(v.top<b.top-2?(u(v.right,v.top,null,v.bottom),u(l,b.top,b.left,b.bottom)):u(v.right,v.top,b.left-v.right,v.bottom)),v.bottom<b.top&&u(l,v.bottom,null,b.top)}n.appendChild(o)}function wr(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){e.hasFocus()||kr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Cr(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Sr(e))}function _r(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&kr(e))}),100)}function Sr(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(fe(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),wr(e))}function kr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(fe(e,"blur",e,t),e.state.focused=!1,I(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Ir(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,s=0;s<t.view.length;s++){var c=t.view[s],u=e.options.lineWrapping,d=void 0,p=0;if(!c.hidden){if(i+=c.line.height,a&&l<8){var m=c.node.offsetTop+c.node.offsetHeight;d=m-n,n=m}else{var f=c.node.getBoundingClientRect();d=f.bottom-f.top,!u&&c.text.firstChild&&(p=c.text.firstChild.getBoundingClientRect().right-f.left-1)}var h=c.line.height-d;if((h>.005||h<-.005)&&(i<r&&(o-=h),Ye(c.line,d),Er(c.line),c.rest))for(var g=0;g<c.rest.length;g++)Er(c.rest[g]);if(p>e.display.sizerWidth){var v=Math.ceil(p/ir(e.display));v>e.display.maxLineLength&&(e.display.maxLineLength=v,e.display.maxLine=c.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function Er(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Tr(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-_n(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=Xe(t,r),a=Xe(t,i);if(n&&n.ensure){var l=n.ensure.from.line,s=n.ensure.to.line;l<o?(o=l,a=Xe(t,Zt(Ge(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=Xe(t,Zt(Ge(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function Ar(e,t){var n=e.display,r=rr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=Tn(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Sn(n),s=t.top<r,c=t.bottom>l-r;if(t.top<i)a.scrollTop=s?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?l:t.bottom)-o);u!=i&&(a.scrollTop=u)}var d=e.options.fixedGutter?0:n.gutters.offsetWidth,p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-d,m=En(e)-n.gutters.offsetWidth,f=t.right-t.left>m;return f&&(t.right=t.left+m),t.left<10?a.scrollLeft=0:t.left<p?a.scrollLeft=Math.max(0,t.left+d-(f?0:10)):t.right>m+p-3&&(a.scrollLeft=t.right+(f?0:10)-m),a}function Dr(e,t){null!=t&&(Fr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Lr(e){Fr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Pr(e,t,n){null==t&&null==n||Fr(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Fr(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Nr(e,$n(e,t.from),$n(e,t.to),t.margin))}function Nr(e,t,n,r){var i=Ar(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Pr(e,i.scrollLeft,i.scrollTop)}function jr(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||si(e,{top:t}),Rr(e,t,!0),n&&si(e),ri(e,100))}function Rr(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Or(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,di(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Mr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Sn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+In(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Br=function(e,t,n){this.cm=n;var r=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),de(r,"scroll",(function(){r.clientHeight&&t(r.scrollTop,"vertical")})),de(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&l<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Br.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Br.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Br.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Br.prototype.zeroWidthHack=function(){var e=b&&!m?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new B,this.disableVert=new B},Br.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,(function r(){var i=e.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,r)}))},Br.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Wr=function(){};function zr(e,t){t||(t=Mr(e));var n=e.display.barWidth,r=e.display.barHeight;Hr(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Ir(e),Hr(e,Mr(e)),n=e.display.barWidth,r=e.display.barHeight}function Hr(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Wr.prototype.update=function(){return{bottom:0,right:0}},Wr.prototype.setScrollLeft=function(){},Wr.prototype.setScrollTop=function(){},Wr.prototype.clear=function(){};var Zr={native:Br,null:Wr};function Ur(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&I(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Zr[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),de(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?Or(e,t):jr(e,t)}),e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Vr=0;function Gr(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Vr,markArrays:null},t=e.curOp,an?an.ops.push(t):t.ownsGroup=an={ops:[t],delayedCallbacks:[]}}function qr(e){var t=e.curOp;t&&function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}(n)}finally{an=null,t(n)}}(t,(function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,n=0;n<t.length;n++)$r(t[n]);for(var r=0;r<t.length;r++)Yr(t[r]);for(var i=0;i<t.length;i++)Kr(t[i]);for(var o=0;o<t.length;o++)Xr(t[o]);for(var a=0;a<t.length;a++)Jr(t[a])}(e)}))}function $r(e){var t=e.cm,n=t.display;(function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=In(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=In(e)+"px",t.scrollbarsClipped=!0)})(t),e.updateMaxLine&&Vt(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new oi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Yr(e){e.updatedDisplay=e.mustUpdate&&ai(e.cm,e.update)}function Kr(e){var t=e.cm,n=t.display;e.updatedDisplay&&Ir(t),e.barMeasure=Mr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Dn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+In(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-En(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Xr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Or(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==P();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&zr(t,e.barMeasure),e.updatedDisplay&&ui(t,e.barMeasure),e.selectionChanged&&wr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Cr(e.cm)}function Jr(e){var t=e.cm,n=t.display,r=t.doc;e.updatedDisplay&&li(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&Rr(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Or(t,e.scrollLeft,!0,!0),e.scrollToPos&&function(e,t){if(!he(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!f){var o=A("div","​",null,"position: absolute;\n                         top: "+(t.top-n.viewOffset-_n(e.display))+"px;\n                         height: "+(t.bottom-t.top+In(e)+n.barHeight)+"px;\n                         left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?et(t.line,t.ch+1,"before"):t,t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var a=!1,l=qn(e,t),s=n&&n!=t?qn(e,n):l,c=Ar(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r}),u=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=c.scrollTop&&(jr(e,c.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(a=!0)),null!=c.scrollLeft&&(Or(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}(t,lt(r,e.scrollToPos.from),lt(r,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a<i.length;++a)i[a].lines.length||fe(i[a],"hide");if(o)for(var l=0;l<o.length;++l)o[l].lines.length&&fe(o[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&fe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Qr(e,t){if(e.curOp)return t();Gr(e);try{return t()}finally{qr(e)}}function ei(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Gr(e);try{return t.apply(e,arguments)}finally{qr(e)}}}function ti(e){return function(){if(this.curOp)return e.apply(this,arguments);Gr(this);try{return e.apply(this,arguments)}finally{qr(this)}}}function ni(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Gr(t);try{return e.apply(this,arguments)}finally{qr(t)}}}function ri(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,R(ii,e))}function ii(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=mt(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(r.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?He(t.mode,r.state):null,s=dt(e,o,r,!0);l&&(r.state=l),o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),p=0;!d&&p<a.length;++p)d=a[p]!=o.styles[p];d&&i.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=e.options.maxHighlightLength&&ft(e,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ri(e,e.options.workDelay),!0})),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Qr(e,(function(){for(var t=0;t<i.length;t++)pr(e,i[t],"text")}))}}var oi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Tr(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=En(e),this.force=n,this.dims=or(e),this.events=[]};function ai(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return mr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==hr(e))return!1;pi(e)&&(mr(e),t.dims=or(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Ct&&(o=Bt(e.doc,o),a=Wt(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;(function(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=on(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=on(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(ur(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(on(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,ur(e,n)))),r.viewTo=n})(e,o,a),n.viewOffset=Zt(Ge(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var c=hr(e);if(!l&&0==c&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=function(e){if(e.hasFocus())return null;var t=P();if(!t||!L(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&L(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}(e);return c>4&&(n.lineDiv.style.display="none"),function(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function l(t){var n=t.nextSibling;return s&&b&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var c=r.view,u=r.viewFrom,d=0;d<c.length;d++){var p=c[d];if(p.hidden);else if(p.node&&p.node.parentNode==o){for(;a!=p.node;)a=l(a);var m=i&&null!=t&&t<=u&&p.lineNumber;p.changes&&(W(p.changes,"gutter")>-1&&(m=!1),un(e,p,u,n)),m&&(E(p.lineNumber),p.lineNumber.appendChild(document.createTextNode(Qe(e.options,u)))),a=p.node.nextSibling}else{var f=vn(e,p,u,n);o.insertBefore(f,a)}u+=p.size}for(;a;)a=l(a)}(e,n.updateLineNumbers,t.dims),c>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=P()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&L(document.body,e.anchorNode)&&L(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(u),E(n.cursorDiv),E(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ri(e,400)),n.updateLineNumbers=null,!0}function li(e,t){for(var n=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=En(e))r&&(t.visible=Tr(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Sn(e.display)-Tn(e),n.top)}),t.visible=Tr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!ai(e,t))break;Ir(e);var i=Mr(e);gr(e),zr(e,i),ui(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function si(e,t){var n=new oi(e,t);if(ai(e,n)){Ir(e),li(e,n);var r=Mr(e);gr(e),zr(e,r),ui(e,r),n.finish()}}function ci(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",sn(e,"gutterChanged",e)}function ui(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+In(e)+"px"}function di(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=ar(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){e.options.fixedGutter&&(n[a].gutter&&(n[a].gutter.style.left=o),n[a].gutterBackground&&(n[a].gutterBackground.style.left=o));var l=n[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function pi(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Qe(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(A("div",[A("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ci(e.display),!0}return!1}function mi(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var o=e[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;r=!0}n.push({className:o,style:a})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function fi(e){var t=e.gutters,n=e.gutterSpecs;E(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,a=i.style,l=t.appendChild(A("div",null,"CodeMirror-gutter "+o));a&&(l.style.cssText=a),"CodeMirror-linenumbers"==o&&(e.lineGutter=l,l.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ci(e)}function hi(e){fi(e.display),dr(e),di(e)}function gi(e,t,r,i){var o=this;this.input=r,o.scrollbarFiller=A("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=A("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=D("div",null,"CodeMirror-code"),o.selectionDiv=A("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=A("div",null,"CodeMirror-cursors"),o.measure=A("div",null,"CodeMirror-measure"),o.lineMeasure=A("div",null,"CodeMirror-measure"),o.lineSpace=D("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var c=D("div",[o.lineSpace],"CodeMirror-lines");o.mover=A("div",[c],null,"position: relative"),o.sizer=A("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=A("div",null,null,"position: absolute; height: 50px; width: 1px;"),o.gutters=A("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=A("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=A("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),o.wrapper.setAttribute("translate","no"),a&&l<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),s||n&&v||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=mi(i.gutters,i.lineNumbers),fi(o),r.init(o)}oi.prototype.signal=function(e,t){ve(e,t)&&this.events.push(arguments)},oi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)fe.apply(null,this.events[e])};var vi=0,bi=null;function yi(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function xi(e){var t=yi(e);return t.x*=bi,t.y*=bi,t}function wi(e,t){var r=yi(t),i=r.x,o=r.y,a=bi;0===t.deltaMode&&(i=t.deltaX,o=t.deltaY,a=1);var l=e.display,c=l.scroller,u=c.scrollWidth>c.clientWidth,p=c.scrollHeight>c.clientHeight;if(i&&u||o&&p){if(o&&b&&s)e:for(var m=t.target,f=l.view;m!=c;m=m.parentNode)for(var h=0;h<f.length;h++)if(f[h].node==m){e.display.currentWheelTarget=m;break e}if(i&&!n&&!d&&null!=a)return o&&p&&jr(e,Math.max(0,c.scrollTop+o*a)),Or(e,Math.max(0,c.scrollLeft+i*a)),(!o||o&&p)&&ye(t),void(l.wheelStartX=null);if(o&&null!=a){var g=o*a,v=e.doc.scrollTop,y=v+l.wrapper.clientHeight;g<0?v=Math.max(0,v+g-50):y=Math.min(e.doc.height,y+g+50),si(e,{top:v,bottom:y})}vi<20&&0!==t.deltaMode&&(null==l.wheelStartX?(l.wheelStartX=c.scrollLeft,l.wheelStartY=c.scrollTop,l.wheelDX=i,l.wheelDY=o,setTimeout((function(){if(null!=l.wheelStartX){var e=c.scrollLeft-l.wheelStartX,t=c.scrollTop-l.wheelStartY,n=t&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX;l.wheelStartX=l.wheelStartY=null,n&&(bi=(bi*vi+n)/(vi+1),++vi)}}),200)):(l.wheelDX+=i,l.wheelDY+=o))}}a?bi=-.53:n?bi=15:u?bi=-.7:p&&(bi=-1/3);var Ci=function(e,t){this.ranges=e,this.primIndex=t};Ci.prototype.primary=function(){return this.ranges[this.primIndex]},Ci.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!nt(n.anchor,r.anchor)||!nt(n.head,r.head))return!1}return!0},Ci.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new _i(rt(this.ranges[t].anchor),rt(this.ranges[t].head));return new Ci(e,this.primIndex)},Ci.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Ci.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(tt(t,r.from())>=0&&tt(e,r.to())<=0)return n}return-1};var _i=function(e,t){this.anchor=e,this.head=t};function Si(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort((function(e,t){return tt(e.from(),t.from())})),n=W(t,i);for(var o=1;o<t.length;o++){var a=t[o],l=t[o-1],s=tt(l.to(),a.from());if(r&&!a.empty()?s>0:s>=0){var c=ot(l.from(),a.from()),u=it(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head;o<=n&&--n,t.splice(--o,2,new _i(d?u:c,d?c:u))}}return new Ci(t,n)}function ki(e,t){return new Ci([new _i(e,t||e)],0)}function Ii(e){return e.text?et(e.from.line+e.text.length-1,$(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Ei(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return Ii(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Ii(t).ch-t.to.ch),et(n,r)}function Ti(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new _i(Ei(i.anchor,t),Ei(i.head,t)))}return Si(e.cm,n,e.sel.primIndex)}function Ai(e,t,n){return e.line==t.line?et(n.line,e.ch-t.ch+n.ch):et(n.line+(e.line-t.line),e.ch)}function Di(e){e.doc.mode=Be(e.options,e.doc.modeOption),Li(e)}function Li(e){e.doc.iter((function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)})),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ri(e,100),e.state.modeGen++,e.curOp&&dr(e)}function Pi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==$(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Fi(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){(function(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Tt(e),At(e,n);var i=r?r(e):1;i!=e.height&&Ye(e,i)})(e,n,i,r),sn(e,"change",e,t)}function a(e,t){for(var n=[],o=e;o<t;++o)n.push(new Gt(c[o],i(o),r));return n}var l=t.from,s=t.to,c=t.text,u=Ge(e,l.line),d=Ge(e,s.line),p=$(c),m=i(c.length-1),f=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Pi(e,t)){var h=a(0,c.length-1);o(d,d.text,m),f&&e.remove(l.line,f),h.length&&e.insert(l.line,h)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,l.ch)+p+u.text.slice(s.ch),m);else{var g=a(1,c.length-1);g.push(new Gt(p+u.text.slice(s.ch),m,r)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,g)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),i(0)),e.remove(l.line+1,f);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(d,p+d.text.slice(s.ch),m);var v=a(1,c.length-1);f>1&&e.remove(l.line+1,f-1),e.insert(l.line+1,v)}sn(e,"change",e,t)}function Ni(e,t,n){!function e(r,i,o){if(r.linked)for(var a=0;a<r.linked.length;++a){var l=r.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;n&&!s||(t(l.doc,s),e(l.doc,r,s))}}}(e,null,!0)}function ji(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,sr(e),Di(e),Ri(e),e.options.direction=t.direction,e.options.lineWrapping||Vt(e),e.options.mode=t.modeOption,dr(e)}function Ri(e){("rtl"==e.doc.direction?F:I)(e.display.lineDiv,"CodeMirror-rtl")}function Oi(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function Mi(e,t){var n={from:rt(t.from),to:Ii(t),text:qe(e,t.from,t.to)};return Zi(e,n,t.from.line,t.to.line+1),Ni(e,(function(e){return Zi(e,n,t.from.line,t.to.line+1)}),!0),n}function Bi(e){for(;e.length&&$(e).ranges;)e.pop()}function Wi(e,t,n,r){var i=e.history;i.undone.length=0;var o,a,l=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Bi(e.done),$(e.done)):e.done.length&&!$(e.done).ranges?$(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),$(e.done)):void 0}(i,i.lastOp==r)))a=$(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,a.to)?a.to=Ii(t):o.changes.push(Mi(e,t));else{var s=$(i.done);for(s&&s.ranges||Hi(e.sel,i.done),o={changes:[Mi(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||fe(e,"historyAdded")}function zi(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,$(i.done),t))?i.done[i.done.length-1]=t:Hi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Bi(i.undone)}function Hi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Zi(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),(function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o}))}function Ui(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function Vi(e,t){var n=function(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(Ui(n[i]));return r}(e,t),r=It(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(n[i]=a)}return n}function Gi(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?Ci.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];r.push({changes:l});for(var s=0;s<a.length;++s){var c=a[s],u=void 0;if(l.push({from:c.from,to:c.to,text:c.text}),t)for(var d in c)(u=d.match(/^spans_(\d+)$/))&&W(t,Number(u[1]))>-1&&($(l)[d]=c[d],delete c[d])}}}return r}function qi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=tt(t,i)<0;o!=tt(n,i)<0?(i=t,t=n):o!=tt(t,n)<0&&(t=n)}return new _i(i,t)}return new _i(n||t,t)}function $i(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qi(e,new Ci([qi(e.sel.primary(),t,n,i)],0),r)}function Yi(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=qi(e.sel.ranges[o],t[o],null,i);Qi(e,Si(e.cm,r,e.sel.primIndex),n)}function Ki(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Qi(e,Si(e.cm,i,e.sel.primIndex),r)}function Xi(e,t,n,r){Qi(e,ki(t,n),r)}function Ji(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?(r[r.length-1]=t,eo(e,t,n)):Qi(e,t,n)}function Qi(e,t,n){eo(e,t,n),zi(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function eo(e,t,n){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=function(e,t,n){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new _i(lt(e,t[n].anchor),lt(e,t[n].head))},origin:n&&n.origin};return fe(e,"beforeSelectionChange",e,r),e.cm&&fe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Si(e.cm,r.ranges,r.ranges.length-1):t}(e,t,n));var r=n&&n.bias||(tt(t.primary().head,e.sel.primary().head)<0?-1:1);to(e,ro(e,t,r,!0)),n&&!1===n.scroll||!e.cm||"nocursor"==e.cm.getOption("readOnly")||Lr(e.cm)}function to(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),sn(e,"cursorActivity",e))}function no(e){to(e,ro(e,e.sel,null,!1))}function ro(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=oo(e,a.anchor,l&&l.anchor,n,r),c=oo(e,a.head,l&&l.head,n,r);(i||s!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new _i(s,c))}return i?Si(e.cm,i,t.primIndex):t}function io(e,t,n,r,i){var o=Ge(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker,c="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,u="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==l.from||(c?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(u?l.to>=t.ch:l.to>t.ch))){if(i&&(fe(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var d=s.find(r<0?1:-1),p=void 0;if((r<0?u:c)&&(d=ao(e,d,-r,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(p=tt(d,n))&&(r<0?p<0:p>0))return io(e,d,t,r,i)}var m=s.find(r<0?-1:1);return(r<0?c:u)&&(m=ao(e,m,r,m.line==t.line?o:null)),m?io(e,m,t,r,i):null}}return t}function oo(e,t,n,r,i){var o=r||1;return io(e,t,n,o,i)||!i&&io(e,t,n,o,!0)||io(e,t,n,-o,i)||!i&&io(e,t,n,-o,!0)||(e.cantEdit=!0,et(e.first,0))}function ao(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?lt(e,et(t.line-1)):null:n>0&&t.ch==(r||Ge(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+n)}function lo(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),H)}function so(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(t,n,i,o){t&&(r.from=lt(e,t)),n&&(r.to=lt(e,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),fe(e,"beforeChange",e,r),e.cm&&fe(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function co(e,t,n){if(e.cm){if(!e.cm.curOp)return ei(e.cm,co)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))||(t=so(e,t,!0))){var r=wt&&!n&&function(e,t,n){var r=null;if(e.iter(t.line,n.line+1,(function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=W(r,n)||(r||(r=[])).push(n)}})),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var a=r[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(tt(c.to,l.from)<0||tt(c.from,l.to)>0)){var u=[s,1],d=tt(c.from,l.from),p=tt(c.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(p>0||!a.inclusiveRight&&!p)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-3}}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)uo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else uo(e,t)}}function uo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var n=Ti(e,t);Wi(e,t,n,e.cm?e.cm.curOp.id:NaN),fo(e,t,n,It(e,t));var r=[];Ni(e,(function(e,n){n||-1!=W(r,e.history)||(bo(e.history,t),r.push(e.history)),fo(e,t,null,It(e,t))}))}}function po(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,a=e.sel,l="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,c=0;c<l.length&&(i=l[c],n?!i.ranges||i.equals(e.sel):i.ranges);c++);if(c!=l.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(i=l.pop()).ranges){if(r)return void l.push(i);break}if(Hi(i,s),n&&!i.equals(e.sel))return void Qi(e,i,{clearRedo:!1});a=i}var u=[];Hi(a,s),s.push({changes:u,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var d=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),p=function(n){var r=i.changes[n];if(r.origin=t,d&&!so(e,r,!1))return l.length=0,{};u.push(Mi(e,r));var o=n?Ti(e,r):$(l);fo(e,r,o,Vi(e,r)),!n&&e.cm&&e.cm.scrollIntoView({from:r.from,to:Ii(r)});var a=[];Ni(e,(function(e,t){t||-1!=W(a,e.history)||(bo(e.history,r),a.push(e.history)),fo(e,r,null,Vi(e,r))}))},m=i.changes.length-1;m>=0;--m){var f=p(m);if(f)return f.v}}}}function mo(e,t){if(0!=t&&(e.first+=t,e.sel=new Ci(Y(e.sel.ranges,(function(e){return new _i(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){dr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)pr(e.cm,r,"gutter")}}function fo(e,t,n,r){if(e.cm&&!e.cm.curOp)return ei(e.cm,fo)(e,t,n,r);if(t.to.line<e.first)mo(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);mo(e,i),t={from:et(e.first,0),to:et(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:et(o,Ge(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=qe(e,t.from,t.to),n||(n=Ti(e,t)),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=Ke(Mt(Ge(r,o.line))),r.iter(s,a.line+1,(function(e){if(e==i.maxLine)return l=!0,!0}))),r.sel.contains(t.from,t.to)>-1&&ge(e),Fi(r,t,n,lr(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,(function(e){var t=Ut(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)})),l&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=Ge(e,r).stateAfter;if(i&&(!(i instanceof ct)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}(r,o.line),ri(e,400);var c=t.text.length-(a.line-o.line)-1;t.full?dr(e):o.line!=a.line||1!=t.text.length||Pi(e.doc,t)?dr(e,o.line,a.line+1,c):pr(e,o.line,"text");var u=ve(e,"changes"),d=ve(e,"change");if(d||u){var p={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&sn(e,"change",e,p),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}(e.cm,t,r):Fi(e,t,r),eo(e,n,H),e.cantEdit&&oo(e,et(e.firstLine(),0))&&(e.cantEdit=!1)}}function ho(e,t,n,r,i){var o;r||(r=n),tt(r,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),co(e,{from:n,to:r,text:t,origin:i})}function go(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function vo(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var l=0;l<o.ranges.length;l++)go(o.ranges[l].anchor,t,n,r),go(o.ranges[l].head,t,n,r)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(n<c.from.line)c.from=et(c.from.line+r,c.from.ch),c.to=et(c.to.line+r,c.to.ch);else if(t<=c.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function bo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;vo(e.done,n,r,i),vo(e.undone,n,r,i)}function yo(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=Ge(e,at(e,t)):i=Ke(t),null==i?null:(r(o,i)&&e.cm&&pr(e.cm,i,n),o)}function xo(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}function wo(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}_i.prototype.from=function(){return ot(this.anchor,this.head)},_i.prototype.to=function(){return it(this.anchor,this.head)},_i.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},xo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,qt(i),sn(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},wo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var o=Math.min(t,i-e),a=r.height;if(r.removeInner(e,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof xo))){var l=[];this.collapse(l),this.children=[new xo(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var a=i.lines.length%25+25,l=a;l<i.lines.length;){var s=new xo(i.lines.slice(l,l+=25));i.height-=s.height,this.children.splice(++r,0,s),s.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new wo(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var n=W(e.parent.children,e);e.parent.children.splice(n+1,0,t)}else{var r=new wo(e.children);r.parent=e,e.children=[r,t],e=r}t.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var Co=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};function _o(e,t,n){Zt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Dr(e,n)}Co.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Ke(n);if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=wn(this);Ye(n,Math.max(0,n.height-o)),e&&(Qr(e,(function(){_o(e,n,-o),pr(e,r,"widget")})),sn(e,"lineWidgetCleared",e,this,r))}},Co.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=wn(this)-t;i&&(zt(this.doc,r)||Ye(r,r.height+i),n&&Qr(n,(function(){n.curOp.forceUpdate=!0,_o(n,r,i),sn(n,"lineWidgetChanged",n,e,Ke(r))})))},be(Co);var So=0,ko=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++So};function Io(e,t,n,r,i){if(r&&r.shared)return function(e,t,n,r,i){(r=O(r)).shared=!1;var o=[Io(e,t,n,r,i)],a=o[0],l=r.widgetNode;return Ni(e,(function(e){l&&(r.widgetNode=l.cloneNode(!0)),o.push(Io(e,lt(e,t),lt(e,n),r,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=$(o)})),new Eo(o,a)}(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return ei(e.cm,Io)(e,t,n,r,i);var o=new ko(e,i),a=tt(t,n);if(r&&O(r,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=D("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Ot(e,t.line,t,n,o)||t.line!=n.line&&Ot(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ct=!0}o.addToHistory&&Wi(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l,s=t.line,c=e.cm;if(e.iter(s,n.line+1,(function(r){c&&o.collapsed&&!c.options.lineWrapping&&Mt(r)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Ye(r,0),function(e,t,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}(r,new _t(o,s==t.line?t.ch:null,s==n.line?n.ch:null),e.cm&&e.cm.curOp),++s})),o.collapsed&&e.iter(t.line,n.line+1,(function(t){zt(e,t)&&Ye(t,0)})),o.clearOnEnter&&de(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(wt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++So,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)dr(c,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=t.line;u<=n.line;u++)pr(c,u,"text");o.atomic&&no(c.doc),sn(c,"markerAdded",c,o)}return o}ko.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Gr(e),ve(this,"clear")){var n=this.find();n&&sn(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=St(a.markedSpans,this);e&&!this.collapsed?pr(e,Ke(a),"text"):e&&(null!=l.to&&(i=Ke(a)),null!=l.from&&(r=Ke(a))),a.markedSpans=kt(a.markedSpans,l),null==l.from&&this.collapsed&&!zt(this.doc,a)&&e&&Ye(a,rr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var c=Mt(this.lines[s]),u=Ut(c);u>e.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&dr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&no(e.doc)),e&&sn(e,"markerCleared",e,this,r,i),t&&qr(e),this.parent&&this.parent.clear()}},ko.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=St(o.markedSpans,this);if(null!=a.from&&(n=et(t?o:Ke(o),a.from),-1==e))return n;if(null!=a.to&&(r=et(t?o:Ke(o),a.to),1==e))return r}return n&&{from:n,to:r}},ko.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;t&&r&&Qr(r,(function(){var i=t.line,o=Ke(t.line),a=Ln(r,o);if(a&&(Mn(a),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!zt(n.doc,i)&&null!=n.height){var l=n.height;n.height=null;var s=wn(n)-l;s&&Ye(i,i.height+s)}sn(r,"markerChanged",r,e)}))},ko.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=W(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ko.prototype.detachLine=function(e){if(this.lines.splice(W(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},be(ko);var Eo=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function To(e){return e.findMarks(et(e.first,0),e.clipPos(et(e.lastLine())),(function(e){return e.parent}))}function Ao(e){for(var t=function(t){var n=e[t],r=[n.primary.doc];Ni(n.primary.doc,(function(e){return r.push(e)}));for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==W(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}},n=0;n<e.length;n++)t(n)}Eo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();sn(this,"clear")}},Eo.prototype.find=function(e,t){return this.primary.find(e,t)},be(Eo);var Do=0,Lo=function(e,t,n,r,i){if(!(this instanceof Lo))return new Lo(e,t,n,r,i);null==n&&(n=0),wo.call(this,[new xo([new Gt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=et(n,0);this.sel=ki(o),this.history=new Oi(null),this.id=++Do,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Fi(this,{from:o,to:o,text:e}),Qi(this,ki(o),H)};Lo.prototype=X(wo.prototype,{constructor:Lo,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=$e(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:ni((function(e){var t=et(this.first,0),n=this.first+this.size-1;co(this,{from:t,to:et(n,Ge(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Pr(this.cm,0,0),Qi(this,ki(t),H)})),replaceRange:function(e,t,n,r){ho(this,e,t=lt(this,t),n=n?lt(this,n):t,r)},getRange:function(e,t,n){var r=qe(this,lt(this,e),lt(this,t));return!1===n?r:""===n?r.join(""):r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Je(this,e))return Ge(this,e)},getLineNumber:function(e){return Ke(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Ge(this,e)),Mt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return lt(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ni((function(e,t,n){Xi(this,lt(this,"number"==typeof e?et(e,t||0):e),null,n)})),setSelection:ni((function(e,t,n){Xi(this,lt(this,e),lt(this,t||e),n)})),extendSelection:ni((function(e,t,n){$i(this,lt(this,e),t&&lt(this,t),n)})),extendSelections:ni((function(e,t){Yi(this,st(this,e),t)})),extendSelectionsBy:ni((function(e,t){Yi(this,st(this,Y(this.sel.ranges,e)),t)})),setSelections:ni((function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new _i(lt(this,e[i].anchor),lt(this,e[i].head||e[i].anchor));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Qi(this,Si(this.cm,r,t),n)}})),addSelection:ni((function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new _i(lt(this,e),lt(this,t||e))),Qi(this,Si(this.cm,r,r.length-1),n)})),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=qe(this,n[r].from(),n[r].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=qe(this,n[r].from(),n[r].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:ni((function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:n}}for(var l=t&&"end"!=t&&function(e,t,n){for(var r=[],i=et(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Ai(l.from,i,o),c=Ai(Ii(l),i,o);if(i=l.to,o=c,"around"==n){var u=e.sel.ranges[a],d=tt(u.head,u.anchor)<0;r[a]=new _i(d?c:s,d?s:c)}else r[a]=new _i(s,s)}return new Ci(r,e.sel.primIndex)}(this,r,t),s=r.length-1;s>=0;s--)co(this,r[s]);l?Ji(this,l):this.cm&&Lr(this.cm)})),undo:ni((function(){po(this,"undo")})),redo:ni((function(){po(this,"redo")})),undoSelection:ni((function(){po(this,"undo",!0)})),redoSelection:ni((function(){po(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Oi(this.history),Ni(this,(function(t){return t.history=e.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Gi(this.history.done),undone:Gi(this.history.undone)}},setHistory:function(e){var t=this.history=new Oi(this.history);t.done=Gi(e.done.slice(0),null,!0),t.undone=Gi(e.undone.slice(0),null,!0)},setGutterMarker:ni((function(e,t,n){return yo(this,e,"gutter",(function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&te(r)&&(e.gutterMarkers=null),!0}))})),clearGutter:ni((function(e){var t=this;this.iter((function(n){n.gutterMarkers&&n.gutterMarkers[e]&&yo(t,n,"gutter",(function(){return n.gutterMarkers[e]=null,te(n.gutterMarkers)&&(n.gutterMarkers=null),!0}))}))})),lineInfo:function(e){var t;if("number"==typeof e){if(!Je(this,e))return null;if(t=e,!(e=Ge(this,e)))return null}else if(null==(t=Ke(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:ni((function(e,t,n){return yo(this,e,"gutter"==t?"gutter":"class",(function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[r]){if(S(n).test(e[r]))return!1;e[r]+=" "+n}else e[r]=n;return!0}))})),removeLineClass:ni((function(e,t,n){return yo(this,e,"gutter"==t?"gutter":"class",(function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[r];if(!i)return!1;if(null==n)e[r]=null;else{var o=i.match(S(n));if(!o)return!1;var a=o.index+o[0].length;e[r]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0}))})),addLineWidget:ni((function(e,t,n){return function(e,t,n,r){var i=new Co(e,n,r),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),yo(e,t,"widget",(function(t){var n=t.widgets||(t.widgets=[]);if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!zt(e,t)){var r=Zt(t)<e.scrollTop;Ye(t,t.height+wn(i)),r&&Dr(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&sn(o,"lineWidgetAdded",o,i,"number"==typeof t?t:Ke(t)),i}(this,e,t,n)})),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Io(this,lt(this,e),lt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return Io(this,e=lt(this,e),e,n,"bookmark")},findMarksAt:function(e){var t=[],n=Ge(this,(e=lt(this,e)).line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=lt(this,e),t=lt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,(function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];null!=s.to&&i==e.line&&e.ch>=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i})),r},getAllMarks:function(){var e=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&e.push(n[r].marker)})),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter((function(i){var o=i.text.length+r;if(o>e)return t=e,!0;e-=o,++n})),lt(this,et(n,t))},indexFromPos:function(e){var t=(e=lt(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,(function(e){t+=e.text.length+n})),t},copy:function(e){var t=new Lo($e(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var r=new Lo($e(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(tt(o,a)){var l=Io(e,o,a,r.primary,r.primary.type);r.markers.push(l),l.parent=r}}}(r,To(this)),r},unlinkDoc:function(e){if(e instanceof Ea&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t)if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),Ao(To(this));break}if(e.history==this.history){var n=[e.id];Ni(e,(function(e){return n.push(e.id)}),!0),e.history=new Oi(null),e.history.done=Gi(this.history.done,n),e.history.undone=Gi(this.history.undone,n)}},iterLinkedDocs:function(e){Ni(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Le(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ni((function(e){var t;"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&Qr(t=this.cm,(function(){Ri(t),dr(t)})))}))}),Lo.prototype.eachLine=Lo.prototype.iter;var Po=0;function Fo(e){var t=this;if(No(t),!he(t,e)&&!Cn(t.display,e)){ye(e),a&&(Po=+new Date);var n=cr(t,e,!0),r=e.dataTransfer.files;if(n&&!t.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),l=0,s=function(){++l==i&&ei(t,(function(){var e={from:n=lt(t.doc,n),to:n,text:t.doc.splitLines(o.filter((function(e){return null!=e})).join(t.doc.lineSeparator())),origin:"paste"};co(t.doc,e),Ji(t.doc,ki(lt(t.doc,n),lt(t.doc,Ii(e))))}))()},c=function(e,n){if(t.options.allowDropFileTypes&&-1==W(t.options.allowDropFileTypes,e.type))s();else{var r=new FileReader;r.onerror=function(){return s()},r.onload=function(){var e=r.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[n]=e),s()},r.readAsText(e)}},u=0;u<r.length;u++)c(r[u],u);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var d=e.dataTransfer.getData("Text");if(d){var p;if(t.state.draggingText&&!t.state.draggingText.copy&&(p=t.listSelections()),eo(t.doc,ki(n,n)),p)for(var m=0;m<p.length;++m)ho(t.doc,"",p[m].anchor,p[m].head,"drag");t.replaceSelection(d,"around","paste"),t.display.input.focus()}}catch(e){}}}}function No(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function jo(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation((function(){for(var t=0;t<n.length;t++)e(n[t])}))}}var Ro=!1;function Oo(){var e;Ro||(de(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,jo(Mo)}),100))})),de(window,"blur",(function(){return jo(kr)})),Ro=!0)}function Mo(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Bo={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Wo=0;Wo<10;Wo++)Bo[Wo+48]=Bo[Wo+96]=String(Wo);for(var zo=65;zo<=90;zo++)Bo[zo]=String.fromCharCode(zo);for(var Ho=1;Ho<=12;Ho++)Bo[Ho+111]=Bo[Ho+63235]="F"+Ho;var Zo={};function Uo(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function Vo(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=Y(n.split(" "),Uo),o=0;o<i.length;o++){var a=void 0,l=void 0;o==i.length-1?(l=i.join(" "),a=r):(l=i.slice(0,o+1).join(" "),a="...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[n]}for(var c in t)e[c]=t[c];return e}function Go(e,t,n,r){var i=(t=Ko(t)).call?t.call(e,r):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Go(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var a=Go(e,t.fallthrough[o],n,r);if(a)return a}}}function qo(e){var t="string"==typeof e?e:Bo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function $o(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(C?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(C?t.ctrlKey:t.metaKey)&&"Mod"!=r&&(e="Cmd-"+e),!n&&t.shiftKey&&"Shift"!=r&&(e="Shift-"+e),e}function Yo(e,t){if(d&&34==e.keyCode&&e.char)return!1;var n=Bo[e.keyCode];return null!=n&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(n=e.code),$o(n,e,t))}function Ko(e){return"string"==typeof e?Zo[e]:e}function Xo(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&tt(o.from,$(r).to)<=0;){var a=r.pop();if(tt(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}Qr(e,(function(){for(var t=r.length-1;t>=0;t--)ho(e.doc,"",r[t].from,r[t].to,"+delete");Lr(e)}))}function Jo(e,t,n){var r=ie(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Qo(e,t,n){var r=Jo(e,t.ch,n);return null==r?null:new et(t.line,r,n<0?"after":"before")}function ea(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=ce(n,t.doc.direction);if(o){var a,l=i<0?$(o):o[0],s=i<0==(1==l.level)?"after":"before";if(l.level>0||"rtl"==t.doc.direction){var c=Pn(t,n);a=i<0?n.text.length-1:0;var u=Fn(t,c,a).top;a=oe((function(e){return Fn(t,c,e).top==u}),i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=Jo(n,a,1))}else a=i<0?l.to:l.from;return new et(r,a,s)}}return new et(r,i<0?n.text.length:0,i<0?"before":"after")}Zo.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Zo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Zo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Zo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Zo.default=b?Zo.macDefault:Zo.pcDefault;var ta={selectAll:lo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),H)},killLine:function(e){return Xo(e,(function(t){if(t.empty()){var n=Ge(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:et(t.head.line+1,0)}:{from:t.head,to:et(t.head.line,n)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(e){return Xo(e,(function(t){return{from:et(t.from().line,0),to:lt(e.doc,et(t.to().line+1,0))}}))},delLineLeft:function(e){return Xo(e,(function(e){return{from:et(e.from().line,0),to:e.from()}}))},delWrappedLineLeft:function(e){return Xo(e,(function(t){var n=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:n},"div"),to:t.from()}}))},delWrappedLineRight:function(e){return Xo(e,(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}}))},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(et(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(et(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy((function(t){return na(e,t.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy((function(t){return ra(e,t.head)}),{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy((function(t){return function(e,t){var n=Ge(e.doc,t),r=function(e){for(var t;t=jt(e);)e=t.find(1,!0).line;return e}(n);return r!=n&&(t=Ke(r)),ea(!0,e,n,t,-1)}(e,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")}),U)},goLineLeft:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")}),U)},goLineLeftSmart:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?ra(e,t.head):r}),U)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=M(e.getLine(o.line),o.ch,r);t.push(q(r-a%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Qr(e,(function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,o=Ge(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new et(i.line,i.ch-1)),i.ch>0)i=new et(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Ge(e.doc,i.line-1).text;a&&(i=new et(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),et(i.line-1,a.length-1),i,"+transpose"))}n.push(new _i(i,i))}e.setSelections(n)}))},newlineAndIndent:function(e){return Qr(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Lr(e)}))},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function na(e,t){var n=Ge(e.doc,t),r=Mt(n);return r!=n&&(t=Ke(r)),ea(!0,e,r,t,1)}function ra(e,t){var n=na(e,t.line),r=Ge(e.doc,n.line),i=ce(r,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(n.ch,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return et(n.line,a?0:o,n.sticky)}return n}function ia(e,t,n){if("string"==typeof t&&!(t=ta[t]))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=z}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}var oa=new B;function aa(e,t,n,r){var i=e.state.keySeq;if(i){if(qo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:oa.set(50,(function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())})),la(e,i+" "+t,n,r))return!0}return la(e,t,n,r)}function la(e,t,n,r){var i=function(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Go(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Go(t,e.options.extraKeys,n,e)||Go(t,e.options.keyMap,n,e)}(e,t,r);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&sn(e,"keyHandled",e,t,n),"handled"!=i&&"multi"!=i||(ye(n),wr(e)),!!i}function sa(e,t){var n=Yo(t,!0);return!!n&&(t.shiftKey&&!e.state.keySeq?aa(e,"Shift-"+n,t,(function(t){return ia(e,t,!0)}))||aa(e,n,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return ia(e,t)})):aa(e,n,t,(function(t){return ia(e,t)})))}var ca=null;function ua(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||(t.curOp.focus=P(),he(t,e)))){a&&l<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var i=sa(t,e);d&&(ca=i?r:null,i||88!=r||Fe||!(b?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),n&&!b&&!i&&46==r&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function n(e){18!=e.keyCode&&e.altKey||(I(t,"CodeMirror-crosshair"),me(document,"keyup",n),me(document,"mouseover",n))}F(t,"CodeMirror-crosshair"),de(document,"keyup",n),de(document,"mouseover",n)}(t)}}function da(e){16==e.keyCode&&(this.doc.sel.shift=!1),he(this,e)}function pa(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||Cn(t.display,e)||he(t,e)||e.ctrlKey&&!e.altKey||b&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(d&&n==ca)return ca=null,void ye(e);if(!d||e.which&&!(e.which<10)||!sa(t,e)){var i=String.fromCharCode(null==r?n:r);"\b"!=i&&(function(e,t,n){return aa(e,"'"+n+"'",t,(function(t){return ia(e,t,!0)}))}(t,e,i)||t.display.input.onKeyPress(e))}}}var ma,fa,ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};function ga(e){var t=this,n=t.display;if(!(he(t,e)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=e.shiftKey,Cn(n,e))s||(n.scroller.draggable=!1,setTimeout((function(){return n.scroller.draggable=!0}),100));else if(!ya(t,e)){var r=cr(t,e),i=Se(e),o=r?function(e,t){var n=+new Date;return fa&&fa.compare(n,e,t)?(ma=fa=null,"triple"):ma&&ma.compare(n,e,t)?(fa=new ha(n,e,t),ma=null,"double"):(ma=new ha(n,e,t),fa=null,"single")}(r,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),r&&function(e,t,n,r,i){var o="Click";return"double"==r?o="Double"+o:"triple"==r&&(o="Triple"+o),aa(e,$o(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,(function(t){if("string"==typeof t&&(t=ta[t]),!t)return!1;var r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r=t(e,n)!=z}finally{e.state.suppressEdits=!1}return r}))}(t,i,r,o,e)||(1==i?r?function(e,t,n,r){a?setTimeout(R(Cr,e),0):e.curOp.focus=P();var i,o=function(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(null==i.unit){var o=y?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),null==i.addNew&&(i.addNew=b?n.metaKey:n.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(b?n.altKey:n.ctrlKey)),i}(e,n,r),c=e.doc.sel;e.options.dragDrop&&Ee&&!e.isReadOnly()&&"single"==n&&(i=c.contains(t))>-1&&(tt((i=c.ranges[i]).from(),t)<0||t.xRel>0)&&(tt(i.to(),t)>0||t.xRel<0)?function(e,t,n,r){var i=e.display,o=!1,c=ei(e,(function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:_r(e)),me(i.wrapper.ownerDocument,"mouseup",c),me(i.wrapper.ownerDocument,"mousemove",u),me(i.scroller,"dragstart",d),me(i.scroller,"drop",c),o||(ye(t),r.addNew||$i(e.doc,n,null,null,r.extend),s&&!p||a&&9==l?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),u=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},d=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=c,c.copy=!r.moveOnDrag,de(i.wrapper.ownerDocument,"mouseup",c),de(i.wrapper.ownerDocument,"mousemove",u),de(i.scroller,"dragstart",d),de(i.scroller,"drop",c),e.state.delayingBlurEvent=!0,setTimeout((function(){return i.input.focus()}),20),i.scroller.dragDrop&&i.scroller.dragDrop()}(e,r,t,o):function(e,t,n,r){a&&_r(e);var i=e.display,o=e.doc;ye(t);var l,s,c=o.sel,u=c.ranges;if(r.addNew&&!r.extend?(s=o.sel.contains(n),l=s>-1?u[s]:new _i(n,n)):(l=o.sel.primary(),s=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(l=new _i(n,n)),n=cr(e,t,!0,!0),s=-1;else{var d=va(e,n,r.unit);l=r.extend?qi(l,d.anchor,d.head,r.extend):d}r.addNew?-1==s?(s=u.length,Qi(o,Si(e,u.concat([l]),s),{scroll:!1,origin:"*mouse"})):u.length>1&&u[s].empty()&&"char"==r.unit&&!r.extend?(Qi(o,Si(e,u.slice(0,s).concat(u.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),c=o.sel):Ki(o,s,l,Z):(s=0,Qi(o,new Ci([l],0),Z),c=o.sel);var p=n;function m(t){if(0!=tt(p,t))if(p=t,"rectangle"==r.unit){for(var i=[],a=e.options.tabSize,u=M(Ge(o,n.line).text,n.ch,a),d=M(Ge(o,t.line).text,t.ch,a),m=Math.min(u,d),f=Math.max(u,d),h=Math.min(n.line,t.line),g=Math.min(e.lastLine(),Math.max(n.line,t.line));h<=g;h++){var v=Ge(o,h).text,b=V(v,m,a);m==f?i.push(new _i(et(h,b),et(h,b))):v.length>b&&i.push(new _i(et(h,b),et(h,V(v,f,a))))}i.length||i.push(new _i(n,n)),Qi(o,Si(e,c.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var y,x=l,w=va(e,t,r.unit),C=x.anchor;tt(w.anchor,C)>0?(y=w.head,C=ot(x.from(),w.anchor)):(y=w.anchor,C=it(x.to(),w.head));var _=c.ranges.slice(0);_[s]=function(e,t){var n=t.anchor,r=t.head,i=Ge(e.doc,n.line);if(0==tt(n,r)&&n.sticky==r.sticky)return t;var o=ce(i);if(!o)return t;var a=le(o,n.ch,n.sticky),l=o[a];if(l.from!=n.ch&&l.to!=n.ch)return t;var s,c=a+(l.from==n.ch==(1!=l.level)?0:1);if(0==c||c==o.length)return t;if(r.line!=n.line)s=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=le(o,r.ch,r.sticky),d=u-a||(r.ch-n.ch)*(1==l.level?-1:1);s=u==c-1||u==c?d<0:d>0}var p=o[c+(s?-1:0)],m=s==(1==p.level),f=m?p.from:p.to,h=m?"after":"before";return n.ch==f&&n.sticky==h?t:new _i(new et(n.line,f,h),r)}(e,new _i(lt(o,C),y)),Qi(o,Si(e,_,s),Z)}}var f=i.wrapper.getBoundingClientRect(),h=0;function g(t){var n=++h,a=cr(e,t,!0,"rectangle"==r.unit);if(a)if(0!=tt(a,p)){e.curOp.focus=P(),m(a);var l=Tr(i,o);(a.line>=l.to||a.line<l.from)&&setTimeout(ei(e,(function(){h==n&&g(t)})),150)}else{var s=t.clientY<f.top?-20:t.clientY>f.bottom?20:0;s&&setTimeout(ei(e,(function(){h==n&&(i.scroller.scrollTop+=s,g(t))})),50)}}function v(t){e.state.selectingText=!1,h=1/0,t&&(ye(t),i.input.focus()),me(i.wrapper.ownerDocument,"mousemove",b),me(i.wrapper.ownerDocument,"mouseup",y),o.history.lastSelOrigin=null}var b=ei(e,(function(e){0!==e.buttons&&Se(e)?g(e):v(e)})),y=ei(e,v);e.state.selectingText=y,de(i.wrapper.ownerDocument,"mousemove",b),de(i.wrapper.ownerDocument,"mouseup",y)}(e,r,t,o)}(t,r,o,e):_e(e)==n.scroller&&ye(e):2==i?(r&&$i(t.doc,r),setTimeout((function(){return n.input.focus()}),20)):3==i&&(_?t.display.input.onContextMenu(e):_r(t)))}}function va(e,t,n){if("char"==n)return new _i(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new _i(et(t.line,0),lt(e.doc,et(t.line+1,0)));var r=n(e,t);return new _i(r.from,r.to)}function ba(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ye(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!ve(e,n))return we(t);o-=l.top-a.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var c=a.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=i)return fe(e,n,e,Xe(e.doc,o),e.display.gutterSpecs[s].className,t),we(t)}}function ya(e,t){return ba(e,t,"gutterClick",!0)}function xa(e,t){Cn(e.display,t)||function(e,t){return!!ve(e,"gutterContextMenu")&&ba(e,t,"gutterContextMenu",!1)}(e,t)||he(e,t,"contextmenu")||_||e.display.input.onContextMenu(t)}function wa(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Wn(e)}ha.prototype.compare=function(e,t,n){return this.time+400>e&&0==tt(t,this.pos)&&n==this.button};var Ca={toString:function(){return"CodeMirror.Init"}},_a={},Sa={};function ka(e,t,n){if(!t!=!(n&&n!=Ca)){var r=e.display.dragFunctions,i=t?de:me;i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function Ia(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(I(e.display.wrapper,"CodeMirror-wrap"),Vt(e)),sr(e),dr(e),Wn(e),setTimeout((function(){return zr(e)}),100)}function Ea(e,t){var n=this;if(!(this instanceof Ea))return new Ea(e,t);this.options=t=t?O(t):{},O(_a,t,!1);var r=t.value;"string"==typeof r?r=new Lo(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Ea.inputStyles[t.inputStyle](this),o=this.display=new gi(e,r,i,t);for(var c in o.wrapper.CodeMirror=this,wa(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ur(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new B,keySeq:null,specialChars:null},t.autofocus&&!v&&o.input.focus(),a&&l<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),function(e){var t=e.display;de(t.scroller,"mousedown",ei(e,ga)),de(t.scroller,"dblclick",a&&l<11?ei(e,(function(t){if(!he(e,t)){var n=cr(e,t);if(n&&!ya(e,t)&&!Cn(e.display,t)){ye(t);var r=e.findWordAt(n);$i(e.doc,r.anchor,r.head)}}})):function(t){return he(e,t)||ye(t)}),de(t.scroller,"contextmenu",(function(t){return xa(e,t)})),de(t.input.getField(),"contextmenu",(function(n){t.scroller.contains(n.target)||xa(e,n)}));var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),(r=t.activeTouch).end=+new Date)}function o(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function s(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}de(t.scroller,"touchstart",(function(i){if(!he(e,i)&&!o(i)&&!ya(e,i)){t.input.ensurePolled(),clearTimeout(n);var a=+new Date;t.activeTouch={start:a,moved:!1,prev:a-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),de(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),de(t.scroller,"touchend",(function(n){var r=t.activeTouch;if(r&&!Cn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var o,a=e.coordsChar(t.activeTouch,"page");o=!r.prev||s(r,r.prev)?new _i(a,a):!r.prev.prev||s(r,r.prev.prev)?e.findWordAt(a):new _i(et(a.line,0),lt(e.doc,et(a.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),ye(n)}i()})),de(t.scroller,"touchcancel",i),de(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(jr(e,t.scroller.scrollTop),Or(e,t.scroller.scrollLeft,!0),fe(e,"scroll",e))})),de(t.scroller,"mousewheel",(function(t){return wi(e,t)})),de(t.scroller,"DOMMouseScroll",(function(t){return wi(e,t)})),de(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){he(e,t)||Ce(t)},over:function(t){he(e,t)||(function(e,t){var n=cr(e,t);if(n){var r=document.createDocumentFragment();br(e,n,r),e.display.dragCursor||(e.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),T(e.display.dragCursor,r)}}(e,t),Ce(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-Po<100))Ce(t);else if(!he(e,t)&&!Cn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!p)){var n=A("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),d&&n.parentNode.removeChild(n)}}(e,t)},drop:ei(e,Fo),leave:function(t){he(e,t)||No(e)}};var c=t.input.getField();de(c,"keyup",(function(t){return da.call(e,t)})),de(c,"keydown",ei(e,ua)),de(c,"keypress",ei(e,pa)),de(c,"focus",(function(t){return Sr(e,t)})),de(c,"blur",(function(t){return kr(e,t)}))}(this),Oo(),Gr(this),this.curOp.forceUpdate=!0,ji(this,r),t.autofocus&&!v||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&Sr(n)}),20):kr(this),Sa)Sa.hasOwnProperty(c)&&Sa[c](this,t[c],Ca);pi(this),t.finishInit&&t.finishInit(this);for(var u=0;u<Ta.length;++u)Ta[u](this);qr(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Ea.defaults=_a,Ea.optionHandlers=Sa;var Ta=[];function Aa(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=mt(e,t).state:n="prev");var a=e.options.tabSize,l=Ge(o,t),s=M(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(r||/\S/.test(l.text)){if("smart"==n&&((c=o.mode.indent(i,l.text.slice(u.length),l.text))==z||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?M(Ge(o,t-1).text,null,a):0:"add"==n?c=s+e.options.indentUnit:"subtract"==n?c=s-e.options.indentUnit:"number"==typeof n&&(c=s+n),c=Math.max(0,c);var d="",p=0;if(e.options.indentWithTabs)for(var m=Math.floor(c/a);m;--m)p+=a,d+="\t";if(p<c&&(d+=q(c-p)),d!=u)return ho(o,d,et(t,0),et(t,u.length),"+input"),l.stateAfter=null,!0;for(var f=0;f<o.sel.ranges.length;f++){var h=o.sel.ranges[f];if(h.head.line==t&&h.head.ch<u.length){var g=et(t,u.length);Ki(o,f,new _i(g,g));break}}}Ea.defineInitHook=function(e){return Ta.push(e)};var Da=null;function La(e){Da=e}function Pa(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=Le(t),c=null;if(l&&r.ranges.length>1)if(Da&&Da.text.join("\n")==t){if(r.ranges.length%Da.text.length==0){c=[];for(var u=0;u<Da.text.length;u++)c.push(o.splitLines(Da.text[u]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(c=Y(s,(function(e){return[e]})));for(var d=e.curOp.updateInput,p=r.ranges.length-1;p>=0;p--){var m=r.ranges[p],f=m.from(),h=m.to();m.empty()&&(n&&n>0?f=et(f.line,f.ch-n):e.state.overwrite&&!l?h=et(h.line,Math.min(Ge(o,h.line).text.length,h.ch+$(s).length)):l&&Da&&Da.lineWise&&Da.text.join("\n")==s.join("\n")&&(f=h=et(f.line,0)));var g={from:f,to:h,text:c?c[p%c.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};co(e.doc,g),sn(e,"inputRead",e,g)}t&&!l&&Na(e,t),Lr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Fa(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Qr(t,(function(){return Pa(t,n,0,null,"paste")})),!0}function Na(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=Aa(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Ge(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Aa(e,i.head.line,"smart"));a&&sn(e,"electricInput",e,i.head.line)}}}function ja(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:et(i,0),head:et(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function Ra(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Oa(){var e=A("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=A("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?e.style.width="1000px":e.setAttribute("wrap","off"),h&&(e.style.border="1px solid black"),Ra(e),t}function Ma(e,t,n,r,i){var o=t,a=n,l=Ge(e,t.line),s=i&&"rtl"==e.direction?-n:n;function c(o){var a,c;if("codepoint"==r){var u=l.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(u))a=null;else{var d=n>0?u>=55296&&u<56320:u>=56320&&u<57343;a=new et(t.line,Math.max(0,Math.min(l.text.length,t.ch+n*(d?2:1))),-n)}}else a=i?function(e,t,n,r){var i=ce(t,e.doc.direction);if(!i)return Qo(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=le(i,n.ch,n.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from<n.ch))return Qo(t,n,r);var l,s=function(e,n){return Jo(t,e instanceof et?e.ch:e,n)},c=function(n){return e.options.lineWrapping?(l=l||Pn(e,t),Jn(e,t,l,n)):{begin:0,end:t.text.length}},u=c("before"==n.sticky?s(n,-1):n.ch);if("rtl"==e.doc.direction||1==a.level){var d=1==a.level==r<0,p=s(n,d?1:-1);if(null!=p&&(d?p<=a.to&&p<=u.end:p>=a.from&&p>=u.begin)){var m=d?"before":"after";return new et(n.line,p,m)}}var f=function(e,t,r){for(var o=function(e,t){return t?new et(n.line,s(e,1),"before"):new et(n.line,e,"after")};e>=0&&e<i.length;e+=t){var a=i[e],l=t>0==(1!=a.level),c=l?r.begin:s(r.end,-1);if(a.from<=c&&c<a.to)return o(c,l);if(c=l?a.from:s(a.to,-1),r.begin<=c&&c<r.end)return o(c,l)}},h=f(o+r,r,u);if(h)return h;var g=r>0?u.end:s(u.begin,-1);return null==g||r>0&&g==t.text.length||!(h=f(r>0?0:i.length-1,r,c(g)))?null:h}(e.cm,l,t,n):Qo(l,t,n);if(null==a){if(o||((c=t.line+s)<e.first||c>=e.first+e.size||(t=new et(c,t.ch,t.sticky),!(l=Ge(e,c)))))return!1;t=ea(i,e.cm,l,t.line,s)}else t=a;return!0}if("char"==r||"codepoint"==r)c();else if("column"==r)c(!0);else if("word"==r||"group"==r)for(var u=null,d="group"==r,p=e.cm&&e.cm.getHelper(t,"wordChars"),m=!0;!(n<0)||c(!m);m=!1){var f=l.text.charAt(t.ch)||"\n",h=ee(f,p)?"w":d&&"\n"==f?"n":!d||/\s/.test(f)?null:"p";if(!d||m||h||(h="s"),u&&u!=h){n<0&&(n=1,c(),t.sticky="after");break}if(h&&(u=h),n>0&&!c(!m))break}var g=oo(e,t,o,a,!0);return nt(o,g)&&(g.hitSide=!0),g}function Ba(e,t,n,r){var i,o,a=e.doc,l=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(s-.5*rr(e.display),3);i=(n>0?t.bottom:t.top)+n*c}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;(o=Kn(e,l,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Wa=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new B,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function za(e,t){var n=Ln(e,t.line);if(!n||n.hidden)return null;var r=Ge(e.doc,t.line),i=An(n,r,t.line),o=ce(r,e.doc.direction),a="left";o&&(a=le(o,t.ch)%2?"right":"left");var l=Rn(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function Ha(e,t){return t&&(e.bad=!0),e}function Za(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Ha(e.clipPos(et(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return Ua(o,t,n)}}function Ua(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!L(r,t))return Ha(et(Ke(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var o=e.rest?$(e.rest):e.line;return Ha(et(Ke(o),o.text.length),i)}var a=3==t.nodeType?t:null,l=t;for(a||1!=t.childNodes.length||3!=t.firstChild.nodeType||(a=t.firstChild,n&&(n=a.nodeValue.length));l.parentNode!=r;)l=l.parentNode;var s=e.measure,c=s.maps;function u(t,n,r){for(var i=-1;i<(c?c.length:0);i++)for(var o=i<0?s.map:c[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==n){var u=Ke(i<0?e.line:e.rest[i]),d=o[a]+r;return(r<0||l!=t)&&(d=o[a+(r?1:0)]),et(u,d)}}}var d=u(a,l,n);if(d)return Ha(d,i);for(var p=l.nextSibling,m=a?a.nodeValue.length-n:0;p;p=p.nextSibling){if(d=u(p,p.firstChild,0))return Ha(et(d.line,d.ch-m),i);m+=p.textContent.length}for(var f=l.previousSibling,h=n;f;f=f.previousSibling){if(d=u(f,f.firstChild,-1))return Ha(et(d.line,d.ch+h),i);h+=f.textContent.length}}Wa.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;function o(e){for(var t=e.target;t;t=t.parentNode){if(t==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}return!1}function a(e){if(o(e)&&!he(r,e)){if(r.somethingSelected())La({lineWise:!1,text:r.getSelections()}),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=ja(r);La({lineWise:!0,text:t.text}),"cut"==e.type&&r.operation((function(){r.setSelections(t.ranges,0,H),r.replaceSelection("",null,"cut")}))}if(e.clipboardData){e.clipboardData.clearData();var a=Da.text.join("\n");if(e.clipboardData.setData("Text",a),e.clipboardData.getData("Text")==a)return void e.preventDefault()}var l=Oa(),s=l.firstChild;r.display.lineSpace.insertBefore(l,r.display.lineSpace.firstChild),s.value=Da.text.join("\n");var c=P();j(s),setTimeout((function(){r.display.lineSpace.removeChild(l),c.focus(),c==i&&n.showPrimarySelection()}),50)}}i.contentEditable=!0,Ra(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),de(i,"paste",(function(e){!o(e)||he(r,e)||Fa(e,r)||l<=11&&setTimeout(ei(r,(function(){return t.updateFromDOM()})),20)})),de(i,"compositionstart",(function(e){t.composing={data:e.data,done:!1}})),de(i,"compositionupdate",(function(e){t.composing||(t.composing={data:e.data,done:!1})})),de(i,"compositionend",(function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)})),de(i,"touchstart",(function(){return n.forceCompositionEnd()})),de(i,"input",(function(){t.composing||t.readFromDOMSoon()})),de(i,"copy",a),de(i,"cut",a)},Wa.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Wa.prototype.prepareSelection=function(){var e=vr(this.cm,!1);return e.focus=P()==this.div,e},Wa.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Wa.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Wa.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),o=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var a=Za(t,e.anchorNode,e.anchorOffset),l=Za(t,e.focusNode,e.focusOffset);if(!a||a.bad||!l||l.bad||0!=tt(ot(a,l),i)||0!=tt(it(a,l),o)){var s=t.display.view,c=i.line>=t.display.viewFrom&&za(t,i)||{node:s[0].measure.map[2],offset:0},u=o.line<t.display.viewTo&&za(t,o);if(!u){var d=s[s.length-1].measure,p=d.maps?d.maps[d.maps.length-1]:d.map;u={node:p[p.length-1],offset:p[p.length-2]-p[p.length-3]}}if(c&&u){var m,f=e.rangeCount&&e.getRangeAt(0);try{m=k(c.node,c.offset,u.offset,u.node)}catch(e){}m&&(!n&&t.state.focused?(e.collapse(c.node,c.offset),m.collapsed||(e.removeAllRanges(),e.addRange(m))):(e.removeAllRanges(),e.addRange(m)),f&&null==e.anchorNode?e.addRange(f):n&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Wa.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation((function(){return e.cm.curOp.selectionChanged=!0}))}),20)},Wa.prototype.showMultipleSelections=function(e){T(this.cm.display.cursorDiv,e.cursors),T(this.cm.display.selectionDiv,e.selection)},Wa.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Wa.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return L(this.div,t)},Wa.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&P()==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Wa.prototype.blur=function(){this.div.blur()},Wa.prototype.getField=function(){return this.div},Wa.prototype.supportsTouch=function(){return!0},Wa.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout((function(){return e.pollSelection()}),20):Qr(this.cm,(function(){return t.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,(function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}))},Wa.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Wa.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(g&&u&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=Za(t,e.anchorNode,e.anchorOffset),r=Za(t,e.focusNode,e.focusOffset);n&&r&&Qr(t,(function(){Qi(t.doc,ki(n,r),H),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)}))}}},Wa.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,n,r=this.cm,i=r.display,o=r.doc.sel.primary(),a=o.from(),l=o.to();if(0==a.ch&&a.line>r.firstLine()&&(a=et(a.line-1,Ge(r.doc,a.line-1).length)),l.ch==Ge(r.doc,l.line).text.length&&l.line<r.lastLine()&&(l=et(l.line+1,0)),a.line<i.viewFrom||l.line>i.viewTo-1)return!1;a.line==i.viewFrom||0==(e=ur(r,a.line))?(t=Ke(i.view[0].line),n=i.view[0].node):(t=Ke(i.view[e].line),n=i.view[e-1].node.nextSibling);var s,c,u=ur(r,l.line);if(u==i.view.length-1?(s=i.viewTo-1,c=i.lineDiv.lastChild):(s=Ke(i.view[u+1].line)-1,c=i.view[u+1].node.previousSibling),!n)return!1;for(var d=r.doc.splitLines(function(e,t,n,r,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1;function c(){a&&(o+=l,s&&(o+=l),a=s=!1)}function u(e){e&&(c(),o+=e)}function d(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void u(n);var o,p=t.getAttribute("cm-marker");if(p){var m=e.findMarks(et(r,0),et(i+1,0),(g=+p,function(e){return e.id==g}));return void(m.length&&(o=m[0].find(0))&&u(qe(e.doc,o.from,o.to).join(l)))}if("false"==t.getAttribute("contenteditable"))return;var f=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;f&&c();for(var h=0;h<t.childNodes.length;h++)d(t.childNodes[h]);/^(pre|p)$/i.test(t.nodeName)&&(s=!0),f&&(a=!0)}else 3==t.nodeType&&u(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var g}for(;d(t),t!=n;)t=t.nextSibling,s=!1;return o}(r,n,c,t,s)),p=qe(r.doc,et(t,0),et(s,Ge(r.doc,s).text.length));d.length>1&&p.length>1;)if($(d)==$(p))d.pop(),p.pop(),s--;else{if(d[0]!=p[0])break;d.shift(),p.shift(),t++}for(var m=0,f=0,h=d[0],g=p[0],v=Math.min(h.length,g.length);m<v&&h.charCodeAt(m)==g.charCodeAt(m);)++m;for(var b=$(d),y=$(p),x=Math.min(b.length-(1==d.length?m:0),y.length-(1==p.length?m:0));f<x&&b.charCodeAt(b.length-f-1)==y.charCodeAt(y.length-f-1);)++f;if(1==d.length&&1==p.length&&t==a.line)for(;m&&m>a.ch&&b.charCodeAt(b.length-f-1)==y.charCodeAt(y.length-f-1);)m--,f++;d[d.length-1]=b.slice(0,b.length-f).replace(/^\u200b+/,""),d[0]=d[0].slice(m).replace(/\u200b+$/,"");var w=et(t,m),C=et(s,p.length?$(p).length-f:0);return d.length>1||d[0]||tt(w,C)?(ho(r.doc,d,w,C,"+input"),!0):void 0},Wa.prototype.ensurePolled=function(){this.forceCompositionEnd()},Wa.prototype.reset=function(){this.forceCompositionEnd()},Wa.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Wa.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Wa.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Qr(this.cm,(function(){return dr(e.cm)}))},Wa.prototype.setUneditable=function(e){e.contentEditable="false"},Wa.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ei(this.cm,Pa)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Wa.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Wa.prototype.onContextMenu=function(){},Wa.prototype.resetPosition=function(){},Wa.prototype.needsContentAttribute=!0;var Va=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new B,this.hasSelection=!1,this.composing=null};Va.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!he(r,e)){if(r.somethingSelected())La({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=ja(r);La({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,H):(n.prevInput="",i.value=t.text.join("\n"),j(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),h&&(i.style.width="0px"),de(i,"input",(function(){a&&l>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),de(i,"paste",(function(e){he(r,e)||Fa(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),de(i,"cut",o),de(i,"copy",o),de(e.scroller,"paste",(function(t){if(!Cn(e,t)&&!he(r,t)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),de(e.lineSpace,"selectstart",(function(t){Cn(e,t)||ye(t)})),de(i,"compositionstart",(function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}})),de(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},Va.prototype.createField=function(e){this.wrapper=Oa(),this.textarea=this.wrapper.firstChild},Va.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Va.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=vr(e);if(e.options.moveInputWithCursor){var i=qn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Va.prototype.showSelection=function(e){var t=this.cm.display;T(t.cursorDiv,e.cursors),T(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Va.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&j(this.textarea),a&&l>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",a&&l>=9&&(this.hasSelection=null))}},Va.prototype.getField=function(){return this.textarea},Va.prototype.supportsTouch=function(){return!1},Va.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},Va.prototype.blur=function(){this.textarea.blur()},Va.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Va.prototype.receivedFocus=function(){this.slowPoll()},Va.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},Va.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}))},Va.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Pe(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(a&&l>=9&&this.hasSelection===i||b&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,c=Math.min(r.length,i.length);s<c&&r.charCodeAt(s)==i.charCodeAt(s);)++s;return Qr(t,(function(){Pa(t,i.slice(s),r.length-s,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Va.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Va.prototype.onKeyPress=function(){a&&l>=9&&(this.hasSelection=null),this.fastPoll()},Va.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=cr(n,e),c=r.scroller.scrollTop;if(o&&!d){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&ei(n,Qi)(n.doc,ki(o),H);var u,p=i.style.cssText,m=t.wrapper.style.cssText,f=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(e.clientY-f.top-5)+"px; left: "+(e.clientX-f.left-5)+"px;\n      z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(u=window.scrollY),r.input.focus(),s&&window.scrollTo(null,u),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=v,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&l>=9&&g(),_){Ce(e);var h=function(){me(window,"mouseup",h),setTimeout(v,20)};de(window,"mouseup",h)}else setTimeout(v,50)}function g(){if(null!=i.selectionStart){var e=n.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=m,i.style.cssText=p,a&&l<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=c),null!=i.selectionStart)){(!a||a&&l<9)&&g();var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?ei(n,lo)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},Va.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},Va.prototype.setUneditable=function(){},Va.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=Ca&&i(e,t,n)}:i)}e.defineOption=n,e.Init=Ca,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,Di(e)}),!0),n("indentUnit",2,Di,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){Li(e),Wn(e),dr(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(et(r,o))}r++}));for(var i=n.length-1;i>=0;i--)ho(e.doc,t,n[i],et(n[i].line,n[i].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Ca&&e.refresh()})),n("specialCharPlaceholder",Jt,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!x),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){wa(e),hi(e)}),!0),n("keyMap","default",(function(e,t,n){var r=Ko(t),i=n!=Ca&&Ko(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ia,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=mi(t,e.options.lineNumbers),hi(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?ar(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return zr(e)}),!0),n("scrollbarStyle","native",(function(e){Ur(e),zr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=mi(e.options.gutters,t),hi(e)}),!0),n("firstLineNumber",1,hi,!0),n("lineNumberFormatter",(function(e){return e}),hi,!0),n("showCursorWhenSelecting",!1,gr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(kr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,ka),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,gr,!0),n("singleCursorHeightPerLine",!0,gr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Li,!0),n("addModeClass",!1,Li,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,Li,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}(Ea),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&ei(this,t[e])(this,n,i),fe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Ko(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:ti((function(t,n){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");(function(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)})(this.state.overlays,{mode:r,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},(function(e){return e.priority})),this.state.modeGen++,dr(this)})),removeOverlay:ti((function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void dr(this)}})),indentLine:ti((function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Je(this.doc,e)&&Aa(this,e,t,n)})),indentSelection:ti((function(e){for(var t=this.doc.sel.ranges,n=-1,r=0;r<t.length;r++){var i=t[r];if(i.empty())i.head.line>n&&(Aa(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Lr(this));else{var o=i.from(),a=i.to(),l=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;s<n;++s)Aa(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[r].from().ch>0&&Ki(this.doc,r,new _i(o,c[r].to()),H)}}})),getTokenAt:function(e,t){return bt(this,e,t)},getLineTokens:function(e,t){return bt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=lt(this.doc,e);var t,n=pt(this,Ge(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){t=n[2*a+2];break}r=a+1}}var l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!n.hasOwnProperty(t))return r;var i=n[t],o=this.getModeAt(e);if("string"==typeof o[t])i[o[t]]&&r.push(i[o[t]]);else if(o[t])for(var a=0;a<o[t].length;a++){var l=i[o[t][a]];l&&r.push(l)}else o.helperType&&i[o.helperType]?r.push(i[o.helperType]):i[o.name]&&r.push(i[o.name]);for(var s=0;s<i._global.length;s++){var c=i._global[s];c.pred(o,this)&&-1==W(r,c.val)&&r.push(c.val)}return r},getStateAfter:function(e,t){var n=this.doc;return mt(this,(e=at(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary();return qn(this,null==e?n.head:"object"==typeof e?lt(this.doc,e):e?n.from():n.to(),t||"page")},charCoords:function(e,t){return Gn(this,lt(this.doc,e),t||"page")},coordsChar:function(e,t){return Kn(this,(e=Vn(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Vn(this,{top:e,left:0},t||"page").top,Xe(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),r=Ge(this.doc,e)}else r=e;return Un(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-Zt(r):0)},defaultTextHeight:function(){return rr(this.display)},defaultCharWidth:function(){return ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,a,l,s=this.display,c=(e=qn(this,lt(this.doc,e))).bottom,u=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t),"over"==r)c=e.top;else if("above"==r||"near"==r){var d=Math.max(s.wrapper.clientHeight,this.doc.height),p=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>d)&&e.top>t.offsetHeight?c=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=d&&(c=e.bottom),u+t.offsetWidth>p&&(u=p-t.offsetWidth)}t.style.top=c+"px",t.style.left=t.style.right="","right"==i?(u=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&(o=this,a={left:u,top:c,right:u+t.offsetWidth,bottom:c+t.offsetHeight},null!=(l=Ar(o,a)).scrollTop&&jr(o,l.scrollTop),null!=l.scrollLeft&&Or(o,l.scrollLeft))},triggerOnKeyDown:ti(ua),triggerOnKeyPress:ti(pa),triggerOnKeyUp:da,triggerOnMouseDown:ti(ga),execCommand:function(e){if(ta.hasOwnProperty(e))return ta[e].call(null,this)},triggerElectric:ti((function(e){Na(this,e)})),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=lt(this.doc,e),a=0;a<t&&!(o=Ma(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:ti((function(e,t){var n=this;this.extendSelectionsBy((function(r){return n.display.shift||n.doc.extend||r.empty()?Ma(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()}),U)})),deleteH:ti((function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):Xo(this,(function(n){var i=Ma(r,n.head,e,t,!1);return e<0?{from:i,to:n.head}:{from:n.head,to:i}}))})),findPosV:function(e,t,n,r){var i=1,o=r;t<0&&(i=-1,t=-t);for(var a=lt(this.doc,e),l=0;l<t;++l){var s=qn(this,a,"div");if(null==o?o=s.left:s.left=o,(a=Ba(this,s,i,n)).hitSide)break}return a},moveV:ti((function(e,t){var n=this,r=this.doc,i=[],o=!this.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy((function(a){if(o)return e<0?a.from():a.to();var l=qn(n,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=Ba(n,l,e,t);return"page"==t&&a==r.sel.primary()&&Dr(n,Gn(n,s,"div").top-l.top),s}),U),i.length)for(var a=0;a<r.sel.ranges.length;a++)r.sel.ranges[a].goalColumn=i[a]})),findWordAt:function(e){var t=Ge(this.doc,e.line).text,n=e.ch,r=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&r!=t.length||!n?++r:--n;for(var o=t.charAt(n),a=ee(o,i)?function(e){return ee(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ee(e)};n>0&&a(t.charAt(n-1));)--n;for(;r<t.length&&a(t.charAt(r));)++r}return new _i(et(e.line,n),et(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):I(this.display.cursorDiv,"CodeMirror-overwrite"),fe(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ti((function(e,t){Pr(this,e,t)})),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-In(this)-this.display.barHeight,width:e.scrollWidth-In(this)-this.display.barWidth,clientHeight:Tn(this),clientWidth:En(this)}},scrollIntoView:ti((function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:et(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?function(e,t){Fr(e),e.curOp.scrollToPos=t}(this,e):Nr(this,e.from,e.to,e.margin)})),setSize:ti((function(e,t){var n=this,r=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&Bn(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,(function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){pr(n,i,"widget");break}++i})),this.curOp.forceUpdate=!0,fe(this,"refresh",this)})),operation:function(e){return Qr(this,e)},startOperation:function(){return Gr(this)},endOperation:function(){return qr(this)},refresh:ti((function(){var e=this.display.cachedTextHeight;dr(this),this.curOp.forceUpdate=!0,Wn(this),Pr(this,this.doc.scrollLeft,this.doc.scrollTop),ci(this.display),(null==e||Math.abs(e-rr(this.display))>.5||this.options.lineWrapping)&&sr(this),fe(this,"refresh",this)})),swapDoc:ti((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),ji(this,e),Wn(this),this.display.input.reset(),Pr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sn(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},be(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}(Ea);var Ga="iter insert remove copy getEditor constructor".split(" ");for(var qa in Lo.prototype)Lo.prototype.hasOwnProperty(qa)&&W(Ga,qa)<0&&(Ea.prototype[qa]=function(e){return function(){return e.apply(this.doc,arguments)}}(Lo.prototype[qa]));return be(Lo),Ea.inputStyles={textarea:Va,contenteditable:Wa},Ea.defineMode=function(e){Ea.defaults.mode||"null"==e||(Ea.defaults.mode=e),Oe.apply(this,arguments)},Ea.defineMIME=function(e,t){Re[e]=t},Ea.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Ea.defineMIME("text/plain","null"),Ea.defineExtension=function(e,t){Ea.prototype[e]=t},Ea.defineDocExtension=function(e,t){Lo.prototype[e]=t},Ea.fromTextArea=function(e,t){if((t=t?O(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=P();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=l.getValue()}var i;if(e.form&&(de(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(n){n.save=r,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,r(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(me(e.form,"submit",r),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var l=Ea((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return l},function(e){e.off=me,e.on=de,e.wheelEventPixels=xi,e.Doc=Lo,e.splitLines=Le,e.countColumn=M,e.findColumn=V,e.isWordChar=Q,e.Pass=z,e.signal=fe,e.Line=Gt,e.changeEnd=Ii,e.scrollbarModel=Zr,e.Pos=et,e.cmpPos=tt,e.modes=je,e.mimeModes=Re,e.resolveMode=Me,e.getMode=Be,e.modeExtensions=We,e.extendMode=ze,e.copyState=He,e.startState=Ue,e.innerMode=Ze,e.commands=ta,e.keyMap=Zo,e.keyName=Yo,e.isModifierKey=qo,e.lookupKey=Go,e.normalizeKeyMap=Vo,e.StringStream=Ve,e.SharedTextMarker=Eo,e.TextMarker=ko,e.LineWidget=Co,e.e_preventDefault=ye,e.e_stopPropagation=xe,e.e_stop=Ce,e.addClass=F,e.contains=L,e.rmClass=I,e.keyNames=Bo}(Ea),Ea.version="5.65.2",Ea}()},25002:function(e,t,n){!function(e){"use strict";function t(e){for(var t={},n=0;n<e.length;++n)t[e[n].toLowerCase()]=!0;return t}e.defineMode("css",(function(t,n){var r=n.inline;n.propertyKeywords||(n=e.resolveMode("text/css"));var i,o,a=t.indentUnit,l=n.tokenHooks,s=n.documentTypes||{},c=n.mediaTypes||{},u=n.mediaFeatures||{},d=n.mediaValueKeywords||{},p=n.propertyKeywords||{},m=n.nonStandardPropertyKeywords||{},f=n.fontProperties||{},h=n.counterDescriptors||{},g=n.colorKeywords||{},v=n.valueKeywords||{},b=n.allowNested,y=n.lineComment,x=!0===n.supportsAtComponent,w=!1!==t.highlightNonStandardPropertyKeywords;function C(e,t){return i=t,e}function _(e,t){var n=e.next();if(l[n]){var r=l[n](e,t);if(!1!==r)return r}return"@"==n?(e.eatWhile(/[\w\\\-]/),C("def",e.current())):"="==n||("~"==n||"|"==n)&&e.eat("=")?C(null,"compare"):'"'==n||"'"==n?(t.tokenize=S(n),t.tokenize(e,t)):"#"==n?(e.eatWhile(/[\w\\\-]/),C("atom","hash")):"!"==n?(e.match(/^\s*\w*/),C("keyword","important")):/\d/.test(n)||"."==n&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),C("number","unit")):"-"!==n?/[,+>*\/]/.test(n)?C(null,"select-op"):"."==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?C("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(n)?C(null,n):e.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(e.current())&&(t.tokenize=k),C("variable callee","variable")):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),C("property","word")):C(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),C("number","unit")):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?C("variable-2","variable-definition"):C("variable-2","variable")):e.match(/^\w+-/)?C("meta","meta"):void 0}function S(e){return function(t,n){for(var r,i=!1;null!=(r=t.next());){if(r==e&&!i){")"==e&&t.backUp(1);break}i=!i&&"\\"==r}return(r==e||!i&&")"!=e)&&(n.tokenize=null),C("string","string")}}function k(e,t){return e.next(),e.match(/^\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=S(")"),C(null,"(")}function I(e,t,n){this.type=e,this.indent=t,this.prev=n}function E(e,t,n,r){return e.context=new I(n,t.indentation()+(!1===r?0:a),e.context),n}function T(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function A(e,t,n){return P[n.context.type](e,t,n)}function D(e,t,n,r){for(var i=r||1;i>0;i--)n.context=n.context.prev;return A(e,t,n)}function L(e){var t=e.current().toLowerCase();o=v.hasOwnProperty(t)?"atom":g.hasOwnProperty(t)?"keyword":"variable"}var P={top:function(e,t,n){if("{"==e)return E(n,t,"block");if("}"==e&&n.context.prev)return T(n);if(x&&/@component/i.test(e))return E(n,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return E(n,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return E(n,t,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return n.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return E(n,t,"at");if("hash"==e)o="builtin";else if("word"==e)o="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return E(n,t,"interpolation");if(":"==e)return"pseudo";if(b&&"("==e)return E(n,t,"parens")}return n.context.type},block:function(e,t,n){if("word"==e){var r=t.current().toLowerCase();return p.hasOwnProperty(r)?(o="property","maybeprop"):m.hasOwnProperty(r)?(o=w?"string-2":"property","maybeprop"):b?(o=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(o+=" error","maybeprop")}return"meta"==e?"block":b||"hash"!=e&&"qualifier"!=e?P.top(e,t,n):(o="error","block")},maybeprop:function(e,t,n){return":"==e?E(n,t,"prop"):A(e,t,n)},prop:function(e,t,n){if(";"==e)return T(n);if("{"==e&&b)return E(n,t,"propBlock");if("}"==e||"{"==e)return D(e,t,n);if("("==e)return E(n,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)L(t);else if("interpolation"==e)return E(n,t,"interpolation")}else o+=" error";return"prop"},propBlock:function(e,t,n){return"}"==e?T(n):"word"==e?(o="property","maybeprop"):n.context.type},parens:function(e,t,n){return"{"==e||"}"==e?D(e,t,n):")"==e?T(n):"("==e?E(n,t,"parens"):"interpolation"==e?E(n,t,"interpolation"):("word"==e&&L(t),"parens")},pseudo:function(e,t,n){return"meta"==e?"pseudo":"word"==e?(o="variable-3",n.context.type):A(e,t,n)},documentTypes:function(e,t,n){return"word"==e&&s.hasOwnProperty(t.current())?(o="tag",n.context.type):P.atBlock(e,t,n)},atBlock:function(e,t,n){if("("==e)return E(n,t,"atBlock_parens");if("}"==e||";"==e)return D(e,t,n);if("{"==e)return T(n)&&E(n,t,b?"block":"top");if("interpolation"==e)return E(n,t,"interpolation");if("word"==e){var r=t.current().toLowerCase();o="only"==r||"not"==r||"and"==r||"or"==r?"keyword":c.hasOwnProperty(r)?"attribute":u.hasOwnProperty(r)?"property":d.hasOwnProperty(r)?"keyword":p.hasOwnProperty(r)?"property":m.hasOwnProperty(r)?w?"string-2":"property":v.hasOwnProperty(r)?"atom":g.hasOwnProperty(r)?"keyword":"error"}return n.context.type},atComponentBlock:function(e,t,n){return"}"==e?D(e,t,n):"{"==e?T(n)&&E(n,t,b?"block":"top",!1):("word"==e&&(o="error"),n.context.type)},atBlock_parens:function(e,t,n){return")"==e?T(n):"{"==e||"}"==e?D(e,t,n,2):P.atBlock(e,t,n)},restricted_atBlock_before:function(e,t,n){return"{"==e?E(n,t,"restricted_atBlock"):"word"==e&&"@counter-style"==n.stateArg?(o="variable","restricted_atBlock_before"):A(e,t,n)},restricted_atBlock:function(e,t,n){return"}"==e?(n.stateArg=null,T(n)):"word"==e?(o="@font-face"==n.stateArg&&!f.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==n.stateArg&&!h.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,t,n){return"word"==e?(o="variable","keyframes"):"{"==e?E(n,t,"top"):A(e,t,n)},at:function(e,t,n){return";"==e?T(n):"{"==e||"}"==e?D(e,t,n):("word"==e?o="tag":"hash"==e&&(o="builtin"),"at")},interpolation:function(e,t,n){return"}"==e?T(n):"{"==e||";"==e?D(e,t,n):("word"==e?o="variable":"variable"!=e&&"("!=e&&")"!=e&&(o="error"),"interpolation")}};return{startState:function(e){return{tokenize:null,state:r?"block":"top",stateArg:null,context:new I(r?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var n=(t.tokenize||_)(e,t);return n&&"object"==typeof n&&(i=n[1],n=n[0]),o=n,"comment"!=i&&(t.state=P[t.state](i,e,t)),o},indent:function(e,t){var n=e.context,r=t&&t.charAt(0),i=n.indent;return"prop"!=n.type||"}"!=r&&")"!=r||(n=n.prev),n.prev&&("}"!=r||"block"!=n.type&&"top"!=n.type&&"interpolation"!=n.type&&"restricted_atBlock"!=n.type?(")"!=r||"parens"!=n.type&&"atBlock_parens"!=n.type)&&("{"!=r||"at"!=n.type&&"atBlock"!=n.type)||(i=Math.max(0,n.indent-a)):i=(n=n.prev).indent),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:y,fold:"brace"}}));var n=["domain","regexp","url","url-prefix"],r=t(n),i=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],o=t(i),a=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover","prefers-color-scheme","dynamic-range","video-dynamic-range"],l=t(a),s=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive","dark","light","standard","high"],c=t(s),u=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","all","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","binding","bleed","block-size","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-content","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-height-step","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotate","rotation","rotation-point","row-gap","ruby-align","ruby-overhang","ruby-position","ruby-span","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-type","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-orientation","text-outline","text-overflow","text-rendering","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","touch-action","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","paint-order","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],d=t(u),p=["accent-color","aspect-ratio","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","content-visibility","margin-block","margin-block-end","margin-block-start","margin-inline","margin-inline-end","margin-inline-start","overflow-anchor","overscroll-behavior","padding-block","padding-block-end","padding-block-start","padding-inline","padding-inline-end","padding-inline-start","scroll-snap-stop","scrollbar-3d-light-color","scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-track-color","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","shape-inside","zoom"],m=t(p),f=t(["font-display","font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),h=t(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),g=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],v=t(g),b=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","blur","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","brightness","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","conic-gradient","contain","content","contents","content-box","context-menu","continuous","contrast","copy","counter","counters","cover","crop","cross","crosshair","cubic-bezier","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","drop-shadow","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","grayscale","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","hue-rotate","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","manipulation","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiple_mask_images","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturate","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","sepia","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],y=t(b),x=n.concat(i).concat(a).concat(s).concat(u).concat(p).concat(g).concat(b);function w(e,t){for(var n,r=!1;null!=(n=e.next());){if(r&&"/"==n){t.tokenize=null;break}r="*"==n}return["comment","comment"]}e.registerHelper("hintWords","css",x),e.defineMIME("text/css",{documentTypes:r,mediaTypes:o,mediaFeatures:l,mediaValueKeywords:c,propertyKeywords:d,nonStandardPropertyKeywords:m,fontProperties:f,counterDescriptors:h,colorKeywords:v,valueKeywords:y,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=w,w(e,t))}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:o,mediaFeatures:l,mediaValueKeywords:c,propertyKeywords:d,nonStandardPropertyKeywords:m,colorKeywords:v,valueKeywords:y,fontProperties:f,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=w,w(e,t)):["operator","operator"]},":":function(e){return!!e.match(/^\s*\{/,!1)&&[null,null]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:o,mediaFeatures:l,mediaValueKeywords:c,propertyKeywords:d,nonStandardPropertyKeywords:m,colorKeywords:v,valueKeywords:y,fontProperties:f,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=w,w(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),e.defineMIME("text/x-gss",{documentTypes:r,mediaTypes:o,mediaFeatures:l,propertyKeywords:d,nonStandardPropertyKeywords:m,fontProperties:f,counterDescriptors:h,colorKeywords:v,valueKeywords:y,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=w,w(e,t))}},name:"css",helperType:"gss"})}(n(70907))},35572:function(e,t,n){t.parse=n(73603),t.stringify=n(64335)},73603:function(e){var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function n(e){return e?e.replace(/^\s+|\s+$/g,""):""}function r(e,t){var n=e&&"string"==typeof e.type,i=n?e:t;for(var o in e){var a=e[o];Array.isArray(a)?a.forEach((function(e){r(e,i)})):a&&"object"==typeof a&&r(a,i)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}e.exports=function(e,i){i=i||{};var o=1,a=1;function l(e){var t=e.match(/\n/g);t&&(o+=t.length);var n=e.lastIndexOf("\n");a=~n?e.length-n:a+e.length}function s(){var e={line:o,column:a};return function(t){return t.position=new c(e),g(),t}}function c(e){this.start=e,this.end={line:o,column:a},this.source=i.source}c.prototype.content=e;var u=[];function d(t){var n=new Error(i.source+":"+o+":"+a+": "+t);if(n.reason=t,n.filename=i.source,n.line=o,n.column=a,n.source=e,!i.silent)throw n;u.push(n)}function p(){return h(/^{\s*/)}function m(){return h(/^}/)}function f(){var t,n,r,i=[];for(g(),v(i);e.length&&"}"!=e.charAt(0)&&(t=T()||(n=void 0,r=void 0,n=s(),(r=y())?(v(),n({type:"rule",selectors:r,declarations:w()})):d("selector missing")));)!1!==t&&(i.push(t),v(i));return i}function h(t){var n=t.exec(e);if(n){var r=n[0];return l(r),e=e.slice(r.length),n}}function g(){h(/^\s*/)}function v(e){var t;for(e=e||[];t=b();)!1!==t&&e.push(t);return e}function b(){var t=s();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return d("End of comment missing");var r=e.slice(2,n-2);return a+=2,l(r),e=e.slice(n),a+=2,t({type:"comment",comment:r})}}function y(){var e=h(/^([^{]+)/);if(e)return n(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(e){return e.replace(/,/g,"‌")})).split(/\s*(?![^(]*\)),\s*/).map((function(e){return e.replace(/\u200C/g,",")}))}function x(){var e=s(),r=h(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(r){if(r=n(r[0]),!h(/^:\s*/))return d("property missing ':'");var i=h(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),o=e({type:"declaration",property:r.replace(t,""),value:i?n(i[0]).replace(t,""):""});return h(/^[;\s]*/),o}}function w(){var e,t=[];if(!p())return d("missing '{'");for(v(t);e=x();)!1!==e&&(t.push(e),v(t));return m()?t:d("missing '}'")}function C(){for(var e,t=[],n=s();e=h(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),h(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:w()})}var _,S=E("import"),k=E("charset"),I=E("namespace");function E(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var n=s(),r=h(t);if(r){var i={type:e};return i[e]=r[1].trim(),n(i)}}}function T(){if("@"==e[0])return function(){var e=s();if(t=h(/^@([-\w]+)?keyframes\s*/)){var t,n=t[1];if(!(t=h(/^([-\w]+)\s*/)))return d("@keyframes missing name");var r,i=t[1];if(!p())return d("@keyframes missing '{'");for(var o=v();r=C();)o.push(r),o=o.concat(v());return m()?e({type:"keyframes",name:i,vendor:n,keyframes:o}):d("@keyframes missing '}'")}}()||function(){var e=s(),t=h(/^@media *([^{]+)/);if(t){var r=n(t[1]);if(!p())return d("@media missing '{'");var i=v().concat(f());return m()?e({type:"media",media:r,rules:i}):d("@media missing '}'")}}()||function(){var e=s(),t=h(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:n(t[1]),media:n(t[2])})}()||function(){var e=s(),t=h(/^@supports *([^{]+)/);if(t){var r=n(t[1]);if(!p())return d("@supports missing '{'");var i=v().concat(f());return m()?e({type:"supports",supports:r,rules:i}):d("@supports missing '}'")}}()||S()||k()||I()||function(){var e=s(),t=h(/^@([-\w]+)?document *([^{]+)/);if(t){var r=n(t[1]),i=n(t[2]);if(!p())return d("@document missing '{'");var o=v().concat(f());return m()?e({type:"document",document:i,vendor:r,rules:o}):d("@document missing '}'")}}()||function(){var e=s();if(h(/^@page */)){var t=y()||[];if(!p())return d("@page missing '{'");for(var n,r=v();n=x();)r.push(n),r=r.concat(v());return m()?e({type:"page",selectors:t,declarations:r}):d("@page missing '}'")}}()||function(){var e=s();if(h(/^@host\s*/)){if(!p())return d("@host missing '{'");var t=v().concat(f());return m()?e({type:"host",rules:t}):d("@host missing '}'")}}()||function(){var e=s();if(h(/^@font-face\s*/)){if(!p())return d("@font-face missing '{'");for(var t,n=v();t=x();)n.push(t),n=n.concat(v());return m()?e({type:"font-face",declarations:n}):d("@font-face missing '}'")}}()}return r((_=f(),{type:"stylesheet",stylesheet:{source:i.source,rules:_,parsingErrors:u}}))}},68829:function(e){function t(e){this.options=e||{}}e.exports=t,t.prototype.emit=function(e){return e},t.prototype.visit=function(e){return this[e.type](e)},t.prototype.mapVisit=function(e,t){var n="";t=t||"";for(var r=0,i=e.length;r<i;r++)n+=this.visit(e[r]),t&&r<i-1&&(n+=this.emit(t));return n}},21352:function(e,t,n){var r=n(68829),i=n(89118);function o(e){r.call(this,e)}e.exports=o,i(o,r),o.prototype.compile=function(e){return e.stylesheet.rules.map(this.visit,this).join("")},o.prototype.comment=function(e){return this.emit("",e.position)},o.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)},o.prototype.media=function(e){return this.emit("@media "+e.media,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},o.prototype.document=function(e){var t="@"+(e.vendor||"")+"document "+e.document;return this.emit(t,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},o.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)},o.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)},o.prototype.supports=function(e){return this.emit("@supports "+e.supports,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},o.prototype.keyframes=function(e){return this.emit("@"+(e.vendor||"")+"keyframes "+e.name,e.position)+this.emit("{")+this.mapVisit(e.keyframes)+this.emit("}")},o.prototype.keyframe=function(e){var t=e.declarations;return this.emit(e.values.join(","),e.position)+this.emit("{")+this.mapVisit(t)+this.emit("}")},o.prototype.page=function(e){var t=e.selectors.length?e.selectors.join(", "):"";return this.emit("@page "+t,e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}")},o.prototype["font-face"]=function(e){return this.emit("@font-face",e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}")},o.prototype.host=function(e){return this.emit("@host",e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")},o.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)},o.prototype.rule=function(e){var t=e.declarations;return t.length?this.emit(e.selectors.join(","),e.position)+this.emit("{")+this.mapVisit(t)+this.emit("}"):""},o.prototype.declaration=function(e){return this.emit(e.property+":"+e.value,e.position)+this.emit(";")}},20478:function(e,t,n){var r=n(68829),i=n(89118);function o(e){e=e||{},r.call(this,e),this.indentation=e.indent}e.exports=o,i(o,r),o.prototype.compile=function(e){return this.stylesheet(e)},o.prototype.stylesheet=function(e){return this.mapVisit(e.stylesheet.rules,"\n\n")},o.prototype.comment=function(e){return this.emit(this.indent()+"/*"+e.comment+"*/",e.position)},o.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)},o.prototype.media=function(e){return this.emit("@media "+e.media,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},o.prototype.document=function(e){var t="@"+(e.vendor||"")+"document "+e.document;return this.emit(t,e.position)+this.emit("  {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},o.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)},o.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)},o.prototype.supports=function(e){return this.emit("@supports "+e.supports,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},o.prototype.keyframes=function(e){return this.emit("@"+(e.vendor||"")+"keyframes "+e.name,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.keyframes,"\n")+this.emit(this.indent(-1)+"}")},o.prototype.keyframe=function(e){var t=e.declarations;return this.emit(this.indent())+this.emit(e.values.join(", "),e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(t,"\n")+this.emit(this.indent(-1)+"\n"+this.indent()+"}\n")},o.prototype.page=function(e){var t=e.selectors.length?e.selectors.join(", ")+" ":"";return this.emit("@page "+t,e.position)+this.emit("{\n")+this.emit(this.indent(1))+this.mapVisit(e.declarations,"\n")+this.emit(this.indent(-1))+this.emit("\n}")},o.prototype["font-face"]=function(e){return this.emit("@font-face ",e.position)+this.emit("{\n")+this.emit(this.indent(1))+this.mapVisit(e.declarations,"\n")+this.emit(this.indent(-1))+this.emit("\n}")},o.prototype.host=function(e){return this.emit("@host",e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")},o.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)},o.prototype.rule=function(e){var t=this.indent(),n=e.declarations;return n.length?this.emit(e.selectors.map((function(e){return t+e})).join(",\n"),e.position)+this.emit(" {\n")+this.emit(this.indent(1))+this.mapVisit(n,"\n")+this.emit(this.indent(-1))+this.emit("\n"+this.indent()+"}"):""},o.prototype.declaration=function(e){return this.emit(this.indent())+this.emit(e.property+": "+e.value,e.position)+this.emit(";")},o.prototype.indent=function(e){return this.level=this.level||1,null!=e?(this.level+=e,""):Array(this.level).join(this.indentation||"  ")}},64335:function(e,t,n){var r=n(21352),i=n(20478);e.exports=function(e,t){var o=(t=t||{}).compress?new r(t):new i(t);if(t.sourcemap){n(51073)(o);var a=o.compile(e);return o.applySourceMaps(),{code:a,map:"generator"===t.sourcemap?o.map:o.map.toJSON()}}return o.compile(e)}},51073:function(e,t,n){var r=n(20065).SourceMapGenerator,i=n(20065).SourceMapConsumer,o=n(14471),a=n(37019),l=n(96344);e.exports=function(e){for(var n in e._comment=e.comment,e.map=new r,e.position={line:1,column:1},e.files={},t)e[n]=t[n]};const s=function(e){return"\\"===l.sep?e.replace(/\\/g,"/").replace(/^[a-z]:\/?/i,"/"):e};t.updatePosition=function(e){var t=e.match(/\n/g);t&&(this.position.line+=t.length);var n=e.lastIndexOf("\n");this.position.column=~n?e.length-n:this.position.column+e.length},t.emit=function(e,t){if(t){var n=s(t.source||"source.css");this.map.addMapping({source:n,generated:{line:this.position.line,column:Math.max(this.position.column-1,0)},original:{line:t.start.line,column:t.start.column-1}}),this.addFile(n,t)}return this.updatePosition(e),e},t.addFile=function(e,t){"string"==typeof t.content&&(Object.prototype.hasOwnProperty.call(this.files,e)||(this.files[e]=t.content))},t.applySourceMaps=function(){Object.keys(this.files).forEach((function(e){var t=this.files[e];if(this.map.setSourceContent(e,t),!1!==this.options.inputSourcemaps){var n=o.resolveSync(t,e,a.readFileSync);if(n){var r=new i(n.map),c=n.sourcesRelativeTo;this.map.applySourceMap(r,e,s(l.dirname(c)))}}}),this)},t.comment=function(e){return/^# sourceMappingURL=/.test(e.comment)?this.emit("",e.position):this._comment(e)}},20242:function(e){"use strict";var t="%[a-f0-9]{2}",n=new RegExp(t,"gi"),r=new RegExp("("+t+")+","gi");function i(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function o(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(n),r=1;r<t.length;r++)t=(e=i(t,r).join("")).match(n);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=r.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var i=o(n[0]);i!==n[0]&&(t[n[0]]=i)}n=r.exec(e)}t["%C2"]="�";for(var a=Object.keys(t),l=0;l<a.length;l++){var s=a[l];e=e.replace(new RegExp(s,"g"),t[s])}return e}(e)}}},74870:function(e,t,n){var r;e=n.nmd(e),function(i){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof n.g&&n.g;o.global!==o&&o.window!==o&&o.self;var a,l=2147483647,s=36,c=/^xn--/,u=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=Math.floor,f=String.fromCharCode;function h(e){throw RangeError(p[e])}function g(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+g((e=e.replace(d,".")).split("."),t).join(".")}function b(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function y(e){return g(e,(function(e){var t="";return e>65535&&(t+=f((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+f(e)})).join("")}function x(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function w(e,t,n){var r=0;for(e=n?m(e/700):e>>1,e+=m(e/t);e>455;r+=s)e=m(e/35);return m(r+36*e/(e+38))}function C(e){var t,n,r,i,o,a,c,u,d,p,f,g=[],v=e.length,b=0,x=128,C=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&h("not-basic"),g.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<v;){for(o=b,a=1,c=s;i>=v&&h("invalid-input"),((u=(f=e.charCodeAt(i++))-48<10?f-22:f-65<26?f-65:f-97<26?f-97:s)>=s||u>m((l-b)/a))&&h("overflow"),b+=u*a,!(u<(d=c<=C?1:c>=C+26?26:c-C));c+=s)a>m(l/(p=s-d))&&h("overflow"),a*=p;C=w(b-o,t=g.length+1,0==o),m(b/t)>l-x&&h("overflow"),x+=m(b/t),b%=t,g.splice(b++,0,x)}return y(g)}function _(e){var t,n,r,i,o,a,c,u,d,p,g,v,y,C,_,S=[];for(v=(e=b(e)).length,t=128,n=0,o=72,a=0;a<v;++a)(g=e[a])<128&&S.push(f(g));for(r=i=S.length,i&&S.push("-");r<v;){for(c=l,a=0;a<v;++a)(g=e[a])>=t&&g<c&&(c=g);for(c-t>m((l-n)/(y=r+1))&&h("overflow"),n+=(c-t)*y,t=c,a=0;a<v;++a)if((g=e[a])<t&&++n>l&&h("overflow"),g==t){for(u=n,d=s;!(u<(p=d<=o?1:d>=o+26?26:d-o));d+=s)_=u-p,C=s-p,S.push(f(x(p+_%C,0))),u=m(_/C);S.push(f(x(u,0))),o=w(n,y,r==i),n=0,++r}++n,++t}return S.join("")}a={version:"1.3.2",ucs2:{decode:b,encode:y},decode:C,encode:_,toASCII:function(e){return v(e,(function(e){return u.test(e)?"xn--"+_(e):e}))},toUnicode:function(e){return v(e,(function(e){return c.test(e)?C(e.slice(4).toLowerCase()):e}))}},void 0===(r=function(){return a}.call(t,n,t,e))||(e.exports=r)}()},55240:function(e){"use strict";function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,n,r,i){n=n||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(n);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var s=e.length;l>0&&s>l&&(s=l);for(var c=0;c<s;++c){var u,d,p,m,f=e[c].replace(a,"%20"),h=f.indexOf(r);h>=0?(u=f.substr(0,h),d=f.substr(h+1)):(u=f,d=""),p=decodeURIComponent(u),m=decodeURIComponent(d),t(o,p)?Array.isArray(o[p])?o[p].push(m):o[p]=[o[p],m]:o[p]=m}return o}},3907:function(e){"use strict";var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,n,r,i){return n=n||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(i){var o=encodeURIComponent(t(i))+r;return Array.isArray(e[i])?e[i].map((function(e){return o+encodeURIComponent(t(e))})).join(n):o+encodeURIComponent(t(e[i]))})).join(n):i?encodeURIComponent(t(i))+r+encodeURIComponent(t(e)):""}},54415:function(e,t,n){"use strict";t.decode=t.parse=n(55240),t.encode=t.stringify=n(3907)},14471:function(e,t,n){var r=n(89504),i=n(3040),o=n(439),a=n(20242);function l(){return Array.prototype.reduce.call(arguments,(function(e,t){return i.resolve(e,t)}))}function s(e){return"\\"===o.sep?e.replace(/\\/g,"/").replace(/^[a-z]:\/?/i,"/"):e}function c(e){return a(e.replace(/\+/g,"%2B"))}function u(e,t,n){setImmediate((function(){e(t,n)}))}function d(e,t){try{return JSON.parse(e.replace(/^\)\]\}'/,""))}catch(e){throw e.sourceMapData=t,e}}function p(e,t,n){var r=c(t);try{return String(e(r))}catch(e){throw e.sourceMapData=n,e}}var m=/[#@] sourceMappingURL=([^\s'"]*)/,f=RegExp("(?:/\\*(?:\\s*\r?\n(?://)?)?(?:"+m.source+")\\s*\\*/|//(?:"+m.source+"))\\s*");function h(e,t,n,r){var i;try{i=y(e,t)}catch(e){return u(r,e)}if(!i||i.map)return u(r,null,i);n(c(i.url),(function(e,t){if(e)return e.sourceMapData=i,r(e);i.map=String(t);try{i.map=d(i.map,i)}catch(e){return r(e)}r(null,i)}))}function g(e,t,n){var r=y(e,t);return!r||r.map||(r.map=p(n,r.url,r),r.map=d(r.map,r)),r}var v=/^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/,b=/^(?:application|text)\/json$/;function y(e,t){t=s(t);var n=function(e){var t=e.match(f);return t?t[1]||t[2]||"":null}(e);if(!n)return null;var i=n.match(v);if(i){var o=i[1]||"text/plain",a=i[2]||"",c=i[3]||"",u={sourceMappingURL:n,url:null,sourcesRelativeTo:t,map:c};if(!b.test(o)){var p=new Error("Unuseful data uri mime type: "+o);throw p.sourceMapData=u,p}try{u.map=d(";base64"===a?function(e){if("undefined"==typeof TextDecoder||"undefined"==typeof Uint8Array)return r(e);var t=function(e){for(var t=r(e),n=t.length,i=new Uint8Array(n),o=0;o<n;o++)i[o]=t.charCodeAt(o);return i}(e);return new TextDecoder("utf-8",{fatal:!0}).decode(t)}(c):decodeURIComponent(c),u)}catch(p){throw p.sourceMapData=u,p}return u}var m=l(t,n);return{sourceMappingURL:n,url:m,sourcesRelativeTo:m,map:null}}function x(e,t,n,r,i){"function"==typeof r&&(i=r,r={});var o=e.sources?e.sources.length:0,a={sourcesResolved:[],sourcesContent:[]};if(0!==o){var l=function(){0==--o&&i(null,a)};_(e,t,r,(function(e,t,r){if(a.sourcesResolved[r]=e,"string"==typeof t)a.sourcesContent[r]=t,u(l,null);else{var i=c(e);n(i,(function(e,t){a.sourcesContent[r]=e||String(t),l()}))}}))}else u(i,null,a)}function w(e,t,n,r){var i={sourcesResolved:[],sourcesContent:[]};return e.sources&&0!==e.sources.length?(_(e,t,r,(function(e,t,r){if(i.sourcesResolved[r]=e,null!==n)if("string"==typeof t)i.sourcesContent[r]=t;else{var o=c(e);try{i.sourcesContent[r]=String(n(o))}catch(e){i.sourcesContent[r]=e}}})),i):i}var C=/\/?$/;function _(e,t,n,r){var i;n=n||{},t=s(t);for(var o=0,a=e.sources.length;o<a;o++)i=null,"string"==typeof n.sourceRoot?i=n.sourceRoot:"string"==typeof e.sourceRoot&&!1!==n.sourceRoot&&(i=e.sourceRoot),r(null===i||""===i?l(t,e.sources[o]):l(t,i.replace(C,"/"),e.sources[o]),(e.sourcesContent||[])[o],o)}e.exports={resolveSourceMap:h,resolveSourceMapSync:g,resolveSources:x,resolveSourcesSync:w,resolve:function(e,t,n,r,i){if("function"==typeof r&&(i=r,r={}),null===e){var o={sourceMappingURL:null,url:t,sourcesRelativeTo:t,map:null},a=c(t);n(a,(function(e,t){if(e)return e.sourceMapData=o,i(e);o.map=String(t);try{o.map=d(o.map,o)}catch(e){return i(e)}l(o)}))}else h(e,t,n,(function(e,t){return e?i(e):t?void l(t):i(null,null)}));function l(e){x(e.map,e.sourcesRelativeTo,n,r,(function(t,n){if(t)return i(t);e.sourcesResolved=n.sourcesResolved,e.sourcesContent=n.sourcesContent,i(null,e)}))}},resolveSync:function(e,t,n,r){var i;if(null===e)(i={sourceMappingURL:null,url:t,sourcesRelativeTo:t,map:null}).map=p(n,t,i),i.map=d(i.map,i);else if(!(i=g(e,t,n)))return null;var o=w(i.map,i.sourcesRelativeTo,n,r);return i.sourcesResolved=o.sourcesResolved,i.sourcesContent=o.sourcesContent,i},parseMapToJSON:d}},7402:function(e,t,n){var r=n(23114),i=Object.prototype.hasOwnProperty,o="undefined"!=typeof Map;function a(){this._array=[],this._set=o?new Map:Object.create(null)}a.fromArray=function(e,t){for(var n=new a,r=0,i=e.length;r<i;r++)n.add(e[r],t);return n},a.prototype.size=function(){return o?this._set.size:Object.getOwnPropertyNames(this._set).length},a.prototype.add=function(e,t){var n=o?e:r.toSetString(e),a=o?this.has(e):i.call(this._set,n),l=this._array.length;a&&!t||this._array.push(e),a||(o?this._set.set(e,l):this._set[n]=l)},a.prototype.has=function(e){if(o)return this._set.has(e);var t=r.toSetString(e);return i.call(this._set,t)},a.prototype.indexOf=function(e){if(o){var t=this._set.get(e);if(t>=0)return t}else{var n=r.toSetString(e);if(i.call(this._set,n))return this._set[n]}throw new Error('"'+e+'" is not in the set.')},a.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},a.prototype.toArray=function(){return this._array.slice()},t.I=a},93719:function(e,t,n){var r=n(8407);t.encode=function(e){var t,n="",i=function(e){return e<0?1+(-e<<1):0+(e<<1)}(e);do{t=31&i,(i>>>=5)>0&&(t|=32),n+=r.encode(t)}while(i>0);return n},t.decode=function(e,t,n){var i,o,a,l,s=e.length,c=0,u=0;do{if(t>=s)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(o=r.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));i=!!(32&o),c+=(o&=31)<<u,u+=5}while(i);n.value=(l=(a=c)>>1,1==(1&a)?-l:l),n.rest=t}},8407:function(e,t){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");t.encode=function(e){if(0<=e&&e<n.length)return n[e];throw new TypeError("Must be between 0 and 63: "+e)},t.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}},54397:function(e,t){function n(e,r,i,o,a,l){var s=Math.floor((r-e)/2)+e,c=a(i,o[s],!0);return 0===c?s:c>0?r-s>1?n(s,r,i,o,a,l):l==t.LEAST_UPPER_BOUND?r<o.length?r:-1:s:s-e>1?n(e,s,i,o,a,l):l==t.LEAST_UPPER_BOUND?s:e<0?-1:e}t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(e,r,i,o){if(0===r.length)return-1;var a=n(-1,r.length,e,r,i,o||t.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===i(r[a],r[a-1],!0);)--a;return a}},3307:function(e,t,n){var r=n(23114);function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}i.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},i.prototype.add=function(e){var t,n,i,o,a,l;n=e,i=(t=this._last).generatedLine,o=n.generatedLine,a=t.generatedColumn,l=n.generatedColumn,o>i||o==i&&l>=a||r.compareByGeneratedPositionsInflated(t,n)<=0?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(r.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},t.H=i},90384:function(e,t){function n(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function r(e,t,i,o){if(i<o){var a=i-1;n(e,(u=i,d=o,Math.round(u+Math.random()*(d-u))),o);for(var l=e[o],s=i;s<o;s++)t(e[s],l)<=0&&n(e,a+=1,s);n(e,a+1,s);var c=a+1;r(e,t,i,c-1),r(e,t,c+1,o)}var u,d}t.U=function(e,t){r(e,t,0,e.length-1)}},22799:function(e,t,n){var r=n(23114),i=n(54397),o=n(7402).I,a=n(93719),l=n(90384).U;function s(e,t){var n=e;return"string"==typeof e&&(n=r.parseSourceMapInput(e)),null!=n.sections?new d(n,t):new c(n,t)}function c(e,t){var n=e;"string"==typeof e&&(n=r.parseSourceMapInput(e));var i=r.getArg(n,"version"),a=r.getArg(n,"sources"),l=r.getArg(n,"names",[]),s=r.getArg(n,"sourceRoot",null),c=r.getArg(n,"sourcesContent",null),u=r.getArg(n,"mappings"),d=r.getArg(n,"file",null);if(i!=this._version)throw new Error("Unsupported version: "+i);s&&(s=r.normalize(s)),a=a.map(String).map(r.normalize).map((function(e){return s&&r.isAbsolute(s)&&r.isAbsolute(e)?r.relative(s,e):e})),this._names=o.fromArray(l.map(String),!0),this._sources=o.fromArray(a,!0),this._absoluteSources=this._sources.toArray().map((function(e){return r.computeSourceURL(s,e,t)})),this.sourceRoot=s,this.sourcesContent=c,this._mappings=u,this._sourceMapURL=t,this.file=d}function u(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function d(e,t){var n=e;"string"==typeof e&&(n=r.parseSourceMapInput(e));var i=r.getArg(n,"version"),a=r.getArg(n,"sections");if(i!=this._version)throw new Error("Unsupported version: "+i);this._sources=new o,this._names=new o;var l={line:-1,column:0};this._sections=a.map((function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var n=r.getArg(e,"offset"),i=r.getArg(n,"line"),o=r.getArg(n,"column");if(i<l.line||i===l.line&&o<l.column)throw new Error("Section offsets must be ordered and non-overlapping.");return l=n,{generatedOffset:{generatedLine:i+1,generatedColumn:o+1},consumer:new s(r.getArg(e,"map"),t)}}))}s.fromSourceMap=function(e,t){return c.fromSourceMap(e,t)},s.prototype._version=3,s.prototype.__generatedMappings=null,Object.defineProperty(s.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),s.prototype.__originalMappings=null,Object.defineProperty(s.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),s.prototype._charIsMappingSeparator=function(e,t){var n=e.charAt(t);return";"===n||","===n},s.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")},s.GENERATED_ORDER=1,s.ORIGINAL_ORDER=2,s.GREATEST_LOWER_BOUND=1,s.LEAST_UPPER_BOUND=2,s.prototype.eachMapping=function(e,t,n){var i,o=t||null;switch(n||s.GENERATED_ORDER){case s.GENERATED_ORDER:i=this._generatedMappings;break;case s.ORIGINAL_ORDER:i=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var a=this.sourceRoot;i.map((function(e){var t=null===e.source?null:this._sources.at(e.source);return{source:t=r.computeSourceURL(a,t,this._sourceMapURL),generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:null===e.name?null:this._names.at(e.name)}}),this).forEach(e,o)},s.prototype.allGeneratedPositionsFor=function(e){var t=r.getArg(e,"line"),n={source:r.getArg(e,"source"),originalLine:t,originalColumn:r.getArg(e,"column",0)};if(n.source=this._findSourceIndex(n.source),n.source<0)return[];var o=[],a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",r.compareByOriginalPositions,i.LEAST_UPPER_BOUND);if(a>=0){var l=this._originalMappings[a];if(void 0===e.column)for(var s=l.originalLine;l&&l.originalLine===s;)o.push({line:r.getArg(l,"generatedLine",null),column:r.getArg(l,"generatedColumn",null),lastColumn:r.getArg(l,"lastGeneratedColumn",null)}),l=this._originalMappings[++a];else for(var c=l.originalColumn;l&&l.originalLine===t&&l.originalColumn==c;)o.push({line:r.getArg(l,"generatedLine",null),column:r.getArg(l,"generatedColumn",null),lastColumn:r.getArg(l,"lastGeneratedColumn",null)}),l=this._originalMappings[++a]}return o},t.SourceMapConsumer=s,c.prototype=Object.create(s.prototype),c.prototype.consumer=s,c.prototype._findSourceIndex=function(e){var t,n=e;if(null!=this.sourceRoot&&(n=r.relative(this.sourceRoot,n)),this._sources.has(n))return this._sources.indexOf(n);for(t=0;t<this._absoluteSources.length;++t)if(this._absoluteSources[t]==e)return t;return-1},c.fromSourceMap=function(e,t){var n=Object.create(c.prototype),i=n._names=o.fromArray(e._names.toArray(),!0),a=n._sources=o.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file,n._sourceMapURL=t,n._absoluteSources=n._sources.toArray().map((function(e){return r.computeSourceURL(n.sourceRoot,e,t)}));for(var s=e._mappings.toArray().slice(),d=n.__generatedMappings=[],p=n.__originalMappings=[],m=0,f=s.length;m<f;m++){var h=s[m],g=new u;g.generatedLine=h.generatedLine,g.generatedColumn=h.generatedColumn,h.source&&(g.source=a.indexOf(h.source),g.originalLine=h.originalLine,g.originalColumn=h.originalColumn,h.name&&(g.name=i.indexOf(h.name)),p.push(g)),d.push(g)}return l(n.__originalMappings,r.compareByOriginalPositions),n},c.prototype._version=3,Object.defineProperty(c.prototype,"sources",{get:function(){return this._absoluteSources.slice()}}),c.prototype._parseMappings=function(e,t){for(var n,i,o,s,c,d=1,p=0,m=0,f=0,h=0,g=0,v=e.length,b=0,y={},x={},w=[],C=[];b<v;)if(";"===e.charAt(b))d++,b++,p=0;else if(","===e.charAt(b))b++;else{for((n=new u).generatedLine=d,s=b;s<v&&!this._charIsMappingSeparator(e,s);s++);if(o=y[i=e.slice(b,s)])b+=i.length;else{for(o=[];b<s;)a.decode(e,b,x),c=x.value,b=x.rest,o.push(c);if(2===o.length)throw new Error("Found a source, but no line and column");if(3===o.length)throw new Error("Found a source and line, but no column");y[i]=o}n.generatedColumn=p+o[0],p=n.generatedColumn,o.length>1&&(n.source=h+o[1],h+=o[1],n.originalLine=m+o[2],m=n.originalLine,n.originalLine+=1,n.originalColumn=f+o[3],f=n.originalColumn,o.length>4&&(n.name=g+o[4],g+=o[4])),C.push(n),"number"==typeof n.originalLine&&w.push(n)}l(C,r.compareByGeneratedPositionsDeflated),this.__generatedMappings=C,l(w,r.compareByOriginalPositions),this.__originalMappings=w},c.prototype._findMapping=function(e,t,n,r,o,a){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return i.search(e,t,o,a)},c.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var n=this._generatedMappings[e+1];if(t.generatedLine===n.generatedLine){t.lastGeneratedColumn=n.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},c.prototype.originalPositionFor=function(e){var t={generatedLine:r.getArg(e,"line"),generatedColumn:r.getArg(e,"column")},n=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",r.compareByGeneratedPositionsDeflated,r.getArg(e,"bias",s.GREATEST_LOWER_BOUND));if(n>=0){var i=this._generatedMappings[n];if(i.generatedLine===t.generatedLine){var o=r.getArg(i,"source",null);null!==o&&(o=this._sources.at(o),o=r.computeSourceURL(this.sourceRoot,o,this._sourceMapURL));var a=r.getArg(i,"name",null);return null!==a&&(a=this._names.at(a)),{source:o,line:r.getArg(i,"originalLine",null),column:r.getArg(i,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},c.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))},c.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;var n=this._findSourceIndex(e);if(n>=0)return this.sourcesContent[n];var i,o=e;if(null!=this.sourceRoot&&(o=r.relative(this.sourceRoot,o)),null!=this.sourceRoot&&(i=r.urlParse(this.sourceRoot))){var a=o.replace(/^file:\/\//,"");if("file"==i.scheme&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!i.path||"/"==i.path)&&this._sources.has("/"+o))return this.sourcesContent[this._sources.indexOf("/"+o)]}if(t)return null;throw new Error('"'+o+'" is not in the SourceMap.')},c.prototype.generatedPositionFor=function(e){var t=r.getArg(e,"source");if((t=this._findSourceIndex(t))<0)return{line:null,column:null,lastColumn:null};var n={source:t,originalLine:r.getArg(e,"line"),originalColumn:r.getArg(e,"column")},i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",r.compareByOriginalPositions,r.getArg(e,"bias",s.GREATEST_LOWER_BOUND));if(i>=0){var o=this._originalMappings[i];if(o.source===n.source)return{line:r.getArg(o,"generatedLine",null),column:r.getArg(o,"generatedColumn",null),lastColumn:r.getArg(o,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},d.prototype=Object.create(s.prototype),d.prototype.constructor=s,d.prototype._version=3,Object.defineProperty(d.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var n=0;n<this._sections[t].consumer.sources.length;n++)e.push(this._sections[t].consumer.sources[n]);return e}}),d.prototype.originalPositionFor=function(e){var t={generatedLine:r.getArg(e,"line"),generatedColumn:r.getArg(e,"column")},n=i.search(t,this._sections,(function(e,t){return e.generatedLine-t.generatedOffset.generatedLine||e.generatedColumn-t.generatedOffset.generatedColumn})),o=this._sections[n];return o?o.consumer.originalPositionFor({line:t.generatedLine-(o.generatedOffset.generatedLine-1),column:t.generatedColumn-(o.generatedOffset.generatedLine===t.generatedLine?o.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},d.prototype.hasContentsOfAllSources=function(){return this._sections.every((function(e){return e.consumer.hasContentsOfAllSources()}))},d.prototype.sourceContentFor=function(e,t){for(var n=0;n<this._sections.length;n++){var r=this._sections[n].consumer.sourceContentFor(e,!0);if(r)return r}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},d.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var n=this._sections[t];if(-1!==n.consumer._findSourceIndex(r.getArg(e,"source"))){var i=n.consumer.generatedPositionFor(e);if(i)return{line:i.line+(n.generatedOffset.generatedLine-1),column:i.column+(n.generatedOffset.generatedLine===i.line?n.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},d.prototype._parseMappings=function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var n=0;n<this._sections.length;n++)for(var i=this._sections[n],o=i.consumer._generatedMappings,a=0;a<o.length;a++){var s=o[a],c=i.consumer._sources.at(s.source);c=r.computeSourceURL(i.consumer.sourceRoot,c,this._sourceMapURL),this._sources.add(c),c=this._sources.indexOf(c);var u=null;s.name&&(u=i.consumer._names.at(s.name),this._names.add(u),u=this._names.indexOf(u));var d={source:c,generatedLine:s.generatedLine+(i.generatedOffset.generatedLine-1),generatedColumn:s.generatedColumn+(i.generatedOffset.generatedLine===s.generatedLine?i.generatedOffset.generatedColumn-1:0),originalLine:s.originalLine,originalColumn:s.originalColumn,name:u};this.__generatedMappings.push(d),"number"==typeof d.originalLine&&this.__originalMappings.push(d)}l(this.__generatedMappings,r.compareByGeneratedPositionsDeflated),l(this.__originalMappings,r.compareByOriginalPositions)}},67819:function(e,t,n){var r=n(93719),i=n(23114),o=n(7402).I,a=n(3307).H;function l(e){e||(e={}),this._file=i.getArg(e,"file",null),this._sourceRoot=i.getArg(e,"sourceRoot",null),this._skipValidation=i.getArg(e,"skipValidation",!1),this._sources=new o,this._names=new o,this._mappings=new a,this._sourcesContents=null}l.prototype._version=3,l.fromSourceMap=function(e){var t=e.sourceRoot,n=new l({file:e.file,sourceRoot:t});return e.eachMapping((function(e){var r={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(r.source=e.source,null!=t&&(r.source=i.relative(t,r.source)),r.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(r.name=e.name)),n.addMapping(r)})),e.sources.forEach((function(r){var o=r;null!==t&&(o=i.relative(t,r)),n._sources.has(o)||n._sources.add(o);var a=e.sourceContentFor(r);null!=a&&n.setSourceContent(r,a)})),n},l.prototype.addMapping=function(e){var t=i.getArg(e,"generated"),n=i.getArg(e,"original",null),r=i.getArg(e,"source",null),o=i.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,n,r,o),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=n&&n.line,originalColumn:null!=n&&n.column,source:r,name:o})},l.prototype.setSourceContent=function(e,t){var n=e;null!=this._sourceRoot&&(n=i.relative(this._sourceRoot,n)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[i.toSetString(n)]=t):this._sourcesContents&&(delete this._sourcesContents[i.toSetString(n)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},l.prototype.applySourceMap=function(e,t,n){var r=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.');r=e.file}var a=this._sourceRoot;null!=a&&(r=i.relative(a,r));var l=new o,s=new o;this._mappings.unsortedForEach((function(t){if(t.source===r&&null!=t.originalLine){var o=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=o.source&&(t.source=o.source,null!=n&&(t.source=i.join(n,t.source)),null!=a&&(t.source=i.relative(a,t.source)),t.originalLine=o.line,t.originalColumn=o.column,null!=o.name&&(t.name=o.name))}var c=t.source;null==c||l.has(c)||l.add(c);var u=t.name;null==u||s.has(u)||s.add(u)}),this),this._sources=l,this._names=s,e.sources.forEach((function(t){var r=e.sourceContentFor(t);null!=r&&(null!=n&&(t=i.join(n,t)),null!=a&&(t=i.relative(a,t)),this.setSourceContent(t,r))}),this)},l.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)&&!(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))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))},l.prototype._serializeMappings=function(){for(var e,t,n,o,a=0,l=1,s=0,c=0,u=0,d=0,p="",m=this._mappings.toArray(),f=0,h=m.length;f<h;f++){if(e="",(t=m[f]).generatedLine!==l)for(a=0;t.generatedLine!==l;)e+=";",l++;else if(f>0){if(!i.compareByGeneratedPositionsInflated(t,m[f-1]))continue;e+=","}e+=r.encode(t.generatedColumn-a),a=t.generatedColumn,null!=t.source&&(o=this._sources.indexOf(t.source),e+=r.encode(o-d),d=o,e+=r.encode(t.originalLine-1-c),c=t.originalLine-1,e+=r.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(n=this._names.indexOf(t.name),e+=r.encode(n-u),u=n)),p+=e}return p},l.prototype._generateSourcesContent=function(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=i.relative(t,e));var n=i.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null}),this)},l.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},l.prototype.toString=function(){return JSON.stringify(this.toJSON())},t.SourceMapGenerator=l},25421:function(e,t,n){var r=n(67819).SourceMapGenerator,i=n(23114),o=/(\r?\n)/,a="$$$isSourceNode$$$";function l(e,t,n,r,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==n?null:n,this.name=null==i?null:i,this[a]=!0,null!=r&&this.add(r)}l.fromStringWithSourceMap=function(e,t,n){var r=new l,a=e.split(o),s=0,c=function(){return e()+(e()||"");function e(){return s<a.length?a[s++]:void 0}},u=1,d=0,p=null;return t.eachMapping((function(e){if(null!==p){if(!(u<e.generatedLine)){var t=(n=a[s]||"").substr(0,e.generatedColumn-d);return a[s]=n.substr(e.generatedColumn-d),d=e.generatedColumn,m(p,t),void(p=e)}m(p,c()),u++,d=0}for(;u<e.generatedLine;)r.add(c()),u++;if(d<e.generatedColumn){var n=a[s]||"";r.add(n.substr(0,e.generatedColumn)),a[s]=n.substr(e.generatedColumn),d=e.generatedColumn}p=e}),this),s<a.length&&(p&&m(p,c()),r.add(a.splice(s).join(""))),t.sources.forEach((function(e){var o=t.sourceContentFor(e);null!=o&&(null!=n&&(e=i.join(n,e)),r.setSourceContent(e,o))})),r;function m(e,t){if(null===e||void 0===e.source)r.add(t);else{var o=n?i.join(n,e.source):e.source;r.add(new l(e.originalLine,e.originalColumn,o,t,e.name))}}},l.prototype.add=function(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[a]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},l.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[a]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},l.prototype.walk=function(e){for(var t,n=0,r=this.children.length;n<r;n++)(t=this.children[n])[a]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},l.prototype.join=function(e){var t,n,r=this.children.length;if(r>0){for(t=[],n=0;n<r-1;n++)t.push(this.children[n]),t.push(e);t.push(this.children[n]),this.children=t}return this},l.prototype.replaceRight=function(e,t){var n=this.children[this.children.length-1];return n[a]?n.replaceRight(e,t):"string"==typeof n?this.children[this.children.length-1]=n.replace(e,t):this.children.push("".replace(e,t)),this},l.prototype.setSourceContent=function(e,t){this.sourceContents[i.toSetString(e)]=t},l.prototype.walkSourceContents=function(e){for(var t=0,n=this.children.length;t<n;t++)this.children[t][a]&&this.children[t].walkSourceContents(e);var r=Object.keys(this.sourceContents);for(t=0,n=r.length;t<n;t++)e(i.fromSetString(r[t]),this.sourceContents[r[t]])},l.prototype.toString=function(){var e="";return this.walk((function(t){e+=t})),e},l.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},n=new r(e),i=!1,o=null,a=null,l=null,s=null;return this.walk((function(e,r){t.code+=e,null!==r.source&&null!==r.line&&null!==r.column?(o===r.source&&a===r.line&&l===r.column&&s===r.name||n.addMapping({source:r.source,original:{line:r.line,column:r.column},generated:{line:t.line,column:t.column},name:r.name}),o=r.source,a=r.line,l=r.column,s=r.name,i=!0):i&&(n.addMapping({generated:{line:t.line,column:t.column}}),o=null,i=!1);for(var c=0,u=e.length;c<u;c++)10===e.charCodeAt(c)?(t.line++,t.column=0,c+1===u?(o=null,i=!1):i&&n.addMapping({source:r.source,original:{line:r.line,column:r.column},generated:{line:t.line,column:t.column},name:r.name})):t.column++})),this.walkSourceContents((function(e,t){n.setSourceContent(e,t)})),{code:t.code,map:n}}},23114:function(e,t){t.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 n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function i(e){var t=e.match(n);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[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}function a(e){var n=e,r=i(e);if(r){if(!r.path)return e;n=r.path}for(var a,l=t.isAbsolute(n),s=n.split(/\/+/),c=0,u=s.length-1;u>=0;u--)"."===(a=s[u])?s.splice(u,1):".."===a?c++:c>0&&(""===a?(s.splice(u+1,c),c=0):(s.splice(u,2),c--));return""===(n=s.join("/"))&&(n=l?"/":"."),r?(r.path=n,o(r)):n}function l(e,t){""===e&&(e="."),""===t&&(t=".");var n=i(t),l=i(e);if(l&&(e=l.path||"/"),n&&!n.scheme)return l&&(n.scheme=l.scheme),o(n);if(n||t.match(r))return t;if(l&&!l.host&&!l.path)return l.host=t,o(l);var s="/"===t.charAt(0)?t:a(e.replace(/\/+$/,"")+"/"+t);return l?(l.path=s,o(l)):s}t.urlParse=i,t.urlGenerate=o,t.normalize=a,t.join=l,t.isAbsolute=function(e){return"/"===e.charAt(0)||n.test(e)},t.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var n=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return t;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)};var s=!("__proto__"in Object.create(null));function c(e){return e}function u(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(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 d(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}t.toSetString=s?c:function(e){return u(e)?"$"+e:e},t.fromSetString=s?c:function(e){return u(e)?e.slice(1):e},t.compareByOriginalPositions=function(e,t,n){var r=d(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:d(e.name,t.name)},t.compareByGeneratedPositionsDeflated=function(e,t,n){var r=e.generatedLine-t.generatedLine;return 0!==r||0!=(r=e.generatedColumn-t.generatedColumn)||n||0!==(r=d(e.source,t.source))||0!=(r=e.originalLine-t.originalLine)||0!=(r=e.originalColumn-t.originalColumn)?r:d(e.name,t.name)},t.compareByGeneratedPositionsInflated=function(e,t){var n=e.generatedLine-t.generatedLine;return 0!==n||0!=(n=e.generatedColumn-t.generatedColumn)||0!==(n=d(e.source,t.source))||0!=(n=e.originalLine-t.originalLine)||0!=(n=e.originalColumn-t.originalColumn)?n:d(e.name,t.name)},t.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},t.computeSourceURL=function(e,t,n){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),n){var r=i(n);if(!r)throw new Error("sourceMapURL could not be parsed");if(r.path){var s=r.path.lastIndexOf("/");s>=0&&(r.path=r.path.substring(0,s+1))}t=l(o(r),t)}return a(t)}},20065:function(e,t,n){t.SourceMapGenerator=n(67819).SourceMapGenerator,t.SourceMapConsumer=n(22799).SourceMapConsumer,n(25421)},3040:function(e,t,n){"use strict";var r=n(74870),i=n(54783);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=y,t.resolve=function(e,t){return y(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?y(e,!1,!0).resolveObject(t):t},t.format=function(e){return i.isString(e)&&(e=y(e)),e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var a=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(c),d=["%","/","?",";","#"].concat(u),p=["/","?","#"],m=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,h={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=n(54415);function y(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),l=-1!==o&&o<e.indexOf("#")?"?":"#",c=e.split(l);c[0]=c[0].replace(/\\/g,"/");var y=e=c.join(l);if(y=y.trim(),!n&&1===e.split("#").length){var x=s.exec(y);if(x)return this.path=y,this.href=y,this.pathname=x[1],x[2]?(this.search=x[2],this.query=t?b.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var w=a.exec(y);if(w){var C=(w=w[0]).toLowerCase();this.protocol=C,y=y.substr(w.length)}if(n||w||y.match(/^\/\/[^@\/]+@[^@\/]+/)){var _="//"===y.substr(0,2);!_||w&&g[w]||(y=y.substr(2),this.slashes=!0)}if(!g[w]&&(_||w&&!v[w])){for(var S,k,I=-1,E=0;E<p.length;E++)-1!==(T=y.indexOf(p[E]))&&(-1===I||T<I)&&(I=T);for(-1!==(k=-1===I?y.lastIndexOf("@"):y.lastIndexOf("@",I))&&(S=y.slice(0,k),y=y.slice(k+1),this.auth=decodeURIComponent(S)),I=-1,E=0;E<d.length;E++){var T;-1!==(T=y.indexOf(d[E]))&&(-1===I||T<I)&&(I=T)}-1===I&&(I=y.length),this.host=y.slice(0,I),y=y.slice(I),this.parseHost(),this.hostname=this.hostname||"";var A="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!A)for(var D=this.hostname.split(/\./),L=(E=0,D.length);E<L;E++){var P=D[E];if(P&&!P.match(m)){for(var F="",N=0,j=P.length;N<j;N++)P.charCodeAt(N)>127?F+="x":F+=P[N];if(!F.match(m)){var R=D.slice(0,E),O=D.slice(E+1),M=P.match(f);M&&(R.push(M[1]),O.unshift(M[2])),O.length&&(y="/"+O.join(".")+y),this.hostname=R.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),A||(this.hostname=r.toASCII(this.hostname));var B=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+B,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==y[0]&&(y="/"+y))}if(!h[C])for(E=0,L=u.length;E<L;E++){var z=u[E];if(-1!==y.indexOf(z)){var H=encodeURIComponent(z);H===z&&(H=escape(z)),y=y.split(z).join(H)}}var Z=y.indexOf("#");-1!==Z&&(this.hash=y.substr(Z),y=y.slice(0,Z));var U=y.indexOf("?");if(-1!==U?(this.search=y.substr(U),this.query=y.substr(U+1),t&&(this.query=b.parse(this.query)),y=y.slice(0,U)):t&&(this.search="",this.query={}),y&&(this.pathname=y),v[C]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){B=this.pathname||"";var V=this.search||"";this.path=B+V}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,a="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(a=b.stringify(this.query));var l=this.search||a&&"?"+a||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||v[t])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),l&&"?"!==l.charAt(0)&&(l="?"+l),t+o+(n=n.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(l=l.replace("#","%23"))+r},o.prototype.resolve=function(e){return this.resolveObject(y(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(i.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var n=new o,r=Object.keys(this),a=0;a<r.length;a++){var l=r[a];n[l]=this[l]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),c=0;c<s.length;c++){var u=s[c];"protocol"!==u&&(n[u]=e[u])}return v[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!v[e.protocol]){for(var d=Object.keys(e),p=0;p<d.length;p++){var m=d[p];n[m]=e[m]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||g[e.protocol])n.pathname=e.pathname;else{for(var f=(e.pathname||"").split("/");f.length&&!(e.host=f.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==f[0]&&f.unshift(""),f.length<2&&f.unshift(""),n.pathname=f.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var h=n.pathname||"",b=n.search||"";n.path=h+b}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var y=n.pathname&&"/"===n.pathname.charAt(0),x=e.host||e.pathname&&"/"===e.pathname.charAt(0),w=x||y||n.host&&e.pathname,C=w,_=n.pathname&&n.pathname.split("/")||[],S=(f=e.pathname&&e.pathname.split("/")||[],n.protocol&&!v[n.protocol]);if(S&&(n.hostname="",n.port=null,n.host&&(""===_[0]?_[0]=n.host:_.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===f[0]?f[0]=e.host:f.unshift(e.host)),e.host=null),w=w&&(""===f[0]||""===_[0])),x)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,_=f;else if(f.length)_||(_=[]),_.pop(),_=_.concat(f),n.search=e.search,n.query=e.query;else if(!i.isNullOrUndefined(e.search))return S&&(n.hostname=n.host=_.shift(),(A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=A.shift(),n.host=n.hostname=A.shift())),n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!_.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var k=_.slice(-1)[0],I=(n.host||e.host||_.length>1)&&("."===k||".."===k)||""===k,E=0,T=_.length;T>=0;T--)"."===(k=_[T])?_.splice(T,1):".."===k?(_.splice(T,1),E++):E&&(_.splice(T,1),E--);if(!w&&!C)for(;E--;E)_.unshift("..");!w||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),I&&"/"!==_.join("/").substr(-1)&&_.push("");var A,D=""===_[0]||_[0]&&"/"===_[0].charAt(0);return S&&(n.hostname=n.host=D?"":_.length?_.shift():"",(A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=A.shift(),n.host=n.hostname=A.shift())),(w=w||n.host&&_.length)&&!D&&_.unshift(""),_.length?n.pathname=_.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=l.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},54783:function(e){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},65311:function(e){"use strict";e.exports=jQuery},37019:function(){},96344:function(){},439:function(){}},function(e){e.O(0,[351],(function(){return 41228,e(e.s=41228)})),e.O()}]);