useblocks 1.1.85-dev.10 → 1.1.85-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -40
- package/compat-globals.js +1 -1
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/js/discussHandlers.sDXLf5I7.js +88 -0
- package/iframe/js/{iframe-eblock.body.js → iframe-eblock.body.714faf8a.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.js → iframe.body.714faf8a.js} +35 -35
- package/iframe/js/iframe.js +2 -2
- package/package.json +4 -1
- package/runtime/THIRD_PARTY_LICENSES.txt +49 -42
- package/runtime/package.json +4 -1
- package/runtime/react/index.js +1 -1
- package/runtime/uuid/index.js +21 -0
- package/static/core/11bc33e0.js +1 -0
- package/static/core/1ed86ed3.js +1 -0
- package/static/core/248de796.js +1 -0
- package/static/core/{e50b6f57.js → 274b5d7a.js} +1 -1
- package/static/core/4067c5be.js +1 -0
- package/static/core/453596ac.js +27 -0
- package/static/core/4b12ae50.js +1 -0
- package/static/core/{db82c42b.js → 50d547f6.js} +1 -1
- package/static/core/549c0ef1.js +1 -0
- package/static/core/{b29146b3.js → 563a690f.js} +5 -5
- package/static/core/{c1bf6439.js → 5c62f38b.js} +1 -1
- package/static/core/5f949f39.js +1 -0
- package/static/core/{e0d71533.js → 60aa31a3.js} +6 -6
- package/static/core/{79749848.js → 66619f08.js} +7 -7
- package/static/core/7052d050.js +28 -0
- package/static/core/{984e936f.js → 7555e955.js} +1 -1
- package/static/core/{55a38638.js → 7c89682e.js} +7 -7
- package/static/core/83c17079.js +2 -0
- package/static/core/{4c83d06a.js → 8c5284f6.js} +1 -1
- package/static/core/{e0e5c9b9.js → 958fe93e.js} +2 -2
- package/static/core/{6fcb3c31.js → a3f7b4c9.js} +1 -1
- package/static/core/{9560f31a.js → a494cc9f.js} +1 -1
- package/static/core/{a5996860.js → a6303cb2.js} +1 -1
- package/static/core/b8a0f663.js +1 -0
- package/static/core/bb65f553.js +1 -0
- package/static/core/{4c3f5897.js → c2f990cf.js} +2 -2
- package/static/core/{72d350ea.js → c8d6258e.js} +1 -1
- package/static/core/{3ece766f.js → d58ae4ac.js} +2 -2
- package/static/core/d61988e0.js +7 -0
- package/static/core/d887672a.js +1 -0
- package/static/core/dcc37768.js +1 -0
- package/static/core/{30841c46.js → e50f64f6.js} +1 -1
- package/static/core/{175b5b0f.js → ff7d14e8.js} +1 -1
- package/static/esm/2490dab8.js +1 -0
- package/static/esm/971f1b2c.js +1 -0
- package/static/esm/ad8c16a9.js +1 -0
- package/static/esm/f76c9d9d.js +1 -0
- package/static/umd/6639d610.js +1 -0
- package/static/umd-runtime/B7h7P1Np.js +1 -0
- package/static/umd-runtime/{DHIkHsbq.js → BAqQTgiL.js} +1 -1
- package/static/umd-runtime/{DiNHpyis.js → BB6AXfHj.js} +1 -1
- package/static/umd-runtime/{CnUGCoaH.js → BauvM4c_.js} +1 -1
- package/static/umd-runtime/{cL_ha9ef.js → CgVJ4rE0.js} +1 -1
- package/static/umd-runtime/Cvm7BS4_.js +341 -0
- package/static/umd-runtime/{BnE05QKl.js → D7DggGzi.js} +1 -1
- package/static/umd-runtime/{2iAslXEF.js → DBbch1O-.js} +1 -1
- package/static/umd-runtime/{Bcqtk2f7.js → Dqoi-pC_.js} +2 -2
- package/static/umd-runtime/{CDTBLHGd.js → G2k8ELiO.js} +3 -3
- package/static/umd-runtime/{CVtPwspX.js → SFp4nbvq.js} +1 -1
- package/static/umd-runtime/{DVB_-O4B.js → UsRzAWs2.js} +1 -1
- package/static/umd-runtime/runtime.js +1 -1
- package/static/umd-runtime/ui-kit-icons.js +1 -1
- package/static/umd-runtime/ui-kit.js +2 -2
- package/static/umd-runtime/{DP3QTW77.js → uk9LyZos.js} +1 -1
- package/useblocks-core.714faf8a.js +859 -0
- package/useblocks-esm.js +11 -11
- package/{useblocks-po.8098d114.js → useblocks-po.714faf8a.js} +1 -1
- package/useblocks.d.ts +109 -25
- package/useblocks.js +39 -15
- package/vendor/@rc-component/cascader/package.json +1 -1
- package/vendor/@rc-component/dialog/es/Dialog/Content/Panel.js +3 -2
- package/vendor/@rc-component/dialog/package.json +1 -1
- package/vendor/@rc-component/image/es/Preview/index.js +3 -3
- package/vendor/@rc-component/image/package.json +1 -1
- package/vendor/@rc-component/input/es/BaseInput.js +3 -3
- package/vendor/@rc-component/input/es/Input.js +20 -27
- package/vendor/@rc-component/{textarea → input}/es/ResizableTextArea.js +5 -4
- package/vendor/@rc-component/{textarea → input}/es/TextArea.js +30 -40
- package/vendor/@rc-component/{textarea → input}/es/calculateNodeHeight.js +4 -4
- package/vendor/@rc-component/input/es/hooks/useCountDisplay.js +25 -0
- package/vendor/@rc-component/input/es/hooks/useCountExceed.js +25 -0
- package/vendor/@rc-component/input/es/hooks/useMergedValue.js +13 -0
- package/vendor/@rc-component/input/es/index.js +3 -1
- package/vendor/@rc-component/input/package.json +1 -1
- package/vendor/@rc-component/mentions/es/DropdownMenu.js +1 -1
- package/vendor/@rc-component/mentions/es/Mentions.js +35 -8
- package/vendor/@rc-component/mentions/package.json +1 -1
- package/vendor/@rc-component/menu/es/Menu.js +1 -0
- package/vendor/@rc-component/menu/es/MenuItem.js +1 -0
- package/vendor/@rc-component/menu/es/MenuItemGroup.js +1 -0
- package/vendor/@rc-component/menu/es/SubMenu/PopupTrigger.js +1 -0
- package/vendor/@rc-component/menu/es/SubMenu/index.js +1 -0
- package/vendor/@rc-component/menu/es/context/MenuContext.js +1 -0
- package/vendor/@rc-component/menu/es/hooks/useAccessibility.js +1 -0
- package/vendor/@rc-component/menu/es/hooks/useKeyRecords.js +1 -0
- package/vendor/@rc-component/menu/es/utils/commonUtil.js +1 -0
- package/vendor/@rc-component/menu/es/utils/nodeUtil.js +2 -1
- package/vendor/@rc-component/menu/es/utils/warnUtil.js +1 -0
- package/vendor/@rc-component/menu/package.json +1 -1
- package/vendor/@rc-component/notification/LICENSE +21 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/LICENSE +22 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Children/toArray.js +15 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/canUseDom.js +6 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/contains.js +13 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/dynamicCSS.js +94 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/findDOMNode.js +14 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/focus.js +99 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/isVisible.js +18 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/shadow.js +12 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/styleChecker.js +2 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/KeyCode.js +499 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Portal.js +28 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/React/isFragment.js +12 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/React/render.js +2 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/getScrollBarSize.js +2 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useControlledState.js +3 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useDelayState.js +4 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useEvent.js +9 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useId.js +23 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useLayoutEffect.js +26 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useMemo.js +12 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useMergedState.js +4 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useState.js +24 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useSyncState.js +20 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/index.js +36 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/is.js +21 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/isEqual.js +35 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/isMobile.js +11 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/mergeProps.js +14 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/omit.js +1 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/pickAttrs.js +50 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/proxyObject.js +1 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/raf.js +36 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/ref.js +38 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/test/domHook.js +36 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/utils/get.js +11 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/utils/set.js +58 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/warning.js +46 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/package.json +6 -0
- package/vendor/@rc-component/notification/es/Notification.js +129 -0
- package/vendor/@rc-component/notification/es/NotificationList/Content.js +33 -0
- package/vendor/@rc-component/notification/es/NotificationList/index.js +174 -0
- package/vendor/@rc-component/notification/es/NotificationProvider.js +4 -3
- package/vendor/@rc-component/notification/es/Notifications.js +28 -31
- package/vendor/@rc-component/notification/es/Progress.js +10 -0
- package/vendor/@rc-component/notification/es/hooks/useClosable.js +30 -0
- package/vendor/@rc-component/notification/es/hooks/useListPosition/index.js +50 -0
- package/vendor/@rc-component/notification/es/hooks/useListPosition/useSizes.js +33 -0
- package/vendor/@rc-component/notification/es/hooks/useNoticeTimer.js +58 -0
- package/vendor/@rc-component/notification/es/hooks/useNotification.js +27 -18
- package/vendor/@rc-component/notification/es/hooks/useStack.js +4 -4
- package/vendor/@rc-component/notification/es/index.js +4 -2
- package/vendor/@rc-component/notification/package.json +1 -1
- package/vendor/@rc-component/picker/es/PickerInput/Selector/SingleSelector/MultipleDates.js +13 -3
- package/vendor/@rc-component/picker/es/PickerInput/Selector/SingleSelector/index.js +3 -1
- package/vendor/@rc-component/picker/es/PickerInput/SinglePicker.js +2 -1
- package/vendor/@rc-component/picker/package.json +1 -1
- package/vendor/@rc-component/table/LICENSE +21 -0
- package/vendor/@rc-component/table/es/Body/MeasureCell.js +1 -0
- package/vendor/@rc-component/table/es/Body/MeasureRow.js +1 -0
- package/vendor/@rc-component/table/es/Cell/useCellRender.js +1 -0
- package/vendor/@rc-component/table/es/FixedHolder/index.js +1 -0
- package/vendor/@rc-component/table/es/Table.js +17 -9
- package/vendor/@rc-component/table/es/VirtualTable/BodyGrid.js +10 -4
- package/vendor/@rc-component/table/es/VirtualTable/BodyLine.js +13 -5
- package/vendor/@rc-component/table/es/hooks/useColumns/index.js +1 -0
- package/vendor/@rc-component/table/es/hooks/useExpand.js +1 -0
- package/vendor/@rc-component/table/es/hooks/useFixedInfo.js +1 -0
- package/vendor/@rc-component/table/es/hooks/useSticky.js +1 -0
- package/vendor/@rc-component/table/es/index.js +2 -1
- package/vendor/@rc-component/table/es/stickyScrollBar.js +1 -0
- package/vendor/@rc-component/table/es/utils/legacyUtil.js +1 -0
- package/vendor/@rc-component/table/es/utils/offsetUtil.js +1 -0
- package/vendor/@rc-component/table/package.json +1 -1
- package/vendor/@rc-component/tabs/es/TabNavList/OperationNode.js +4 -2
- package/vendor/@rc-component/tabs/es/TabNavList/TabNode.js +5 -4
- package/vendor/@rc-component/tabs/es/TabNavList/index.js +11 -4
- package/vendor/@rc-component/tabs/es/Tabs.js +1 -0
- package/vendor/@rc-component/tabs/es/hooks/useAnimateConfig.js +1 -0
- package/vendor/@rc-component/tabs/es/hooks/useIndicator.js +1 -0
- package/vendor/@rc-component/tabs/es/hooks/useUpdate.js +1 -0
- package/vendor/@rc-component/tabs/package.json +1 -1
- package/vendor/@rc-component/tour/es/TourStep/DefaultPanel.js +4 -1
- package/vendor/@rc-component/tour/package.json +1 -1
- package/vendor/@rc-component/tree/es/MotionTreeNode.js +1 -0
- package/vendor/@rc-component/tree/es/NodeList.js +2 -2
- package/vendor/@rc-component/tree/es/Tree.js +4 -5
- package/vendor/@rc-component/tree/es/TreeNode.js +7 -2
- package/vendor/@rc-component/tree/es/index.js +3 -0
- package/vendor/@rc-component/tree/es/useUnmount.js +1 -0
- package/vendor/@rc-component/tree/es/util.js +1 -0
- package/vendor/@rc-component/tree/es/utils/conductUtil.js +1 -0
- package/vendor/@rc-component/tree/es/utils/treeUtil.js +1 -0
- package/vendor/@rc-component/tree/package.json +1 -1
- package/vendor/@rc-component/tree-select/package.json +1 -1
- package/vendor/@rc-component/util/es/index.js +10 -10
- package/vendor/antd/es/_util/ActionButton.js +2 -3
- package/vendor/antd/es/_util/ContextIsolator.js +1 -1
- package/vendor/antd/es/_util/PurePanel.js +7 -4
- package/vendor/antd/es/_util/convertToTooltipProps.js +2 -2
- package/vendor/antd/es/_util/fallbackProp.js +15 -0
- package/vendor/antd/es/_util/gapSize.js +2 -1
- package/vendor/antd/es/_util/getRenderPropValue.js +2 -1
- package/vendor/antd/es/_util/getScroll.js +4 -4
- package/vendor/antd/es/_util/hooks/index.js +2 -2
- package/vendor/antd/es/_util/hooks/useAllowClear.js +25 -0
- package/vendor/antd/es/_util/hooks/useClosable.js +6 -5
- package/vendor/antd/es/_util/hooks/{useMergeSemantic.js → useMergeSemantic/index.js} +14 -24
- package/vendor/antd/es/_util/hooks/useMergeSemantic/utils.js +14 -0
- package/vendor/antd/es/_util/hooks/useMergedMask.js +2 -1
- package/vendor/antd/es/_util/is.js +27 -0
- package/vendor/antd/es/_util/motion.js +8 -8
- package/vendor/antd/es/_util/normalizeIcon.js +9 -0
- package/vendor/antd/es/_util/placements.js +2 -1
- package/vendor/antd/es/_util/reactNode.js +2 -1
- package/vendor/antd/es/_util/responsiveObserver.js +3 -2
- package/vendor/antd/es/_util/scrollTo.js +3 -1
- package/vendor/antd/es/_util/styleChecker.js +1 -0
- package/vendor/antd/es/_util/throttleByAnimationFrame.js +1 -0
- package/vendor/antd/es/_util/toList.js +1 -1
- package/vendor/antd/es/_util/wave/WaveEffect.js +3 -1
- package/vendor/antd/es/_util/wave/index.js +14 -4
- package/vendor/antd/es/_util/wave/util.js +5 -3
- package/vendor/antd/es/alert/Alert.js +12 -10
- package/vendor/antd/es/alert/ErrorBoundary.js +1 -1
- package/vendor/antd/es/alert/style/index.js +16 -10
- package/vendor/antd/es/anchor/Anchor.js +23 -16
- package/vendor/antd/es/anchor/AnchorLink.js +4 -4
- package/vendor/antd/es/app/App.js +7 -3
- package/vendor/antd/es/auto-complete/AutoComplete.js +7 -8
- package/vendor/antd/es/avatar/Avatar.js +5 -3
- package/vendor/antd/es/back-top/index.js +1 -0
- package/vendor/antd/es/badge/Badge.js +5 -6
- package/vendor/antd/es/badge/Ribbon.js +1 -2
- package/vendor/antd/es/badge/style/index.js +4 -3
- package/vendor/antd/es/border-beam/BorderBeam.js +42 -0
- package/vendor/antd/es/border-beam/BorderBeamEffect.js +24 -0
- package/vendor/antd/es/border-beam/hooks/useBorderSize.js +37 -0
- package/vendor/antd/es/border-beam/hooks/useChildDom.js +24 -0
- package/vendor/antd/es/border-beam/index.js +7 -0
- package/vendor/antd/es/border-beam/style/index.js +60 -0
- package/vendor/antd/es/border-beam/util.js +26 -0
- package/vendor/antd/es/breadcrumb/Breadcrumb.js +1 -2
- package/vendor/antd/es/breadcrumb/BreadcrumbItem.js +1 -1
- package/vendor/antd/es/breadcrumb/useItemRender.js +3 -2
- package/vendor/antd/es/button/Button.js +7 -6
- package/vendor/antd/es/button/buttonHelpers.js +4 -8
- package/vendor/antd/es/button/index.js +2 -2
- package/vendor/antd/es/button/style/index.js +5 -0
- package/vendor/antd/es/calendar/generateCalendar.js +20 -8
- package/vendor/antd/es/card/Card.js +5 -7
- package/vendor/antd/es/card/CardMeta.js +1 -2
- package/vendor/antd/es/carousel/index.js +2 -1
- package/vendor/antd/es/cascader/Panel.js +1 -1
- package/vendor/antd/es/cascader/index.js +23 -16
- package/vendor/antd/es/cascader/style/columns.js +6 -2
- package/vendor/antd/es/checkbox/Checkbox.js +2 -3
- package/vendor/antd/es/checkbox/Group.js +2 -1
- package/vendor/antd/es/checkbox/style/index.js +1 -5
- package/vendor/antd/es/checkbox/useBubbleLock.js +1 -0
- package/vendor/antd/es/collapse/Collapse.js +3 -3
- package/vendor/antd/es/collapse/style/index.js +1 -4
- package/vendor/antd/es/color-picker/ColorPicker.js +1 -2
- package/vendor/antd/es/color-picker/ColorPickerPanel.js +2 -1
- package/vendor/antd/es/color-picker/components/ColorTrigger.js +3 -1
- package/vendor/antd/es/color-picker/components/PanelPicker/index.js +1 -0
- package/vendor/antd/es/config-provider/hooks/useSize.js +3 -2
- package/vendor/antd/es/config-provider/hooks/useTheme.js +2 -0
- package/vendor/antd/es/config-provider/index.js +11 -3
- package/vendor/antd/es/date-picker/generatePicker/generateRangePicker.js +20 -10
- package/vendor/antd/es/date-picker/generatePicker/generateSinglePicker.js +17 -8
- package/vendor/antd/es/date-picker/generatePicker/useSuffixIcon.js +1 -1
- package/vendor/antd/es/date-picker/hooks/useMergedPickerSemantic.js +1 -2
- package/vendor/antd/es/date-picker/style/index.js +13 -3
- package/vendor/antd/es/date-picker/style/multiple.js +3 -4
- package/vendor/antd/es/date-picker/style/panel.js +5 -20
- package/vendor/antd/es/date-picker/util.js +14 -13
- package/vendor/antd/es/descriptions/Cell.js +2 -3
- package/vendor/antd/es/descriptions/hooks/useItems.js +2 -1
- package/vendor/antd/es/descriptions/index.js +3 -3
- package/vendor/antd/es/divider/index.js +3 -2
- package/vendor/antd/es/drawer/Drawer.js +10 -5
- package/vendor/antd/es/drawer/DrawerPanel.js +3 -2
- package/vendor/antd/es/dropdown/dropdown.js +11 -8
- package/vendor/antd/es/dropdown/style/index.js +2 -6
- package/vendor/antd/es/empty/index.js +1 -2
- package/vendor/antd/es/flex/index.js +2 -2
- package/vendor/antd/es/float-button/BackTop.js +1 -0
- package/vendor/antd/es/float-button/FloatButton.js +3 -3
- package/vendor/antd/es/float-button/FloatButtonGroup.js +2 -2
- package/vendor/antd/es/form/ErrorList.js +13 -6
- package/vendor/antd/es/form/Form.js +7 -6
- package/vendor/antd/es/form/FormItem/ItemHolder.js +1 -1
- package/vendor/antd/es/form/FormItem/index.js +6 -6
- package/vendor/antd/es/form/FormItemInput.js +5 -3
- package/vendor/antd/es/form/FormItemLabel.js +2 -1
- package/vendor/antd/es/form/FormList.js +1 -0
- package/vendor/antd/es/form/hooks/useChildren.js +4 -3
- package/vendor/antd/es/form/hooks/useForm.js +3 -1
- package/vendor/antd/es/form/hooks/useFrameState.js +1 -0
- package/vendor/antd/es/form/hooks/useItemRef.js +7 -5
- package/vendor/antd/es/form/style/index.js +1 -3
- package/vendor/antd/es/grid/col.js +5 -7
- package/vendor/antd/es/grid/hooks/useBreakpoint.js +1 -0
- package/vendor/antd/es/grid/hooks/useGutter.js +2 -1
- package/vendor/antd/es/grid/row.js +7 -6
- package/vendor/antd/es/image/PreviewGroup.js +1 -2
- package/vendor/antd/es/image/Progress.js +58 -0
- package/vendor/antd/es/image/hooks/useMergedPreviewConfig.js +3 -1
- package/vendor/antd/es/image/hooks/usePlaceholderConfig.js +15 -0
- package/vendor/antd/es/image/hooks/usePreviewConfig.js +3 -2
- package/vendor/antd/es/image/index.js +36 -5
- package/vendor/antd/es/image/style/index.js +114 -4
- package/vendor/antd/es/image/style/progressAnimation.js +26 -0
- package/vendor/antd/es/index.js +2 -1
- package/vendor/antd/es/input/Input.js +9 -4
- package/vendor/antd/es/input/OTP/OTPInput.js +1 -0
- package/vendor/antd/es/input/OTP/index.js +3 -3
- package/vendor/antd/es/input/Password.js +45 -26
- package/vendor/antd/es/input/Search.js +6 -5
- package/vendor/antd/es/input/TextArea.js +13 -7
- package/vendor/antd/es/input/style/index.js +17 -11
- package/vendor/antd/es/input/style/otp.js +2 -1
- package/vendor/antd/es/input/style/variants.js +16 -10
- package/vendor/antd/es/input-number/index.js +3 -3
- package/vendor/antd/es/input-number/style/index.js +9 -9
- package/vendor/antd/es/layout/Sider.js +3 -2
- package/vendor/antd/es/list/index.js +5 -3
- package/vendor/antd/es/locale/en_US.js +3 -1
- package/vendor/antd/es/locale/ru_RU.js +3 -1
- package/vendor/antd/es/locale/useLocale.js +2 -1
- package/vendor/antd/es/masonry/Masonry.js +4 -3
- package/vendor/antd/es/mentions/index.js +28 -14
- package/vendor/antd/es/menu/MenuItem.js +2 -1
- package/vendor/antd/es/menu/OverrideContext.js +1 -0
- package/vendor/antd/es/menu/SubMenu.js +1 -1
- package/vendor/antd/es/menu/menu.js +5 -5
- package/vendor/antd/es/menu/style/index.js +21 -36
- package/vendor/antd/es/menu/style/vertical.js +2 -1
- package/vendor/antd/es/message/PureList.js +49 -0
- package/vendor/antd/es/message/PurePanel.js +28 -36
- package/vendor/antd/es/message/index.js +6 -3
- package/vendor/antd/es/message/style/index.js +102 -99
- package/vendor/antd/es/message/useMessage.js +29 -33
- package/vendor/antd/es/message/util.js +1 -1
- package/vendor/antd/es/modal/ConfirmDialog.js +11 -9
- package/vendor/antd/es/modal/Modal.js +12 -7
- package/vendor/antd/es/modal/PurePanel.js +1 -2
- package/vendor/antd/es/modal/confirm.js +4 -3
- package/vendor/antd/es/modal/shared.js +3 -2
- package/vendor/antd/es/modal/useModal/HookModal.js +2 -1
- package/vendor/antd/es/notification/PureList.js +46 -0
- package/vendor/antd/es/notification/PurePanel.js +37 -56
- package/vendor/antd/es/notification/hooks/useStackConfig.js +13 -0
- package/vendor/antd/es/notification/index.js +3 -1
- package/vendor/antd/es/notification/style/index.js +103 -170
- package/vendor/antd/es/notification/style/notification.js +191 -0
- package/vendor/antd/es/notification/style/placement.js +117 -60
- package/vendor/antd/es/notification/useNotification.js +37 -40
- package/vendor/antd/es/notification/util.js +9 -50
- package/vendor/antd/es/pagination/Pagination.js +1 -2
- package/vendor/antd/es/pagination/useShowSizeChanger.js +2 -1
- package/vendor/antd/es/popconfirm/PurePanel.js +4 -1
- package/vendor/antd/es/popconfirm/index.js +1 -2
- package/vendor/antd/es/popover/PurePanel.js +1 -2
- package/vendor/antd/es/popover/index.js +1 -2
- package/vendor/antd/es/progress/Circle.js +2 -1
- package/vendor/antd/es/progress/progress.js +3 -3
- package/vendor/antd/es/progress/utils.js +4 -3
- package/vendor/antd/es/qr-code/index.js +4 -4
- package/vendor/antd/es/radio/group.js +4 -3
- package/vendor/antd/es/radio/radio.js +2 -2
- package/vendor/antd/es/radio/style/index.js +1 -1
- package/vendor/antd/es/rate/index.js +2 -4
- package/vendor/antd/es/result/index.js +6 -5
- package/vendor/antd/es/result/style/index.js +10 -6
- package/vendor/antd/es/segmented/index.js +5 -3
- package/vendor/antd/es/select/index.js +23 -12
- package/vendor/antd/es/select/style/dropdown.js +1 -1
- package/vendor/antd/es/select/style/select-input.js +23 -15
- package/vendor/antd/es/select/useIcons.js +43 -26
- package/vendor/antd/es/skeleton/Element.js +2 -1
- package/vendor/antd/es/skeleton/Skeleton.js +3 -3
- package/vendor/antd/es/slider/SliderTooltip.js +1 -0
- package/vendor/antd/es/slider/index.js +5 -3
- package/vendor/antd/es/slider/useRafLock.js +1 -0
- package/vendor/antd/es/space/Compact.js +1 -1
- package/vendor/antd/es/space/Item.js +1 -1
- package/vendor/antd/es/space/index.js +2 -2
- package/vendor/antd/es/space/style/addon.js +5 -2
- package/vendor/antd/es/spin/Indicator/Progress.js +2 -1
- package/vendor/antd/es/spin/index.js +1 -2
- package/vendor/antd/es/splitter/Panel.js +7 -3
- package/vendor/antd/es/splitter/SplitBar.js +5 -4
- package/vendor/antd/es/splitter/Splitter.js +9 -6
- package/vendor/antd/es/splitter/hooks/useItems.js +2 -1
- package/vendor/antd/es/splitter/hooks/useSizes.js +1 -1
- package/vendor/antd/es/splitter/style/index.js +8 -6
- package/vendor/antd/es/statistic/Number.js +8 -4
- package/vendor/antd/es/statistic/Statistic.js +14 -10
- package/vendor/antd/es/steps/index.js +4 -4
- package/vendor/antd/es/style/compact-item-vertical.js +2 -1
- package/vendor/antd/es/style/compact-item.js +6 -6
- package/vendor/antd/es/switch/index.js +1 -2
- package/vendor/antd/es/table/InternalTable.js +23 -14
- package/vendor/antd/es/table/hooks/useFilledColumns.js +23 -0
- package/vendor/antd/es/table/hooks/useFilter/FilterDropdown.js +22 -16
- package/vendor/antd/es/table/hooks/useFilter/FilterWrapper.js +1 -0
- package/vendor/antd/es/table/hooks/useFilter/index.js +34 -18
- package/vendor/antd/es/table/hooks/useLazyKVMap.js +2 -1
- package/vendor/antd/es/table/hooks/usePagination.js +7 -4
- package/vendor/antd/es/table/hooks/useSelection.js +32 -21
- package/vendor/antd/es/table/hooks/useSorter.js +10 -5
- package/vendor/antd/es/table/style/bordered.js +5 -27
- package/vendor/antd/es/table/style/empty.js +1 -4
- package/vendor/antd/es/table/style/index.js +1 -4
- package/vendor/antd/es/table/util.js +6 -6
- package/vendor/antd/es/tabs/hooks/useAnimateConfig.js +2 -1
- package/vendor/antd/es/tabs/index.js +1 -2
- package/vendor/antd/es/tag/CheckableTagGroup.js +8 -5
- package/vendor/antd/es/tag/hooks/useColor.js +4 -3
- package/vendor/antd/es/tag/index.js +13 -7
- package/vendor/antd/es/theme/themes/dark/colors.js +2 -1
- package/vendor/antd/es/theme/themes/default/colors.js +2 -1
- package/vendor/antd/es/theme/useToken.js +2 -2
- package/vendor/antd/es/theme/util/alias.js +34 -29
- package/vendor/antd/es/timeline/Timeline.js +3 -4
- package/vendor/antd/es/tooltip/PurePanel.js +1 -2
- package/vendor/antd/es/tooltip/UniqueProvider/index.js +2 -1
- package/vendor/antd/es/tooltip/index.js +9 -7
- package/vendor/antd/es/tour/PurePanel.js +2 -2
- package/vendor/antd/es/tour/index.js +1 -1
- package/vendor/antd/es/tour/panelRender.js +4 -2
- package/vendor/antd/es/transfer/ListBody.js +3 -1
- package/vendor/antd/es/transfer/ListItem.js +2 -1
- package/vendor/antd/es/transfer/Section.js +17 -8
- package/vendor/antd/es/transfer/index.js +51 -16
- package/vendor/antd/es/transfer/style/index.js +5 -1
- package/vendor/antd/es/tree/Tree.js +1 -2
- package/vendor/antd/es/tree/style/index.js +5 -1
- package/vendor/antd/es/tree/utils/iconUtil.js +5 -4
- package/vendor/antd/es/tree-select/index.js +3 -3
- package/vendor/antd/es/typography/Base/CopyBtn.js +3 -2
- package/vendor/antd/es/typography/Base/Ellipsis.js +3 -3
- package/vendor/antd/es/typography/Base/index.js +38 -31
- package/vendor/antd/es/typography/Editable.js +10 -4
- package/vendor/antd/es/typography/Link.js +1 -0
- package/vendor/antd/es/typography/Text.js +2 -1
- package/vendor/antd/es/typography/Typography.js +20 -10
- package/vendor/antd/es/typography/hooks/useCopyClick.js +2 -1
- package/vendor/antd/es/typography/hooks/useMergedConfig.js +13 -7
- package/vendor/antd/es/typography/hooks/useTooltipProps.js +2 -1
- package/vendor/antd/es/typography/hooks/useTypographySemantic.js +33 -0
- package/vendor/antd/es/typography/style/index.js +12 -27
- package/vendor/antd/es/typography/style/mixins.js +46 -13
- package/vendor/antd/es/upload/Upload.js +13 -7
- package/vendor/antd/es/upload/UploadList/ListItem.js +6 -5
- package/vendor/antd/es/upload/UploadList/index.js +4 -3
- package/vendor/antd/es/upload/utils.js +18 -1
- package/vendor/antd/es/version/version.js +1 -1
- package/vendor/antd/es/watermark/index.js +6 -4
- package/vendor/antd/es/watermark/useSingletonCache.js +1 -0
- package/vendor/antd/es/watermark/useWatermark.js +3 -3
- package/vendor/antd/package.json +1 -1
- package/vendor/useblocks-ui-kit/es/components/DataEntry/Input/index.js +1 -1
- package/vendor/useblocks-ui-kit/package.json +1 -1
- package/iframe/js/discussHandlers.CCCXIEaO.js +0 -88
- package/static/core/1f101241.js +0 -1
- package/static/core/1fa93ad8.js +0 -28
- package/static/core/2007bc93.js +0 -1
- package/static/core/30ab7b1d.js +0 -1
- package/static/core/440a91be.js +0 -1
- package/static/core/44e96a78.js +0 -1
- package/static/core/823aedee.js +0 -1
- package/static/core/828583e1.js +0 -2
- package/static/core/8cc6e392.js +0 -1
- package/static/core/9aefcefb.js +0 -1
- package/static/core/a4f90443.js +0 -27
- package/static/core/a7ac37cd.js +0 -1
- package/static/core/df41de18.js +0 -7
- package/static/esm/349f9e2c.js +0 -1
- package/static/esm/50fbfdf6.js +0 -1
- package/static/media/icon-sets/lucide.json +0 -6275
- package/static/media/icon-sets/tabler.json +0 -19336
- package/static/umd-runtime/Cl8heeC3.js +0 -1
- package/static/umd-runtime/D0xo8o9c.js +0 -335
- package/useblocks-core.8098d114.js +0 -859
- package/vendor/@rc-component/notification/es/Notice.js +0 -106
- package/vendor/@rc-component/notification/es/NoticeList.js +0 -98
- package/vendor/@rc-component/textarea/LICENSE.md +0 -9
- package/vendor/@rc-component/textarea/es/index.js +0 -6
- package/vendor/@rc-component/textarea/package.json +0 -6
- package/vendor/antd/es/_util/extendsObject.js +0 -12
- package/vendor/antd/es/_util/getAllowClear.js +0 -12
- package/vendor/antd/es/_util/isNonNullable.js +0 -6
- package/vendor/antd/es/_util/isPrimitive.js +0 -4
- package/vendor/antd/es/notification/style/pure-panel.js +0 -18
- package/vendor/antd/es/notification/style/stack.js +0 -85
- /package/iframe/{iframe-eblock.8098d114.html → iframe-eblock.714faf8a.html} +0 -0
- /package/iframe/{iframe.8098d114.html → iframe.714faf8a.html} +0 -0
package/useblocks.js
CHANGED
|
@@ -1014,7 +1014,7 @@ var __amdEnv = window.__useblocks__ || (window.__useblocks__ = {});
|
|
|
1014
1014
|
|
|
1015
1015
|
|
|
1016
1016
|
// Configure AMD loader
|
|
1017
|
-
__amdEnv.require.config({ baseUrl: "./", paths: {"core":"useblocks-core.
|
|
1017
|
+
__amdEnv.require.config({ baseUrl: "./", paths: {"core":"useblocks-core.714faf8a.js","monaco":"static/monaco/index.js","po":"useblocks-po.714faf8a.js"} });
|
|
1018
1018
|
|
|
1019
1019
|
// PublicPath (script detection: entry script lookup → document.currentScript)
|
|
1020
1020
|
if (!__useblocks__.publicPath) {
|
|
@@ -1362,7 +1362,7 @@ if (!ns.assetUrl) {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
|
|
1364
1364
|
if (!ns.version) {
|
|
1365
|
-
ns.version = "1.1.85-dev.
|
|
1365
|
+
ns.version = "1.1.85-dev.11";
|
|
1366
1366
|
}
|
|
1367
1367
|
|
|
1368
1368
|
var modules = ns.modules = Object.create(null);
|
|
@@ -1408,7 +1408,7 @@ if (!ns.version) {
|
|
|
1408
1408
|
return m["UiKit"] !== undefined ? m["UiKit"] : m;
|
|
1409
1409
|
});
|
|
1410
1410
|
Object.defineProperty(modules, "UiKit", {
|
|
1411
|
-
value: barrelPromise, configurable: true, enumerable: true,
|
|
1411
|
+
value: barrelPromise, writable: true, configurable: true, enumerable: true,
|
|
1412
1412
|
});
|
|
1413
1413
|
return barrelPromise;
|
|
1414
1414
|
},
|
|
@@ -1419,7 +1419,7 @@ if (!ns.version) {
|
|
|
1419
1419
|
get: function() {
|
|
1420
1420
|
var iconsPromise = ns.require("static/umd-runtime/ui-kit-icons.js");
|
|
1421
1421
|
Object.defineProperty(modules, "UiKitIcons", {
|
|
1422
|
-
value: iconsPromise, configurable: true, enumerable: true,
|
|
1422
|
+
value: iconsPromise, writable: true, configurable: true, enumerable: true,
|
|
1423
1423
|
});
|
|
1424
1424
|
return iconsPromise;
|
|
1425
1425
|
},
|
|
@@ -1442,10 +1442,28 @@ if (!ns.version) {
|
|
|
1442
1442
|
return merged;
|
|
1443
1443
|
});
|
|
1444
1444
|
|
|
1445
|
+
// Снятые из контракта имена: внятная ошибка вместо "Cannot read properties of undefined".
|
|
1446
|
+
var __removedExports = {"Uuid":"the shared `uuid` package was removed from the editor runtime; bundle `uuid` into the plugin or use `crypto.randomUUID()`"};
|
|
1447
|
+
var __silentProps = ["then","toString","valueOf","constructor","inspect","$$typeof"];
|
|
1448
|
+
for (var __removedName in __removedExports) {
|
|
1449
|
+
if (!Object.prototype.hasOwnProperty.call(__removedExports, __removedName)) { continue; }
|
|
1450
|
+
if (modules[__removedName] !== undefined) { continue; }
|
|
1451
|
+
modules[__removedName] = (function(name, hint) {
|
|
1452
|
+
return new Proxy(Object.create(null), {
|
|
1453
|
+
get: function(_target, prop) {
|
|
1454
|
+
if (typeof prop === "symbol" || __silentProps.indexOf(prop) !== -1) { return undefined; }
|
|
1455
|
+
throw new Error(
|
|
1456
|
+
"[shared-runtime] " + name + "." + String(prop) + " is not available: " + hint + "."
|
|
1457
|
+
);
|
|
1458
|
+
},
|
|
1459
|
+
});
|
|
1460
|
+
})(__removedName, __removedExports[__removedName]);
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1445
1463
|
var __compatDirect = {};
|
|
1446
1464
|
|
|
1447
1465
|
// Слой совместимости: предупреждаем того, кто пришёл за пакетом, а не всех подряд.
|
|
1448
|
-
var __compatLazy = {"AntDesignIcons":"[runtime] `@ant-design/icons` is served from the host runtime
|
|
1466
|
+
var __compatLazy = {"AntDesignIcons":"[runtime] `@ant-design/icons` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version."};
|
|
1449
1467
|
for (var __compatName in __compatLazy) {
|
|
1450
1468
|
if (!Object.prototype.hasOwnProperty.call(__compatLazy, __compatName)) { continue; }
|
|
1451
1469
|
(function (name, message) {
|
|
@@ -2072,17 +2090,23 @@ if (typeof ns.define === 'function') {
|
|
|
2072
2090
|
})();
|
|
2073
2091
|
|
|
2074
2092
|
|
|
2075
|
-
__useblocks__.define("static/umd/993c2c90.js",["require","exports","module"],function(Dn,u,Nn){var I=class ct{_inner;_isDisposed=!1;constructor(t=[]){this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof ct&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(t){this.addDisposable({dispose:t})}removeDisposable(t){const r=this._inner.indexOf(t);r>=0&&this._inner.splice(r,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const t of[...this._inner])t.dispose()}}};function M(e){return`service_container_${e}`}var y=new Set,H;function ut(){if(!H)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,se.prototype.getInstanceAsync),e.stack}function V(e){y.delete(e)&&H?.end(e)}var se=class oe extends I{_parent;_injectCallbacks=[];_injections=Object.create(null);_runCallbacks(t){this._injectCallbacks.forEach(r=>r(t))}constructor(t=null){super(),this._parent=t,t&&this.addDisposable(t.onInject(r=>this._runCallbacks(r)))}onInject=t=>(this._injectCallbacks.push(t),{dispose:()=>{const r=this._injectCallbacks.indexOf(t);r>=0&&this._injectCallbacks.splice(r,1)}});inject(t,r){this._injections[t]=()=>r,this._runCallbacks(t)}injectFactory(t,r,n){const i=this._injections[t];let o=typeof i=="function"?i():i;const s=this._injections[t]=()=>(o=r(this,o),o);n&&s(),this._runCallbacks(t)}_find(t,r=!0){return this._injections[t]||r&&this._parent?._find(t)}_onInject(t,r,n=new I){return n.addDisposable(this.onInject(i=>{t===i&&(n.dispose(),r(this.getInstance(i)))})),this._parent&&n.addDisposable(this._parent._onInject(t,r,n)),this.addDisposable(n),n}getInstance(t,r=!0){const n=this._find(t,r);if(typeof n=="function")return n()}getOrCreateInstance(t,r){const n=this._find(t);if(typeof n=="function")return n();const i=r(this);return this.inject(t,i),i}getInstanceAsync(t){const r=this._find(t);if(typeof r=="function")return Promise.resolve(r());const n=ut();return new Promise((i,o)=>{const s={id:String(t),startedAt:Date.now(),origin:n,container:this,reject:o};y.add(s),H?.start(s),this._onInject(t,()=>{V(s),i(this.getInstance(t))})})}failPendingWaits(t){for(const r of Array.from(y))r.container===this&&(V(r),r.reject(t))}pendingWaits(){return[...y].filter(t=>t.container===this)}addService(t,r){const n=M(t);this.injectFactory(n,(o,s=[])=>s.indexOf(r)<0?[...s,r]:s);const i=new I;return i.addDispose(()=>{this.injectFactory(n,(o,s=[])=>s.filter(a=>a!==r))}),i}addServiceFactory(t,r,n){const i=M(t);let o;this.injectFactory(i,(a,c=[])=>(o=r(a,o),o===void 0?c:c.indexOf(o)<0?[...c,o]:c),n);const s=new I;return s.addDispose(()=>{this.injectFactory(i,(a,c=[])=>o===void 0?c:c.filter(_=>_!==o))}),s}getServices(t){const r=M(t);return[...this.getInstance(r,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new oe(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const r=this._parent?.getOrCreateIsolatedContainer(t);return new oe(r)})}remove(t){const r=this._injections;delete r[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(y))t.container===this&&V(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function $(e){return e.startsWith("__")?e:`__${e}__`}function _t(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=$(e),r=globalThis;return r[t]??={}}function lt(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function dt(e){if(e)return $(e);const t="useblocks".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return $(t)}function ae(e){const t=dt(e),r=_t(t);if(lt(r.container))return r.container;const n=new se(null);return r.container=n,n}function ft(e){return ae(e)}function Et(){let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){let n=Math.random()*16;return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),(r==="x"?n:n&3|8).toString(16)})}function ce(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Et()}function f(e=ce()){return e}function ue(){return"umd".trim()||"unknown"}function pt(e){if(typeof globalThis>"u")return;const t=ue(),r=globalThis[e]??{};globalThis[e]=r;const n=r.__diagnostics??={},i=n.diModuleEval??={evalCount:0,records:[]};i.records.push({buildSource:t,timestamp:Date.now(),stack:new Error().stack}),i.evalCount+=1}function ht(){const e="useblocks".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function Ot(e,t){if(pt(t),typeof globalThis>"u")return e;const r=ue(),n=globalThis,i=n[t]=n[t]||{},o=i.__diagnostics=i.__diagnostics||{},s=o.dependencyResolver=o.dependencyResolver||{entries:[]},a={container:e,source:"packages/runtime-core/di/index.ts",buildSource:r,timestamp:Date.now(),stack:new Error().stack};return s.entries.push(a),e}var j;function At(){if(j)return j;const e=ht();return j=Ot(ae(e),e),j}var W=new Proxy({},{get(e,t,r){const n=At(),i=Reflect.get(n,t,r);return typeof i=="function"?i.bind(n):i}});function gt(e,t="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return t}}function S(e){if(e instanceof DOMException&&e.name==="AbortError")return e;const t=e===void 0?"The operation was aborted.":typeof e=="string"?e:e instanceof Error?e.message:String(e);return new DOMException(t,"AbortError")}function It(e){return e instanceof DOMException&&e.name==="AbortError"}function q(e){if(e?.aborted)throw S(e.reason)}function mt(e,t){return t?(t.aborted&&e.catch(()=>{}),q(t),new Promise((r,n)=>{const i=()=>{o(),n(S(t.reason))},o=()=>{t.removeEventListener("abort",i)};t.addEventListener("abort",i),e.then(s=>{o(),r(s)},s=>{o(),n(s)})})):e}var _e=class extends I{_options;_listeners=[];constructor(e={}){super(),this._options=e}getListeners(e){return this._listeners.flatMap(([t])=>typeof t=="function"?t:t.getListeners(e))}hasListeners(){for(const[e]of this._listeners){if(typeof e=="function")return!0;const t=e;if(typeof t.hasListeners=="function"){if(t.hasListeners())return!0;continue}return!0}return!1}_addListener(e,t=0,r){if(this.isDisposed())return{dispose:()=>{}};const n=this._listeners,i=this._options;r&&typeof e=="function"&&(e=e.bind(r));const o=n.findIndex(([,a])=>a<t),s=[e,t];return n.splice(o>=0?o:n.length,0,s),n.length===1&&i.onFirstListenerAdd&&i.onFirstListenerAdd(),{dispose:()=>{const a=n.indexOf(s);a>=0&&(n.splice(a,1),!n.length&&i.onLastListenerRemove&&i.onLastListenerRemove())}}}on=this._addListener.bind(this);event=this._addListener.bind(this);once=(e,t=0,r)=>{const n=this._addListener((...i)=>(n?.dispose(),r?e.call(r,...i):e(...i)),t);return n};un=e=>{const t=this._listeners.findIndex(([r])=>r===e);t>=0&&(this._listeners.splice(t,1),this._listeners.length===0&&this._options.onLastListenerRemove&&this._options.onLastListenerRemove())};dispose(){this._listeners.splice(0,this._listeners.length),this._options.onLastListenerRemove&&this._options.onLastListenerRemove(),super.dispose()}},b=class extends _e{execute(e,t){for(const r of t)try{r(...e)}catch{}}fire(...e){if(!this.isDisposed()){const t=this.execute(e,this.getListeners(e));return t===void 0?void 0:t}}},Tt=class extends b{execute([e],t){for(const r of t)try{r(e)}catch{}}},St=class extends b{_suspendCounter=0;_wasFired=!1;execute([e],t){if(this._suspendCounter)this._wasFired=!0;else for(const r of t)try{r(e)}catch{}}suspend(){this._suspendCounter++}resume(){--this._suspendCounter===0&&this._wasFired&&(this.fire(),this._wasFired=!1)}},B=class extends b{async execute([e],t){const r=[];for(const n of t)try{r.push(await n(e))}catch{}return r}async fireSettled(e){const t={results:[],errors:[]};if(this.isDisposed())return t;for(const r of this.getListeners([e]))try{t.results.push(await r(e))}catch(n){t.errors.push(n)}return t}};function bt(e,t=0){const r=new _e,n=e(r,t);return n&&r.addDisposable(n),r.event}function Dt(e,t,r=0){const n=new b,i=e((...o)=>{if(t(...o))return n.fire(...o)},r);return i&&n.addDisposable(i),n.event}function Nt(e,t=0,r=0){const n=new b;let i,o;const s=e((...a)=>{o=a,i||(i=setTimeout(()=>{o&&n.fire(...o),i=void 0},t))},r);return s&&n.addDisposable(s),n.event}function Pt(e,t){return e.getOrCreateInstance(t,()=>new B)}function d(e){return f(e)}var K;(function(e){e.BEFORE_SAVE_EMAIL=d("events.BEFORE_SAVE_EMAIL"),e.ON_SAVEBUTTON_CLICK_ID=d("events.ON_SAVEBUTTON_CLICK_ID"),e.ON_NEXTBUTTON_CLICK_ID=d("events.ON_NEXTBUTTON_CLICK_ID"),e.ON_PREVIOUSBUTTON_CLICK_ID=d("events.ON_PREVIOUSBUTTON_CLICK_ID"),e.ON_DOCUMENT_SESSION_CHANGE=d("events.ON_DOCUMENT_SESSION_CHANGE"),e.WILL_EMAIL_INIT_ID=d("events.WILL_EMAIL_INIT_ID"),e.ON_EMAIL_INIT_ID=d("events.ON_EMAIL_INIT_ID"),e.ON_BLOCK_INIT_ID=d("events.ON_BLOCK_INIT_ID"),e.ON_CONTENT_CHANGED_ID=d("events.ON_CONTENT_CHANGED_ID"),e.ON_PREHEADER_CHANGED_ID=d("events.ON_PREHEADER_CHANGED_ID"),e.ON_SUBJECT_CHANGED_ID=d("events.ON_SUBJECT_CHANGED_ID"),e.ON_EMAIL_CHANGED_ID=d("events.ON_EMAIL_CHANGED_ID"),e.ON_HEADER_APPLIED_ID=d("events.ON_HEADER_APPLIED_ID"),e.ON_BLOCK_CHANGED_ID=d("events.ON_BLOCK_CHANGED_ID"),e.ON_CHUNKS_LOADED=d("events.ON_CHUNKS_LOADED"),e.ON_SEND_TESTEMAIL_ID=d("events.ON_SEND_TESTEMAIL_ID"),e.ON_SEND_LIVEPREVIEW_ID=d("events.ON_SEND_LIVEPREVIEW_ID"),e.ON_SHARE_ID=d("events.ON_SHARE_ID"),e.ON_SHOW_PREVIEW_ID=d("events.ON_SHOW_PREVIEW_ID"),e.ON_EMAIL_CLONE_ID=d("events.ON_EMAIL_CLONE_ID"),e.ON_SEND_EMAIL_MODAL_ID=d("events.ON_SEND_EMAIL_MODAL_ID"),e.ON_NOTIFICATION=d("events.ON_NOTIFICATION"),e.READ_LOCALE=d("events.READ_LOCALE"),e.ON_TRANSLATE_ID=d("events.ON_TRANSLATE_ID"),e.ON_CODE_VALIDATE_ID=d("events.ON_CODE_VALIDATE_ID"),e.UPLOAD_EVENT_ID=d("events.UPLOAD_EVENT_ID"),e.PROXY_URL_EVENT_ID=d("events.PROXY_URL_EVENT_ID"),e.FILE_PROXY_EVENT_ID=d("events.FILE_PROXY_EVENT_ID"),e.ON_LIMIT_ID=d("events.ON_LIMIT_ID"),e.ON_BROWSER_EXTENSION_DETECTED_ID=d("events.ON_BROWSER_EXTENSION_DETECTED_ID"),e.ON_LAYOUT_CONVERT_REQUEST_ID=d("events.ON_LAYOUT_CONVERT_REQUEST_ID"),e.ON_BROWSER_TRANSLATE_DETECTED_ID=d("events.ON_BROWSER_TRANSLATE_DETECTED_ID"),e.AI_TEXT_REQUEST_ID=d("events.AI_TEXT_REQUEST_ID"),e.AI_IMAGE_REQUEST_ID=d("events.AI_IMAGE_REQUEST_ID"),e.AI_TEXT_PROGRESS_ID=d("events.AI_TEXT_PROGRESS_ID"),e.AI_IMAGE_PROGRESS_ID=d("events.AI_IMAGE_PROGRESS_ID"),e.AI_TEXT_STREAM_ID=d("events.AI_TEXT_STREAM_ID")})(K||(K={}));function yt(e,t){return e.getOrCreateInstance(t,()=>new B).event}function Ct(e,t){return e.getOrCreateInstance(t,()=>new B)}var Lt=f("plugin.app"),Rt=f("plugin.disposable"),vt=f("InitPipelineContext"),wt=f("plugin.instance"),Mt=f("plugin.lateSurfaceListeners"),le=f("plugin.optionsSource"),jt=f("plugin.store"),de=f("ConfigSource"),Bt=f("plugin.standalone.project"),fe=f("plugin.standalone.bootstrapToken"),Pn=f("plugin.element"),Ee=f("plugin.securityModule"),xt=f("plugin.standalone.activated"),Ft=f("plugin.standalone.fileProxyRegistered"),z=f("plugin.jwt.token"),C=f("plugin.jwt.error"),kt=f("PluginCollection"),Ut=d("APP_LOAD_EVENT"),Gt=d("CONFIG_CHANGED_EVENT"),Xt=(function(e){return e.Json="application/json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain",e})({}),Ht=class{baseUrl="https://api.emailmaker.ru/wp-json";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(r=>this.encodeQueryParam(t,r)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(r=>typeof t[r]<"u").map(r=>Array.isArray(t[r])?this.addArrayQueryParam(t,r):this.addQueryParam(t,r)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>Object.keys(e||{}).reduce((t,r)=>{const n=e[r];return t.append(r,n instanceof Blob?n:typeof n=="object"&&n!==null?JSON.stringify(n):`${n}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const r=this.abortControllers.get(e);return r?r.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};async request({body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:c,proxyHandler:_,...l}){const E=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},h=this.mergeRequestParams(l,E);c&&(i=i?{...i,...c}:c);const p=i&&this.toQueryString(i),g=this.contentFormatters[n||"application/json"],O=o||h.format,G=`${s||this.baseUrl||""}${r}${p?`?${p}`:""}`,Sn=_?_(G,{body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:c,proxyHandler:_,...l}):G,st=new Request(Sn,{...h,headers:{...h.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(a?this.createAbortSignal(a):h.signal)||null,body:typeof e>"u"||e===null?null:g(e)});return this.customFetch(st).then(async at=>{const m=at;m.data=null,m.error=null,m.meta={request:st,response:m};const bn=O?await at[O]().then(X=>(m.ok?m.data=X:m.error={data:X},m)).catch(X=>(m.error=X,m)):m;return a&&this.abortControllers.delete(a),bn})}},Vt=f("prewarm.networkActivity");function $t(){let e=0;const t=new Set,r=()=>{t.forEach(n=>n())};return{begin(){e+=1,r();let n=!1;return()=>{n||(n=!0,e-=1,r())}},inFlight:()=>e,watch(n){return t.add(n),()=>t.delete(n)}}}function Wt(e){return e.getOrCreateInstance(Vt,()=>$t())}var pe=Symbol("rest.publicRequest"),x=f("rest.requestHandler"),qt=f("rest.responseHandler"),J=f("rest.customFetch"),Y=f("rest_transport"),Kt=e=>{e.inject(J,{execute:async(t,r={})=>{const n=e.getServices(x),i={public:r[pe]===!0},o=Wt(e).begin();try{let s=t instanceof Request?t:new Request(t,r);for(const _ of n){const l=await _.execute(s,i);l instanceof Request&&(s=l)}let a=await fetch(s);const c=e.getServices(qt);for(const _ of c)a=await _.execute(a);return a}finally{o()}}})};function zt(e,t){const r=e.getInstance(Y);if(!r)throw new Error("[restApi] транспорт не зарегистрирован в контейнере");return Object.assign({},...t.map(n=>new n(r)))}function Jt(e,t=window){return{peer:e,send(r){e.postMessage(r,"*")},subscribe(r){const n=i=>{r({data:i.data,source:i.source,ports:i.ports})};return t.addEventListener("message",n),{dispose:()=>t.removeEventListener("message",n)}},close(){}}}function Yt(e){let t=!1;return{peer:e,send(r){e.postMessage(r)},subscribe(r){const n=i=>{r({data:i.data,source:e})};return e.addEventListener("message",n),t||(t=!0,e.start()),{dispose:()=>e.removeEventListener("message",n)}},close(){e.close()}}}function Qt(e){return e}function Zt(e){return e&&typeof e=="object"}function he(e,t){return e&&typeof e=="object"&&e.operationId===t}var T="INIT_MESSAGE",Oe="em:port-ready",er="em:window-drained",Q="";function Ae(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var tr=class extends I{_listeners=Object.create(null);addListenerAsync=(e,t,r=0,n)=>{const i=this._listeners[e]||(this._listeners[e]=[]);n&&typeof t=="function"&&(t=t.bind(n));const o=i.findIndex(([a,c])=>r<=c),s=[t,r];return this.isDisposed()||i.splice(o>=0?o:i.length,0,s),{dispose(){const a=i.indexOf(s);a>=0&&i.splice(a,1)}}};fireAsync=(e,t)=>{if(!this.isDisposed()){const r=this._listeners[e]||(this._listeners[e]=[]);let n;for(let i=0;i<r.length;i++){const o=r[i][0],s=n;n=a=>o(a,s)}if(n)return n(t)}};addListener=(e,t,r=0)=>this.addListenerAsync(e,(n,i)=>{try{t(n)}catch{}return i&&i(n)},r)},rr=class extends I{_singleton;_target;_transport;_transportSubscription;_ports=new Map;_drained=new WeakSet;_inited=!1;_emitter=this.addDisposable(new tr);_handshaken=new WeakSet;_greeted=new WeakSet;_outgoingFilter;constructor(e,t){super(),this._singleton=t,this._transport=Jt({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(T,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(T))}),e&&this.setTarget(e)}_onTransportMessage=e=>{const t=e,r=t.data,n=t.source,i=r?.port===!0?t.ports?.[0]:void 0,o=!this._isPortSource(t.source);if(o&&n&&r?.operationId==="em:window-drained"){this._drained.add(n);return}if(!(o&&n&&this._drained.has(n))){if(n&&n!==this._target&&this._greeted.has(n)&&he(r,T)){this._greeted.delete(n),this._handshaken.add(n),this._postMessage(n,{operationId:T,data:{}}),i&&this.usePort(i,!0,n);return}if(Zt(r)&&(t.source===this.target||this._isCurrentPort(t.source))||this._singleton&&he(r,T)){if(i){const _=this._target;Promise.resolve().then(()=>this.usePort(i,!0,_))}const s=this._emitter.fireAsync(r.operationId||Q,r.operationId===void 0?t:r.data),a=r.result,c=r.error;a&&c&&Promise.resolve(s).then(_=>this._sendMessage(a,_),_=>this._sendMessage(c,_))}}};setTarget(e){if(this._target!==e){if(this._target=e,!e){this._inited=!1;return}if(this._handshaken.has(e)){this._inited=!0,this._emitter.fireAsync(T,void 0);return}this._inited=!1,this._postMessage(e,{operationId:T,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:T,data:{},port:!0},[t])}setOutgoingFilter(e){return this._outgoingFilter=e,()=>{this._outgoingFilter===e&&(this._outgoingFilter=void 0)}}sendNow(e){const t=this._target;return!this._inited||!t?!1:(this._postMessage(t,e),!0)}greet(e){this._handshaken.has(e)||this._greeted.has(e)||this._target===e||(this._greeted.add(e),this._postMessage(e,{operationId:T,data:{}}))}forget(e){this._handshaken.delete(e),this._greeted.delete(e),this._closePort(e),this._drained.delete(e),this._target===e&&(this._inited=!1)}usePort(e,t=!1,r=this._target){if(!r||this._ports.has(r))return;const n=Yt(e),i=n.subscribe(this._onTransportMessage);this._ports.set(r,{transport:n,subscription:i}),t&&(n.send({operationId:Oe,data:{}}),this.drainWindow(r))}useWindow(e=this._target){e&&(this._closePort(e),this._drained.delete(e))}get usesPort(){return this._target!==void 0&&this._ports.has(this._target)}hasPort(e){return this._ports.has(e)}_closePort(e){const t=this._ports.get(e);t&&(t.subscription.dispose(),t.transport.close(),this._ports.delete(e))}drainWindow(e){this._ports.has(e)&&e.postMessage({operationId:er,data:{}},"*")}isWindowDrained(e){return this._drained.has(e)}_isPortSource(e){for(const t of this._ports.values())if(t.transport.peer===e)return!0;return!1}_isCurrentPort(e){return this._target!==void 0&&this._ports.get(this._target)?.transport.peer===e}getTarget(){return this._target}get target(){return this._target}_postMessage(e,t,r){let n=t;this._outgoingFilter&&!r?.length&&(n="data"in t?{...t,data:this._outgoingFilter(t.data)}:this._outgoingFilter(t));try{const i=this._ports.get(e);if(i){i.transport.send(n);return}if(r?.length){e.postMessage(n,"*",r);return}e.postMessage(n,"*")}catch(i){if(i?.name==="DataCloneError"){const o=typeof n?.data=="object"&&n?.data!==null?n.data:void 0}throw i}}_sendMessage(e,t,r=!0){if(!r&&!this.isInited())return;const n=this.addDisposable(this.onInit(i=>{const o=e?{operationId:e,data:t}:t;try{this._postMessage(i,{...o})}finally{n.dispose()}}))}send(e,t,r){return typeof e=="string"?this._sendMessage(e,t,r):this._sendMessage(Q,e,t)}sendAsync(e,t,r=!0){if(!r&&!this.isInited())return Promise.resolve();const n=Ae(),i=Ae();return new Promise((o,s)=>{const a=this.addDisposable(new I);a.addDisposable(this.onInit(c=>{try{this._postMessage(c,{operationId:e,data:t,result:n,error:i})}catch(_){a.dispose(),s(_);return}a.addDisposable(this._onMessage(n,_=>{o(_),a.dispose()})),a.addDisposable(this._onMessage(i,_=>{s(_),a.dispose()}))}))})}_onMessage(e,t,r=0){return this._emitter.addListener(e,t,r)}addListener(e,t,r){return t?this._onMessage(e,t,r):this._onMessage(Q,e)}addListenerAsyncPipe(e,t,r=0){return this._emitter.addListenerAsync(e,t,r)}addListenerAsync(e,t,r=0){return this._emitter.addListenerAsync(e,async(n,i)=>{const o=await t(n);return i?i(n):o},r)}isInited(){return this._inited}get inited(){return this._inited}onInit(e,t=!0,r=0){const n=this.addDisposable(new I);return this._inited&&this._target?t&&Promise.resolve().then(()=>{!this._inited||!this._target?n.addDisposable(this.onInit(e,t,r)):e(this._target)}):n.addDisposable(this._onMessage(T,()=>{e(this._target)},r)),n}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}};function L(e){return f(e)}var nr=f("extensions.atomsHandlers"),ir=L("HANDLE_ATOM_INSERT"),or=f("extensions.sandboxExtensions"),sr="SANDBOX_EXTENSION_SCRIPT_STATUS",ar=f("MESSAGE_SERVICE"),cr=L("SETTINGS_PANEL_EVENT"),ur="advanced",_r=L("MODAL_SHOW_EVENT"),lr=L("MODAL_CLOSE_EVENT"),dr=L("MODAL_UPDATE_EVENT"),yn=f("client"),Cn=f("v2_client"),Ln=f("ai_client"),fr=f("app.cookieManager"),Rn=f("app.storageProvider"),vn=f("image-blob-resolver"),Er=f("template-directives"),pr="INJECTION";function hr(e){return e.getState}function Or(e){if(!hr(e)){e.dispose();return}const t=e.getState()[pr];t&&(W.getInstance(t)?.dispose(),W.remove(t))}function ge(e){return Object.assign({},...e)}var Ie=["generic","stockImages","emFiles","cdn"];function Z(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function me(e){return!Z(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>Ie.includes(t))}function Te(e){return e.length===0?[]:e.length===1?e[0]:e}function Se(e){let t=!1,r=[];for(const n of e)if(n!==void 0){if(t=!0,Array.isArray(n)){r=[...n,...r];continue}r=[n,...r]}if(t)return Te(r)}function Ar(e){return Z(e)&&("value"in e||"replace"in e)}function be(e,t){return t===void 0?e:Array.isArray(t)?[...t,...e]:[t,...e]}function gr(e){let t=!1,r=[],n=!1;for(const o of e)if(o!==void 0){if(Ar(o)){t=!0,o.replace&&(r=[],n=!0),o.value!==void 0&&(r=be(r,o.value),n=!0);continue}r=be(r,o),n=!0}const i=n?Te(r):void 0;if(!t)return i;if(i!==void 0)return{value:i}}function Ir(e){const t=e.filter(n=>n!==void 0);if(t.length===0)return;if(!t.some(n=>me(n)))return Se(t);const r={};for(const n of Ie){const i=gr(e.map(o=>{if(o!==void 0)return me(o)?o[n]:n==="generic"?o:void 0}));i!==void 0&&(r[n]=i)}return Object.keys(r).length>0?r:void 0}function mr(e){return Se(e)}function Tr(e){if(e!==void 0){if(Array.isArray(e))return{replace:!1,hosts:e};if(Z(e)&&Array.isArray(e.value))return{replace:!!e.replace,hosts:e.value}}}function Sr(e,t){const r=[...e],n=new Set(r.map(i=>i.toLowerCase()));for(const i of t){const o=i.trim().replace(/:\d+$/,"");if(!o)continue;const s=o.toLowerCase();n.has(s)||(n.add(s),r.push(o))}return r}function br(e){let t=[],r=!1;for(const n of e){const i=Tr(n);i&&(r=!0,i.replace&&(t=[]),t=Sr(t,i.hosts))}return r?t:void 0}function Dr(e){const t=e.filter(i=>i!==void 0);if(t.length===0)return;const r=ge(t.map(({directHosts:i,...o})=>o)),n=br(t.map(i=>i?.directHosts));return n!==void 0&&(r.directHosts=n),r}function ee(e){return e?.backendProxy}function R(e){return e.replace(/\/$/,"")}function De(e){return/^https?:\/\//i.test(e)}function Ne(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Nr(e){const t=new Set;return e.filter(r=>!r.url||t.has(r.url)?!1:(t.add(r.url),!0))}function Pr(e){const t=ee(e);return t?[t]:[]}function yr(e){return{proxyEmFiles:!0,proxyAi:!1}}function Cr(e,t){const r=yr(t),n=t?.backendProxyPolicy;switch(e){case"emFiles":return n?.proxyEmFiles??r.proxyEmFiles;case"ai":return n?.proxyAi??r.proxyAi;default:return!0}}var Lr={url:".+",url_encoded:".+",origin:"https?:\\/\\/[^\\/?#]+",origin_encoded:".+",proxy_url:"https?:\\/\\/[^\\/?#]+",proxy_url_encoded:".+",path:"[^?#]*",pathname:"[^?#]*",path_with_slash:"\\/[^?#]*",pathname_with_slash:"\\/[^?#]*",query:"[^#]*",search:"\\?[^#]*",hash:"#.*",fragment:".*",pathname_after_wp_json:"[^?#]*",pathname_after_wp_json_with_slash:"\\/[^?#]*",rest_namespace:"[^/?#]*",rest_version:"[^/?#]*",rest_route:"[^?#]*",rest_route_with_slash:"\\/[^?#]*"};function Rr(e){const t=[],r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\{([a-z_]+)\\\}/gi,(n,i)=>(t.push(i),`(${Lr[i]||".+"})`));return{regex:new RegExp(`^${r}$`,"i"),tokens:t}}function vr(e){return/[?#]/.test(e)||/\{(?:url|url_encoded|query|search|hash|fragment)\}/i.test(e)}function wr(e,t){if(vr(t))return e;try{const r=new URL(e);return`${r.origin}${r.pathname}`}catch{return e.split(/[?#]/)[0]||e}}function Mr(e,t,r){if(r.endsWith("_encoded"))return!0;const n=e.slice(0,t),i=n.lastIndexOf("#"),o=n.lastIndexOf("?"),s=n.lastIndexOf("&"),a=n.lastIndexOf("=");return a>Math.max(o,s)&&a>i}function jr(e){try{const t=new URL(e),r=t.pathname.replace(/^\/+/,""),n=t.search.replace(/^\?/,""),i=t.hash.replace(/^#/,""),o=r.replace(/^wp-json\/?/i,""),s=o?`/${o}`:"/",a=o.match(/^([^/]+)(?:\/([^/]+))?(?:\/(.*))?$/),c=a?.[1]||"",_=a?.[2]||"",l=a?.[3]||"";return{url:e,url_encoded:encodeURIComponent(e),origin:t.origin,origin_encoded:encodeURIComponent(t.origin),proxy_url:t.origin,proxy_url_encoded:encodeURIComponent(t.origin),path:r,pathname:r,path_with_slash:t.pathname||"/",pathname_with_slash:t.pathname||"/",query:n,search:t.search,hash:t.hash,fragment:i,pathname_after_wp_json:o,pathname_after_wp_json_with_slash:s,rest_namespace:c,rest_version:_,rest_route:l,rest_route_with_slash:l?`/${l}`:"/"}}catch{return}}function te(e,t){if(!e)return{};if(Array.isArray(e)){for(const a of e){const c=te(a,t);if(c!==void 0)return c}return}if(e==="*")return{};const r=wr(t,e),{regex:n,tokens:i}=Rr(e),o=n.exec(r);if(!o)return;const s={};return i.forEach((a,c)=>{s[`matched_${a}`]=o[c+1]||""}),s}function F(e,t,r={}){const n=jr(t);if(!n)return t;const i={...n,...r};let o="",s=0;const a=/\{([a-z_]+)\}/gi;let c;for(;c=a.exec(e);){o+=e.slice(s,c.index);const _=i[c[1]]??"",l=Mr(e,c.index,c[1])?encodeURIComponent(_):_;o+=l,s=c.index+c[0].length}o+=e.slice(s);try{const _=new URL(o),l=new URL(t);return!o.includes("{search}")&&!o.includes("{query}")&&l.search&&l.searchParams.forEach((E,h)=>{_.searchParams.has(h)||_.searchParams.append(h,E)}),!o.includes("{hash}")&&!o.includes("{fragment}")&&l.hash&&!_.hash&&(_.hash=l.hash),_.toString()}catch{return o}}function Pe(e,t){try{const r=new URL(t);return`${R(e)}/${r.pathname.replace(/^\//,"")}${r.search}${r.hash}`}catch{return t}}function ye(e,t){const r=R(e);return t?De(t)?t:t.startsWith("?")||t.startsWith("#")?`${r}${t}`:`${r}${t.startsWith("/")?"":"/"}${t}`:r}function Ce(e,t,r,n){const i=e.match;return i?Array.isArray(i)?i.some(o=>Ce({...e,match:o},t,r,n)):typeof i=="function"?!!i({url:t,method:n,requestType:r}):i==="*"?!0:te(i,t)!==void 0:!0}function Br(e,t,r,n="generic"){if(e==null)return[];const i=Array.isArray(e)?e:[e],o=[];return i.forEach((s,a)=>{if(!s)return;if(typeof s=="string"){const E=s.includes("{")&&s.includes("}")?F(s,t):Pe(s,t);o.push({key:`backend:${a}`,url:E,source:"resource"});return}if(!Ne(s)||!("rewrite"in s))return;const c=s;if(!Ce(c,t,n,r))return;const _=typeof c.match=="string"||Array.isArray(c.match)?te(c.match,t)||{}:{},l=typeof c.proxyBase=="string"&&c.proxyBase.trim()?c.proxyBase.trim():void 0;(Array.isArray(c.rewrite)?c.rewrite:[c.rewrite]).filter(Boolean).forEach((E,h)=>{const p=typeof E=="function"?(()=>{const g=E({url:t,proxyBase:l,method:r,requestType:n,..._}),O=l&&!De(g)?ye(l,g):g;return O.includes("{")&&O.includes("}")?F(O,t,_):O})():l?F(ye(l,E),t,_):E.includes("{")&&E.includes("}")?F(E,t,_):Pe(E,t);o.push({key:`backend:${c.id||"rule"}:${a}:${h}`,url:p,source:"resource"})})}),Nr(o)}function xr(e){try{const t=new URL(e);return/(?:^|\/)wp-json\/em-files\/v\d+(?:\/|$)/i.test(t.pathname)?"emFiles":/(?:^|\/)wp-json\/ai-generator\/v\d+(?:\/|$)/i.test(t.pathname)?"ai":"generic"}catch{return"generic"}}function Fr(e,t=[]){return e==null||(Array.isArray(e)?e:[e]).forEach(r=>{if(r){if(typeof r=="string"){const n=r.split("{")[0]?.trim();n&&t.push(R(n));return}!Ne(r)||!("rewrite"in r)||(typeof r.proxyBase=="string"&&r.proxyBase.trim()&&t.push(R(r.proxyBase.trim())),(Array.isArray(r.rewrite)?r.rewrite:[r.rewrite]).forEach(n=>{if(typeof n!="string")return;const i=n.split("{")[0]?.trim();i&&t.push(R(i))}))}}),t}function kr(e,t){return Pr(t).flatMap(r=>Fr(r)).filter(Boolean).some(r=>r&&e.startsWith(r))}function Ur(e,t){return!!ee(t)&&Cr(e,t)}function Gr(e,t={}){const r=t.requestType||xr(e);return Ur(r,t.config)?Br(ee(t.config),e,t.method,r):[]}function Xr(e,t={}){return kr(e,t.config)?[e]:Gr(e,t).map(r=>r.url)}function D(e){for(;e.endsWith("/");)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}function Le(...e){const t=e.filter(o=>o!=null);if(t.length===0)return;if(t.length===1)return t[0];const r=t.find(o=>o.aborted);if(r)return r;if(typeof AbortSignal<"u"&&typeof AbortSignal.any=="function")return AbortSignal.any(t);const n=new AbortController,i=o=>{n.signal.aborted||n.abort(o.reason)};for(const o of t)o.addEventListener("abort",()=>i(o),{once:!0});return n.signal}var Re=3e5,ve=15e3,A=null,we=!1;function Hr(){return!0}function Vr(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_TTL_MS||"").trim();if(!e)return Re;const t=Number(e);return Number.isFinite(t)&&t>0?t:Re}function $r(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_ATTEMPT_TIMEOUT_MS||"").trim();if(!e)return ve;const t=Number(e);return Number.isFinite(t)&&t>0?t:ve}function Wr(){const e="https://app.useblocks.io/api".trim();return e?D(e):void 0}function qr(e){const t=e.trim();if(!t)return[];if(t.startsWith("["))try{const r=JSON.parse(t);if(!Array.isArray(r))throw new Error("expected JSON array");return r.map(n=>String(n).trim()).filter(Boolean)}catch{return we||(we=!0),[]}return t.split(",").map(r=>r.trim()).filter(Boolean)}function Kr(e){const t=new Set,r=[];for(const n of e){const i=D(n);t.has(i)||(t.add(i),r.push(i))}return r}function Me(e){const t=String(e||"").trim();return t?D(t):Wr()}function je(e,t=[]){return e?Kr([e,...t]).slice(0,3):[]}function Be(){return qr(String({}.REACT_APP_OPENAPI_FAILOVER_BASE_URLS||"").trim())}function zr(e=Date.now()){return A?e-A.switchedAt>=Vr():!0}function xe(e=Date.now()){A&&zr(e)&&(A=null)}function N(e){if(!Hr())return!1;const t=Me(e);if(!t)return!1;const r=Be();return r.length===0?!1:je(t,r).length>1}function v(e){const t=Me(e);if(!t)return[];const r=Be();return r.length===0?[t]:je(t,r)}function k(e){const t=v(e);if(t.length===0)return"";if(xe(),A){const r=t.indexOf(A.activeUrl);if(r>=0)return t[r]}return t[0]}function Fe(e){const t=v(e);if(t.length<=1||(xe(),!A||!t.includes(A.activeUrl)))return t;const r=A.activeUrl;return[r,...t.filter(n=>n!==r)]}function ke(e){return k(e)||void 0}function Ue(e){const t=e||void 0;if(typeof AbortController>"u")return{signal:t,timeoutError:()=>{},done:()=>{}};const r=$r(),n=new AbortController;let i;const o=setTimeout(()=>{i=Jr(r),n.abort(i)},r);return{signal:Le(t,n.signal),timeoutError:()=>i,done:()=>clearTimeout(o)}}function Jr(e){const t=`[apiOriginFailover] origin attempt timed out after ${e}ms`;if(typeof DOMException=="function")return new DOMException(t,"TimeoutError");const r=new Error(t);return r.name="TimeoutError",r}function Ge(e){return e===502||e===503||e===504}function Xe(e){return!(e instanceof Error)&&!(e instanceof DOMException)?!1:e.name==="TimeoutError"?!0:e instanceof TypeError}var He;function Yr(e){He=e}function U(e,t){if(!N(t))return;const r=v(t);if(r.length<=1)return;const n=r.indexOf(D(e));if(n<0)return;const i=n+1;if(i>=r.length)return;const o=r[i],s=A?.activeUrl;A={activeUrl:o,switchedAt:Date.now()},s!==o&&He?.()}function Ve(e,t){if(!N(t))return;const r=D(e),n=v(t);if(n.includes(r)){if(r===n[0]){A=null;return}A?.activeUrl!==r&&(A={activeUrl:r,switchedAt:Date.now()})}}function $e(){A=null}var Qr=e=>{const t=new FormData,r=(n,i,o)=>{if(i!=null){if(i instanceof Blob){n.append(o,i);return}if(Array.isArray(i)){i.forEach((s,a)=>{const c=o?`${o}[${a}]`:`${a}`;r(n,s,c)});return}if(typeof i=="object"){Object.keys(i).forEach(s=>{const a=i[s],c=o?`${o}[${s}]`:s;r(n,a,c)});return}n.append(o,String(i))}};return r(t,e),t},Zr={baseUrl:D("https://app.useblocks.io/api"),baseApiParams:{secure:!0,credentials:"same-origin",format:"json"},securityWorker:()=>({credentials:"same-origin"})},P=new Map;function en(e){const t=e?.getInstance(de);return t?t.get()??t.bootstrap():void 0}var tn=class extends Ht{container;constructor(e={},t){super(e),this.container=t}buildRequestUrl(e){const{path:t,baseUrl:r,extraQuery:n}=e;let{query:i}=e;n&&(i=i?{...i,...n}:n);const o=i&&this.toQueryString(i);return`${r||this.baseUrl||""}${t}${o?`?${o}`:""}`}buildRequestKey(e,t){return`${t.toUpperCase()} ${e}`}getBackendProxyCandidates(e,t){const r=en(this.container),n=this.container?.getInstance(Ee)!==void 0,i=Xr(e,{config:r,method:t,standalone:n}),o=i.length>0?i:[e],s=this.buildRequestKey(e,t),a=P.get(s);return!a||!o.includes(a)?o:[a,...o.filter(c=>c!==a)]}shouldRetryResponse(e){return e.status===502||e.status===503||e.status===504}resolveFailoverBaseUrl(){return String(this.baseUrl||"").trim()||void 0}async requestOnOrigin(e,t,r=!1){const n={...e,baseUrl:t},i=this.buildRequestUrl(n),o=n.method||"GET",s=this.buildRequestKey(i,o),a=this.getBackendProxyCandidates(i,o);let c,_;for(const l of a){const E=p=>p===i?l:p,h=r?Ue(e.signal):void 0;try{const p=await super.request({...n,proxyHandler:E,...h?{signal:h.signal}:{}});if(!p.ok&&this.shouldRetryResponse(p)&&l!==a[a.length-1]){_=p,P.get(s)===l&&P.delete(s);continue}return P.set(s,l),p}catch(p){P.get(s)===l&&P.delete(s);const g=h?.timeoutError();if(g)throw g;if(c=p,(p instanceof DOMException||p instanceof Error)&&p.name==="AbortError")throw p}finally{h?.done()}}if(_)return _;throw c instanceof Error?c:new Error("Backend proxy chain failed")}async request(e){const t=String(e.baseUrl||"").trim();if(t)return this.requestOnOrigin(e,t);const r=this.resolveFailoverBaseUrl(),n=N(r),i=e.failoverAttemptTimeout??n,o=n?Fe(r):r?[k(r)]:[this.baseUrl].filter(Boolean);if(o.length===0)return this.requestOnOrigin(e,this.baseUrl);let s,a;for(let c=0;c<o.length;c++){const _=o[c],l=c===o.length-1;try{const E=await this.requestOnOrigin(e,_,i);if(!E.ok&&Ge(E.status)){if(a=E,!l){U(_,r);continue}break}return E.ok&&Ve(_,r),E}catch(E){if(!Xe(E))throw E;s=E,l||U(_,r)}}if(n&&$e(),a)return a;throw s instanceof Error?s:new Error("API origin failover chain failed")}};function We(e={},t){const r=new tn({...Zr,...e},t);return r.contentFormatters["multipart/form-data"]=Qr,r}var qe=f("rest.clientFactory"),rn=e=>{Kt(e);const t=We({customFetch:e.getInstance(J)?.execute||fetch},e);e.inject(Y,t)},Ke;(function(e){const t="https://racs.rest/v3";function r(i,o){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)};return fetch(`${t}?resource=${i}&dataset=${document.location.hostname}`,s)}e.post=r;async function n(i,o=0){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:`{"filter":{},"limit":${o}}`};return await(await fetch(`${t}/get?resource=${i}&dataset=${document.location.hostname}`,s)).json()}e.getAll=n})(Ke||(Ke={}));function w(e,t){if(e!==t){if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const r=Array.isArray(e),n=Array.isArray(t);if(r){if(!n)return!1;const a=e.length;if(t.length!==a)return!1;for(let c=0;c<a;c++)if(!w(e[c],t[c]))return!1}else if(n)return!1;const i=Object.keys(e),o=Object.keys(t),s=i.length;if(s!==o.length)return!1;for(let a=0;a<s;a++){const c=i[a];if(!t.hasOwnProperty(c)||!w(e[c],t[c]))return!1}}return!0}function nn(e){const t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),r=atob(t),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new TextDecoder().decode(n)}function ze(e){const[t,r,n]=e.split("."),i=JSON.parse(nn(r));return{exp:i.exp,createdAt:i.iat,data:i}}var re=f("plugin.auth.token"),Je=new WeakMap,on=3e4;function sn(e){let t;try{t=ze(e).exp}catch{return!0}return typeof t!="number"||!Number.isFinite(t)?!0:t*1e3<=Date.now()+on}function an(e,t,r,n){const i=Je.get(e);i&&(i.stale=!0);const o={stale:!1};Je.set(e,o),e.injectFactory(re,async(s,a)=>{if(o.stale)return"";try{let c=await a||void 0;if(!c){const _=e.getInstance(fe);_&&(c=await _)}return t?!c||sn(c)?await t(r,n,c):c:""}catch{return""}},!0)}var Ye=f("auth.oauthProvided"),Qe=new WeakMap;function Ze(e,t){const r=Qe.get(e)??{applied:!1};(!r.applied||r.getAuthToken!==t.getAuthToken||!w(r.user,t.user)||r.project!==t.project)&&(Qe.set(e,{applied:!0,getAuthToken:t.getAuthToken,user:t.user,project:t.project}),an(e,t.getAuthToken,t.user,t.project))}function et(e){if(e.getInstance(Ye))return;e.inject(Ye,!0);let t;e.getInstance(le)?.watch(r=>{t=r}),e.addService(x,{execute:async(r,n)=>{if(n?.public||!t?.getAuthToken)return;e.getInstance(re)===void 0&&Ze(e,t);const i=await e.getInstanceAsync(re);i&&r.headers.set("authorization",`Bearer ${i}`)}})}var cn={text:{fontFamily:["Google Fonts","Sans Serif","Mulish","Regular"],fontSize:16,fontSizeDim:"px",lineHeight:24,lineHeightDim:"px",color:"#595959",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},headings:{fontFamily:["Google Fonts","Sans Serif","Mulish","Bold"],fontSize:28,fontSizeDim:"px",lineHeight:34,lineHeightDim:"px",color:"#000000",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},links:{color:"#1890ff",contrastColor:"#FFFFFF",underline:!0},buttons:{fontFamily:["Google Fonts","Sans Serif","Mulish","Medium"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1890ff",bold:!1,italic:!1,backgroundColor:"#1890ff",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:6,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},textAlign:"center",padding:{all:null,top:null,right:null,bottom:null,left:null}},block:{backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1890ff",padding:{all:null,top:null,right:null,bottom:null,left:null}},cards:{contrastBackgroundColor:"#1890ff",contrastTextColor:"#ffffff",baseBackgroundColor:"#f8f8f8",baseTextColor:"#333333",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}}},tt="ERROR",un="useblocks",_n={em_color_scheme:"em_color_scheme",em_code_mode_pane_sizes:"em_code_mode_pane_sizes",em_preview_pane_sizes:"em_preview_pane_sizes",em_default_sizes:"em_default_sizes",em_pane_sizes:"em_pane_sizes",em_test_emails:"em_test_emails",em_menu_is_locked:"em_menu_is_locked",em_code_mode_settings:"em_code_mode_settings",em_folder_is_open:"em_folder_is_open",em_active_tab:"em_active_tab",em_ai_settings:"em_ai_settings",em_last_active_page:"em_last_active_page",em_layout_convert_never_suggest:"em_layout_convert_never_suggest",em_filemanager_v2:"em_filemanager_v2",em_projects_v2:"em_projects_v2",em_translations_v2:"em_translations_v2",em_defer_chrome:"em_defer_chrome",em_stripo_import:"em_stripo_import",em_guest_locale:"em_guest_locale"},ln="light",dn="dark",fn="(prefers-color-scheme: dark)",En={MESSAGE:"message",INIT_PREVIEW:"init_preview",UPDATE_PREVIEW:"update_preview",UPDATE_EDITOR:"update_editor",UPDATE_EDITOR_POSITION:"update_editor_position",UPDATE_SIDE_MENU_EDITOR:"update_side_menu_editor",SAVE_EMAIL:"saveEmail",SANDBOX_ELEMENT_SETTINGS_SET:"sandbox_element_settings_set",SANDBOX_IMAGE_RESET:"sandbox_image_reset",SANDBOX_NATIVE_IMAGE_DROP_CLEAR:"sandbox_native-image-drop-clear",SANDBOX_EMAIL_SETTINGS_SET:"sandbox_email_settings_set",SANDBOX_BLOCK_SETTINGS_SET:"sandbox_block_settings_set",SANDBOX_ELEMENT_PARENT_GET:"sandbox_element_parent_get",SANDBOX_ELEMENT_PARENT_TABLE_GET:"sandbox_element_parent_table_get",SANDBOX_ELEMENT_PREV_GET:"sandbox_element_prev_get",SANDBOX_ELEMENT_NEXT_GET:"sandbox_element_next_get",SANDBOX_ELEMENT_REMOVE:"sandbox_element_remove",SANDBOX_ELEMENT_ACTIVE_RESET:"sandbox_element_active_reset",SANDBOX_ELEMENT_ACTIVE_SET:"sandbox_element_active_set",SANDBOX_ELEMENT_HOVER_SET:"sandbox_element_hover_set",SANDBOX_ELEMENT_IMG_LINK:"sandbox_element_img_link",SANDBOX_ELEMENT_TEXT:"sandbox_element_text",SANDBOX_EMAIL_CONTENT_GET:"sandbox_email_content_get",SANDBOX_SET_POSITION_TO_IMG:"sandbox_set_position_to_img",SANDBOX_SET_POSITION_TO_LINK:"sandbox_set_position_to_link",SANDBOX_ACCORDION_ADD_SECTION:"sandbox_accordion_add_section",SANDBOX_ACCORDION_REMOVE_SECTION:"sandbox_accordion_remove_section",APPLICATION_FOCUS_IN_IFRAME:"application_focus_in_iframe",APPLICATION_EMAIL_SETTINGS_SET:"application_email_settings_set",APPLICATION_BLOCK_SETTINGS_SET:"application_block_settings_set",APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",_APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",APPLICATION_ELEMENT_SETTINGS_CLOSE:"application_element_settings_close",APPLICATION_ACTION:"application_action",APPLICATION_EBLOCK_ADD:"application_eblock_add",SANDBOX_EBLOCK_SET_EM_BLOCK_ID:"sandbox_eblock_set_em_block_id",SANDBOX_GLOBAL_BLOCK_REPLACE:"sandbox_global_block_replace",APPLICATION_SCROLL_TO:"application_scroll-to",APPLICATION_SCROLL_BLOCK_SHOW:"application_scroll-block-show",APPLICATION_SCROLL_BLOCK_HIDE:"application_scroll-block-hide",APPLICATION_DISCUSS_SET_ID:"application_discuss_set_id",APPLICATION_DISCUSS_GET_COMMENT:"application_discuss_get_comment",APPLICATION_DISCUSS_NO_COMMENT:"application_discuss_no_comment",APPLICATION_DISCUSS_SAVE_TARGET:"application_discuss_save_target",APPLICATION_IFRAME_SET_HEIGHT:"application_iframe_set_height",APPLICATION_COMMON_STYLES_UPDATE:"application_commonStyles_update",APPLICATION_EMAIL_CONTENT_GET:"application_email_content_get",APPLICATION_OPEN_IMAGE_AI_POPUP:"application_open-image-ai-popup",APPLICATION_OPEN_IMAGE_UPLOAD_POPUP:"application_open-image-upload-popup",APPLICATION_OPEN_IMAGE_EDIT_POPUP:"application_open-image-edit-popup",APPLICATION_OPEN_IMAGE_GIF_POPUP:"application_open-image-gif-popup",APPLICATION_OPEN_IMAGE_STOCK_POPUP:"application_open-image-stock-popup",APPLICATION_CLOSE_IMAGE_EDIT_POPUP:"application_close-image-edit-popup",APPLICATION_NATIVE_IMAGE_DROP:"application_native-image-drop",APPLICATION_SUBJECT_UPDATE:"application_subject_update",APPLICATION_PREHEADER_UPDATE:"application_preheader_update",APPLICATION_DOMPARSER_ERROR:"application_domparser_error",APPLICATION_UPDATE_ENTITY:"application_update_entity",APPLICATION_IFRAME_DRAG_EVENT:"application_iframe_drag_event",APPLICATION_HAS_AMP:"application_has_amp",APPLICATION_CANVAS_IMAGE_GET:"application_canvas_image_get",APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:"application_atom_inserted",APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW:"application_template_not_em_alert_show",SANDBOX_WINDOW_CHARACTERISTIC:"sandbox_window-characteristic",SANDBOX_IFRAME_SETSIZE:"sandbox_iframe-setsize",SANDBOX_BLOCK_INSERT:"sandbox_block-insert",SANDBOX_ATOM_INSERT:"sandbox_atom-insert",SANDBOX_DRAG_CANCEL:"sandbox_drag-cancel",UPDATE_EDITOR_POSITION_FROM_EDITOR:"update_position_from_editor",UPDATE_EDITOR_POSITION_FROM_IFRAME:"update_position_from_iframe",SANDBOX_CHANGE_PREVIEW:"sandbox_change_preview",APPLICATION_CHANGE_PREVIEW:"application_change_preview",SANDBOX_LOCK_EDIT:"sandbox_lock_edit",SANDBOX_FLOATBLOCK_ADD:"sandbox_floatBlock_add",SANDBOX_FLOATBLOCK_REMOVE:"sandbox_floatBlock_remove",SANDBOX_FLOATBLOCK_COPY:"sandbox_floatBlock_copy",SANDBOX_FLOATBLOCK_SWAP:"sandbox_floatBlock_swap",EDITOR_CHANGE_FOCUS:"editor_change_focus",SANDBOX_RESIZED:"sandbox_resized",SANDBOX_LOCK_DISCUSS:"sandbox_lock_discuss",SANDBOX_DISCUSS_SET_TARGET:"sandbox_discuss_set_target",SANDBOX_DISCUSS_REMOVE_TARGET:"sandbox_discuss_remove_target",SANDBOX_DISCUSS_RESET:"sandbox_discuss_reset",SANDBOX_DISCUSS_GET_TARGET:"sandbox_discuss_get_target",SANDBOX_READY:"SANDBOX_READY",SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:"sandbox_subject_update",SANDBOX_PREHEADER_UPDATE:"sandbox_preheader_update",SANDBOX_DRAG_EVENT:"sandbox_drag_event",SANDBOX_WHEEL:"sandbox_wheel",SANDBOX_ADD_MERGETAG:"sandbox_add_mergetag",SANDBOX_TRANSLATIONS:"sandbox_send_translations",SANDBOX_SET_THEME_VARIABLES:"sandbox_send_theme_variables",SANDBOX_SET_PROJECT_FONTS:"sandbox_set_project_fonts",SANDBOX_CANVAS_IMAGE_CACHE_SETUP:"sandbox_canvas_image_cache_setup",SANDBOX_SET_ENTITY:"sandbox_set_entity",SANDBOX_INIT_START:"sandbox_init_start",SANDBOX_INITED:"sandbox_inited",SANDBOX_UPDATE_ENTITY:"sandbox_update_entity",RELOAD:"reload",SANDBOX_ADD_EXTENSIONS:"sandbox_add_extensions",SANDBOX_REMOVE_EXTENSIONS:"sandbox_remove_extensions",SANDBOX_ADD_SCRIPT:"sandbox_add_script",SANDBOX_IS_EMAIL_EMPTY:"sandbox_is_email_empty",SANDBOX_SWITCH_THEME:"sandbox_switch_theme"},rt=e=>{const t={current:Promise.resolve(),state:e,decorate:(r,n)=>(n&&(r=r.bind(n)),function(...i){const o=t.current.then(()=>r(...i));return t.current=o.then(s=>{t.state=s},s=>{}),o})};return t};function ne(e){return function(t){return{setOptions:()=>{},instance:{},dispose:()=>{},...e(t)||{}}}}function pn(e){return t=>{const r={},n=[];for(const s of e)n.push(s(t));for(const s of n)Object.assign(r,s.instance);return{instance:r,setOptions:async s=>{for(const a of n)await a.setOptions(s)},dispose:()=>{for(const s of n)s.dispose()}}}}function hn(e=tt){const t=new Error(e);return t.name="AuthPipelineError",t}async function On(e,t,r,n){const i=n?.attemptTimeout??N(r),o=N(r)?Fe(r):v(r).length>0?[k(r)]:[];if(o.length===0)throw new Error("[apiOriginFailover] no API base URL configured");const s=e.startsWith("/")?e:`/${e}`;let a,c;for(let _=0;_<o.length;_++){const l=o[_],E=_===o.length-1,h=i?Ue(t.signal):void 0;try{const p=await fetch(`${l}${s}`,{...t,...h?{signal:h.signal}:{}});if(!p.ok&&Ge(p.status)){if(a=p,!E){U(l,r);continue}break}return p.ok&&Ve(l,r),p}catch(p){const g=h?.timeoutError();if(!g&&!Xe(p))throw p;c=g||p,E||U(l,r)}finally{h?.done()}}if(N(r)&&$e(),a)return a;throw c instanceof Error?c:new Error("[apiOriginFailover] fetch chain failed")}function nt(e){e.inject(C,void 0),e.inject(z,void 0)}var An=ne(e=>{let t,r;const n=rt();return e.addService(x,{execute:n.decorate(async(i,o)=>{if(o?.public||!t)return;const s=String(e.getInstance(z)||"").trim();if(s){i.headers.append("authorization",`Bearer ${s}`);return}if(!e.getInstance(C))try{const a=e.getInstance(qe),c=String(a?.getOptions()?.baseUrl||"").trim(),_=ke(r||c||void 0);if(!_)throw new Error("JWT auth requires baseUrl");const l=await On("/jwt-auth/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},_);if(!l.ok)throw new Error(`JWT auth failed: ${l.status}`);const E=await l.json(),h=String(E.token||"").trim();if(!h)throw new Error("JWT auth failed: empty token");e.inject(C,void 0),e.inject(z,h),i.headers.append("authorization",`Bearer ${h}`)}catch{throw e.inject(C,tt),hn()}})}),{setOptions(i){const o=i.jwtAuth,s=String(i.baseUrl||"").trim()||void 0,a=!w(o,t),c=s!==r;if(t=o,r=s,!o){nt(e);return}a||c?nt(e):e.inject(C,void 0)}}}),gn=ne(e=>(et(e),{setOptions(t){Ze(e,t)}}));function In(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/([^a-zA-Z0-9_-])/g,"\\$1")}function ie(e,t=document){try{const n=t.querySelector(e);if(n)return n}catch{return null}const r=t.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;if(!i)continue;const o=ie(e,i);if(o)return o}return null}function it(e,t=[]){const r=e.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;i&&(t.push(i),it(i,t))}return t}function mn(e,t,r){if(e.isConnected)return e;const n=e.id?.trim();return n?ot(`#${In(n)}`,t,r):Promise.reject(S("Editor mount element was disconnected and has no id — pass a CSS selector or call init() again after the host remounts the container."))}function ot(e,t,r){if(q(r),typeof e<"u"){if(typeof e=="string"){const n=e,i=ie(n);if(i)return i;const o=t.addDisposable(new I);return new Promise((s,a)=>{const c=O=>{o.dispose(),O()},_=()=>{c(()=>a(S(r?.reason)))};if(r?.aborted){_();return}r?.addEventListener("abort",_),o.addDispose(()=>r?.removeEventListener("abort",_));const l=document.body??document.documentElement;if(!l){c(()=>a(S("Document is not ready to observe mount element")));return}const E=new Set,h=new MutationObserver(()=>{const O=ie(n);if(O){c(()=>s(O));return}g()}),p=O=>{E.has(O)||(E.add(O),h.observe(O,{attributes:!0,childList:!0,subtree:!0}))},g=()=>{const O=document.documentElement;if(O)for(const G of it(O))p(G)};p(l),g(),o.addDispose(()=>h.disconnect())})}return e instanceof Element?mn(e,t,r):e}return e}var Tn=new Map;Object.defineProperty(u,"ADVANCED_SETTINGS_PANEL",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(u,"APP_ID",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(u,"APP_LOAD_EVENT_ID",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(u,"ATOMS_HANDLERS_ID",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(u,"AsyncEmitter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(u,"BaseEmitter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(u,"COMMON_STYLES",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(u,"CONFIG_CHANGED_EVENT_ID",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(u,"CONFIG_SOURCE_ID",{enumerable:!0,get:function(){return de}}),Object.defineProperty(u,"COOKIE_MANAGER_ID",{enumerable:!0,get:function(){return fr}}),Object.defineProperty(u,"CUSTOM_FETCH_ID",{enumerable:!0,get:function(){return J}}),Object.defineProperty(u,"ContentType",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(u,"DARK",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(u,"DISPOSABLE_ID",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(u,"DependencyResolver",{enumerable:!0,get:function(){return W}}),Object.defineProperty(u,"Disposable",{enumerable:!0,get:function(){return I}}),Object.defineProperty(u,"ELEMENT_MAP",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(u,"EVENT_TYPES",{enumerable:!0,get:function(){return En}}),Object.defineProperty(u,"Emitter",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(u,"HANDLE_ATOM_INSERT_ID",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(u,"INIT_PIPELINE_ID",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(u,"INSTANCE_ID",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(u,"JWTMixin",{enumerable:!0,get:function(){return An}}),Object.defineProperty(u,"LATE_SURFACE_LISTENERS_ID",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(u,"LIGHT",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(u,"LOCAL_STORAGE_ITEMS",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(u,"MESSAGE_SERVICE_ID",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(u,"MODAL_CLOSE_EVENT",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(u,"MODAL_SHOW_EVENT",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(u,"MODAL_UPDATE_EVENT",{enumerable:!0,get:function(){return dr}}),Object.defineProperty(u,"MessageService",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(u,"OAuthMixin",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(u,"OPTIONS_SOURCE_ID",{enumerable:!0,get:function(){return le}}),Object.defineProperty(u,"PLUGIN_COLLECTION_ID",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(u,"PORT_READY",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(u,"PREFERS_COLOR_SCHEME_DARK",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(u,"PUBLIC_REQUEST",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(u,"REQUEST_HANDLER_ID",{enumerable:!0,get:function(){return x}}),Object.defineProperty(u,"REST_CLIENT_FACTORY_ID",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(u,"REST_TRANSPORT_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(u,"SANDBOX_EXTENSIONS_ID",{enumerable:!0,get:function(){return or}}),Object.defineProperty(u,"SANDBOX_EXTENSION_SCRIPT_STATUS_ID",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(u,"SECURITY_MODULE_ID",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(u,"SETTINGS_PANEL_EVENT",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(u,"STANDALONE_ACTIVATED_ID",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(u,"STANDALONE_BOOTSTRAP_TOKEN_ID",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(u,"STANDALONE_FILE_PROXY_REGISTERED_ID",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(u,"STANDALONE_PROJECT_ID",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(u,"STORE_ID",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(u,"Signal",{enumerable:!0,get:function(){return St}}),Object.defineProperty(u,"TEMPLATE_DIRECTIVES_ID",{enumerable:!0,get:function(){return Er}}),Object.defineProperty(u,"USEBLOCKS",{enumerable:!0,get:function(){return un}}),Object.defineProperty(u,"combineMixins",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(u,"composeAbortSignals",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(u,"createAbortError",{enumerable:!0,get:function(){return S}}),Object.defineProperty(u,"createIdentifier",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(u,"createIdentifier$1",{enumerable:!0,get:function(){return f}}),Object.defineProperty(u,"createQueue",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(u,"createTransport",{enumerable:!0,get:function(){return We}}),Object.defineProperty(u,"debounce",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(u,"decodeJwt",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(u,"deepEqual",{enumerable:!0,get:function(){return w}}),Object.defineProperty(u,"defineMixin",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(u,"events",{enumerable:!0,get:function(){return K}}),Object.defineProperty(u,"filter",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(u,"generateUUID",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(u,"getActiveBaseUrl",{enumerable:!0,get:function(){return k}}),Object.defineProperty(u,"getApi",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(u,"getEmitter",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(u,"getEmitter$1",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(u,"getEvent",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(u,"getServiceContainerId",{enumerable:!0,get:function(){return M}}),Object.defineProperty(u,"isAbortError",{enumerable:!0,get:function(){return It}}),Object.defineProperty(u,"mapHttpStatusToErrorCode",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(u,"mergeBackendProxyLayers",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(u,"mergeResourceProxyLayers",{enumerable:!0,get:function(){return Ir}}),Object.defineProperty(u,"mergeResourceProxyPolicyLayers",{enumerable:!0,get:function(){return Dr}}),Object.defineProperty(u,"mergeShallowConfigLayers",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(u,"provideOAuth",{enumerable:!0,get:function(){return et}}),Object.defineProperty(u,"raceWithAbortSignal",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(u,"registerRestTransport",{enumerable:!0,get:function(){return rn}}),Object.defineProperty(u,"releaseContainer",{enumerable:!0,get:function(){return Or}}),Object.defineProperty(u,"resolveContainer",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(u,"resolveExplicitApiBaseUrl",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(u,"setApiOriginFailoverHook",{enumerable:!0,get:function(){return Yr}}),Object.defineProperty(u,"snapshot",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(u,"throwIfAborted",{enumerable:!0,get:function(){return q}}),Object.defineProperty(u,"waitForElement",{enumerable:!0,get:function(){return ot}})});
|
|
2093
|
+
__useblocks__.define("static/umd/b11043e6.js",["require","exports","module"],function(y,l,w){var p=Object.create,_=Object.defineProperty,i=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,f=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,O=(e,r)=>()=>(r||(e((r={exports:{}}).exports,r),e=null),r.exports),v=(e,r)=>{let t={};for(var u in e)_(t,u,{get:e[u],enumerable:!0});return r||_(t,Symbol.toStringTag,{value:"Module"}),t},P=(e,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(var c=b(r),o=0,s=c.length,n;o<s;o++)n=c[o],!a.call(e,n)&&n!==t&&_(e,n,{get:(j=>r[j]).bind(null,n),enumerable:!(u=i(r,n))||u.enumerable});return e},g=(e,r,t)=>(t=e!=null?p(f(e)):{},P(r||!e||!e.__esModule||!a.call(e,"default")?_(t,"default",{value:e,enumerable:!0}):t,e));Object.defineProperty(l,"__commonJSMin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(l,"__exportAll",{enumerable:!0,get:function(){return v}}),Object.defineProperty(l,"__toESM",{enumerable:!0,get:function(){return g}})});
|
|
2094
|
+
|
|
2095
|
+
|
|
2096
|
+
__useblocks__.define("static/umd/450a82ad.js",["require","exports","module"],function(Cn,u,Ln){var I=class ct{_inner;_isDisposed=!1;constructor(t=[]){this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof ct&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(t){this.addDisposable({dispose:t})}removeDisposable(t){const r=this._inner.indexOf(t);r>=0&&this._inner.splice(r,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const t of[...this._inner])t.dispose()}}};function M(e){return`service_container_${e}`}var P=new Set,H;function ut(){if(!H)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,se.prototype.getInstanceAsync),e.stack}function V(e){P.delete(e)&&H?.end(e)}var se=class oe extends I{_parent;_injectCallbacks=[];_injections=Object.create(null);_runCallbacks(t){[...this._injectCallbacks].forEach(r=>r(t))}constructor(t=null){super(),this._parent=t,t&&this.addDisposable(t.onInject(r=>this._runCallbacks(r)))}onInject=t=>(this._injectCallbacks.push(t),{dispose:()=>{const r=this._injectCallbacks.indexOf(t);r>=0&&this._injectCallbacks.splice(r,1)}});inject(t,r){this._injections[t]=()=>r,this._runCallbacks(t)}injectFactory(t,r,n){const i=this._injections[t];let o=typeof i=="function"?i():i;const s=this._injections[t]=()=>(o=r(this,o),o);n&&s(),this._runCallbacks(t)}_find(t,r=!0){return this._injections[t]||r&&this._parent?._find(t)}_onInject(t,r,n=new I){return n.addDisposable(this.onInject(i=>{t===i&&!n.isDisposed()&&(n.dispose(),r(this.getInstance(i)))})),this._parent&&n.addDisposable(this._parent._onInject(t,r,n)),this.addDisposable(n),n}getInstance(t,r=!0){const n=this._find(t,r);if(typeof n=="function")return n()}getOrCreateInstance(t,r){const n=this._find(t);if(typeof n=="function")return n();const i=r(this);return this.inject(t,i),i}getInstanceAsync(t){const r=this._find(t);if(typeof r=="function")return Promise.resolve(r());const n=ut();return new Promise((i,o)=>{const s={id:String(t),startedAt:Date.now(),origin:n,container:this,reject:o};P.add(s),H?.start(s),this._onInject(t,()=>{V(s),i(this.getInstance(t))})})}failPendingWaits(t){for(const r of Array.from(P))r.container===this&&(V(r),r.reject(t))}pendingWaits(){return[...P].filter(t=>t.container===this)}addService(t,r){const n=M(t);this.injectFactory(n,(o,s=[])=>s.indexOf(r)<0?[...s,r]:s);const i=new I;return i.addDispose(()=>{this.injectFactory(n,(o,s=[])=>s.filter(a=>a!==r))}),i}addServiceFactory(t,r,n){const i=M(t);let o;this.injectFactory(i,(a,c=[])=>(o=r(a,o),o===void 0?c:c.indexOf(o)<0?[...c,o]:c),n);const s=new I;return s.addDispose(()=>{this.injectFactory(i,(a,c=[])=>o===void 0?c:c.filter(_=>_!==o))}),s}getServices(t){const r=M(t);return[...this.getInstance(r,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new oe(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const r=this._parent?.getOrCreateIsolatedContainer(t);return new oe(r)})}remove(t){const r=this._injections;delete r[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(P))t.container===this&&V(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function W(e){return e.startsWith("__")?e:`__${e}__`}function _t(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=W(e),r=globalThis;return r[t]??={}}function lt(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function dt(e){if(e)return W(e);const t="useblocks".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return W(t)}function ae(e){const t=dt(e),r=_t(t);if(lt(r.container))return r.container;const n=new se(null);return r.container=n,n}function ft(e){return ae(e)}function Et(){let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){let n=Math.random()*16;return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),(r==="x"?n:n&3|8).toString(16)})}function ce(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Et()}function d(e=ce()){return e}function ue(){return"umd".trim()||"unknown"}function pt(e){if(typeof globalThis>"u")return;const t=ue(),r=globalThis[e]??{};globalThis[e]=r;const n=r.__diagnostics??={},i=n.diModuleEval??={evalCount:0,records:[]};i.records.push({buildSource:t,timestamp:Date.now(),stack:new Error().stack}),i.evalCount+=1}function ht(){const e="useblocks".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function Ot(e,t){if(pt(t),typeof globalThis>"u")return e;const r=ue(),n=globalThis,i=n[t]=n[t]||{},o=i.__diagnostics=i.__diagnostics||{},s=o.dependencyResolver=o.dependencyResolver||{entries:[]},a={container:e,source:"packages/runtime-core/di/index.ts",buildSource:r,timestamp:Date.now(),stack:new Error().stack};return s.entries.push(a),e}var j;function gt(){if(j)return j;const e=ht();return j=Ot(ae(e),e),j}var $=new Proxy({},{get(e,t,r){const n=gt(),i=Reflect.get(n,t,r);return typeof i=="function"?i.bind(n):i}});function At(e,t="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return t}}function S(e){if(e instanceof DOMException&&e.name==="AbortError")return e;const t=e===void 0?"The operation was aborted.":typeof e=="string"?e:e instanceof Error?e.message:String(e);return new DOMException(t,"AbortError")}function It(e){return e instanceof DOMException&&e.name==="AbortError"}function q(e){if(e?.aborted)throw S(e.reason)}function mt(e,t){return t?(t.aborted&&e.catch(()=>{}),q(t),new Promise((r,n)=>{const i=()=>{o(),n(S(t.reason))},o=()=>{t.removeEventListener("abort",i)};t.addEventListener("abort",i),e.then(s=>{o(),r(s)},s=>{o(),n(s)})})):e}var _e=class extends I{_options;_listeners=[];constructor(e={}){super(),this._options=e}getListeners(e){return this._listeners.flatMap(([t])=>typeof t=="function"?t:t.getListeners(e))}hasListeners(){for(const[e]of this._listeners){if(typeof e=="function")return!0;const t=e;if(typeof t.hasListeners=="function"){if(t.hasListeners())return!0;continue}return!0}return!1}_addListener(e,t=0,r){if(this.isDisposed())return{dispose:()=>{}};const n=this._listeners,i=this._options;r&&typeof e=="function"&&(e=e.bind(r));const o=n.findIndex(([,a])=>a<t),s=[e,t];return n.splice(o>=0?o:n.length,0,s),n.length===1&&i.onFirstListenerAdd&&i.onFirstListenerAdd(),{dispose:()=>{const a=n.indexOf(s);a>=0&&(n.splice(a,1),!n.length&&i.onLastListenerRemove&&i.onLastListenerRemove())}}}on=this._addListener.bind(this);event=this._addListener.bind(this);once=(e,t=0,r)=>{const n=this._addListener((...i)=>(n?.dispose(),r?e.call(r,...i):e(...i)),t);return n};un=e=>{const t=this._listeners.findIndex(([r])=>r===e);t>=0&&(this._listeners.splice(t,1),this._listeners.length===0&&this._options.onLastListenerRemove&&this._options.onLastListenerRemove())};dispose(){this._listeners.splice(0,this._listeners.length),this._options.onLastListenerRemove&&this._options.onLastListenerRemove(),super.dispose()}},b=class extends _e{execute(e,t){for(const r of t)try{r(...e)}catch{}}fire(...e){if(!this.isDisposed()){const t=this.execute(e,this.getListeners(e));return t===void 0?void 0:t}}},Tt=class extends b{execute([e],t){for(const r of t)try{r(e)}catch{}}},St=class extends b{_suspendCounter=0;_wasFired=!1;execute([e],t){if(this._suspendCounter)this._wasFired=!0;else for(const r of t)try{r(e)}catch{}}suspend(){this._suspendCounter++}resume(){--this._suspendCounter===0&&this._wasFired&&(this.fire(),this._wasFired=!1)}},B=class extends b{async execute([e],t){const r=[];for(const n of t)try{r.push(await n(e))}catch{}return r}async fireSettled(e){const t={results:[],errors:[]};if(this.isDisposed())return t;for(const r of this.getListeners([e]))try{t.results.push(await r(e))}catch(n){t.errors.push(n)}return t}};function bt(e,t=0){const r=new _e,n=e(r,t);return n&&r.addDisposable(n),r.event}function Dt(e,t,r=0){const n=new b,i=e((...o)=>{if(t(...o))return n.fire(...o)},r);return i&&n.addDisposable(i),n.event}function Nt(e,t=0,r=0){const n=new b;let i,o;const s=e((...a)=>{o=a,i||(i=setTimeout(()=>{o&&n.fire(...o),i=void 0},t))},r);return s&&n.addDisposable(s),n.event}function yt(e,t){return e.getOrCreateInstance(t,()=>new B)}function f(e){return d(e)}var K;(function(e){e.BEFORE_SAVE_EMAIL=f("events.BEFORE_SAVE_EMAIL"),e.ON_SAVEBUTTON_CLICK_ID=f("events.ON_SAVEBUTTON_CLICK_ID"),e.ON_NEXTBUTTON_CLICK_ID=f("events.ON_NEXTBUTTON_CLICK_ID"),e.ON_PREVIOUSBUTTON_CLICK_ID=f("events.ON_PREVIOUSBUTTON_CLICK_ID"),e.ON_DOCUMENT_SESSION_CHANGE=f("events.ON_DOCUMENT_SESSION_CHANGE"),e.WILL_EMAIL_INIT_ID=f("events.WILL_EMAIL_INIT_ID"),e.ON_EMAIL_INIT_ID=f("events.ON_EMAIL_INIT_ID"),e.ON_BLOCK_INIT_ID=f("events.ON_BLOCK_INIT_ID"),e.ON_CONTENT_CHANGED_ID=f("events.ON_CONTENT_CHANGED_ID"),e.ON_PREHEADER_CHANGED_ID=f("events.ON_PREHEADER_CHANGED_ID"),e.ON_SUBJECT_CHANGED_ID=f("events.ON_SUBJECT_CHANGED_ID"),e.ON_EMAIL_CHANGED_ID=f("events.ON_EMAIL_CHANGED_ID"),e.ON_HEADER_APPLIED_ID=f("events.ON_HEADER_APPLIED_ID"),e.ON_BLOCK_CHANGED_ID=f("events.ON_BLOCK_CHANGED_ID"),e.ON_CHUNKS_LOADED=f("events.ON_CHUNKS_LOADED"),e.ON_SEND_TESTEMAIL_ID=f("events.ON_SEND_TESTEMAIL_ID"),e.ON_SEND_LIVEPREVIEW_ID=f("events.ON_SEND_LIVEPREVIEW_ID"),e.ON_SHARE_ID=f("events.ON_SHARE_ID"),e.ON_SHOW_PREVIEW_ID=f("events.ON_SHOW_PREVIEW_ID"),e.ON_EMAIL_CLONE_ID=f("events.ON_EMAIL_CLONE_ID"),e.ON_SEND_EMAIL_MODAL_ID=f("events.ON_SEND_EMAIL_MODAL_ID"),e.ON_NOTIFICATION=f("events.ON_NOTIFICATION"),e.READ_LOCALE=f("events.READ_LOCALE"),e.ON_TRANSLATE_ID=f("events.ON_TRANSLATE_ID"),e.ON_CODE_VALIDATE_ID=f("events.ON_CODE_VALIDATE_ID"),e.UPLOAD_EVENT_ID=f("events.UPLOAD_EVENT_ID"),e.PROXY_URL_EVENT_ID=f("events.PROXY_URL_EVENT_ID"),e.FILE_PROXY_EVENT_ID=f("events.FILE_PROXY_EVENT_ID"),e.ON_LIMIT_ID=f("events.ON_LIMIT_ID"),e.ON_BROWSER_EXTENSION_DETECTED_ID=f("events.ON_BROWSER_EXTENSION_DETECTED_ID"),e.ON_LAYOUT_CONVERT_REQUEST_ID=f("events.ON_LAYOUT_CONVERT_REQUEST_ID"),e.ON_BROWSER_TRANSLATE_DETECTED_ID=f("events.ON_BROWSER_TRANSLATE_DETECTED_ID"),e.AI_TEXT_REQUEST_ID=f("events.AI_TEXT_REQUEST_ID"),e.AI_IMAGE_REQUEST_ID=f("events.AI_IMAGE_REQUEST_ID"),e.AI_TEXT_PROGRESS_ID=f("events.AI_TEXT_PROGRESS_ID"),e.AI_IMAGE_PROGRESS_ID=f("events.AI_IMAGE_PROGRESS_ID"),e.AI_TEXT_STREAM_ID=f("events.AI_TEXT_STREAM_ID")})(K||(K={}));function Pt(e,t){return e.getOrCreateInstance(t,()=>new B).event}function Ct(e,t){return e.getOrCreateInstance(t,()=>new B)}var Lt=d("plugin.app"),Rt=d("plugin.disposable"),vt=d("InitPipelineContext"),wt=d("plugin.instance"),Mt=d("plugin.lateSurfaceListeners"),le=d("plugin.optionsSource"),jt=d("plugin.store"),de=d("ConfigSource"),Bt=d("plugin.standalone.project"),fe=d("plugin.standalone.bootstrapToken"),Rn=d("plugin.element"),Ee=d("plugin.securityModule"),xt=d("plugin.standalone.activated"),Ft=d("plugin.standalone.fileProxyRegistered"),z=d("plugin.jwt.token"),C=d("plugin.jwt.error"),kt=d("PluginCollection"),Ut=f("APP_LOAD_EVENT"),Gt=f("CONFIG_CHANGED_EVENT");function Xt(e,t=window){return{peer:e,send(r){e.postMessage(r,"*")},subscribe(r){const n=i=>{r({data:i.data,source:i.source,ports:i.ports})};return t.addEventListener("message",n),{dispose:()=>t.removeEventListener("message",n)}},close(){}}}function Ht(e){let t=!1;return{peer:e,send(r){e.postMessage(r)},subscribe(r){const n=i=>{r({data:i.data,source:e})};return e.addEventListener("message",n),t||(t=!0,e.start()),{dispose:()=>e.removeEventListener("message",n)}},close(){e.close()}}}function Vt(e){return e}function Wt(e){return e&&typeof e=="object"}function pe(e,t){return e&&typeof e=="object"&&e.operationId===t}var T="INIT_MESSAGE",he="em:port-ready",$t="em:window-drained",J="";function Oe(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var qt=class extends I{_listeners=Object.create(null);addListenerAsync=(e,t,r=0,n)=>{const i=this._listeners[e]||(this._listeners[e]=[]);n&&typeof t=="function"&&(t=t.bind(n));const o=i.findIndex(([a,c])=>r<=c),s=[t,r];return this.isDisposed()||i.splice(o>=0?o:i.length,0,s),{dispose(){const a=i.indexOf(s);a>=0&&i.splice(a,1)}}};fireAsync=(e,t)=>{if(!this.isDisposed()){const r=this._listeners[e]||(this._listeners[e]=[]);let n;for(let i=0;i<r.length;i++){const o=r[i][0],s=n;n=a=>o(a,s)}if(n)return n(t)}};addListener=(e,t,r=0)=>this.addListenerAsync(e,(n,i)=>{try{t(n)}catch{}return i&&i(n)},r)},Kt=class extends I{_singleton;_target;_transport;_transportSubscription;_ports=new Map;_drained=new WeakSet;_inited=!1;_emitter=this.addDisposable(new qt);_handshaken=new WeakSet;_greeted=new WeakSet;_outgoingFilter;_outgoingObservers=new Set;constructor(e,t){super(),this._singleton=t,this._transport=Xt({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(T,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(T))}),e&&this.setTarget(e)}_onTransportMessage=e=>{const t=e,r=t.data,n=t.source,i=r?.port===!0?t.ports?.[0]:void 0,o=!this._isPortSource(t.source);if(o&&n&&r?.operationId==="em:window-drained"){this._drained.add(n);return}if(!(o&&n&&this._drained.has(n))){if(n&&n!==this._target&&this._greeted.has(n)&&pe(r,T)){this._greeted.delete(n),this._handshaken.add(n),this._postMessage(n,{operationId:T,data:{}}),i&&this.usePort(i,!0,n);return}if(Wt(r)&&(t.source===this.target||this._isCurrentPort(t.source))||this._singleton&&pe(r,T)){if(i){const _=this._target;Promise.resolve().then(()=>this.usePort(i,!0,_))}const s=this._emitter.fireAsync(r.operationId||J,r.operationId===void 0?t:r.data),a=r.result,c=r.error;a&&c&&Promise.resolve(s).then(_=>this._sendMessage(a,_),_=>this._sendMessage(c,_))}}};setTarget(e){if(this._target!==e){if(this._target=e,!e){this._inited=!1;return}if(this._handshaken.has(e)){this._inited=!0,this._emitter.fireAsync(T,void 0);return}this._inited=!1,this._postMessage(e,{operationId:T,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:T,data:{},port:!0},[t])}observeOutgoing(e){return this._outgoingObservers.add(e),{dispose:()=>{this._outgoingObservers.delete(e)}}}_notifyOutgoing(e,t){for(const r of Array.from(this._outgoingObservers))try{r(e,t)}catch{}}setOutgoingFilter(e){return this._outgoingFilter=e,()=>{this._outgoingFilter===e&&(this._outgoingFilter=void 0)}}sendNow(e){const t=this._target;return!this._inited||!t?!1:(this._postMessage(t,e),!0)}greet(e){this._handshaken.has(e)||this._greeted.has(e)||this._target===e||(this._greeted.add(e),this._postMessage(e,{operationId:T,data:{}}))}forget(e){this._handshaken.delete(e),this._greeted.delete(e),this._closePort(e),this._drained.delete(e),this._target===e&&(this._inited=!1)}usePort(e,t=!1,r=this._target){if(!r||this._ports.has(r))return;const n=Ht(e),i=n.subscribe(this._onTransportMessage);this._ports.set(r,{transport:n,subscription:i}),t&&(n.send({operationId:he,data:{}}),this.drainWindow(r))}useWindow(e=this._target){e&&(this._closePort(e),this._drained.delete(e))}get usesPort(){return this._target!==void 0&&this._ports.has(this._target)}hasPort(e){return this._ports.has(e)}_closePort(e){const t=this._ports.get(e);t&&(t.subscription.dispose(),t.transport.close(),this._ports.delete(e))}drainWindow(e){this._ports.has(e)&&e.postMessage({operationId:$t,data:{}},"*")}isWindowDrained(e){return this._drained.has(e)}_isPortSource(e){for(const t of this._ports.values())if(t.transport.peer===e)return!0;return!1}_isCurrentPort(e){return this._target!==void 0&&this._ports.get(this._target)?.transport.peer===e}getTarget(){return this._target}get target(){return this._target}_postMessage(e,t,r){let n=t;this._outgoingFilter&&!r?.length&&(n="data"in t?{...t,data:this._outgoingFilter(t.data)}:this._outgoingFilter(t));try{const i=this._ports.get(e);if(i){i.transport.send(n);return}if(r?.length){e.postMessage(n,"*",r);return}e.postMessage(n,"*")}catch(i){if(i?.name==="DataCloneError"){const o=typeof n?.data=="object"&&n?.data!==null?n.data:void 0}throw i}}_sendMessage(e,t,r=!0){if(!r&&!this.isInited())return;e&&this._notifyOutgoing(e,t);const n=this.addDisposable(this.onInit(i=>{const o=e?{operationId:e,data:t}:t;try{this._postMessage(i,{...o})}finally{n.dispose()}}))}send(e,t,r){return typeof e=="string"?this._sendMessage(e,t,r):this._sendMessage(J,e,t)}sendAsync(e,t,r=!0){if(!r&&!this.isInited())return Promise.resolve();this._notifyOutgoing(e,t);const n=Oe(),i=Oe();return new Promise((o,s)=>{const a=this.addDisposable(new I);a.addDisposable(this.onInit(c=>{try{this._postMessage(c,{operationId:e,data:t,result:n,error:i})}catch(_){a.dispose(),s(_);return}a.addDisposable(this._onMessage(n,_=>{o(_),a.dispose()})),a.addDisposable(this._onMessage(i,_=>{s(_),a.dispose()}))}))})}_onMessage(e,t,r=0){return this._emitter.addListener(e,t,r)}addListener(e,t,r){return t?this._onMessage(e,t,r):this._onMessage(J,e)}addListenerAsyncPipe(e,t,r=0){return this._emitter.addListenerAsync(e,t,r)}addListenerAsync(e,t,r=0){return this._emitter.addListenerAsync(e,async(n,i)=>{const o=await t(n);return i?i(n):o},r)}isInited(){return this._inited}get inited(){return this._inited}onInit(e,t=!0,r=0){const n=this.addDisposable(new I);return this._inited&&this._target?t&&Promise.resolve().then(()=>{!this._inited||!this._target?n.addDisposable(this.onInit(e,t,r)):e(this._target)}):n.addDisposable(this._onMessage(T,()=>{e(this._target)},r)),n}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}};function L(e){return d(e)}var zt=d("extensions.atomsHandlers"),Jt=L("HANDLE_ATOM_INSERT"),Yt=d("HeadlessMode"),Qt=d("extensions.sandboxExtensions"),Zt="SANDBOX_EXTENSION_SCRIPT_STATUS",er=d("MESSAGE_SERVICE"),tr=L("SETTINGS_PANEL_EVENT"),rr="advanced",nr=L("MODAL_SHOW_EVENT"),ir=L("MODAL_CLOSE_EVENT"),or=L("MODAL_UPDATE_EVENT"),vn=d("client"),wn=d("v2_client"),Mn=d("ai_client"),sr=d("app.cookieManager"),jn=d("app.storageProvider"),Bn=d("image-blob-resolver"),ar=d("template-directives"),cr=(function(e){return e.Json="application/json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain",e})({}),ur=class{baseUrl="https://api.emailmaker.ru/wp-json";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(r=>this.encodeQueryParam(t,r)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(r=>typeof t[r]<"u").map(r=>Array.isArray(t[r])?this.addArrayQueryParam(t,r):this.addQueryParam(t,r)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>Object.keys(e||{}).reduce((t,r)=>{const n=e[r];return t.append(r,n instanceof Blob?n:typeof n=="object"&&n!==null?JSON.stringify(n):`${n}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const r=this.abortControllers.get(e);return r?r.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};async request({body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:c,proxyHandler:_,...l}){const E=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},h=this.mergeRequestParams(l,E);c&&(i=i?{...i,...c}:c);const p=i&&this.toQueryString(i),A=this.contentFormatters[n||"application/json"],O=o||h.format,G=`${s||this.baseUrl||""}${r}${p?`?${p}`:""}`,yn=_?_(G,{body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:c,proxyHandler:_,...l}):G,st=new Request(yn,{...h,headers:{...h.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(a?this.createAbortSignal(a):h.signal)||null,body:typeof e>"u"||e===null?null:A(e)});return this.customFetch(st).then(async at=>{const m=at;m.data=null,m.error=null,m.meta={request:st,response:m};const Pn=O?await at[O]().then(X=>(m.ok?m.data=X:m.error={data:X},m)).catch(X=>(m.error=X,m)):m;return a&&this.abortControllers.delete(a),Pn})}},_r=d("prewarm.networkActivity");function lr(){let e=0;const t=new Set,r=()=>{t.forEach(n=>n())};return{begin(){e+=1,r();let n=!1;return()=>{n||(n=!0,e-=1,r())}},inFlight:()=>e,watch(n){return t.add(n),()=>t.delete(n)}}}function dr(e){return e.getOrCreateInstance(_r,()=>lr())}var ge=Symbol("rest.publicRequest"),x=d("rest.requestHandler"),fr=d("rest.responseHandler"),Y=d("rest.customFetch"),Er=(e,t)=>fetch(e,t),Q=d("rest_transport"),pr=e=>{e.inject(Y,{execute:async(t,r={})=>{const n=e.getServices(x),i={public:r[ge]===!0},o=dr(e).begin();try{let s=t instanceof Request?t:new Request(t,r);for(const _ of n){const l=await _.execute(s,i);l instanceof Request&&(s=l)}let a=await fetch(s);const c=e.getServices(fr);for(const _ of c)a=await _.execute(a);return a}finally{o()}}})};function hr(e,t){const r=e.getInstance(Q);if(!r)throw new Error("[restApi] транспорт не зарегистрирован в контейнере");return Object.assign({},...t.map(n=>new n(r)))}var Or="INJECTION";function gr(e){return e.getState}function Ar(e){if(!gr(e)){e.dispose();return}const t=e.getState()[Or];t&&($.getInstance(t)?.dispose(),$.remove(t))}function Ir(e,t){for(const r of e)if(r&&t in r)return r[t]}function Ae(e){return Object.assign({},...e)}var Ie=["generic","stockImages","emFiles","cdn"];function Z(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function me(e){return!Z(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>Ie.includes(t))}function Te(e){return e.length===0?[]:e.length===1?e[0]:e}function Se(e){let t=!1,r=[];for(const n of e)if(n!==void 0){if(t=!0,Array.isArray(n)){r=[...n,...r];continue}r=[n,...r]}if(t)return Te(r)}function mr(e){return Z(e)&&("value"in e||"replace"in e)}function be(e,t){return t===void 0?e:Array.isArray(t)?[...t,...e]:[t,...e]}function Tr(e){let t=!1,r=[],n=!1;for(const o of e)if(o!==void 0){if(mr(o)){t=!0,o.replace&&(r=[],n=!0),o.value!==void 0&&(r=be(r,o.value),n=!0);continue}r=be(r,o),n=!0}const i=n?Te(r):void 0;if(!t)return i;if(i!==void 0)return{value:i}}function Sr(e){const t=e.filter(n=>n!==void 0);if(t.length===0)return;if(!t.some(n=>me(n)))return Se(t);const r={};for(const n of Ie){const i=Tr(e.map(o=>{if(o!==void 0)return me(o)?o[n]:n==="generic"?o:void 0}));i!==void 0&&(r[n]=i)}return Object.keys(r).length>0?r:void 0}function br(e){return Se(e)}function Dr(e){if(e!==void 0){if(Array.isArray(e))return{replace:!1,hosts:e};if(Z(e)&&Array.isArray(e.value))return{replace:!!e.replace,hosts:e.value}}}function Nr(e,t){const r=[...e],n=new Set(r.map(i=>i.toLowerCase()));for(const i of t){const o=i.trim().replace(/:\d+$/,"");if(!o)continue;const s=o.toLowerCase();n.has(s)||(n.add(s),r.push(o))}return r}function yr(e){let t=[],r=!1;for(const n of e){const i=Dr(n);i&&(r=!0,i.replace&&(t=[]),t=Nr(t,i.hosts))}return r?t:void 0}function Pr(e){const t=e.filter(i=>i!==void 0);if(t.length===0)return;const r=Ae(t.map(({directHosts:i,...o})=>o)),n=yr(t.map(i=>i?.directHosts));return n!==void 0&&(r.directHosts=n),r}function ee(e){return e?.backendProxy}function R(e){return e.replace(/\/$/,"")}function De(e){return/^https?:\/\//i.test(e)}function Ne(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Cr(e){const t=new Set;return e.filter(r=>!r.url||t.has(r.url)?!1:(t.add(r.url),!0))}function Lr(e){const t=ee(e);return t?[t]:[]}function Rr(e){return{proxyEmFiles:!0,proxyAi:!1}}function vr(e,t){const r=Rr(t),n=t?.backendProxyPolicy;switch(e){case"emFiles":return n?.proxyEmFiles??r.proxyEmFiles;case"ai":return n?.proxyAi??r.proxyAi;default:return!0}}var wr={url:".+",url_encoded:".+",origin:"https?:\\/\\/[^\\/?#]+",origin_encoded:".+",proxy_url:"https?:\\/\\/[^\\/?#]+",proxy_url_encoded:".+",path:"[^?#]*",pathname:"[^?#]*",path_with_slash:"\\/[^?#]*",pathname_with_slash:"\\/[^?#]*",query:"[^#]*",search:"\\?[^#]*",hash:"#.*",fragment:".*",pathname_after_wp_json:"[^?#]*",pathname_after_wp_json_with_slash:"\\/[^?#]*",rest_namespace:"[^/?#]*",rest_version:"[^/?#]*",rest_route:"[^?#]*",rest_route_with_slash:"\\/[^?#]*"};function Mr(e){const t=[],r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\{([a-z_]+)\\\}/gi,(n,i)=>(t.push(i),`(${wr[i]||".+"})`));return{regex:new RegExp(`^${r}$`,"i"),tokens:t}}function jr(e){return/[?#]/.test(e)||/\{(?:url|url_encoded|query|search|hash|fragment)\}/i.test(e)}function Br(e,t){if(jr(t))return e;try{const r=new URL(e);return`${r.origin}${r.pathname}`}catch{return e.split(/[?#]/)[0]||e}}function xr(e,t,r){if(r.endsWith("_encoded"))return!0;const n=e.slice(0,t),i=n.lastIndexOf("#"),o=n.lastIndexOf("?"),s=n.lastIndexOf("&"),a=n.lastIndexOf("=");return a>Math.max(o,s)&&a>i}function Fr(e){try{const t=new URL(e),r=t.pathname.replace(/^\/+/,""),n=t.search.replace(/^\?/,""),i=t.hash.replace(/^#/,""),o=r.replace(/^wp-json\/?/i,""),s=o?`/${o}`:"/",a=o.match(/^([^/]+)(?:\/([^/]+))?(?:\/(.*))?$/),c=a?.[1]||"",_=a?.[2]||"",l=a?.[3]||"";return{url:e,url_encoded:encodeURIComponent(e),origin:t.origin,origin_encoded:encodeURIComponent(t.origin),proxy_url:t.origin,proxy_url_encoded:encodeURIComponent(t.origin),path:r,pathname:r,path_with_slash:t.pathname||"/",pathname_with_slash:t.pathname||"/",query:n,search:t.search,hash:t.hash,fragment:i,pathname_after_wp_json:o,pathname_after_wp_json_with_slash:s,rest_namespace:c,rest_version:_,rest_route:l,rest_route_with_slash:l?`/${l}`:"/"}}catch{return}}function te(e,t){if(!e)return{};if(Array.isArray(e)){for(const a of e){const c=te(a,t);if(c!==void 0)return c}return}if(e==="*")return{};const r=Br(t,e),{regex:n,tokens:i}=Mr(e),o=n.exec(r);if(!o)return;const s={};return i.forEach((a,c)=>{s[`matched_${a}`]=o[c+1]||""}),s}function F(e,t,r={}){const n=Fr(t);if(!n)return t;const i={...n,...r};let o="",s=0;const a=/\{([a-z_]+)\}/gi;let c;for(;c=a.exec(e);){o+=e.slice(s,c.index);const _=i[c[1]]??"",l=xr(e,c.index,c[1])?encodeURIComponent(_):_;o+=l,s=c.index+c[0].length}o+=e.slice(s);try{const _=new URL(o),l=new URL(t);return!o.includes("{search}")&&!o.includes("{query}")&&l.search&&l.searchParams.forEach((E,h)=>{_.searchParams.has(h)||_.searchParams.append(h,E)}),!o.includes("{hash}")&&!o.includes("{fragment}")&&l.hash&&!_.hash&&(_.hash=l.hash),_.toString()}catch{return o}}function ye(e,t){try{const r=new URL(t);return`${R(e)}/${r.pathname.replace(/^\//,"")}${r.search}${r.hash}`}catch{return t}}function Pe(e,t){const r=R(e);return t?De(t)?t:t.startsWith("?")||t.startsWith("#")?`${r}${t}`:`${r}${t.startsWith("/")?"":"/"}${t}`:r}function Ce(e,t,r,n){const i=e.match;return i?Array.isArray(i)?i.some(o=>Ce({...e,match:o},t,r,n)):typeof i=="function"?!!i({url:t,method:n,requestType:r}):i==="*"?!0:te(i,t)!==void 0:!0}function kr(e,t,r,n="generic"){if(e==null)return[];const i=Array.isArray(e)?e:[e],o=[];return i.forEach((s,a)=>{if(!s)return;if(typeof s=="string"){const E=s.includes("{")&&s.includes("}")?F(s,t):ye(s,t);o.push({key:`backend:${a}`,url:E,source:"resource"});return}if(!Ne(s)||!("rewrite"in s))return;const c=s;if(!Ce(c,t,n,r))return;const _=typeof c.match=="string"||Array.isArray(c.match)?te(c.match,t)||{}:{},l=typeof c.proxyBase=="string"&&c.proxyBase.trim()?c.proxyBase.trim():void 0;(Array.isArray(c.rewrite)?c.rewrite:[c.rewrite]).filter(Boolean).forEach((E,h)=>{const p=typeof E=="function"?(()=>{const A=E({url:t,proxyBase:l,method:r,requestType:n,..._}),O=l&&!De(A)?Pe(l,A):A;return O.includes("{")&&O.includes("}")?F(O,t,_):O})():l?F(Pe(l,E),t,_):E.includes("{")&&E.includes("}")?F(E,t,_):ye(E,t);o.push({key:`backend:${c.id||"rule"}:${a}:${h}`,url:p,source:"resource"})})}),Cr(o)}function Ur(e){try{const t=new URL(e);return/(?:^|\/)wp-json\/em-files\/v\d+(?:\/|$)/i.test(t.pathname)?"emFiles":/(?:^|\/)wp-json\/ai-generator\/v\d+(?:\/|$)/i.test(t.pathname)?"ai":"generic"}catch{return"generic"}}function Gr(e,t=[]){return e==null||(Array.isArray(e)?e:[e]).forEach(r=>{if(r){if(typeof r=="string"){const n=r.split("{")[0]?.trim();n&&t.push(R(n));return}!Ne(r)||!("rewrite"in r)||(typeof r.proxyBase=="string"&&r.proxyBase.trim()&&t.push(R(r.proxyBase.trim())),(Array.isArray(r.rewrite)?r.rewrite:[r.rewrite]).forEach(n=>{if(typeof n!="string")return;const i=n.split("{")[0]?.trim();i&&t.push(R(i))}))}}),t}function Xr(e,t){return Lr(t).flatMap(r=>Gr(r)).filter(Boolean).some(r=>r&&e.startsWith(r))}function Hr(e,t){return!!ee(t)&&vr(e,t)}function Vr(e,t={}){const r=t.requestType||Ur(e);return Hr(r,t.config)?kr(ee(t.config),e,t.method,r):[]}function Wr(e,t={}){return Xr(e,t.config)?[e]:Vr(e,t).map(r=>r.url)}function D(e){for(;e.endsWith("/");)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}function Le(...e){const t=e.filter(o=>o!=null);if(t.length===0)return;if(t.length===1)return t[0];const r=t.find(o=>o.aborted);if(r)return r;if(typeof AbortSignal<"u"&&typeof AbortSignal.any=="function")return AbortSignal.any(t);const n=new AbortController,i=o=>{n.signal.aborted||n.abort(o.reason)};for(const o of t)o.addEventListener("abort",()=>i(o),{once:!0});return n.signal}var Re=3e5,ve=15e3,g=null,we=!1;function $r(){return!0}function qr(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_TTL_MS||"").trim();if(!e)return Re;const t=Number(e);return Number.isFinite(t)&&t>0?t:Re}function Kr(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_ATTEMPT_TIMEOUT_MS||"").trim();if(!e)return ve;const t=Number(e);return Number.isFinite(t)&&t>0?t:ve}function zr(){const e="https://app.useblocks.io/api".trim();return e?D(e):void 0}function Jr(e){const t=e.trim();if(!t)return[];if(t.startsWith("["))try{const r=JSON.parse(t);if(!Array.isArray(r))throw new Error("expected JSON array");return r.map(n=>String(n).trim()).filter(Boolean)}catch{return we||(we=!0),[]}return t.split(",").map(r=>r.trim()).filter(Boolean)}function Yr(e){const t=new Set,r=[];for(const n of e){const i=D(n);t.has(i)||(t.add(i),r.push(i))}return r}function Me(e){const t=String(e||"").trim();return t?D(t):zr()}function je(e,t=[]){return e?Yr([e,...t]).slice(0,3):[]}function Be(){return Jr(String({}.REACT_APP_OPENAPI_FAILOVER_BASE_URLS||"").trim())}function Qr(e=Date.now()){return g?e-g.switchedAt>=qr():!0}function xe(e=Date.now()){g&&Qr(e)&&(g=null)}function N(e){if(!$r())return!1;const t=Me(e);if(!t)return!1;const r=Be();return r.length===0?!1:je(t,r).length>1}function v(e){const t=Me(e);if(!t)return[];const r=Be();return r.length===0?[t]:je(t,r)}function k(e){const t=v(e);if(t.length===0)return"";if(xe(),g){const r=t.indexOf(g.activeUrl);if(r>=0)return t[r]}return t[0]}function Fe(e){const t=v(e);if(t.length<=1||(xe(),!g||!t.includes(g.activeUrl)))return t;const r=g.activeUrl;return[r,...t.filter(n=>n!==r)]}function ke(e){return k(e)||void 0}function Ue(e){const t=e||void 0;if(typeof AbortController>"u")return{signal:t,timeoutError:()=>{},done:()=>{}};const r=Kr(),n=new AbortController;let i;const o=setTimeout(()=>{i=Zr(r),n.abort(i)},r);return{signal:Le(t,n.signal),timeoutError:()=>i,done:()=>clearTimeout(o)}}function Zr(e){const t=`[apiOriginFailover] origin attempt timed out after ${e}ms`;if(typeof DOMException=="function")return new DOMException(t,"TimeoutError");const r=new Error(t);return r.name="TimeoutError",r}function Ge(e){return e===502||e===503||e===504}function Xe(e){return!(e instanceof Error)&&!(e instanceof DOMException)?!1:e.name==="TimeoutError"?!0:e instanceof TypeError}var He;function en(e){He=e}function U(e,t){if(!N(t))return;const r=v(t);if(r.length<=1)return;const n=r.indexOf(D(e));if(n<0)return;const i=n+1;if(i>=r.length)return;const o=r[i],s=g?.activeUrl;g={activeUrl:o,switchedAt:Date.now()},s!==o&&He?.()}function Ve(e,t){if(!N(t))return;const r=D(e),n=v(t);if(n.includes(r)){if(r===n[0]){g=null;return}g?.activeUrl!==r&&(g={activeUrl:r,switchedAt:Date.now()})}}function We(){g=null}var tn=e=>{const t=new FormData,r=(n,i,o)=>{if(i!=null){if(i instanceof Blob){n.append(o,i);return}if(Array.isArray(i)){i.forEach((s,a)=>{const c=o?`${o}[${a}]`:`${a}`;r(n,s,c)});return}if(typeof i=="object"){Object.keys(i).forEach(s=>{const a=i[s],c=o?`${o}[${s}]`:s;r(n,a,c)});return}n.append(o,String(i))}};return r(t,e),t},rn={baseUrl:D("https://app.useblocks.io/api"),baseApiParams:{secure:!0,credentials:"same-origin",format:"json"},securityWorker:()=>({credentials:"same-origin"})},y=new Map;function nn(e){const t=e?.getInstance(de);return t?t.get()??t.bootstrap():void 0}var on=class extends ur{container;constructor(e={},t){super(e),this.container=t}buildRequestUrl(e){const{path:t,baseUrl:r,extraQuery:n}=e;let{query:i}=e;n&&(i=i?{...i,...n}:n);const o=i&&this.toQueryString(i);return`${r||this.baseUrl||""}${t}${o?`?${o}`:""}`}buildRequestKey(e,t){return`${t.toUpperCase()} ${e}`}getBackendProxyCandidates(e,t){const r=nn(this.container),n=this.container?.getInstance(Ee)!==void 0,i=Wr(e,{config:r,method:t,standalone:n}),o=i.length>0?i:[e],s=this.buildRequestKey(e,t),a=y.get(s);return!a||!o.includes(a)?o:[a,...o.filter(c=>c!==a)]}shouldRetryResponse(e){return e.status===502||e.status===503||e.status===504}resolveFailoverBaseUrl(){return String(this.baseUrl||"").trim()||void 0}async requestOnOrigin(e,t,r=!1){const n={...e,baseUrl:t},i=this.buildRequestUrl(n),o=n.method||"GET",s=this.buildRequestKey(i,o),a=this.getBackendProxyCandidates(i,o);let c,_;for(const l of a){const E=p=>p===i?l:p,h=r?Ue(e.signal):void 0;try{const p=await super.request({...n,proxyHandler:E,...h?{signal:h.signal}:{}});if(!p.ok&&this.shouldRetryResponse(p)&&l!==a[a.length-1]){_=p,y.get(s)===l&&y.delete(s);continue}return y.set(s,l),p}catch(p){y.get(s)===l&&y.delete(s);const A=h?.timeoutError();if(A)throw A;if(c=p,(p instanceof DOMException||p instanceof Error)&&p.name==="AbortError")throw p}finally{h?.done()}}if(_)return _;throw c instanceof Error?c:new Error("Backend proxy chain failed")}async request(e){const t=String(e.baseUrl||"").trim();if(t)return this.requestOnOrigin(e,t);const r=this.resolveFailoverBaseUrl(),n=N(r),i=e.failoverAttemptTimeout??n,o=n?Fe(r):r?[k(r)]:[this.baseUrl].filter(Boolean);if(o.length===0)return this.requestOnOrigin(e,this.baseUrl);let s,a;for(let c=0;c<o.length;c++){const _=o[c],l=c===o.length-1;try{const E=await this.requestOnOrigin(e,_,i);if(!E.ok&&Ge(E.status)){if(a=E,!l){U(_,r);continue}break}return E.ok&&Ve(_,r),E}catch(E){if(!Xe(E))throw E;s=E,l||U(_,r)}}if(n&&We(),a)return a;throw s instanceof Error?s:new Error("API origin failover chain failed")}};function sn(e={},t){const r=new on({...rn,...e},t);return r.contentFormatters["multipart/form-data"]=tn,r}var $e=d("rest.clientFactory"),an=e=>{pr(e);const t=sn({customFetch:e.getInstance(Y)?.execute??Er},e);e.inject(Q,t)},qe;(function(e){const t="https://racs.rest/v3";function r(i,o){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)};return fetch(`${t}?resource=${i}&dataset=${document.location.hostname}`,s)}e.post=r;async function n(i,o=0){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:`{"filter":{},"limit":${o}}`};return await(await fetch(`${t}/get?resource=${i}&dataset=${document.location.hostname}`,s)).json()}e.getAll=n})(qe||(qe={}));function w(e,t){if(e!==t){if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const r=Array.isArray(e),n=Array.isArray(t);if(r){if(!n)return!1;const a=e.length;if(t.length!==a)return!1;for(let c=0;c<a;c++)if(!w(e[c],t[c]))return!1}else if(n)return!1;const i=Object.keys(e),o=Object.keys(t),s=i.length;if(s!==o.length)return!1;for(let a=0;a<s;a++){const c=i[a];if(!t.hasOwnProperty(c)||!w(e[c],t[c]))return!1}}return!0}function cn(e){const t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),r=atob(t),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new TextDecoder().decode(n)}function Ke(e){const[t,r,n]=e.split("."),i=JSON.parse(cn(r));return{exp:i.exp,createdAt:i.iat,data:i}}var re=d("plugin.auth.token"),ze=new WeakMap,un=3e4;function _n(e){let t;try{t=Ke(e).exp}catch{return!0}return typeof t!="number"||!Number.isFinite(t)?!0:t*1e3<=Date.now()+un}function ln(e,t,r,n){const i=ze.get(e);i&&(i.stale=!0);const o={stale:!1};ze.set(e,o),e.injectFactory(re,async(s,a)=>{if(o.stale)return"";try{let c=await a||void 0;if(!c){const _=e.getInstance(fe);_&&(c=await _)}return t?!c||_n(c)?await t(r,n,c):c:""}catch{return""}},!0)}var Je=d("auth.oauthProvided"),Ye=new WeakMap;function Qe(e,t){const r=Ye.get(e)??{applied:!1};(!r.applied||r.getAuthToken!==t.getAuthToken||!w(r.user,t.user)||r.project!==t.project)&&(Ye.set(e,{applied:!0,getAuthToken:t.getAuthToken,user:t.user,project:t.project}),ln(e,t.getAuthToken,t.user,t.project))}function Ze(e){if(e.getInstance(Je))return;e.inject(Je,!0);let t;e.getInstance(le)?.watch(r=>{t=r}),e.addService(x,{execute:async(r,n)=>{if(n?.public||!t?.getAuthToken)return;e.getInstance(re)===void 0&&Qe(e,t);const i=await e.getInstanceAsync(re);i&&r.headers.set("authorization",`Bearer ${i}`)}})}var dn={text:{fontFamily:["Google Fonts","Sans Serif","Mulish","Regular"],fontSize:16,fontSizeDim:"px",lineHeight:24,lineHeightDim:"px",color:"#595959",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},headings:{fontFamily:["Google Fonts","Sans Serif","Mulish","Bold"],fontSize:28,fontSizeDim:"px",lineHeight:34,lineHeightDim:"px",color:"#000000",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},links:{color:"#1890ff",contrastColor:"#FFFFFF",underline:!0},buttons:{fontFamily:["Google Fonts","Sans Serif","Mulish","Medium"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1890ff",bold:!1,italic:!1,backgroundColor:"#1890ff",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:6,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},textAlign:"center",padding:{all:null,top:null,right:null,bottom:null,left:null}},block:{backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1890ff",padding:{all:null,top:null,right:null,bottom:null,left:null}},cards:{contrastBackgroundColor:"#1890ff",contrastTextColor:"#ffffff",baseBackgroundColor:"#f8f8f8",baseTextColor:"#333333",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}}},et="ERROR",fn="useblocks",En={em_color_scheme:"em_color_scheme",em_code_mode_pane_sizes:"em_code_mode_pane_sizes",em_preview_pane_sizes:"em_preview_pane_sizes",em_default_sizes:"em_default_sizes",em_pane_sizes:"em_pane_sizes",em_test_emails:"em_test_emails",em_menu_is_locked:"em_menu_is_locked",em_code_mode_settings:"em_code_mode_settings",em_folder_is_open:"em_folder_is_open",em_active_tab:"em_active_tab",em_ai_settings:"em_ai_settings",em_last_active_page:"em_last_active_page",em_layout_convert_never_suggest:"em_layout_convert_never_suggest",em_filemanager_v2:"em_filemanager_v2",em_projects_v2:"em_projects_v2",em_translations_v2:"em_translations_v2",em_defer_chrome:"em_defer_chrome",em_stripo_import:"em_stripo_import",em_guest_locale:"em_guest_locale"},pn="light",hn="dark",On="(prefers-color-scheme: dark)",gn={MESSAGE:"message",INIT_PREVIEW:"init_preview",UPDATE_PREVIEW:"update_preview",UPDATE_EDITOR:"update_editor",UPDATE_EDITOR_POSITION:"update_editor_position",UPDATE_SIDE_MENU_EDITOR:"update_side_menu_editor",SAVE_EMAIL:"saveEmail",SANDBOX_ELEMENT_SETTINGS_SET:"sandbox_element_settings_set",SANDBOX_IMAGE_RESET:"sandbox_image_reset",SANDBOX_NATIVE_IMAGE_DROP_CLEAR:"sandbox_native-image-drop-clear",SANDBOX_EMAIL_SETTINGS_SET:"sandbox_email_settings_set",SANDBOX_BLOCK_SETTINGS_SET:"sandbox_block_settings_set",SANDBOX_ELEMENT_PARENT_GET:"sandbox_element_parent_get",SANDBOX_ELEMENT_PARENT_TABLE_GET:"sandbox_element_parent_table_get",SANDBOX_ELEMENT_PREV_GET:"sandbox_element_prev_get",SANDBOX_ELEMENT_NEXT_GET:"sandbox_element_next_get",SANDBOX_ELEMENT_REMOVE:"sandbox_element_remove",SANDBOX_ELEMENT_ACTIVE_RESET:"sandbox_element_active_reset",SANDBOX_ELEMENT_ACTIVE_SET:"sandbox_element_active_set",SANDBOX_ELEMENT_HOVER_SET:"sandbox_element_hover_set",SANDBOX_ELEMENT_IMG_LINK:"sandbox_element_img_link",SANDBOX_ELEMENT_TEXT:"sandbox_element_text",SANDBOX_EMAIL_CONTENT_GET:"sandbox_email_content_get",SANDBOX_SET_POSITION_TO_IMG:"sandbox_set_position_to_img",SANDBOX_SET_POSITION_TO_LINK:"sandbox_set_position_to_link",SANDBOX_ACCORDION_ADD_SECTION:"sandbox_accordion_add_section",SANDBOX_ACCORDION_REMOVE_SECTION:"sandbox_accordion_remove_section",APPLICATION_FOCUS_IN_IFRAME:"application_focus_in_iframe",APPLICATION_EMAIL_SETTINGS_SET:"application_email_settings_set",APPLICATION_BLOCK_SETTINGS_SET:"application_block_settings_set",APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",_APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",APPLICATION_ELEMENT_SETTINGS_CLOSE:"application_element_settings_close",APPLICATION_ACTION:"application_action",APPLICATION_EBLOCK_ADD:"application_eblock_add",SANDBOX_EBLOCK_SET_EM_BLOCK_ID:"sandbox_eblock_set_em_block_id",SANDBOX_GLOBAL_BLOCK_REPLACE:"sandbox_global_block_replace",APPLICATION_SCROLL_TO:"application_scroll-to",APPLICATION_SCROLL_BLOCK_SHOW:"application_scroll-block-show",APPLICATION_SCROLL_BLOCK_HIDE:"application_scroll-block-hide",APPLICATION_DISCUSS_SET_ID:"application_discuss_set_id",APPLICATION_DISCUSS_GET_COMMENT:"application_discuss_get_comment",APPLICATION_DISCUSS_NO_COMMENT:"application_discuss_no_comment",APPLICATION_DISCUSS_SAVE_TARGET:"application_discuss_save_target",APPLICATION_IFRAME_SET_HEIGHT:"application_iframe_set_height",APPLICATION_COMMON_STYLES_UPDATE:"application_commonStyles_update",APPLICATION_EMAIL_CONTENT_GET:"application_email_content_get",APPLICATION_OPEN_IMAGE_AI_POPUP:"application_open-image-ai-popup",APPLICATION_OPEN_IMAGE_UPLOAD_POPUP:"application_open-image-upload-popup",APPLICATION_OPEN_IMAGE_EDIT_POPUP:"application_open-image-edit-popup",APPLICATION_OPEN_IMAGE_GIF_POPUP:"application_open-image-gif-popup",APPLICATION_OPEN_IMAGE_STOCK_POPUP:"application_open-image-stock-popup",APPLICATION_CLOSE_IMAGE_EDIT_POPUP:"application_close-image-edit-popup",APPLICATION_NATIVE_IMAGE_DROP:"application_native-image-drop",APPLICATION_SUBJECT_UPDATE:"application_subject_update",APPLICATION_PREHEADER_UPDATE:"application_preheader_update",APPLICATION_DOMPARSER_ERROR:"application_domparser_error",APPLICATION_UPDATE_ENTITY:"application_update_entity",APPLICATION_IFRAME_DRAG_EVENT:"application_iframe_drag_event",APPLICATION_HAS_AMP:"application_has_amp",APPLICATION_CANVAS_IMAGE_GET:"application_canvas_image_get",APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:"application_atom_inserted",APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW:"application_template_not_em_alert_show",SANDBOX_WINDOW_CHARACTERISTIC:"sandbox_window-characteristic",SANDBOX_IFRAME_SETSIZE:"sandbox_iframe-setsize",SANDBOX_BLOCK_INSERT:"sandbox_block-insert",SANDBOX_ATOM_INSERT:"sandbox_atom-insert",SANDBOX_DRAG_CANCEL:"sandbox_drag-cancel",UPDATE_EDITOR_POSITION_FROM_EDITOR:"update_position_from_editor",UPDATE_EDITOR_POSITION_FROM_IFRAME:"update_position_from_iframe",SANDBOX_CHANGE_PREVIEW:"sandbox_change_preview",APPLICATION_CHANGE_PREVIEW:"application_change_preview",SANDBOX_LOCK_EDIT:"sandbox_lock_edit",SANDBOX_FLOATBLOCK_ADD:"sandbox_floatBlock_add",SANDBOX_FLOATBLOCK_REMOVE:"sandbox_floatBlock_remove",SANDBOX_FLOATBLOCK_COPY:"sandbox_floatBlock_copy",SANDBOX_FLOATBLOCK_SWAP:"sandbox_floatBlock_swap",EDITOR_CHANGE_FOCUS:"editor_change_focus",SANDBOX_RESIZED:"sandbox_resized",SANDBOX_LOCK_DISCUSS:"sandbox_lock_discuss",SANDBOX_DISCUSS_SET_TARGET:"sandbox_discuss_set_target",SANDBOX_DISCUSS_REMOVE_TARGET:"sandbox_discuss_remove_target",SANDBOX_DISCUSS_RESET:"sandbox_discuss_reset",SANDBOX_DISCUSS_GET_TARGET:"sandbox_discuss_get_target",SANDBOX_READY:"SANDBOX_READY",SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:"sandbox_subject_update",SANDBOX_PREHEADER_UPDATE:"sandbox_preheader_update",SANDBOX_DRAG_EVENT:"sandbox_drag_event",SANDBOX_WHEEL:"sandbox_wheel",SANDBOX_ADD_MERGETAG:"sandbox_add_mergetag",SANDBOX_TRANSLATIONS:"sandbox_send_translations",SANDBOX_SET_THEME_VARIABLES:"sandbox_send_theme_variables",SANDBOX_SET_PROJECT_FONTS:"sandbox_set_project_fonts",SANDBOX_CANVAS_IMAGE_CACHE_SETUP:"sandbox_canvas_image_cache_setup",SANDBOX_SET_ENTITY:"sandbox_set_entity",SANDBOX_INIT_START:"sandbox_init_start",SANDBOX_INITED:"sandbox_inited",SANDBOX_UPDATE_ENTITY:"sandbox_update_entity",RELOAD:"reload",SANDBOX_ADD_EXTENSIONS:"sandbox_add_extensions",SANDBOX_REMOVE_EXTENSIONS:"sandbox_remove_extensions",SANDBOX_ADD_SCRIPT:"sandbox_add_script",SANDBOX_IS_EMAIL_EMPTY:"sandbox_is_email_empty",SANDBOX_SWITCH_THEME:"sandbox_switch_theme"},An={language:"html",detectIndentation:!1,wordWrap:"on",wrappingIndent:"same",smoothScrolling:!0,automaticLayout:!0,tabSize:2,indentSize:2},tt=e=>{const t={current:Promise.resolve(),state:e,decorate:(r,n)=>(n&&(r=r.bind(n)),function(...i){const o=t.current.then(()=>r(...i));return t.current=o.then(s=>{t.state=s},s=>{}),o})};return t};function ne(e){return function(t){return{setOptions:()=>{},instance:{},dispose:()=>{},...e(t)||{}}}}function In(e){return t=>{const r={},n=[];for(const s of e)n.push(s(t));for(const s of n)Object.assign(r,s.instance);return{instance:r,setOptions:async s=>{for(const a of n)await a.setOptions(s)},dispose:()=>{for(const s of n)s.dispose()}}}}function mn(e=et){const t=new Error(e);return t.name="AuthPipelineError",t}async function rt(e,t,r,n){const i=n?.attemptTimeout??N(r),o=N(r)?Fe(r):v(r).length>0?[k(r)]:[];if(o.length===0)throw new Error("[apiOriginFailover] no API base URL configured");const s=e.startsWith("/")?e:`/${e}`;let a,c;for(let _=0;_<o.length;_++){const l=o[_],E=_===o.length-1,h=i?Ue(t.signal):void 0;try{const p=await fetch(`${l}${s}`,{...t,...h?{signal:h.signal}:{}});if(!p.ok&&Ge(p.status)){if(a=p,!E){U(l,r);continue}break}return p.ok&&Ve(l,r),p}catch(p){const A=h?.timeoutError();if(!A&&!Xe(p))throw p;c=A||p,E||U(l,r)}finally{h?.done()}}if(N(r)&&We(),a)return a;throw c instanceof Error?c:new Error("[apiOriginFailover] fetch chain failed")}function nt(e){e.inject(C,void 0),e.inject(z,void 0)}var Tn=ne(e=>{let t,r;const n=tt();return e.addService(x,{execute:n.decorate(async(i,o)=>{if(o?.public||!t)return;const s=String(e.getInstance(z)||"").trim();if(s){i.headers.append("authorization",`Bearer ${s}`);return}if(!e.getInstance(C))try{const a=e.getInstance($e),c=String(a?.getOptions()?.baseUrl||"").trim(),_=ke(r||c||void 0);if(!_)throw new Error("JWT auth requires baseUrl");const l=await rt("/jwt-auth/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},_);if(!l.ok)throw new Error(`JWT auth failed: ${l.status}`);const E=await l.json(),h=String(E.token||"").trim();if(!h)throw new Error("JWT auth failed: empty token");e.inject(C,void 0),e.inject(z,h),i.headers.append("authorization",`Bearer ${h}`)}catch{throw e.inject(C,et),mn()}})}),{setOptions(i){const o=i.jwtAuth,s=String(i.baseUrl||"").trim()||void 0,a=!w(o,t),c=s!==r;if(t=o,r=s,!o){nt(e);return}a||c?nt(e):e.inject(C,void 0)}}}),Sn=ne(e=>(Ze(e),{setOptions(t){Qe(e,t)}}));function bn(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/([^a-zA-Z0-9_-])/g,"\\$1")}function ie(e,t=document){try{const n=t.querySelector(e);if(n)return n}catch{return null}const r=t.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;if(!i)continue;const o=ie(e,i);if(o)return o}return null}function it(e,t=[]){const r=e.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;i&&(t.push(i),it(i,t))}return t}function Dn(e,t,r){if(e.isConnected)return e;const n=e.id?.trim();return n?ot(`#${bn(n)}`,t,r):Promise.reject(S("Editor mount element was disconnected and has no id — pass a CSS selector or call init() again after the host remounts the container."))}function ot(e,t,r){if(q(r),typeof e<"u"){if(typeof e=="string"){const n=e,i=ie(n);if(i)return i;const o=t.addDisposable(new I);return new Promise((s,a)=>{const c=O=>{o.dispose(),O()},_=()=>{c(()=>a(S(r?.reason)))};if(r?.aborted){_();return}r?.addEventListener("abort",_),o.addDispose(()=>r?.removeEventListener("abort",_));const l=document.body??document.documentElement;if(!l){c(()=>a(S("Document is not ready to observe mount element")));return}const E=new Set,h=new MutationObserver(()=>{const O=ie(n);if(O){c(()=>s(O));return}A()}),p=O=>{E.has(O)||(E.add(O),h.observe(O,{attributes:!0,childList:!0,subtree:!0}))},A=()=>{const O=document.documentElement;if(O)for(const G of it(O))p(G)};p(l),A(),o.addDispose(()=>h.disconnect())})}return e instanceof Element?Dn(e,t,r):e}return e}var Nn=new Map;Object.defineProperty(u,"ADVANCED_SETTINGS_PANEL",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(u,"APP_ID",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(u,"APP_LOAD_EVENT_ID",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(u,"ATOMS_HANDLERS_ID",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(u,"AsyncEmitter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(u,"BaseEmitter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(u,"COMMON_STYLES",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(u,"CONFIG_CHANGED_EVENT_ID",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(u,"CONFIG_SOURCE_ID",{enumerable:!0,get:function(){return de}}),Object.defineProperty(u,"COOKIE_MANAGER_ID",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(u,"CUSTOM_FETCH_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(u,"ContentType",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(u,"DARK",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(u,"DISPOSABLE_ID",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(u,"DependencyResolver",{enumerable:!0,get:function(){return $}}),Object.defineProperty(u,"Disposable",{enumerable:!0,get:function(){return I}}),Object.defineProperty(u,"ELEMENT_MAP",{enumerable:!0,get:function(){return Nn}}),Object.defineProperty(u,"EVENT_TYPES",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(u,"Emitter",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(u,"HANDLE_ATOM_INSERT_ID",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(u,"HEADLESS_MODE_ID",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(u,"INIT_PIPELINE_ID",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(u,"INSTANCE_ID",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(u,"JWTMixin",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(u,"LATE_SURFACE_LISTENERS_ID",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(u,"LIGHT",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(u,"LOCAL_STORAGE_ITEMS",{enumerable:!0,get:function(){return En}}),Object.defineProperty(u,"MESSAGE_SERVICE_ID",{enumerable:!0,get:function(){return er}}),Object.defineProperty(u,"MODAL_CLOSE_EVENT",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(u,"MODAL_SHOW_EVENT",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(u,"MODAL_UPDATE_EVENT",{enumerable:!0,get:function(){return or}}),Object.defineProperty(u,"MONACO_EDITOR_OPTIONS",{enumerable:!0,get:function(){return An}}),Object.defineProperty(u,"MessageService",{enumerable:!0,get:function(){return Kt}}),Object.defineProperty(u,"OAuthMixin",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(u,"OPTIONS_SOURCE_ID",{enumerable:!0,get:function(){return le}}),Object.defineProperty(u,"PLUGIN_COLLECTION_ID",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(u,"PORT_READY",{enumerable:!0,get:function(){return he}}),Object.defineProperty(u,"PREFERS_COLOR_SCHEME_DARK",{enumerable:!0,get:function(){return On}}),Object.defineProperty(u,"PUBLIC_REQUEST",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(u,"REQUEST_HANDLER_ID",{enumerable:!0,get:function(){return x}}),Object.defineProperty(u,"REST_CLIENT_FACTORY_ID",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(u,"REST_TRANSPORT_ID",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(u,"SANDBOX_EXTENSIONS_ID",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(u,"SANDBOX_EXTENSION_SCRIPT_STATUS_ID",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(u,"SECURITY_MODULE_ID",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(u,"SETTINGS_PANEL_EVENT",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(u,"STANDALONE_ACTIVATED_ID",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(u,"STANDALONE_BOOTSTRAP_TOKEN_ID",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(u,"STANDALONE_FILE_PROXY_REGISTERED_ID",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(u,"STANDALONE_PROJECT_ID",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(u,"STORE_ID",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(u,"Signal",{enumerable:!0,get:function(){return St}}),Object.defineProperty(u,"TEMPLATE_DIRECTIVES_ID",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(u,"USEBLOCKS",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(u,"combineMixins",{enumerable:!0,get:function(){return In}}),Object.defineProperty(u,"composeAbortSignals",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(u,"createAbortError",{enumerable:!0,get:function(){return S}}),Object.defineProperty(u,"createIdentifier",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(u,"createIdentifier$1",{enumerable:!0,get:function(){return d}}),Object.defineProperty(u,"createQueue",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(u,"debounce",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(u,"decodeJwt",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(u,"deepEqual",{enumerable:!0,get:function(){return w}}),Object.defineProperty(u,"defineMixin",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(u,"events",{enumerable:!0,get:function(){return K}}),Object.defineProperty(u,"fetchWithApiOriginFailover",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(u,"filter",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(u,"generateUUID",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(u,"getActiveBaseUrl",{enumerable:!0,get:function(){return k}}),Object.defineProperty(u,"getApi",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(u,"getEmitter",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(u,"getEmitter$1",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(u,"getEvent",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(u,"getServiceContainerId",{enumerable:!0,get:function(){return M}}),Object.defineProperty(u,"isAbortError",{enumerable:!0,get:function(){return It}}),Object.defineProperty(u,"mapHttpStatusToErrorCode",{enumerable:!0,get:function(){return At}}),Object.defineProperty(u,"mergeBackendProxyLayers",{enumerable:!0,get:function(){return br}}),Object.defineProperty(u,"mergeResourceProxyLayers",{enumerable:!0,get:function(){return Sr}}),Object.defineProperty(u,"mergeResourceProxyPolicyLayers",{enumerable:!0,get:function(){return Pr}}),Object.defineProperty(u,"mergeShallowConfigLayers",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(u,"pickKey",{enumerable:!0,get:function(){return Ir}}),Object.defineProperty(u,"provideOAuth",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(u,"raceWithAbortSignal",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(u,"registerRestTransport",{enumerable:!0,get:function(){return an}}),Object.defineProperty(u,"releaseContainer",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(u,"resolveContainer",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(u,"resolveExplicitApiBaseUrl",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(u,"setApiOriginFailoverHook",{enumerable:!0,get:function(){return en}}),Object.defineProperty(u,"snapshot",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(u,"throwIfAborted",{enumerable:!0,get:function(){return q}}),Object.defineProperty(u,"waitForElement",{enumerable:!0,get:function(){return ot}})});
|
|
2097
|
+
|
|
2098
|
+
|
|
2099
|
+
__useblocks__.define("static/umd/d786efbb.js",["require","exports","module"],function(f,l,m){var v=(function(){const e=typeof document<"u"&&document.createElement("link").relList;return e&&e.supports&&e.supports("modulepreload")?"modulepreload":"preload"})(),k=function(n,e){return new URL(n,e).href},h={},c=function(e,E,P){let p=Promise.resolve();if(0)var R,w;function i(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return p.then(r=>{for(const t of r||[])t.status==="rejected"&&i(t.reason);return e().catch(i)})};Object.defineProperty(l,"__vitePreload",{enumerable:!0,get:function(){return c}})});
|
|
2076
2100
|
|
|
2077
2101
|
|
|
2078
|
-
__useblocks__.define("useblocks.js",["require","exports","module","static/umd/993c2c90.js"],function(Jo,X,Om){Object.defineProperties(X,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var qn=Object.defineProperty,zn=(e,t)=>{let n={};for(var r in e)qn(n,r,{get:e[r],enumerable:!0});return t||qn(n,Symbol.toStringTag,{value:"Module"}),n};const a=Jo("./static/umd/993c2c90.js");var Qo=new Function("url","return import(url)");function Zo(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function ei(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function ti(e){return e.type==="umd"||e.resolve==="registry"}function Lm(e){return e}var ni=class{_context;_pluginRegistry;_options;_map=new Map;_optionsMap=new Map;_readyMap=new Map;_resolveMap=new Map;_initializingPlugins=new Map;_creatingPlugins=new Set;_initializedPlugins=new Set;_creationOrder=[];_lifecycleListeners=new Set;_activated=!1;constructor(e,t,n={}){this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(ei(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(ti(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Qo(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,r.onload=()=>t(),r.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(r)})}initSync(e){const t=[];for(const n of e){const r=this._getOrCreate(n,void 0);t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const{ctor:s,options:o}=await this._resolveEntry(r),i=this._getOrCreate(s,o);n.has(i)||(n.add(i),t.push(i))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const i of e){const l=await this._resolveEntry(i);t.add(l.ctor),n.push(l)}const r=[];this._map.forEach((i,l)=>{t.has(l)||r.push({key:l,plugin:i})});for(let i=r.length-1;i>=0;i--){const{key:l,plugin:c}=r[i];await this._initializingPlugins.get(c),await this._disposePlugin(c,c.constructor.name),this._map.delete(l),this._optionsMap.delete(l),this._readyMap.delete(c),this._resolveMap.delete(c),this._initializingPlugins.delete(c),this._initializedPlugins.delete(c);const d=this._creationOrder.indexOf(c);d>=0&&this._creationOrder.splice(d,1)}const s=[],o=new Set;for(const{ctor:i,options:l}of n){const c=this._getOrCreate(i,l);o.has(c)||(o.add(c),s.push(c))}this._activated&&await this._startPluginsBatch(s)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,s)=>{let o,i=!1;const l=()=>{i||(i=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,l),r())};this._pluginRegistry.on(e,l),n!==void 0&&n>0&&(o=setTimeout(()=>{i||(i=!0,this._pluginRegistry.off(e,l),s(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),s=this._createPluginInstance(e,r),o=s.constructor.name;this._emitLifecycle({type:"created",plugin:s,name:o}),s.required?.(),this._map.set(n,s),this._creationOrder.push(s),this._setupReadyPromise(s)}return this._map.get(n)}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);try{return Zo(e)?new e(this._context,t):e(this._context,t)||{}}finally{this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const s of t){if(this._initializedPlugins.has(s))continue;const o=this._initializingPlugins.get(s);if(o){n.add(o);continue}r.push(s)}if(r.length>0){const s=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,s);n.add(s),s.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===s&&this._initializingPlugins.delete(o)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(s){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:s})}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await n.afterInit?.(),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(s){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:s})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},ri=class{_plugins=new Map;_listeners=new Map;_getOrCreateEntry(e){let t=this._plugins.get(e);return t||(t={overrides:[]},this._plugins.set(e,t)),t}_applyOverrides(e,t){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const s of n)try{s.callback(t)}catch{}const r=n.filter(s=>!s.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(s=>(t.ctor=s,t.loading=void 0,this._notifyListeners(e,s),s));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!1};return r.push(s),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!0};return r.push(s),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(s=>s.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},si=class{resolveRegistry;constructor(e){this.resolveRegistry=e}target(){return this.resolveRegistry()}get(e){return this.target().get(e)}getAsync(e){return this.target().getAsync(e)}add(e,t){return this.target().add(e,t)}addAll(e){return this.target().addAll(e)}addAsync(e,t){return this.target().addAsync(e,t)}has(e){return this.target().has(e)}isLoaded(e){return this.target().isLoaded(e)}override(e,t){return this.target().override(e,t)}on(e,t){return this.target().on(e,t)}once(e,t){return this.target().once(e,t)}off(e,t){return this.target().off(e,t)}keys(){return this.target().keys()}forContext(){return this.target().forContext()}},Wn=class{capacity;items=[];constructor(e){this.capacity=e}push(e){this.items.length>=this.capacity&&this.items.shift(),this.items.push(e)}snapshot(){return this.items.slice()}size(){return this.items.length}clear(){this.items=[]}};function oi(e,t){return t+e}function ii(){return typeof performance>"u"?Date.now():oi(performance.now(),performance.timeOrigin)}var ai="emailmaker:diagnostics",li="diagnostics",ci="diagnostics";function Kn(e,t){return t?`${e}${e.includes("?")?"&":"?"}${ci}=1`:e}var _t;function di(){try{const e=new URLSearchParams(window.location.search).get(li);return e===null?void 0:e!=="0"}catch{return}}function ui(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function fi(){try{const e=window.localStorage.getItem(ai);return e===null?void 0:e==="1"}catch{return}}function Ce(){return _t===void 0&&(_t=typeof window>"u"?!1:di()??ui()??fi()??!1),_t}function pi(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var W={initStart:"loader:init:start",coreReady:"loader:core:ready",initEnd:"loader:init:end",chunksLoaded:"app:chunks:loaded",showStart:"show:start",showEnd:"show:end",canvasCreated:"canvas:created",canvasLoaded:"canvas:loaded",canvasPainted:"canvas:painted",appVisible:"app:visible",editorVisible:"editor:visible",canvasSettled:"canvas:settled"},Mm=Object.values(W),Nm=[W.canvasPainted,W.canvasSettled,W.appVisible,W.editorVisible],hi=5e3,mi=3e3,Xn="diagnosticsStore",Ve,Pe;function Jn(){return{marks:new Wn(hi),resources:new Wn(mi)}}function Qn(){if(Pe)return Pe;const e=yt();return e?(Pe=e[Xn]??Ve??Jn(),e[Xn]=Pe,Ve=void 0,Pe):(Ve??=Jn(),Ve)}function H(e,t){Ce()&&Qn().marks.push({phase:e,at:ii(),...t})}function yt(){if(typeof __useblocks__<"u"&&__useblocks__)return __useblocks__;if(typeof window>"u")return;const e=window[pi()];return e!==null&&typeof e=="object"?e:void 0}function gi(e){const t=e.length,n=Qn();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function Ei(){const e=yt();return!e||!Array.isArray(e.diagnosticsBuffer)?0:gi(e.diagnosticsBuffer)}var vi="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function St(){const e=new Error(vi);return e.name="DestroyedInstanceError",e}function bi(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function wt(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const o=e,i=t;return o.length===i.length&&o.every((l,c)=>wt(l,i[c]))}const r=Object.keys(e),s=Object.keys(t);return r.length!==s.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&wt(e[o],t[o]))}function Zn(e,t){const n={watch(r){let s,o=!1;return e.watch(i=>{const l=t(i);o&&wt(s,l)||(s=l,o=!0,r(l))})},select(r){return Zn(n,r)}};return n}function ue(...e){let t=e[0],n=e.length>0;const r=new Set,s={get(){return n?t:void 0},set(o){t=o,n=!0;for(const i of Array.from(r))i(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return Zn(s,o)}};return s}var er=class{http;constructor(e){this.http=e}app_init_create=(e,t={})=>this.http.request({path:"/app/v1/app_init",method:"POST",body:e,type:a.ContentType.UrlEncoded,...t})},tr=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},n={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...n});get_translations3=({id:e,file:t,...n},r={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...r})};function _i(e){return String(e||"").trim()||void 0}var yi=class extends a.Disposable{deps;_app;_baseUrl;_appInit;_restBaseUrl;_prevApp;constructor(e){super(),this.deps=e,this.addDisposable(e.options.select(t=>this._slice(t)).watch(t=>this._start(t)))}get app(){return this._app}_slice(e){return Object.prototype.hasOwnProperty.call(e,"baseUrl")&&(this._baseUrl=_i(e.baseUrl)),Object.prototype.hasOwnProperty.call(e,"appInit")&&(this._appInit=e.appInit),{appInit:this._appInit,user:e.user,project:e.project,baseUrl:this._baseUrl,restBaseUrl:this.deps.resolveRestBaseUrl(this._baseUrl),standalone:this.deps.isStandalone()}}_start(e){if(this._restBaseUrl!==e.restBaseUrl&&(this._restBaseUrl=e.restBaseUrl,this.deps.setRestBaseUrl(e.restBaseUrl)),e.standalone)return;const t=e.appInit||this.deps.fallbackAppInit,n=Promise.resolve(t({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:this._prevApp}));this._app=n,n.then(r=>{this._app===n&&(this._prevApp=r)},()=>{}),this.deps.publish(n)}},It=a.createIdentifier$1("AppInitService");function Si(e){return async()=>{const t=await e();return(await new er(t).app_init_create({})).data}}function wi(e){e.injectFactory(It,(t,n)=>{if(n)return n;const r=new yi({options:e.getInstance(a.OPTIONS_SOURCE_ID),isStandalone:()=>!!e.getInstance(a.SECURITY_MODULE_ID),resolveRestBaseUrl:s=>s?a.getActiveBaseUrl(s):a.getActiveBaseUrl()||void 0,setRestBaseUrl:s=>{e.getInstance(a.REST_CLIENT_FACTORY_ID)?.setOptions(s?{baseUrl:s}:{})},fallbackAppInit:Si(()=>e.getInstanceAsync(a.REST_TRANSPORT_ID)),publish:s=>{e.inject(a.APP_ID,s)}});return e.getInstance(a.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var Tt=a.createIdentifier$1("documentSession.emailDocuments");function De(e){return e?.getInstance(Tt)}var Ii=a.createIdentifier$1("RevisionServiceFlag");function Ti(e){return e.getOrCreateInstance(Ii,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function nr(e){return Ti(e).isEnabled()}var Ai=a.createIdentifier$1("EmailRightsResolver");function Ci(e,t){const n=e.getInstance(Ai);return n?n(t):!0}var rr=a.createIdentifier$1("EmailHistoryAvailabilityResolver");function Pi(e){return e.getInstance(rr)!==void 0}async function Di(e){const t=e.getInstance(rr);if(!t)return!0;try{return await t()}catch{return!1}}var At={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},sr=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],or=2e4,Ri=sr.reduce((e,t)=>e+At[t],0),ir=or+Ri+3e3;function Oi(e){return sr.reduce((t,n)=>t+ar(n,e),0)}function ar(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:At[e]}function lr(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:ir}function cr(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:or}function Ct(e=ir){return e+3e3}var xm="[show-pipeline]";function dr(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}function km(e,t){}var Li=()=>Ct();function Mi(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function Ni(e){return t=>Mi(e.getOrCreateInstance(a.events.BEFORE_SAVE_EMAIL,()=>new a.AsyncEmitter).fire(t),Li())}function xi(e){return e!=null&&e!==""}var ki;function Ye(e,t){return ki?.capture(e,t)}function Fi(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function qe(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var ee=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${qe(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${qe(this.oldText)}")`:`(replace@${this.oldPosition} "${qe(this.oldText)}" with "${qe(this.newText)}")`}};function ur(e,t){return e===null||e.length===0?t:new Bi(e,t).compress()}var Bi=class oe{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),s=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(s===null)break;this._acceptCurr(s),s=this._getCurr(++n);continue}if(s===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldEnd<=r.newPosition){this._acceptCurr(s),s=this._getCurr(++n);continue}if(r.newEnd<=s.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldPosition<r.newPosition){const[c,d]=oe._splitCurr(s,r.newPosition-s.oldPosition);this._acceptCurr(c),s=d;continue}if(r.newPosition<s.oldPosition){const[c,d]=oe._splitPrev(r,s.oldPosition-r.newPosition);this._acceptPrev(c),r=d;continue}let i,l;if(s.oldEnd===r.newEnd)i=r,l=s,r=this._getPrev(++t),s=this._getCurr(++n);else if(s.oldEnd<r.newEnd){const[c,d]=oe._splitPrev(r,s.oldLength);i=c,l=s,r=d,s=this._getCurr(++n)}else{const[c,d]=oe._splitCurr(s,r.newLength);i=r,l=c,r=this._getPrev(++t),s=d}this._result[this._resultLen++]=new ee(i.oldPosition,i.oldText,l.newPosition,l.newText),this._prevDeltaOffset+=i.newLength-i.oldLength,this._currDeltaOffset+=l.newLength-l.oldLength}const o=oe._merge(this._result);return oe._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=oe._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=oe._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new ee(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new ee(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),s=t.newText.substr(n);return[new ee(t.oldPosition,t.oldText,t.newPosition,r),new ee(t.oldEnd,"",t.newPosition+n,s)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),s=t.oldText.substr(n);return[new ee(t.oldPosition,r,t.newPosition,t.newText),new ee(t.oldPosition+n,s,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,s=t[0];for(let o=1;o<t.length;o++){const i=t[o];s.oldEnd===i.oldPosition?s=new ee(s.oldPosition,s.oldText+i.oldText,s.newPosition,s.newText+i.newText):(n[r++]=s,s=i)}return n[r++]=s,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let s=0;s<t.length;s++){const o=t[s];o.oldText!==o.newText&&(n[r++]=o)}return n}};function ji(e){return new ee(e.newPosition,e.newText,e.oldPosition,e.oldText)}function Ui(e){return e.map(ji)}function fr(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function Hi(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const s=t[r];n=n.slice(0,s.oldPosition)+s.newText+n.slice(s.oldEnd)}return n}function $i(e,t,n){let r=0;const s=e.start===e.end;for(const o of t){const i=o.newLength-o.oldLength;if(o.oldLength===0){const l=o.oldPosition;if(s&&l===e.start)r+=n==="after"?i:0;else{if(e.start<l&&l<e.end)return null;l<=e.start&&(r+=i)}continue}if(s){if(e.start>=o.oldEnd)r+=i;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=i;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var ze=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},pr=0,Gi=Math.random().toString(36).slice(2,8);function Vi(){return pr+=1,`doc-${Gi}-${pr}`}function Yi(e){const t=e.createBuffer(),n=e.docId??Vi();let r=e.serverId??null,s=0,o=null,i=e.attributes??{};const l=new Set;let c=!1,d=!1,u;const p=new Set;let E=null;const h=()=>(E?.version!==s&&(E={version:s,value:t.read()}),E.value),b=v=>Object.entries(v).some(([m,_])=>i[m]!==_);return{get:()=>({docId:n,serverId:r,version:s,savedVersion:o,attributes:i}),getContent:h,mutate(v,{source:m}){if(c)return s;const _=v.changes?.length?v.changes:void 0,y=_?Hi(h(),_):v.content!==void 0?v.content:void 0,w=y!==void 0&&y!==h(),A=v.attributes!==void 0&&b(v.attributes);if(!w&&!A)return s;const C=!(s>(o??-1)),g=A?Object.keys(v.attributes).filter(f=>i[f]!==v.attributes[f]):[];w&&t.write(y),A&&(i={...i,...v.attributes}),s+=1,m!=="user"&&C&&(o=s);const I={source:m,version:s,changes:_,...w?{content:!0}:{},...g.length>0?{attributes:g}:{}};return l.forEach(f=>f(I)),s},markSaved(v,m){const _={serverId:r,savedVersion:o};m!==void 0&&(r=m),(o===null||v>o)&&(o=v),(_.serverId!==r||_.savedVersion!==o)&&l.forEach(y=>y({source:"system",version:s}))},markUnsaved(){c||o===null||o<s||(o=s-1,l.forEach(v=>v({source:"system",version:s})))},markReady(){d||u!==void 0||(d=!0,p.forEach(v=>v.resolve()),p.clear(),l.forEach(v=>v({source:"system",version:s})))},isReady:()=>d,markFailed(v){d||u!==void 0||c||(u=v,p.forEach(m=>m.reject(new ze(v))),p.clear(),l.forEach(m=>m({source:"system",version:s})))},failure:()=>u,whenReady(){return d?Promise.resolve():u!==void 0?Promise.reject(new ze(u)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((v,m)=>{p.add({resolve:v,reject:m})})},subscribe(v){return l.add(v),()=>l.delete(v)},isNew:()=>r===null,isDirty:()=>s>(o??-1),isDisposed:()=>c,dispose(){c=!0,p.forEach(v=>v.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),p.clear(),l.clear(),t.dispose()}}}var qi=500,zi=100,Pt=0;function Wi(e,t={}){const n=t.groupIntervalMs??qi,r=t.maxSteps??zi,s=t.now??(()=>0);let o=[],i=0,l=Pt+=1,c=null,d=!1,u=!1,p=!1;const E=new Set,h=()=>E.forEach(g=>g()),b=(g,I)=>{if(g.length){u=!0;try{e.mutate({changes:g},{source:I})}finally{u=!1}}},v=g=>b(g,"user"),m=g=>{const I=s();d&&c!==null&&I-c<n?o[i-1]=ur(o[i-1],g):(o=o.slice(0,i),o.push(g),i=o.length,d=!0,o.length>r&&(o=o.slice(o.length-r),i=o.length,l=Pt+=1)),c=I,h()},_=()=>{d=!1,c=null},y=g=>{if(!g.length)return;const I=o.length>i;I&&(o=o.slice(0,i)),i>0&&(o[i-1]=ur(o[i-1],g)),_(),I&&h()},w=e.subscribe(({source:g,changes:I})=>{if(!(p||u||!I?.length)){if(g==="remote"){A();return}if(g!=="user"){y(I);return}m(I)}}),A=()=>{o=[],i=0,_(),l=Pt+=1,h()},C=()=>{if(i===0)return!1;const g=Ui(o[i-1]);return fr(e.getContent(),g)?(v(g),i-=1,_(),!0):(o=o.slice(0,i-1),i=o.length,_(),h(),!1)};return{canUndo:()=>i>0,canRedo:()=>i<o.length,undo(){C()&&h()},redo(){if(!(i>=o.length)){if(!fr(e.getContent(),o[i])){o=o.slice(0,i),_(),h();return}v(o[i]),i+=1,_(),h()}},clear:A,applyWithoutHistory(g){const I=e.get().version;if(b(g,"system"),e.get().version===I){_();return}y(g)},getPast:g=>o.slice(0,i).reverse().slice(0,g),getFuture:g=>o.slice(i).reverse().slice(0,g),createSnapshot:()=>({stackId:l,index:i}),restoreSnapshot(g){if(g.stackId!==l||g.index>i)return!1;for(;i>g.index;)if(!C())return h(),!1;return h(),!0},subscribe(g){return E.add(g),()=>E.delete(g)},dispose(){p=!0,w(),E.clear(),o=[],i=0}}}var Ki=["edit","move","resize","insert"];function Dt(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Xi(e){return typeof e=="string"?e:null}function Ji(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function Qi(e){return Ki.includes(e)?e:null}function Zi(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:Xi(t.originId),changeId:Dt(t.changeId),rev:Dt(t.rev),baseRev:Dt(t.baseRev),expected:Ji(t.expected),intent:Qi(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var hr=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},mr="draft";function me(e){return e==null||e===""?mr:String(e)}function ea(e){return e==null||e===""?`${Rt}${mr}`:`${Rt}${String(e)}`}var Rt="block:";function ne(e){return e?.startsWith(Rt)===!0}function Re(e){return ne(e.sessionKey())?void 0:e.current()}function Fm(e,t){}function Oe(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return H(`show:gate:${e}`,{kind:"wait"}),t.then(s=>(H(`show:gate:${e}:end`,{kind:"wait"}),s),s=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw a.isAbortError(s)?(`${e}`,{...n}):(`${e}`,{error:dr(s),...n},void 0),s})}var Bm=5e3;function We(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function Ot(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function ta(e,t={}){const n=We((e??[]).filter(r=>r?.html?.trim()));return Ot(n,t)?n:null}function na(e,t){const n=Date.parse(We(e)?.modified??""),r=ta(e),s=Date.parse(r?.modified??""),o=t===void 0||Number.isFinite(s)&&s>t,i=[n,t??NaN].filter(l=>Number.isFinite(l));return{autosave:o?r:null,...i.length?{latestAt:Math.max(...i)}:{}}}function ra(e,t){const n=We((e??[]).filter(i=>i?.html?.trim())),r=Date.parse(n?.modified??""),s=n&&Number.isFinite(r)&&(t===void 0||r>t),o=[Date.parse(We(e??[])?.modified??""),t??NaN].filter(i=>Number.isFinite(i));return{autosave:s&&Ot(n)?n:null,...o.length?{latestAt:Math.max(...o)}:{}}}function sa({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var gr=e=>e.replace(/\r\n?/g,`
|
|
2079
|
-
`),Er=["recovery","plugin","rest"],oa=["subject","preheader"];function ia(e){let t={},n;for(let s=Er.length-1;s>=0;s--){const o=e.get(Er[s]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(n=o.content))}const r=e.get("plugin")?.attributes;for(const s of oa){const o=r?.[s];typeof o=="string"&&o!==""&&(t={...t,[s]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function Lt(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?gr(t.content):void 0,s=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...s?{changes:[new ee(0,n,0,r)]}:{}},{source:"remote"})}var Mt=e=>typeof e=="string"?e.trim():"";function aa(e,t,n){const{version:r,attributes:s}=e.get(),o=s,i=Mt(o.title)||Mt(o.subject)||Mt(t.fallbackTitle);return{version:r,payload:{html:e.getContent(),title:i,subject:o.subject,preheader:o.preheader,description:o.description,common_styles:o.common_styles||"",meta:o.meta,utm_parameters:o.utm_parameters,parent_email:o.parent_email,is_template:o.is_template||!1,is_inited:o.is_inited,tags:o.tags,emailtags:o.emailtags,group:o.group,renderGuid:e.get().docId,project:t.project??o.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source}}}async function la(e,t,n,r,s){if(n==="materialize"&&r!=null)throw new Error("Письмо уже создано на сервере");if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(s);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,s):t.saveAutosave(r,s)}function ie(e,t=!1){const n={};for(const r of Object.keys(e)){let s=e[r];s!==void 0&&!(typeof s=="number"&&Number.isNaN(s))&&(t&&typeof s=="object"&&s!==null&&(s=ie(s)),n[r]=s)}return n}var ca=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function vr(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!ca.has(t))):{}}function Ke(e,t,n={}){e&&e.mutate({attributes:da(e.get().attributes,t)},{source:n.source??"user"})}function da(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function Nt(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function ua(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function br(e){if(!e)return null;const t=vr(e);return e.common_styles!==void 0&&(t.common_styles=ua(e.common_styles)),Nt(e.html,t)}function _r(e){return e?Nt(e.html,ie(vr(e))):null}var fa=["common_styles","subject","preheader","meta"];function yr(e){if(!e?.html?.trim())return null;const t={};for(const n of fa)pa(n,e[n])&&(t[n]=e[n]);return Nt(e.html,t)}function pa(e,t){return e==="common_styles"?typeof t=="string"&&t.startsWith("{"):e==="meta"?typeof t=="object"&&t!==null&&!Array.isArray(t):typeof t=="string"}var ha=["modified","lock"];function ma(e){if(!e)return null;const t={};for(const n of ha)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var ga=10,Ea=(e,t)=>e.key===t.key&&va(e.serverId,t.serverId),va=(e,t)=>e==null||e===t;function ba(e){return typeof e?.then=="function"}var Sr=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},wr=e=>{e.request.serverId!=null&&!xt(e)&&e.document.markSaved(e.document.get().version)},xt=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),Ir=(e,t)=>t?.content!==void 0&&sa({hasUnsavedUserEdit:xt(e)})==="skip",_a=e=>e.document.subscribe(t=>{t.source==="user"&&(t.content&&e.userTouched.add("content"),t.attributes?.forEach(n=>e.userTouched.add(n))),e.document.isDirty()||e.userTouched.clear()}),ya=(e,t)=>{!e.ready||t.content===void 0||e.document.get().serverId==null||(e.contentShown=!0,!(![...e.userTouched].every(n=>n==="content"||n in(t.attributes??{}))||!e.document.isDirty())&&(e.document.markSaved(e.document.get().version),e.userTouched.clear(),e.document.get().docId))},Sa=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([s,o])=>e.attributes[s]!==o)),r=t.content!==void 0&&t.content!==e.content?t.content:void 0;return r===void 0&&Object.keys(n).length===0?null:r===void 0?{attributes:n}:{content:r,attributes:n}},wa=e=>{const t=ia(e.reports),n=Sa(e.lastMerged,t);e.lastMerged=t,n&&(Lt(e.document,n),wr(e))},kt=(e,t)=>{if(!e.ready&&!xt(e)){wa(e);return}Lt(e.document,t)},Ia=e=>{const{attributes:t,serverId:n,docId:r}=e.document.get();return{...t,html:e.document.getContent(),id:n??void 0,isNew:n==null,renderGuid:r}};function Ta(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:s,resolveTerms:o,canEdit:i,notifyBeforeSave:l,onAdapterError:c,onTimeout:d}=e;let u;const p=new Set,E=new Set,h=()=>p.forEach(f=>f()),b=(f,S)=>{if(!(f.closed||f.ready)){if(f.error!==void 0){f.document.markFailed(f.error),f.document.get().docId;return}wr(f),f.ready=!0,f.document.markReady(),f.document.get().docId,[...f.reports.keys()]}},v=(f,S,T)=>{c?.(S.id,T),!(!S.required||f.closed)&&(f.error=T,f.document.get().docId,S.id,h())},m=(f,S)=>{const T=new Set(S.map(D=>D.id));S.forEach(D=>{D.watch&&f.watchers.push(D.watch(N=>f.closed?!1:f.ready&&(Ir(f,N)||f.contentShown===!0&&N?.content!==void 0)?(f.document.get().docId,D.id,!1):(N&&f.reports.set(D.id,N),kt(f,N),!0)))});const M=(D,N)=>{if(!f.closed){if(!D.required&&Ir(f,N)){f.document.get().docId,D.id,D.loaded?.(!1);return}N&&f.reports.set(D.id,N),kt(f,N),D.loaded?.(N!==null)}},k=()=>{T.size>0||f.closed||(Sr(f),b(f,[]))},z=[];if(S.forEach(D=>{let N;try{N=D.load()}catch(j){v(f,D,j),T.delete(D.id);return}if(ba(N)){z.push({id:D.id,required:D.required,load:()=>N,...D.loaded?{loaded:j=>D.loaded?.(j)}:{}});return}M(D,N),T.delete(D.id)}),z.length===0){k();return}f.timer=setTimeout(()=>{f.timer=void 0,d?.([...T]),f.document.get().docId,[...T],b(f,[...T])},n),f.timer.unref?.(),z.forEach(D=>{D.load().then(N=>M(D,N)).catch(N=>{v(f,D,N)}).finally(()=>{T.delete(D.id),k()})})},_=async(f,S,T)=>{if(T==="snapshot"||T==="anchor")return;const M=o?.();if(M)return M.resolve({project:S.project??f.project,tags:(f.tags??[]).map(k=>({name:k}))})},y=f=>{if(f.lock===!0&&i?.(f)===!1)return new hr("locked");const S=f.tags?.length??0,T=f.emailtags?.length??0;if(Math.max(S,T)>ga)return new hr("too-many-tags")},w=async(f,S,T)=>{try{await f.document.whenReady()}catch(N){return f.saveError=N,f.saveFailures+=1,f.saveFailures,!1}if(f.closed)return!1;const M=y(f.document.get().attributes);if(M)return f.saveError=M,f.saveFailures+=1,M.reason,h(),!1;if(l&&(await l(Ia(f)).catch(()=>{}),f.closed))return!1;let k;try{k=await _(f.document.get().attributes,T,S)}catch(N){return f.saveError=N,f.saveFailures+=1,f.saveFailures,h(),!1}if(f.closed)return!1;const{payload:z,version:D}=aa(f.document,T,k);f.document.get().docId;try{const N=f.document.get().serverId!=null,j=await la(r(),s(f.request.key),S,f.document.get().serverId,z);if(f.closed)return!0;let P;if(S==="snapshot"||S==="anchor"){const L=j?.modified!=null?Date.parse(j.modified):NaN;P=Number.isFinite(L)?L:Date.now(),f.snapshotVersion=D,f.lastRevisionAt=P}else f.document.markSaved(D,j?.id!=null?String(j.id):void 0);const O=f.document.get().serverId;!N&&O!=null&&(f.recoveryFacts={emailId:O,historyLoaded:!0,isRecovering:!1},ne(f.request.key)||(f.request={...f.request,key:me(O),serverId:O})),f.saveError=void 0,f.saveFailures=0,f.document.get().serverId,h();const B={intent:S,serverId:f.document.get().serverId,created:!N,...P!==void 0?{revisionAt:P}:{}};return E.forEach(L=>L(B)),!0}catch(N){return f.saveError=N,f.saveFailures+=1,f.saveFailures,h(),!1}},A=()=>{u&&(u.closed=!0,u.watchers.forEach(f=>f()),u.watchers=[],Sr(u),u.history.dispose(),u.document.dispose(),u=void 0)},C=(f,S,T)=>{let M=!1;S.show&&(f.show?.id!==S.show.id||f.show.token!==S.show.token)&&(f.show=S.show,M=!0,{docId:f.document.get().docId,...S.show});const k=T==="show"?_r(S.patch):null;k&&(f.reports.set("plugin",k),kt(f,k),ya(f,k)),M&&h()},g=(f,S={})=>{const T=u;return!T||T.closed||f==="materialize"&&T.document.get().serverId!=null?Promise.resolve(!1):T.saving?f==="snapshot"||f==="materialize"?Promise.resolve(!1):(T.inFlight??Promise.resolve(!1)).then(()=>g(f,S)):(T.saving=!0,h(),T.inFlight=w(T,f,S).finally(()=>{T.saving=!1,T.inFlight=void 0,u===T&&!T.closed&&h()}),T.inFlight)},I=(f,S="open")=>{if(u&&!u.closed&&S!=="new"&&Ea(u.request,f))return C(u,f,S),u.document;A();const T=Yi({createBuffer:()=>Fi(""),serverId:f.serverId??null}),M={request:f,show:f.show,document:T,history:Wi(T,{now:Date.now}),watchers:[],userTouched:new Set,saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return u=M,M.watchers.push(_a(M)),T.get().docId,f.serverId,m(M,t(f,{publishRecoveryFacts(k){M.closed||(M.recoveryFacts=k,h())},readShownContent:()=>M.closed?null:M.document.getContent()})),h(),T};return{openWith:I,open:(f,S={})=>I({key:me(f),serverId:f,email:S.email,patch:S.patch,show:S.show},"open"),openDraft:(f,S={})=>I({key:me(void 0),serverId:null,email:f,patch:S.patch,show:S.show},"open"),startNewDraft:(f,S={})=>I({key:me(void 0),serverId:null,email:f,patch:S.patch,show:S.show},"new"),reload:(f,S={})=>I({key:me(f),serverId:f,email:S.email,patch:S.patch,show:S.show},"new"),openBlock:(f,S)=>I({key:ne(f)?f:ea(f),serverId:S?.id!=null?String(S.id):null,email:S},"open"),show:(f,S)=>{const T=u;if(!(!T||T.closed))return I({...T.request,patch:f,show:S},"show")},current:()=>u?.document,noteServerFacts:({serverId:f,block:S},T)=>{const M=u;!M||M.closed||M.request.serverId!==f||ne(M.request.key??"")===S&&Lt(M.document,ma(T))},save:g,saveState:()=>({error:u?.saveError,failures:u?.saveFailures??0,saving:u?.saving===!0}),revisionFacts(){if(!u)return;const f=u.revisionFactsSnapshot;return f&&f.snapshotVersion===u.snapshotVersion&&f.lastRevisionAt===u.lastRevisionAt?f:(u.revisionFactsSnapshot={snapshotVersion:u.snapshotVersion,lastRevisionAt:u.lastRevisionAt},u.revisionFactsSnapshot)},recoveryFacts:()=>u?.recoveryFacts,history:()=>u?.history,forcedHeaders:()=>u?.forcedHeaders,beginForcedHeaders(f){u&&!u.closed&&(u.forcedHeaders=f)},endForcedHeaders(){u&&(u.forcedHeaders=void 0)},onSaved(f){return E.add(f),()=>E.delete(f)},showFacts:()=>u?.show,sessionKey:()=>u?.request.key,openError:()=>u?.error,subscribe(f){return p.add(f),()=>p.delete(f)},close(){u&&(A(),h())}}}var Tr=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function Ar(e){if(e instanceof Tr)return e.reason;if(e instanceof ze)return Ar(e.reason)}function Aa(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new Tr("not-found");return br(n)}}}var Cr=a.createIdentifier$1("EmailPort");function Ca(e){return e.getInstance(Cr)}function Pa(e,t){e.inject(Cr,t)}var Pr=a.createIdentifier$1("documentSession.restEmailPortFactories");function Dr(e){return e.getInstance(Pr)!==void 0}function fe(e){const t=e.getInstance(Pr);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var Da=a.createIdentifier$1("EmailTermsResolver");function Ra(e){return e.getInstance(Da)}var Rr=a.createIdentifier$1("EmailHistoryPort"),Oa=a.createIdentifier$1("BlockHistoryPort");function Or(e){return e.getInstance(Oa)}function Lr(e){return e.getInstance(Rr)}function La(e,t){e.inject(Rr,t)}var Ma="em_autosave_pending",jm=6e4;function Xe(e){return`${Ma}_${e}`}function Na(e,t){try{sessionStorage.setItem(Xe(e),JSON.stringify(t))}catch{}}function xa(e){try{const t=sessionStorage.getItem(Xe(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(Xe(e)),null):n}catch{return null}}function Je(e){try{sessionStorage.removeItem(Xe(e))}catch{}}var ka=2e3,Fa=5e3,Ba=5,ja=5e3,Ua=4;function Ha(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function $a(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
2102
|
+
__useblocks__.define("useblocks.js",["require","exports","module","static/umd/b11043e6.js","static/umd/450a82ad.js","static/umd/d786efbb.js"],function(pt,J,Dv){Object.defineProperties(J,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const qt=pt("./static/umd/b11043e6.js"),l=pt("./static/umd/450a82ad.js"),_a=pt("./static/umd/d786efbb.js");var ba=new Function("url","return import(url)");function ya(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function zt(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Or(e){return e.type==="umd"||e.resolve==="registry"}var Sa="If the plugin is built on globals, enable the compatibility layer: the `compatGlobals` option of the bundler plugin or `import '<package>/compat-globals'` before creating the editor.";function Ia(e){const t=Array.isArray(e)?e[0]:e;return zt(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function wa(e,t){const n=Ia(e),r=zt(e)?e:void 0,s=t instanceof Error?t.message:String(t),o=r&&Or(r)&&!/compat/iu.test(s)?` ${Sa}`:"",i=new Error(`Plugin "${n}" was skipped: it failed to load. ${s}${o}`);return i.cause=t,{name:n,url:r?.url,error:i}}function Ta(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}function Pv(e){return e}var Ca=class{_context;_pluginRegistry;_options;_map=new Map;_optionsMap=new Map;_readyMap=new Map;_resolveMap=new Map;_initializingPlugins=new Map;_creatingPlugins=new Set;_initializedPlugins=new Set;_creationOrder=[];_lifecycleListeners=new Set;_activated=!1;constructor(e,t,n={}){this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(zt(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(Or(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await ba(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,this._options.explainScriptFailure?.();let s;const o=a=>{s||(a.filename===r.src?s=this._scriptExecutionError(e,a.error??a.message):Ta(a)&&(s=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},i=()=>window.removeEventListener("error",o);window.addEventListener("error",o),r.onload=()=>{if(i(),s){n(s);return}t()},r.onerror=()=>{i(),n(new Error(`Failed to load script: ${e}`))},document.head.appendChild(r)})}_scriptExecutionError(e,t){const n=t instanceof Error?t.message:String(t),r=new Error(`Plugin script "${e}" threw while executing: ${n}`);return r.cause=t,r}initSync(e){const t=[];for(const n of e){const r=this._createOrSkip(n,void 0);r&&t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const s=await this._resolveOrSkip(r);if(!s)continue;const o=this._createOrSkip(s.ctor,s.options);o&&!n.has(o)&&(n.add(o),t.push(o))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const i of e){const a=await this._resolveOrSkip(i);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((i,a)=>{t.has(a)||r.push({key:a,plugin:i})});for(let i=r.length-1;i>=0;i--){const{key:a,plugin:c}=r[i];await this._initializingPlugins.get(c),await this._disposePlugin(c,c.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(c),this._resolveMap.delete(c),this._initializingPlugins.delete(c),this._initializedPlugins.delete(c);const d=this._creationOrder.indexOf(c);d>=0&&this._creationOrder.splice(d,1)}const s=[],o=new Set;for(const{ctor:i,options:a}of n){const c=this._createOrSkip(i,a);c&&!o.has(c)&&(o.add(c),s.push(c))}this._activated&&await this._startPluginsBatch(s)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,s)=>{let o,i=!1;const a=()=>{i||(i=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(o=setTimeout(()=>{i||(i=!0,this._pluginRegistry.off(e,a),s(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),s=this._createPluginInstance(e,r),o=s.constructor.name;this._emitLifecycle({type:"created",plugin:s,name:o}),s.required?.(),this._map.set(n,s),this._creationOrder.push(s),this._setupReadyPromise(s)}return this._map.get(n)}async _resolveOrSkip(e){try{return await this._resolveEntry(e)}catch(t){const n=wa(e,t);try{this._options.reportLoadFailure?.(n)}catch{}return}}_createOrSkip(e,t){try{return this._getOrCreate(e,t)}catch(n){const r=e.name||"anonymous plugin";this._emitLifecycle({type:"create:error",ctor:e,name:r,error:n});return}}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);const r=this._options.openEarlyWindow?.();try{return ya(e)?new e(this._context,t):e(this._context,t)||{}}finally{r?.(),this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const s of t){if(this._initializedPlugins.has(s))continue;const o=this._initializingPlugins.get(s);if(o){n.add(o);continue}r.push(s)}if(r.length>0){const s=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,s);n.add(s),s.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===s&&this._initializingPlugins.delete(o)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});const s=this._options.openEarlyWindow?.();try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(o){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:o})}finally{s?.()}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await n.afterInit?.(),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(s){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:s})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},Aa=class{_plugins=new Map;_listeners=new Map;_getOrCreateEntry(e){let t=this._plugins.get(e);return t||(t={overrides:[]},this._plugins.set(e,t)),t}_applyOverrides(e,t){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const s of n)try{s.callback(t)}catch{}const r=n.filter(s=>!s.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(s=>(t.ctor=s,t.loading=void 0,this._notifyListeners(e,s),s));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!1};return r.push(s),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!0};return r.push(s),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(s=>s.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},Da=class{resolveRegistry;constructor(e){this.resolveRegistry=e}target(){return this.resolveRegistry()}get(e){return this.target().get(e)}getAsync(e){return this.target().getAsync(e)}add(e,t){return this.target().add(e,t)}addAll(e){return this.target().addAll(e)}addAsync(e,t){return this.target().addAsync(e,t)}has(e){return this.target().has(e)}isLoaded(e){return this.target().isLoaded(e)}override(e,t){return this.target().override(e,t)}on(e,t){return this.target().on(e,t)}once(e,t){return this.target().once(e,t)}off(e,t){return this.target().off(e,t)}keys(){return this.target().keys()}forContext(){return this.target().forContext()}},Lr=class{capacity;items=[];constructor(e){this.capacity=e}push(e){this.items.length>=this.capacity&&this.items.shift(),this.items.push(e)}snapshot(){return this.items.slice()}size(){return this.items.length}clear(){this.items=[]}};function Pa(e,t){return t+e}function Ra(){return typeof performance>"u"?Date.now():Pa(performance.now(),performance.timeOrigin)}var Oa="emailmaker:diagnostics",La="diagnostics",Na="diagnostics";function Nr(e,t){return t?`${e}${e.includes("?")?"&":"?"}${Na}=1`:e}var Kt;function Ma(){try{const e=new URLSearchParams(window.location.search).get(La);return e===null?void 0:e!=="0"}catch{return}}function xa(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function ka(){try{const e=window.localStorage.getItem(Oa);return e===null?void 0:e==="1"}catch{return}}function Ue(){return Kt===void 0&&(Kt=typeof window>"u"?!1:Ma()??xa()??ka()??!1),Kt}function Fa(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var X={initStart:"loader:init:start",coreReady:"loader:core:ready",initEnd:"loader:init:end",chunksLoaded:"app:chunks:loaded",showStart:"show:start",showEnd:"show:end",canvasCreated:"canvas:created",canvasLoaded:"canvas:loaded",canvasPainted:"canvas:painted",appVisible:"app:visible",editorVisible:"editor:visible",canvasSettled:"canvas:settled"},Rv=Object.values(X),Ov=[X.canvasPainted,X.canvasSettled,X.appVisible,X.editorVisible],Ba=5e3,ja=3e3,Mr="diagnosticsStore",ht,$e;function xr(){return{marks:new Lr(Ba),resources:new Lr(ja)}}function kr(){if($e)return $e;const e=Xt();return e?($e=e[Mr]??ht??xr(),e[Mr]=$e,ht=void 0,$e):(ht??=xr(),ht)}function V(e,t){Ue()&&kr().marks.push({phase:e,at:Ra(),...t})}function Xt(){if(typeof __useblocks__<"u"&&__useblocks__)return __useblocks__;if(typeof window>"u")return;const e=window[Fa()];return e!==null&&typeof e=="object"?e:void 0}function Ua(e){const t=e.length,n=kr();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function $a(){const e=Xt();return!e||!Array.isArray(e.diagnosticsBuffer)?0:Ua(e.diagnosticsBuffer)}var Ha="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function fe(){const e=new Error(Ha);return e.name="DestroyedInstanceError",e}function Va(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function Jt(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const o=e,i=t;return o.length===i.length&&o.every((a,c)=>Jt(a,i[c]))}const r=Object.keys(e),s=Object.keys(t);return r.length!==s.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Jt(e[o],t[o]))}function Fr(e,t){const n={watch(r){let s,o=!1;return e.watch(i=>{const a=t(i);o&&Jt(s,a)||(s=a,o=!0,r(a))})},select(r){return Fr(n,r)}};return n}function ie(...e){let t=e[0],n=e.length>0;const r=new Set,s={get(){return n?t:void 0},set(o){t=o,n=!0;for(const i of Array.from(r))i(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return Fr(s,o)}};return s}var Ga=class{http;constructor(e){this.http=e}app_init_create=(e,t={})=>this.http.request({path:"/app/v1/app_init",method:"POST",body:e,type:l.ContentType.UrlEncoded,...t})},Br=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},n={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...n});get_translations3=({id:e,file:t,...n},r={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...r})};function Ya(e){return String(e||"").trim()||void 0}var Wa=class extends l.Disposable{deps;_app;_baseUrl;_appInit;_restBaseUrl;_prevApp;constructor(e){super(),this.deps=e,this.addDisposable(e.options.select(t=>this._slice(t)).watch(t=>this._start(t)))}get app(){return this._app}_slice(e){return Object.prototype.hasOwnProperty.call(e,"baseUrl")&&(this._baseUrl=Ya(e.baseUrl)),Object.prototype.hasOwnProperty.call(e,"appInit")&&(this._appInit=e.appInit),{appInit:this._appInit,user:e.user,project:e.project,baseUrl:this._baseUrl,restBaseUrl:this.deps.resolveRestBaseUrl(this._baseUrl),standalone:this.deps.isStandalone()}}_start(e){if(this._restBaseUrl!==e.restBaseUrl&&(this._restBaseUrl=e.restBaseUrl,this.deps.setRestBaseUrl(e.restBaseUrl)),e.standalone)return;const t=e.appInit||this.deps.fallbackAppInit,n=Promise.resolve(t({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:this._prevApp}));this._app=n,n.then(r=>{this._app===n&&(this._prevApp=r)},()=>{}),this.deps.publish(n)}},Qt=l.createIdentifier$1("AppInitService");function qa(e){return async()=>{const t=await e();return(await new Ga(t).app_init_create({})).data}}function za(e){e.injectFactory(Qt,(t,n)=>{if(n)return n;const r=new Wa({options:e.getInstance(l.OPTIONS_SOURCE_ID),isStandalone:()=>!!e.getInstance(l.SECURITY_MODULE_ID),resolveRestBaseUrl:s=>s?l.getActiveBaseUrl(s):l.getActiveBaseUrl()||void 0,setRestBaseUrl:s=>{e.getInstance(l.REST_CLIENT_FACTORY_ID)?.setOptions(s?{baseUrl:s}:{})},fallbackAppInit:qa(()=>e.getInstanceAsync(l.REST_TRANSPORT_ID)),publish:s=>{e.inject(l.APP_ID,s)}});return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var Zt=l.createIdentifier$1("documentSession.emailDocuments");function Pe(e){return e?.getInstance(Zt)}var Ka=l.createIdentifier$1("RevisionServiceFlag");function jr(e){return e.getOrCreateInstance(Ka,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function Ur(e){return jr(e).isEnabled()}var Xa=l.createIdentifier$1("EmailRightsResolver");function Ja(e,t){const n=e.getInstance(Xa);return n?n(t):!0}var $r=l.createIdentifier$1("EmailHistoryAvailabilityResolver");function Qa(e){return e.getInstance($r)!==void 0}async function Za(e){const t=e.getInstance($r);if(!t)return!0;try{return await t()}catch{return!1}}var en={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},Hr=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],Vr=2e4,el=Hr.reduce((e,t)=>e+en[t],0),Gr=Vr+el+3e3;function tl(e){return Hr.reduce((t,n)=>t+Yr(n,e),0)}function Yr(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:en[e]}function Wr(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:Gr}function qr(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:Vr}function tn(e=Gr){return e+3e3}var Lv="[show-pipeline]";function zr(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}function Nv(e,t){}var nl=()=>tn();function rl(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function sl(e){return t=>rl(e.getOrCreateInstance(l.events.BEFORE_SAVE_EMAIL,()=>new l.AsyncEmitter).fire(t),nl())}function ol(e){return e!=null&&e!==""}var il;function He(e,t){return il?.capture(e,t)}function al(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function mt(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var ne=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${mt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${mt(this.oldText)}")`:`(replace@${this.oldPosition} "${mt(this.oldText)}" with "${mt(this.newText)}")`}};function Kr(e,t){return e===null||e.length===0?t:new ll(e,t).compress()}var ll=class ue{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),s=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(s===null)break;this._acceptCurr(s),s=this._getCurr(++n);continue}if(s===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldEnd<=r.newPosition){this._acceptCurr(s),s=this._getCurr(++n);continue}if(r.newEnd<=s.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldPosition<r.newPosition){const[c,d]=ue._splitCurr(s,r.newPosition-s.oldPosition);this._acceptCurr(c),s=d;continue}if(r.newPosition<s.oldPosition){const[c,d]=ue._splitPrev(r,s.oldPosition-r.newPosition);this._acceptPrev(c),r=d;continue}let i,a;if(s.oldEnd===r.newEnd)i=r,a=s,r=this._getPrev(++t),s=this._getCurr(++n);else if(s.oldEnd<r.newEnd){const[c,d]=ue._splitPrev(r,s.oldLength);i=c,a=s,r=d,s=this._getCurr(++n)}else{const[c,d]=ue._splitCurr(s,r.newLength);i=r,a=c,r=this._getPrev(++t),s=d}this._result[this._resultLen++]=new ne(i.oldPosition,i.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=i.newLength-i.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const o=ue._merge(this._result);return ue._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=ue._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=ue._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new ne(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new ne(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),s=t.newText.substr(n);return[new ne(t.oldPosition,t.oldText,t.newPosition,r),new ne(t.oldEnd,"",t.newPosition+n,s)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),s=t.oldText.substr(n);return[new ne(t.oldPosition,r,t.newPosition,t.newText),new ne(t.oldPosition+n,s,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,s=t[0];for(let o=1;o<t.length;o++){const i=t[o];s.oldEnd===i.oldPosition?s=new ne(s.oldPosition,s.oldText+i.oldText,s.newPosition,s.newText+i.newText):(n[r++]=s,s=i)}return n[r++]=s,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let s=0;s<t.length;s++){const o=t[s];o.oldText!==o.newText&&(n[r++]=o)}return n}};function cl(e){return new ne(e.newPosition,e.newText,e.oldPosition,e.oldText)}function dl(e){return e.map(cl)}function Xr(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function ul(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const s=t[r];n=n.slice(0,s.oldPosition)+s.newText+n.slice(s.oldEnd)}return n}function fl(e,t,n){let r=0;const s=e.start===e.end;for(const o of t){const i=o.newLength-o.oldLength;if(o.oldLength===0){const a=o.oldPosition;if(s&&a===e.start)r+=n==="after"?i:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=i)}continue}if(s){if(e.start>=o.oldEnd)r+=i;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=i;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var gt=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},Jr=0,pl=Math.random().toString(36).slice(2,8);function hl(){return Jr+=1,`doc-${pl}-${Jr}`}function ml(e){const t=e.createBuffer(),n=e.docId??hl();let r=e.serverId??null,s=0,o=null,i=e.attributes??{};const a=new Set;let c=!1,d=!1,u;const f=new Set;let g=null;const m=()=>(g?.version!==s&&(g={version:s,value:t.read()}),g.value),_=v=>Object.entries(v).some(([p,b])=>i[p]!==b);return{get:()=>({docId:n,serverId:r,version:s,savedVersion:o,attributes:i}),getContent:m,mutate(v,{source:p}){if(c)return s;const b=v.changes?.length?v.changes:void 0,S=b?ul(m(),b):v.content!==void 0?v.content:void 0,T=S!==void 0&&S!==m(),C=v.attributes!==void 0&&_(v.attributes);if(!T&&!C)return s;const L=!(s>(o??-1)),E=C?Object.keys(v.attributes).filter(A=>i[A]!==v.attributes[A]):[];T&&t.write(S),C&&(i={...i,...v.attributes}),s+=1,p!=="user"&&L&&(o=s);const y={source:p,version:s,changes:b,...T?{content:!0}:{},...E.length>0?{attributes:E}:{}};return a.forEach(A=>A(y)),s},markSaved(v,p){const b={serverId:r,savedVersion:o};p!==void 0&&(r=p),(o===null||v>o)&&(o=v),(b.serverId!==r||b.savedVersion!==o)&&a.forEach(S=>S({source:"system",version:s}))},markUnsaved(){c||o===null||o<s||(o=s-1,a.forEach(v=>v({source:"system",version:s})))},markReady(){d||u!==void 0||(d=!0,f.forEach(v=>v.resolve()),f.clear(),a.forEach(v=>v({source:"system",version:s})))},isReady:()=>d,markFailed(v){d||u!==void 0||c||(u=v,f.forEach(p=>p.reject(new gt(v))),f.clear(),a.forEach(p=>p({source:"system",version:s})))},failure:()=>u,whenReady(){return d?Promise.resolve():u!==void 0?Promise.reject(new gt(u)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((v,p)=>{f.add({resolve:v,reject:p})})},subscribe(v){return a.add(v),()=>a.delete(v)},isNew:()=>r===null,isDirty:()=>s>(o??-1),isDisposed:()=>c,dispose(){c=!0,f.forEach(v=>v.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),f.clear(),a.clear(),t.dispose()}}}var gl=500,El=100,nn=0;function vl(e,t={}){const n=t.groupIntervalMs??gl,r=t.maxSteps??El,s=t.now??(()=>0);let o=[],i=0,a=nn+=1,c=null,d=!1,u=!1,f=!1;const g=new Set,m=()=>g.forEach(E=>E()),_=(E,y)=>{if(E.length){u=!0;try{e.mutate({changes:E},{source:y})}finally{u=!1}}},v=E=>_(E,"user"),p=E=>{const y=s();d&&c!==null&&y-c<n?o[i-1]=Kr(o[i-1],E):(o=o.slice(0,i),o.push(E),i=o.length,d=!0,o.length>r&&(o=o.slice(o.length-r),i=o.length,a=nn+=1)),c=y,m()},b=()=>{d=!1,c=null},S=E=>{if(!E.length)return;const y=o.length>i;y&&(o=o.slice(0,i)),i>0&&(o[i-1]=Kr(o[i-1],E)),b(),y&&m()},T=e.subscribe(({source:E,changes:y})=>{if(!(f||u||!y?.length)){if(E==="remote"){C();return}if(E!=="user"){S(y);return}p(y)}}),C=()=>{o=[],i=0,b(),a=nn+=1,m()},L=()=>{if(i===0)return!1;const E=dl(o[i-1]);return Xr(e.getContent(),E)?(v(E),i-=1,b(),!0):(o=o.slice(0,i-1),i=o.length,b(),m(),!1)};return{canUndo:()=>i>0,canRedo:()=>i<o.length,undo(){L()&&m()},redo(){if(!(i>=o.length)){if(!Xr(e.getContent(),o[i])){o=o.slice(0,i),b(),m();return}v(o[i]),i+=1,b(),m()}},clear:C,applyWithoutHistory(E){const y=e.get().version;if(_(E,"system"),e.get().version===y){b();return}S(E)},getPast:E=>o.slice(0,i).reverse().slice(0,E),getFuture:E=>o.slice(i).reverse().slice(0,E),createSnapshot:()=>({stackId:a,index:i}),restoreSnapshot(E){if(E.stackId!==a||E.index>i)return!1;for(;i>E.index;)if(!L())return m(),!1;return m(),!0},subscribe(E){return g.add(E),()=>g.delete(E)},dispose(){f=!0,T(),g.clear(),o=[],i=0}}}var _l=["edit","move","resize","insert"];function rn(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function bl(e){return typeof e=="string"?e:null}function yl(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function Sl(e){return _l.includes(e)?e:null}function Il(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:bl(t.originId),changeId:rn(t.changeId),rev:rn(t.rev),baseRev:rn(t.baseRev),expected:yl(t.expected),intent:Sl(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var Ve=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},Qr=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleEmailAutosave did not respond within ${e}ms — the autosave was not written`),this.timeoutMs=e,this.name="IntegratorAutosaveTimeoutError"}},sn=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail did not respond within ${e}ms — the email was not saved`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}};function wl(){return typeof navigator<"u"&&navigator.onLine===!1}function Tl(e){if(e==null)return[];const t=[e];if(typeof e!="object")return t;const n=e;if(n.error!=null&&(t.push(n.error),typeof n.error=="object")){const r=n.error;r.data!=null&&t.push(r.data),r.error!=null&&t.push(r.error)}if(n.data!=null&&(t.push(n.data),typeof n.data=="object")){const r=n.data;r.error!=null&&t.push(r.error)}return n.innerException!=null&&t.push(n.innerException),t}function Zr(e){if(!e)return!1;if(typeof e=="string"){const n=e.toLowerCase();return n.includes("fetch")||n.includes("network")||n.includes("timeout")||n.includes("failed to fetch")||n.includes("load failed")||n.includes("networkerror")}if(e instanceof Error)return Zr(e.message);if(typeof e!="object")return!1;const t=e;return t.status==="FETCH_ERROR"||t.status==="TIMEOUT_ERROR"||t.status==="PARSING_ERROR"?!0:typeof t.status=="number"?t.status===0||t.status===408||t.status>=500:!1}function Cl(e){return wl()?!0:Tl(e).some(Zr)}var es=new WeakSet,ts=new WeakMap;function ns(e){typeof e=="object"&&e!==null&&es.add(e)}function Al(e,t){typeof e=="object"&&e!==null&&ts.set(e,t)}function Dl(e){return typeof e=="object"&&e!==null?ts.get(e):void 0}function Pl(e){return e instanceof sn||e instanceof Qr||typeof e=="object"&&e!==null&&es.has(e)}function Rl(e){return e instanceof Ve||Pl(e)}function Ol(e){return!Rl(e)&&Cl(e)}var rs="draft";function Re(e){return e==null||e===""?rs:String(e)}function Ll(e){return e==null||e===""?`${on}${rs}`:`${on}${String(e)}`}var on="block:";function ae(e){return e?.startsWith(on)===!0}function Ge(e){return ae(e.sessionKey())?void 0:e.current()}function Mv(e,t){}function Ye(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return V(`show:gate:${e}`,{kind:"wait"}),t.then(s=>(V(`show:gate:${e}:end`,{kind:"wait"}),s),s=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw l.isAbortError(s)?(`${e}`,{...n}):(`${e}`,{error:zr(s),...n},void 0),s})}var xv=5e3,Nl=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function Ml(e){const t=e?.trim()??"";if(!Nl.test(t))return Date.parse(t);const n=t.replace(" ","T");return Math.max(Date.parse(n),Date.parse(`${n}Z`))}function We(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function an(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function xl(e,t={}){const n=We((e??[]).filter(r=>r?.html?.trim()));return an(n,t)?n:null}function kl(e,t){const n=Date.parse(We(e)?.modified??""),r=xl(e),s=Date.parse(r?.modified??""),o=t===void 0||Number.isFinite(s)&&s>t,i=[n,t??NaN].filter(a=>Number.isFinite(a));return{autosave:o?r:null,...i.length?{latestAt:Math.max(...i)}:{}}}function ss(e,t,n){const r=We((e??[]).filter(c=>c?.html?.trim())),s=Date.parse(r?.modified??""),o=Date.parse(We((n??[]).filter(c=>c?.html?.trim()))?.modified??""),i=r&&Number.isFinite(s)&&(t===void 0||s>t)&&!(o>s),a=[Date.parse(We(e??[])?.modified??""),t??NaN].filter(c=>Number.isFinite(c));return{autosave:i&&an(r)?r:null,...a.length?{latestAt:Math.max(...a)}:{}}}function Fl({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var os=e=>e.replace(/\r\n?/g,`
|
|
2103
|
+
`),is=["recovery","plugin","rest"],Bl=["subject","preheader"];function jl(e){let t={},n;for(let s=is.length-1;s>=0;s--){const o=e.get(is[s]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(n=o.content))}const r=e.get("plugin")?.attributes;for(const s of Bl){const o=r?.[s];typeof o=="string"&&o!==""&&(t={...t,[s]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function ln(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?os(t.content):void 0,s=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...s?{changes:[new ne(0,n,0,r)]}:{}},{source:"remote"})}var cn=e=>typeof e=="string"?e.trim():"";function Ul(e,t,n,r){const{version:s,attributes:o}=e.get(),i=o,a=r==="snapshot"||r==="anchor",c=a?i.author:void 0,d=a?i.date_gmt:void 0,u=cn(i.title)||cn(i.subject)||cn(t.fallbackTitle);return{version:s,payload:{html:e.getContent(),title:u,subject:i.subject,preheader:i.preheader,description:i.description,common_styles:i.common_styles||"",meta:i.meta,utm_parameters:i.utm_parameters,parent_email:i.parent_email,is_template:i.is_template||!1,is_inited:i.is_inited,tags:i.tags,emailtags:i.emailtags,group:i.group,renderGuid:e.get().docId,project:t.project??i.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source,...c!=null&&c!==""?{author:c}:{},...d?{excerpt:d}:{}}}}var $l=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function Hl(e){const t={};for(const n of $l)e[n]!==void 0&&(t[n]=e[n]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function Vl(e,t,n,r,s){if(n==="materialize"&&r!=null)throw new Error("Письмо уже создано на сервере");if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(s);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,s):t.saveAutosave(r,s)}function pe(e,t=!1){const n={};for(const r of Object.keys(e)){let s=e[r];s!==void 0&&!(typeof s=="number"&&Number.isNaN(s))&&(t&&typeof s=="object"&&s!==null&&(s=pe(s)),n[r]=s)}return n}function Gl(e){return typeof e=="string"&&e.includes("autosave")}var Yl=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function as(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!Yl.has(t))):{}}function qe(e,t,n={}){e&&e.mutate({attributes:Wl(e.get().attributes,t)},{source:n.source??"user"})}function Wl(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function dn(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function ql(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function ls(e){if(!e)return null;const t=as(e);return e.common_styles!==void 0&&(t.common_styles=ql(e.common_styles)),dn(e.html,t)}function cs(e){return e?dn(e.html,pe(as(e))):null}var zl=["common_styles","subject","preheader","meta"];function ds(e){if(!e?.html?.trim())return null;const t={};for(const n of zl)Kl(n,e[n])&&(t[n]=e[n]);return dn(e.html,t)}function Kl(e,t){return e==="common_styles"?typeof t=="string"&&t.startsWith("{"):e==="meta"?typeof t=="object"&&t!==null&&!Array.isArray(t):typeof t=="string"}var Xl=["modified","lock"];function Jl(e){if(!e)return null;const t={};for(const n of Xl)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var Ql=10,Zl=(e,t)=>e.key===t.key&&ec(e.serverId,t.serverId),ec=(e,t)=>e==null||e===t;function tc(e){return typeof e?.then=="function"}var us=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},fs=e=>{e.request.serverId!=null&&!un(e)&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent())},nc=e=>e.document.get().serverId!=null&&!e.document.getContent().trim()&&!!(e.savedContent??e.lastMerged?.content??"").trim(),un=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),ps=(e,t)=>t?.content!==void 0&&Fl({hasUnsavedUserEdit:un(e)})==="skip",rc=e=>e.document.subscribe(t=>{t.source==="user"&&(t.content&&e.userTouched.add("content"),t.attributes?.forEach(n=>e.userTouched.add(n))),e.document.isDirty()||e.userTouched.clear()}),sc=(e,t)=>{!e.ready||t.content===void 0||e.document.get().serverId==null||(e.contentShown=!0,!(![...e.userTouched].every(n=>n==="content"||n in(t.attributes??{}))||!e.document.isDirty())&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent(),e.userTouched.clear(),e.document.get().docId))},oc=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([s,o])=>e.attributes[s]!==o)),r=t.content!==void 0&&t.content!==e.content?t.content:void 0;return r===void 0&&Object.keys(n).length===0?null:r===void 0?{attributes:n}:{content:r,attributes:n}},ic=e=>{const t=jl(e.reports),n=oc(e.lastMerged,t);e.lastMerged=t,n&&(ln(e.document,n),fs(e))},fn=(e,t)=>{if(!e.ready&&!un(e)){ic(e);return}ln(e.document,t)},ac=e=>{const{attributes:t,serverId:n,docId:r}=e.document.get();return{...t,html:e.document.getContent(),id:n??void 0,isNew:n==null,renderGuid:r}};function lc(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:s,resolveTerms:o,canEdit:i,notifyBeforeSave:a,onAdapterError:c,onTimeout:d}=e;let u;const f=new Set,g=new Set,m=()=>f.forEach(h=>h()),_=(h,w)=>{if(!(h.closed||h.ready)){if(h.error!==void 0){h.document.markFailed(h.error),h.document.get().docId;return}fs(h),h.ready=!0,h.document.markReady(),h.document.get().docId,[...h.reports.keys()]}},v=(h,w,D)=>{c?.(w.id,D),!(!w.required||h.closed)&&(h.error=D,h.document.get().docId,w.id,m())},p=(h,w)=>{const D=new Set(w.map(I=>I.id));w.forEach(I=>{I.watch&&h.watchers.push(I.watch(P=>h.closed?!1:h.ready&&(ps(h,P)||h.contentShown===!0&&P?.content!==void 0)?(h.document.get().docId,I.id,!1):(P&&h.reports.set(I.id,P),fn(h,P),!0)))});const k=(I,P)=>{if(!h.closed){if(!I.required&&ps(h,P)){h.document.get().docId,I.id,I.loaded?.(!1);return}P&&h.reports.set(I.id,P),fn(h,P),I.loaded?.(P!==null)}},N=()=>{D.size>0||h.closed||(us(h),_(h,[]))},U=[];if(w.forEach(I=>{let P;try{P=I.load()}catch(x){v(h,I,x),D.delete(I.id);return}if(tc(P)){U.push({id:I.id,required:I.required,load:()=>P,...I.loaded?{loaded:x=>I.loaded?.(x)}:{}});return}k(I,P),D.delete(I.id)}),U.length===0){N();return}h.timer=setTimeout(()=>{h.timer=void 0,d?.([...D]),h.document.get().docId,[...D],_(h,[...D])},n),h.timer.unref?.(),U.forEach(I=>{I.load().then(P=>k(I,P)).catch(P=>{v(h,I,P)}).finally(()=>{D.delete(I.id),N()})})},b=async(h,w,D)=>{if(D==="snapshot"||D==="anchor")return;const k=o?.();if(k)return k.resolve({project:w.project??h.project,tags:(h.tags??[]).map(N=>({name:N}))})},S=h=>{if(h.lock===!0&&i?.(h)===!1)return new Ve("locked");const w=h.tags?.length??0,D=h.emailtags?.length??0;if(Math.max(w,D)>Ql)return new Ve("too-many-tags")},T=(h,w)=>{const D=h.document.get().serverId;w||D==null||(h.recoveryFacts={emailId:D,historyLoaded:!0,isRecovering:!1},ae(h.request.key)||(h.request={...h.request,key:Re(D),serverId:D}))},C=(h,w,D)=>{if(h.closed||D?.id==null)return;const k=h.document.get().serverId,N=k!=null;N&&k!==String(D.id)||(h.document.markSaved(w,String(D.id)),T(h,N),h.document.get().serverId,m())},L=async(h,w,D)=>{try{await h.document.whenReady()}catch(P){return h.saveError=P,h.saveFailures+=1,h.failedIntent=w,h.saveFailures,!1}if(h.closed)return!1;const k=S(h.document.get().attributes);if(k)return h.saveError=k,h.saveFailures+=1,h.failedIntent=w,k.reason,m(),!1;if(a&&(await a(ac(h)).catch(()=>{}),h.closed))return!1;if(nc(h))return w==="snapshot"||(h.saveError=new Ve("empty-content"),h.saveFailures+=1,h.failedIntent=w,m()),!1;let N;try{N=await b(h.document.get().attributes,D,w)}catch(P){return h.saveError=P,h.saveFailures+=1,h.failedIntent=w,h.saveFailures,m(),!1}if(h.closed)return!1;const{payload:U,version:I}=Ul(h.document,D,N,w);h.document.get().docId;try{const P=h.document.get().serverId!=null,x=await Vl(r(),s(h.request.key),w,h.document.get().serverId,U);if(h.closed)return!0;let Q;if(w==="snapshot"||w==="anchor"){const M=x?.modified!=null?Date.parse(x.modified):NaN;Q=Number.isFinite(M)?M:Date.now(),h.snapshotVersion=I,h.lastRevisionAt=Q}else h.document.markSaved(I,x?.id!=null?String(x.id):void 0),h.savedContent=U.html;T(h,P),h.saveError=void 0,h.saveFailures=0,h.failedIntent=void 0,h.document.get().serverId,m();const we={intent:w,serverId:h.document.get().serverId,created:!P,...Q!==void 0?{revisionAt:Q}:{}};return g.forEach(M=>M(we)),!0}catch(P){return(w==="publish"||w==="materialize")&&Dl(P)?.then(x=>C(h,I,x)),h.saveError=P,h.saveFailures+=1,h.failedIntent=w,h.saveFailures,m(),!1}},E=()=>{u&&(u.closed=!0,u.watchers.forEach(h=>h()),u.watchers=[],us(u),u.history.dispose(),u.document.dispose(),u=void 0)},y=(h,w,D)=>{let k=!1;w.show&&(h.show?.id!==w.show.id||h.show.token!==w.show.token)&&(h.show=w.show,k=!0,{docId:h.document.get().docId,...w.show});const N=D==="show"?cs(w.patch):null;N&&(h.reports.set("plugin",N),fn(h,N),sc(h,N)),k&&m()},A=(h,w={})=>{const D=u;return!D||D.closed||h==="materialize"&&D.document.get().serverId!=null?Promise.resolve(!1):D.saving?h==="snapshot"||h==="materialize"?Promise.resolve(!1):(D.inFlight??Promise.resolve(!1)).then(()=>A(h,w)):(D.saving=!0,m(),D.inFlight=L(D,h,w).finally(()=>{D.saving=!1,D.inFlight=void 0,u===D&&!D.closed&&m()}),D.inFlight)},R=(h,w="open")=>{if(u&&!u.closed&&w!=="new"&&Zl(u.request,h))return y(u,h,w),u.document;E();const D=ml({createBuffer:()=>al(""),serverId:h.serverId??null}),k={request:h,show:h.show,document:D,history:vl(D,{now:Date.now}),watchers:[],userTouched:new Set,saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return u=k,k.watchers.push(rc(k)),D.get().docId,h.serverId,p(k,t(h,{publishRecoveryFacts(N){k.closed||(k.recoveryFacts=N,m())},readShownContent:()=>k.closed?null:k.document.getContent()})),m(),D};return{openWith:R,open:(h,w={})=>R({key:Re(h),serverId:h,email:w.email,patch:w.patch,show:w.show},"open"),openDraft:(h,w={})=>R({key:Re(void 0),serverId:null,email:h,patch:w.patch,show:w.show},"open"),startNewDraft:(h,w={})=>R({key:Re(void 0),serverId:null,email:h,patch:w.patch,show:w.show},"new"),reload:(h,w={})=>R({key:Re(h),serverId:h,email:w.email,patch:w.patch,show:w.show},"new"),openBlock:(h,w)=>R({key:ae(h)?h:Ll(h),serverId:w?.id!=null?String(w.id):null,email:w},"open"),show:(h,w)=>{const D=u;if(!(!D||D.closed))return R({...D.request,patch:h,show:w},"show")},current:()=>u?.document,noteServerFacts:({serverId:h,block:w},D)=>{const k=u;!k||k.closed||k.request.serverId!==h||ae(k.request.key??"")===w&&ln(k.document,Jl(D))},save:A,saveState:()=>({error:u?.saveError,failures:u?.saveFailures??0,saving:u?.saving===!0,failedIntent:u?.failedIntent}),revisionFacts(){if(!u)return;const h=u.revisionFactsSnapshot;return h&&h.snapshotVersion===u.snapshotVersion&&h.lastRevisionAt===u.lastRevisionAt?h:(u.revisionFactsSnapshot={snapshotVersion:u.snapshotVersion,lastRevisionAt:u.lastRevisionAt},u.revisionFactsSnapshot)},recoveryFacts:()=>u?.recoveryFacts,history:()=>u?.history,forcedHeaders:()=>u?.forcedHeaders,beginForcedHeaders(h){u&&!u.closed&&(u.forcedHeaders=h)},endForcedHeaders(){u&&(u.forcedHeaders=void 0)},onSaved(h){return g.add(h),()=>g.delete(h)},showFacts:()=>u?.show,sessionKey:()=>u?.request.key,openError:()=>u?.error,subscribe(h){return f.add(h),()=>f.delete(h)},close(){u&&(E(),m())}}}var hs=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function ms(e){if(e instanceof hs)return e.reason;if(e instanceof gt)return ms(e.reason)}function cc(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new hs("not-found");return ls(n)}}}var gs=l.createIdentifier$1("EmailPort");function dc(e){return e.getInstance(gs)}function uc(e,t){e.inject(gs,t)}var Es=l.createIdentifier$1("documentSession.restEmailPortFactories");function vs(e){return e.getInstance(Es)!==void 0}function Ee(e){const t=e.getInstance(Es);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var fc=l.createIdentifier$1("EmailTermsResolver");function pc(e){return e.getInstance(fc)}var _s=l.createIdentifier$1("EmailHistoryPort"),hc=l.createIdentifier$1("BlockHistoryPort");function bs(e){return e.getInstance(hc)}function ys(e){return e.getInstance(_s)}function mc(e,t){e.inject(_s,t)}var gc="em_autosave_pending",kv=6e4;function Et(e){return`${gc}_${e}`}function Ec(e,t){try{sessionStorage.setItem(Et(e),JSON.stringify(t))}catch{}}function Ss(e){try{const t=sessionStorage.getItem(Et(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(Et(e)),null):n}catch{return null}}function ze(e){try{sessionStorage.removeItem(Et(e))}catch{}}var vc=2e3,_c=5e3,bc=5,yc=5e3,Sc=4;function Ic(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function wc(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
2080
2104
|
`,`
|
|
2081
2105
|
`)===t.replaceAll(`\r
|
|
2082
2106
|
`,`
|
|
2083
|
-
`)}function Ft(e,t){return Ot(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function Ga({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:s,onFacts:o,onLate:i,onError:l,pageLoadTs:c=Ha()}){let d=null,u=!1,p=!1,E=0,h={emailId:e,historyLoaded:!1,isRecovering:!1},b=null;const v=new Promise(D=>{b=D}),m=D=>{h={...h,...D},o(h)};let _;const y=D=>{E+=1,m({applied:{phase:D,seq:E}})},w=()=>{d?.timer&&clearTimeout(d.timer),d=null},A=D=>{if(!p){if(b){const N=b;b=null,N(D),_=D.revision?D.phase:void 0;return}i(D)&&D.revision&&y(D.phase)}},C=()=>{if(!d||p)return;const D=d.phase==="fast",N=D?ka:ja,j=D?Ba:Ua;d.timer=setTimeout(()=>{const P=d;if(!(!P||p)){if(P.attempts+=1,S(),D&&P.attempts>=j){const{pending:O}=P;Je(e),m({isRecovering:!1}),A({revision:{html:O.html,common_styles:O.common_styles,subject:O.subject,preheader:O.preheader},phase:"timeout"}),u=!0,P.phase="bg",P.attempts=0,C();return}if(!D&&P.attempts>=j){Je(e),w(),m({isRecovering:!1}),u=!0;return}C()}},N),d.timer.unref?.()},g=D=>{d={phase:"fast",attempts:0,pending:D,timer:null},m({isRecovering:!0}),C()},I=D=>{if(p)return;if(m({historyLoaded:!0,latestRevisionAt:D.latestAt!==void 0&&Number.isFinite(D.latestAt)?D.latestAt:void 0}),n&&d){const P=Ft(D,d.pending.sentAt);if(!P)return;const O=d.phase==="fast"?"found":"bg";Je(e),w(),m({isRecovering:!1}),u=!0,A({revision:P,phase:O});return}if(u)return;const N=n?xa(e):null,j=N&&(N.sentAt<c||!$a(N.html,s()))?N:null;if(j){const P=Ft(D,j.sentAt);if(P){Je(e),u=!0,A({revision:P,phase:"found"});return}g(j);return}u=!0,A({revision:Ft(D),phase:"normal"})},f=D=>{p||(l?.(D),h.historyLoaded||(m({historyLoaded:!1,latestRevisionAt:void 0}),k()),!d&&A({revision:null,phase:"normal"}))},S=()=>t(e).then(I).catch(f);let T,M=!1;const k=()=>{M||d||p||(M=!0,T=setTimeout(()=>{T=void 0,!p&&!h.historyLoaded&&S()},Fa))},z=()=>{p||(m({historyLoaded:!1,latestRevisionAt:void 0}),A({revision:null,phase:"normal"}))};return r?r().then(D=>D?S():z()):S(),{verdict:()=>v,confirmVerdict(D){const N=_;_=void 0,D&&N!==void 0&&!p&&y(N)},dispose(){p=!0,T!==void 0&&(clearTimeout(T),T=void 0),w()}}}function Va({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:s,onFacts:o}){let i=null;const l=Ga({emailId:r,readAutosave:c=>e.readAutosave(c),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:s,onFacts:o,onLate:({revision:c,phase:d})=>{const u=yr(c);return i?.(u)??!1},onError:c=>{c instanceof Error&&c.message}});return{id:"recovery",load:()=>l.verdict().then(({revision:c})=>yr(c)),loaded(c){l.confirmVerdict(c)},watch(c){return i=c,()=>{i=null,l.dispose()}}}}function Mr(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Na(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const s=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),s}}}function Ya(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const s=await t.updateEmail(n,r);return await e.updateEmail(n,r),s}}}var Nr=a.createIdentifier$1("CurrentUser"),xr={};function Bt(e){return e.getOrCreateInstance(Nr,()=>ue(xr))}function kr(e){return e?.getInstance(Nr)?.get()??xr}function Fr(e){return e?.getInstance(a.CONFIG_SOURCE_ID)?.get()??{}}var qa=1.5;function za(e){return!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=qa*e.autosaveTimeoutMs?"none":"revision"}var Wa=4;function Ka(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:s}=e,o=e.readFailures??(()=>0),i=()=>n().autosaveTimeoutMs*2**Math.min(o(),Wa),l=()=>{const _=t();if(!_||_.isDisposed())return"none";const{latestRevisionAt:y,snapshotVersion:w,...A}=n();return za({...A,isDirty:_.isDirty(),isNew:_.isNew(),isReady:_.isReady(),latestRevisionAgeMs:y!=null?Date.now()-y:void 0,isSnapshotSent:w!=null&&w===_.get().version})},c=()=>{const _=t();if(!_||_.isDisposed())return!1;if(!_.isDirty())return _.isNew();const{snapshotVersion:y}=n();return!(y!=null&&y===_.get().version)};let d,u,p,E,h=!1;const b=()=>{u=void 0;const _=t();if(!_||_.isDisposed())return;if(_.get().docId!==d){v();return}const y=l();y==="create"?r():y==="revision"?s():c()&&(d=_.get().docId,u=setTimeout(b,i()))},v=()=>{const _=t();h||!_||u!==void 0||l()==="none"&&!c()||(d=_.get().docId,u=setTimeout(b,i()))},m=()=>{const _=t();_!==p&&(E?.(),p=_,E=_?.subscribe(v),u!==void 0&&(clearTimeout(u),u=void 0))};return m(),v(),{refresh:()=>{h||(m(),v())},stop:()=>{h=!0,E?.(),E=void 0,p=void 0,u!==void 0&&(clearTimeout(u),u=void 0)}}}var Br=a.createIdentifier$1("documentSession.autosaveUiFacts"),jr={isUserBusy:!1,saveContext:{}};function Xa(e){return e.getOrCreateInstance(Br,()=>ue(jr))}function Ur(e){return e?.getInstance(Br)?.get()??jr}var Ja=1e4;function Qa(e,t){const n=()=>{const c=t.current(),d=c?.get().serverId??void 0,u=ne(t.sessionKey()),p=t.recoveryFacts(),E=p?.emailId===d?p:void 0,h=t.revisionFacts(),b=E?.latestRevisionAt,v=h?.lastRevisionAt,m=kr(e).profile;return{isInited:u||c?.get().attributes.is_inited===!0,isEnabled:!!m?.autosaves,isHistoryLoaded:E?.historyLoaded===!0,isUserBusy:Ur(e).isUserBusy,autosaveTimeoutMs:Fr(e).autosaveTimeout||Ja,latestRevisionAt:b!==void 0||v!==void 0?Math.max(b??0,v??0):void 0,snapshotVersion:h?.snapshotVersion}},r=()=>{const c=Ur(e).saveContext;return{...c,project:c.project??t.current()?.get().attributes.project}},s=Ka({readDocument:()=>t.current(),readEnvironment:n,readFailures:()=>t.saveState().failures,onCreate:()=>{ne(t.sessionKey())||t.save("materialize",r())},onRevision:()=>{t.save("snapshot",{project:r().project})}}),o=t.subscribe(s.refresh),i=Bt(e).watch(()=>s.refresh()),l=Xa(e).watch(()=>s.refresh());return()=>{o(),i.dispose(),l.dispose(),s.stop()}}var Hr=12e3;function ae(e){return e.getOrCreateInstance(Tt,()=>{const t=Ta({resolveAdapters:(r,s)=>tl(r,e,s),resolveWritePort:()=>$r(e),resolveHistoryPort:r=>ne(r)?Vr(e):Gr(e),resolveTerms:()=>Ra(e),canEdit:r=>Ci(e,r),notifyBeforeSave:Ni(e),timeoutMs:Hr,onAdapterError:(r,s)=>{s instanceof Error&&s.message,Ye(s,{origin:"email-source-adapter",tags:{source:r}})},onTimeout:r=>{}}),n=Qa(e,t);return e.getInstance(a.DISPOSABLE_ID)?.addDispose(n),t})}function jt(e){return e?.getInstance(Tt)}function $r(e){const t=Ca(e);return t?Ut(e)?Ya(t,fe(e).email(e)):t:fe(e).email(e)}function Za(e){return Lr(e)!==void 0||Dr(e)}function Gr(e){const t=Lr(e);return t?Ut(e)?(H("port:history:server-backed"),Mr(t,fe(e).history(e))):(H("port:history:integrator"),t):(H("port:history:rest (порт не зарегистрирован)"),fe(e).history(e))}function Vr(e){const t=Or(e);return t?Ut(e)?(H("port:block-history:server-backed"),Mr(t,fe(e).blockHistory(e))):(H("port:block-history:integrator"),t):(H("port:block-history:rest (порт не зарегистрирован)"),fe(e).blockHistory(e))}function el(e){return Or(e)!==void 0||Dr(e)}function Ut(e){return nr(e)}function tl({email:e,patch:t,serverId:n,key:r},s,o){const i=[];e?i.push({id:"rest",load:()=>br(e),required:!0}):n&&i.push(Aa($r(s),n)),t&&i.push({id:"plugin",load:()=>_r(t)});const l=ne(r);return xi(n)&&(l?el(s):Za(s))&&i.push(Va({port:l?Vr(s):Gr(s),revisionServiceEnabled:nr(s),...!l&&Pi(s)?{isHistoryAvailable:()=>Di(s)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:c=>o.publishRecoveryFacts(c)})),i}function K(e){return e.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService)}var Yr=new WeakMap,Ht=new WeakMap;function le(e){return Yr.get(e)??0}function qr(e,t){let n=Ht.get(e);return n||(n=new Set,Ht.set(e,n)),n.add(t),()=>{n?.delete(t)}}function nl(e){Yr.set(e,le(e)+1),Ht.get(e)?.forEach(t=>t())}function rl(e){const t=ae(e),n=K(e).addListener(a.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{Re(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function sl(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function ol(e){const t=e.fetchImpl??((o,i)=>fetch(o,i)),n=e.pageHost??(()=>window.location.hostname),r=new Set,s=o=>{try{const i=new URL(o,window.location.href);return i.protocol!=="https:"&&i.protocol!=="http:"?!1:i.hostname===n()||e.sourceHosts().includes(i.hostname)}catch{return!1}};return{accepts:s,async load(o){if(!s(o))return;const i=!r.has(o);r.add(o);try{const l=await t(o,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!l.ok)return;const c=await l.blob();return sl(c)?c:void 0}catch{return}}}}var pe={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function il(e){const t={maxBytes:e.maxBytes??pe.maxBytes,maxImageBytes:e.maxImageBytes??pe.maxImageBytes,ttlMs:e.ttlMs??pe.ttlMs},n=e.now??(()=>Date.now()),r=new Map,s=new Map,o={hits:0,loads:0,failures:0};let i=0;const l=p=>{const E=r.get(p);E&&(i-=E.bytes,r.delete(p))},c=p=>t.ttlMs<=0||n()-p.storedAt<t.ttlMs,d=()=>{if(i<=t.maxBytes)return;const p=[...r.entries()].sort((E,h)=>E[1].usedAt-h[1].usedAt);for(const[E]of p){if(i<=t.maxBytes)return;l(E)}},u=(p,E)=>{E.size>t.maxImageBytes||(r.set(p,{blob:E,bytes:E.size,storedAt:n(),usedAt:n()}),i+=E.size,d())};return{async get(p){const E=r.get(p);if(E&&c(E))return E.usedAt=n(),o.hits+=1,E.blob;E&&l(p);const h=s.get(p);if(h!==void 0)return h;o.loads+=1;const b=(async()=>{try{const v=await e.load(p);return v?u(p,v):o.failures+=1,v}catch{o.failures+=1;return}finally{s.delete(p)}})();return s.set(p,b),b},forget(p){l(p),s.delete(p)},clear(){r.clear(),s.clear(),i=0},stats(){return{entries:r.size,bytes:i,...o}}}}var al=["emcdn.ru","scr.emcdn.ru"];function ll(e){const t=String(e??"").trim();if(!t)return"";try{return new URL(t.includes("//")?t:`https://${t}`).hostname}catch{return t.split("/")[0].split(":")[0]}}function cl(e,t){const n=(r,s)=>{const o=new Set(s?t:[]);for(const i of r){const l=ll(i);l&&o.add(l)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function zr(e){const t=e??{},n=t.isPlugin!==!0?al:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...pe};const s=r===!0||r===void 0?{}:r;return{enabled:s.enabled!==!1,sourceHosts:cl(s.sourceHosts,n),maxBytes:s.maxBytes??pe.maxBytes,maxImageBytes:s.maxImageBytes??pe.maxImageBytes,ttlMs:s.ttlMs??pe.ttlMs}}function dl(e){const t=K(e),n=e.getInstance(a.CONFIG_SOURCE_ID);let r=zr(n?.get());const s=ol({sourceHosts:()=>r.sourceHosts}),o=il({load:b=>s.load(b),maxBytes:r.maxBytes,maxImageBytes:r.maxImageBytes,ttlMs:r.ttlMs}),i=()=>{t.send(a.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:r.enabled,sourceHosts:[...r.sourceHosts]})},l=t.onInit(()=>i()),c=n?.watch(()=>{const b=zr(n.get()),v=JSON.stringify(b)!==JSON.stringify(r);r=b,b.enabled||o.clear(),v&&t.isInited()&&i()}),d={asked:0,served:0,refused:0},u=[],p=(b,v)=>(d.refused+=1,u.push({url:b,reason:v}),u.length>20&&u.shift(),{refused:!0}),E=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:r,counters:{...d},refusals:[...u],store:o.stats()})}),h=t.addListenerAsync(a.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async b=>{const v=b?.url??"";if(d.asked+=1,!r.enabled||!v)return p(v,"disabled");if(!s.accepts(v))return p(v,"host");b.fresh&&o.forget(v);const m=await o.get(v);return m?(d.served+=1,{blob:m}):p(v,"load-failed")});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{l.dispose(),c?.dispose(),h.dispose(),o.clear(),delete E.__emmCanvasImages__})}var ul=2e3;function fl(e){const t=K(e),n=new Set,r=()=>{const i=t.getTarget();if(!i||t.hasPort(i))return;const l=new MessageChannel;let c=!1;const d=p=>{p.data?.operationId==="em:port-ready"&&(c=!0,l.port1.removeEventListener("message",d),t.drainWindow(i))};l.port1.addEventListener("message",d),t.sendPort(i,l.port2),t.usePort(l.port1,!1,i);const u=setTimeout(()=>{n.delete(u),!c&&(Ye(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),l.port1.removeEventListener("message",d),t.useWindow(i))},ul);n.add(u)},s=Object.assign(globalThis,{__emmCanvasPort__:()=>{const i=t.getTarget();return{usesPort:t.usesPort,windowDrained:i?t.isWindowDrained(i):!1}}}),o=t.onInit(()=>r());e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n)clearTimeout(i);o.dispose(),delete s.__emmCanvasPort__})}var pl=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function hl(e){return pl.test(e)||e.indexOf("//")===0}function Qe(e){return e&&(e.endsWith("/")?e:`${e}/`)}function ml(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Wr(e,t){const n=e==null||e===""?"./":String(e);if(hl(n))return Qe(n);const r=t??ml();if(!r)return Qe(n);try{return Qe(new URL(n,r).href)}catch{return Qe(n)}}function gl(){return typeof __useblocks__<"u"&&__useblocks__?.publicPath?Wr(__useblocks__.publicPath):Wr("/")}var El=()=>"",vl=()=>"8098d114";function Kr(e){const t=e?"iframe-eblock":"iframe",n=El();if(n){const o=n.replace(/\/?$/,"/");return Kn(`${o}${t}.html`,Ce())}const r=vl(),s=`${gl().replace(/\/?$/,"/")}iframe/`;return Kn(`${s}${t}${r?`.${r}`:""}.html`,Ce())}var Xr="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function $t(e){return/^file:/i.test(String(e||"").trim())}function bl(e){return $t(e)?`${Xr} allow-same-origin`:Xr}var Um="em:module-body",_l="em:module-body-ack";function yl(e,t,n){try{const r=new URL("./",new URL(t,n)).href,s=new URL(e,r).href;return s.startsWith(r)?s:void 0}catch{return}}function Gt(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.[0-9a-f]{6,})?\.html$/.exec(t);return n?`js/${n[1]}.body.js`:void 0}function Sl(e,t){const n=Gt(t)?.replace(/^js\/|\.body\.js$/g,""),r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(s=>e[s]?.file).filter(s=>!!s):[]}function wl(e,t){const n=Gt(t)?.replace(/\.body\.js$/,".js");if(!n||!(n in e))return[];const r=new Set([n]),s=[n],o=[];for(;s.length>0;)for(const i of e[s.shift()]??[])r.has(i)||(r.add(i),o.push(i),s.push(i));return o}async function Il(e,t){try{const n=await fetch(e,t?.priority?{priority:t.priority}:void 0);return n.ok?await n.blob():void 0}catch{return}}function Tl(e){const t=new Map,n=(r,s)=>{const o=yl(r,e.canvasSrc,e.origin);if(!o)return;const i=t.get(o);if(i!==void 0)return i;const l=e.fetchBody(o,s);return t.set(o,l),l};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,s){for(const o of r)n(o,s)},reset(){t.clear()},get size(){return t.size}}}var ce;function Al(e){try{return $t(new URL(e,window.location.href).href)}catch{return $t(window.location.href)}}function Jr(){const e=Kr(!1);if(!Al(e))return(!ce||ce.canvasSrc!==e)&&(ce={canvasSrc:e,store:Tl({canvasSrc:e,origin:window.location.href,fetchBody:Il}),warmed:!1}),ce.store}async function Cl(e,t){try{const n=new URL(".vite/manifest.json",new URL("./",new URL(e,window.location.href))).href,r=await fetch(n);if(!r.ok)return;const s=await r.json();t(Sl(s,e))}catch{}}function Vt(e){const t=Jr();if(!t||!ce||ce.warmed)return;ce.warmed=!0;const{canvasSrc:n}=ce,r=Gt(n);r&&t.warm([r],e);const s={"js/iframe-eblock.js":["js/discussHandlers.CCCXIEaO.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.CCCXIEaO.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.CCCXIEaO.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]};s?t.warm(wl(s,n),e):Cl(n,o=>t.warm(o,e))}function Pl(e){const t=Jr();if(!t)return;Vt();const n=r=>{const s=r.data;if(!s||s.operationId!=="em:module-body"||!s.result)return;const o=r.source;o&&(o.postMessage({operationId:_l,for:s.result},"*"),t.take(s.data?.url??"").then(i=>{o.postMessage({operationId:s.result,data:i??null},"*")}))};window.addEventListener("message",n),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",n)})}var ge=/<script\b(?=[^>]*(?:\bbis_use(?:=|\s)|\bdata-bis-config(?:=|\s)|\bdata-dynamic-id(?:=|\s)|local\.adguard\.org|(?:chrome-extension|moz-extension|safari-extension):\/\/))[^>]*>[\s\S]*?<\/script>/gi,Dl=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Ee=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Qr=/display:\s*none\s*!important/gi,Rl=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,Ol=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Ll=/height\s*:\s*100%\s*!important/i,Ml=[".socialshare,",".advertisment,",".adHolder,",".adsbygoogle-noablate","#ab_adblock","#popmechanic-snippet","filter_ads_by_classname","clever-core-ads","--gn-ov-ad-height","pub_728x90.text-ad.textAd","html-load.com/player","content-loader.com/player",".adblock","#advblock","body { overflow: visible!important; }"];function Nl(e){return Qr.lastIndex=0,(e.match(Qr)||[]).length}function Zr(e){const t=e.trim(),n=Nl(t);if(n===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||n>=3||t.length>2e3))return!0;const r=Ml.filter(s=>t.includes(s)).length;return r>=1&&(n>=3||t.length>2e3)||n>=5&&r>=1?!0:n>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function xl(e){Ee.lastIndex=0;for(const t of e.matchAll(Ee))if(Zr(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function kl(e){let t=!1;return Ee.lastIndex=0,{html:e.replace(Ee,n=>Zr(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Fl(e){return ge.lastIndex=0,ge.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||xl(e)}function Bl(e){if(!Fl(e))return{html:e,found:!1};let t=!1,n=e;ge.lastIndex=0,ge.test(n)&&(ge.lastIndex=0,n=n.replace(ge,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(Dl,""),t=!0);const r=kl(n);return n=r.html,t=t||r.found,{html:n,found:t}}function jl(e){return!e||!Ll.test(e)?e:(Ee.lastIndex=0,e.replace(Ee,t=>t.replace(Rl,(n,r,s,o)=>`${r}${s.replace(Ol,"")}${o}`)))}function es(e){const t=Bl(e.replaceAll(`\r
|
|
2107
|
+
`)}function pn(e,t){return an(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function Tc({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:s,onFacts:o,onLate:i,onError:a,pageLoadTs:c=Ic()}){let d=null,u=!1,f=!1,g=0,m={emailId:e,historyLoaded:!1,isRecovering:!1},_=null;const v=new Promise(N=>{_=N}),p=N=>{m={...m,...N},o(m)};let b;const S=N=>{g+=1,p({applied:{phase:N,seq:g}})},T=()=>{d?.timer&&clearTimeout(d.timer),d=null},C=N=>{if(!f){if(_){const U=_;_=null,U(N),b=N.revision?N.phase:void 0;return}i(N)&&N.revision&&S(N.phase)}},L=()=>{if(!d||f)return;const N=d.phase==="fast",U=N?vc:yc,I=N?bc:Sc;d.timer=setTimeout(()=>{const P=d;if(!(!P||f)){if(P.attempts+=1,R(),N&&P.attempts>=I){const{pending:x}=P;ze(e),p({isRecovering:!1}),C({revision:{html:x.html,common_styles:x.common_styles,subject:x.subject,preheader:x.preheader},phase:"timeout"}),u=!0,P.phase="bg",P.attempts=0,L();return}if(!N&&P.attempts>=I){ze(e),T(),p({isRecovering:!1}),u=!0;return}L()}},U),d.timer.unref?.()},E=N=>{d={phase:"fast",attempts:0,pending:N,timer:null},p({isRecovering:!0}),L()},y=N=>{if(f)return;if(p({historyLoaded:!0,latestRevisionAt:N.latestAt!==void 0&&Number.isFinite(N.latestAt)?N.latestAt:void 0}),n&&d){const P=pn(N,d.pending.sentAt);if(!P)return;const x=d.phase==="fast"?"found":"bg";ze(e),T(),p({isRecovering:!1}),u=!0,C({revision:P,phase:x});return}if(u)return;const U=n?Ss(e):null,I=U&&(U.sentAt<c||!wc(U.html,s()))?U:null;if(I){const P=pn(N,I.sentAt);if(P){ze(e),u=!0,C({revision:P,phase:"found"});return}E(I);return}u=!0,C({revision:pn(N),phase:"normal"})},A=N=>{f||(a?.(N),m.historyLoaded||(p({historyLoaded:!1,latestRevisionAt:void 0}),D()),!d&&C({revision:null,phase:"normal"}))},R=()=>t(e).then(y).catch(A);let h,w=!1;const D=()=>{w||d||f||(w=!0,h=setTimeout(()=>{h=void 0,!f&&!m.historyLoaded&&R()},_c))},k=()=>{f||(p({historyLoaded:!1,latestRevisionAt:void 0}),C({revision:null,phase:"normal"}))};return r?r().then(N=>N?R():k()):R(),{verdict:()=>v,confirmVerdict(N){const U=b;b=void 0,N&&U!==void 0&&!f&&S(U)},dispose(){f=!0,h!==void 0&&(clearTimeout(h),h=void 0),T()}}}function Cc({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:s,onFacts:o}){let i=null;const a=Tc({emailId:r,readAutosave:c=>e.readAutosave(c),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:s,onFacts:o,onLate:({revision:c,phase:d})=>{const u=ds(c);return i?.(u)??!1},onError:c=>{c instanceof Error&&c.message}});return{id:"recovery",load:()=>a.verdict().then(({revision:c})=>ds(c)),loaded(c){a.confirmVerdict(c)},watch(c){return i=c,()=>{i=null,a.dispose()}}}}function Is(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Ec(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const s=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),s}}}function Ac(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const s=Date.now(),o=await t.updateEmail(n,r);return await e.updateEmail(n,r),(Ss(n)?.sentAt??Number.POSITIVE_INFINITY)<=s&&ze(n),o}}}var ws=l.createIdentifier$1("CurrentUser"),Ts={};function hn(e){return e.getOrCreateInstance(ws,()=>ie(Ts))}function Cs(e){return e?.getInstance(ws)?.get()??Ts}var As=l.createIdentifier$1("HeadlessMode");function Ds(e){return e.getOrCreateInstance(As,()=>ie(!1))}function Dc(e){return e?.getInstance(As)?.get()??!1}var Pc=l.createIdentifier$1("HiddenMount");function Rc(e){return e.getOrCreateInstance(Pc,()=>ie(!1))}function Ps(e){return e?.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function vt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Oc(e,t){return t.modeDefaults(vt(e,t.fallbackMode))}function Rs(e,t){const n=vt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Os(e,t){const n=vt(e,t),r=e.user?.advancedConfigs?.[n],s=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...s}}function Lc(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function Nc(e){return l.mergeResourceProxyLayers(e.map(t=>t?.resourceProxy))}function Mc(e){return l.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function xc(e){return l.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function kc(e){return l.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Fc(e,t){return[e.base,Oc(e,t),e.profile,e.serverSide,Rs(e,t.fallbackMode),e.local,e.user,Os(e,t.fallbackMode)]}function mn(e,t){const n=Fc(e,t),r=l.mergeShallowConfigLayers(n),s=Lc(n);s!==void 0&&(r.fileManager=s);const o=Nc(n);o!==void 0&&(r.resourceProxy=o);const i=Mc(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const a=xc(n);a!==void 0&&(r.backendProxy=a);const c=kc(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}function Bc(e,t,n){const r=Rs(e,n),s=Os(e,n);return l.pickKey([s,e.user,r,e.serverSide],t)}var jc=1.5;function Uc(e){return e.isHeadless||!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=jc*e.autosaveTimeoutMs?"none":"revision"}var Fv=5,Bv=3;function $c(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:s}=e,o=e.readFailures??(()=>0),i=e.readFailureRetryable??(()=>!0);let a;const c=y=>a!==void 0&&a.version===y.get().version?o()-a.failuresAtStart:0,d=y=>{const A=c(y);if(A<=0)return!1;const R=n().retryMaxAttempts??5;return!i()||A>R},u=()=>{const{autosaveTimeoutMs:y,retryIntervalMs:A}=n(),R=t();return R!==void 0&&c(R)>0&&A!==void 0&&A>0?A:y},f=y=>y.isNew()&&o()>=3,g=()=>{const y=t();if(!y||y.isDisposed()||d(y))return"none";const{latestRevisionAt:A,snapshotVersion:R,...h}=n(),w=Date.now(),D=Uc({...h,isDirty:y.isDirty(),isNew:y.isNew(),isReady:y.isReady(),latestRevisionAgeMs:A!=null&&A<=w?w-A:void 0,isSnapshotSent:R!=null&&R===y.get().version});return D==="create"&&f(y)?"none":D},m=()=>{const y=t();if(!y||y.isDisposed()||f(y)||d(y)||n().isHeadless)return!1;if(!y.isDirty())return y.isNew();const{snapshotVersion:A}=n();return!(A!=null&&A===y.get().version)};let _,v,p,b,S=!1;const T=()=>{v=void 0;const y=t();if(!y||y.isDisposed())return;if(y.get().docId!==_){C();return}const A=g();A!=="none"&&a?.version!==y.get().version&&(a={version:y.get().version,failuresAtStart:o()}),A==="create"?r():A==="revision"?s():m()&&(_=y.get().docId,v=setTimeout(T,u()))},C=()=>{const y=t();S||!y||v!==void 0||g()==="none"&&!m()||(_=y.get().docId,v=setTimeout(T,u()))},L=y=>{y.source==="user"&&v!==void 0&&(clearTimeout(v),v=void 0),C()},E=()=>{const y=t();y!==p&&(b?.(),p=y,a=void 0,b=y?.subscribe(L),v!==void 0&&(clearTimeout(v),v=void 0))};return E(),C(),{refresh:()=>{S||(E(),C())},stop:()=>{S=!0,b?.(),b=void 0,p=void 0,v!==void 0&&(clearTimeout(v),v=void 0)}}}var Ls=l.createIdentifier$1("documentSession.autosaveUiFacts"),Ns={isUserBusy:!1,saveContext:{}};function Hc(e){return e.getOrCreateInstance(Ls,()=>ie(Ns))}function gn(e){return e?.getInstance(Ls)?.get()??Ns}function Ms(e){return gn(e).saveContext.fallbackTitle||"Untitled email."}var Vc=1e4,Gc=3e4;function Yc(e,t){const n=u=>{const f=e.getInstance(l.CONFIG_SOURCE_ID)?.layers?.(),g=f?Bc(f,u):void 0;return typeof g=="number"&&g>=0?g:void 0},r=()=>{const u=t.current(),f=u?.get().serverId??void 0,g=ae(t.sessionKey()),m=t.recoveryFacts(),_=m?.emailId===f?m:void 0,v=t.revisionFacts(),p=_?.latestRevisionAt,b=v?.lastRevisionAt,S=Cs(e).profile;return{isInited:g||u?.get().attributes.is_inited===!0,isEnabled:!!S?.autosaves,isHistoryLoaded:_?.historyLoaded===!0,isUserBusy:gn(e).isUserBusy,isHeadless:Dc(e),autosaveTimeoutMs:Ps(e).autosaveTimeout||Vc,latestRevisionAt:p!==void 0||b!==void 0?Math.max(p??0,b??0):void 0,snapshotVersion:v?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??Gc,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},s=()=>{const u=gn(e).saveContext;return{...u,project:u.project??t.current()?.get().attributes.project,fallbackTitle:Ms(e)}},o=$c({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>Ol(t.saveState().error),onCreate:()=>{ae(t.sessionKey())||t.save("materialize",s())},onRevision:()=>{t.save("snapshot",{project:s().project})}}),i=t.subscribe(o.refresh),a=hn(e).watch(()=>o.refresh()),c=Hc(e).watch(()=>o.refresh()),d=Ds(e).watch(()=>o.refresh());return()=>{i(),a.dispose(),c.dispose(),d.dispose(),o.stop()}}var xs=12e3;function he(e){return e.getOrCreateInstance(Zt,()=>{const t=lc({resolveAdapters:(r,s)=>zc(r,e,s),resolveWritePort:()=>ks(e),resolveHistoryPort:r=>ae(r)?Bs(e):Fs(e),resolveTerms:()=>pc(e),canEdit:r=>Ja(e,r),notifyBeforeSave:sl(e),timeoutMs:xs,onAdapterError:(r,s)=>{s instanceof Error&&s.message,He(s,{origin:"email-source-adapter",tags:{source:r}})},onTimeout:r=>{}}),n=Yc(e,t);return e.getInstance(l.DISPOSABLE_ID)?.addDispose(n),t})}function En(e){return e?.getInstance(Zt)}function ks(e){const t=dc(e);return t?vn(e)?Ac(t,Ee(e).email(e)):t:Ee(e).email(e)}function Wc(e){return ys(e)!==void 0||vs(e)}function Fs(e){const t=ys(e);return t?vn(e)?(V("port:history:server-backed"),Is(t,Ee(e).history(e))):(V("port:history:integrator"),t):(V("port:history:rest (порт не зарегистрирован)"),Ee(e).history(e))}function Bs(e){const t=bs(e);return t?vn(e)?(V("port:block-history:server-backed"),Is(t,Ee(e).blockHistory(e))):(V("port:block-history:integrator"),t):(V("port:block-history:rest (порт не зарегистрирован)"),Ee(e).blockHistory(e))}function qc(e){return bs(e)!==void 0||vs(e)}function vn(e){return Ur(e)}function zc({email:e,patch:t,serverId:n,key:r},s,o){const i=[];e?i.push({id:"rest",load:()=>ls(e),required:!0}):n&&i.push(cc(ks(s),n)),t&&i.push({id:"plugin",load:()=>cs(t)});const a=ae(r);return ol(n)&&(a?qc(s):Wc(s))&&i.push(Cc({port:a?Bs(s):Fs(s),revisionServiceEnabled:Ur(s),...!a&&Qa(s)?{isHistoryAvailable:()=>Za(s)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:c=>o.publishRecoveryFacts(c)})),i}function z(e){return e.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}var js=new WeakMap,_n=new WeakMap;function le(e){return js.get(e)??0}function Us(e,t){let n=_n.get(e);return n||(n=new Set,_n.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Kc(e){js.set(e,le(e)+1),_n.get(e)?.forEach(t=>t())}function Xc(e){const t=he(e),n=z(e).addListener(l.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{Ge(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function Jc(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Qc(e){const t=e.fetchImpl??((o,i)=>fetch(o,i)),n=e.pageHost??(()=>window.location.hostname),r=new Set,s=o=>{try{const i=new URL(o,window.location.href);return i.protocol!=="https:"&&i.protocol!=="http:"?!1:i.hostname===n()||e.sourceHosts().includes(i.hostname)}catch{return!1}};return{accepts:s,async load(o){if(!s(o))return;const i=!r.has(o);r.add(o);try{const a=await t(o,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!a.ok)return;const c=await a.blob();return Jc(c)?c:void 0}catch{return}}}}var ve={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function Zc(e){const t={maxBytes:e.maxBytes??ve.maxBytes,maxImageBytes:e.maxImageBytes??ve.maxImageBytes,ttlMs:e.ttlMs??ve.ttlMs},n=e.now??(()=>Date.now()),r=new Map,s=new Map,o={hits:0,loads:0,failures:0};let i=0;const a=f=>{const g=r.get(f);g&&(i-=g.bytes,r.delete(f))},c=f=>t.ttlMs<=0||n()-f.storedAt<t.ttlMs,d=()=>{if(i<=t.maxBytes)return;const f=[...r.entries()].sort((g,m)=>g[1].usedAt-m[1].usedAt);for(const[g]of f){if(i<=t.maxBytes)return;a(g)}},u=(f,g)=>{g.size>t.maxImageBytes||(r.set(f,{blob:g,bytes:g.size,storedAt:n(),usedAt:n()}),i+=g.size,d())};return{async get(f){const g=r.get(f);if(g&&c(g))return g.usedAt=n(),o.hits+=1,g.blob;g&&a(f);const m=s.get(f);if(m!==void 0)return m;o.loads+=1;const _=(async()=>{try{const v=await e.load(f);return v?u(f,v):o.failures+=1,v}catch{o.failures+=1;return}finally{s.delete(f)}})();return s.set(f,_),_},forget(f){a(f),s.delete(f)},configure(f){Object.assign(t,{maxBytes:f.maxBytes??t.maxBytes,maxImageBytes:f.maxImageBytes??t.maxImageBytes,ttlMs:f.ttlMs??t.ttlMs});for(const[g,m]of r)m.bytes>t.maxImageBytes&&a(g);d()},clear(){r.clear(),s.clear(),i=0},stats(){return{entries:r.size,bytes:i,...o}}}}var ed=["emcdn.ru","scr.emcdn.ru"];function td(e){const t=String(e??"").trim();if(!t)return"";try{return new URL(t.includes("//")?t:`https://${t}`).hostname}catch{return t.split("/")[0].split(":")[0]}}function nd(e,t){const n=(r,s)=>{const o=new Set(s?t:[]);for(const i of r){const a=td(i);a&&o.add(a)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function rd(e){const t=e??{},n=t.isPlugin!==!0?ed:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...ve};const s=r===!0||r===void 0?{}:r;return{enabled:s.enabled!==!1,sourceHosts:nd(s.sourceHosts,n),maxBytes:s.maxBytes??ve.maxBytes,maxImageBytes:s.maxImageBytes??ve.maxImageBytes,ttlMs:s.ttlMs??ve.ttlMs}}function sd(e){const t=z(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=()=>rd({...n?.get(),isPlugin:!0});let s=r();const o=Qc({sourceHosts:()=>s.sourceHosts}),i=Zc({load:v=>o.load(v),maxBytes:s.maxBytes,maxImageBytes:s.maxImageBytes,ttlMs:s.ttlMs}),a=()=>{t.send(l.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:s.enabled,sourceHosts:[...s.sourceHosts]})},c=t.onInit(()=>a()),d=n?.watch(()=>{const v=r(),p=JSON.stringify(v)!==JSON.stringify(s);s=v,i.configure(v),v.enabled||i.clear(),p&&t.isInited()&&a()}),u={asked:0,served:0,refused:0},f=[],g=(v,p)=>(u.refused+=1,f.push({url:v,reason:p}),f.length>20&&f.shift(),{refused:!0}),m=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:s,counters:{...u},refusals:[...f],store:i.stats()})}),_=t.addListenerAsync(l.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async v=>{const p=v?.url??"";if(u.asked+=1,!s.enabled||!p)return g(p,"disabled");if(!o.accepts(p))return g(p,"host");v.fresh&&i.forget(p);const b=await i.get(p);return b?(u.served+=1,{blob:b}):g(p,"load-failed")});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),d?.dispose(),_.dispose(),i.clear(),delete m.__emmCanvasImages__})}var od=2e3;function id(e){const t=z(e),n=new Set,r=()=>{const i=t.getTarget();if(!i||t.hasPort(i))return;const a=new MessageChannel;let c=!1;const d=f=>{f.data?.operationId==="em:port-ready"&&(c=!0,a.port1.removeEventListener("message",d),t.drainWindow(i))};a.port1.addEventListener("message",d),t.sendPort(i,a.port2),t.usePort(a.port1,!1,i);const u=setTimeout(()=>{n.delete(u),!c&&(He(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),a.port1.removeEventListener("message",d),t.useWindow(i))},od);n.add(u)},s=Object.assign(globalThis,{__emmCanvasPort__:()=>{const i=t.getTarget();return{usesPort:t.usesPort,windowDrained:i?t.isWindowDrained(i):!1}}}),o=t.onInit(()=>r());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n)clearTimeout(i);o.dispose(),delete s.__emmCanvasPort__})}var ad=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function ld(e){return ad.test(e)||e.indexOf("//")===0}function _t(e){return e&&(e.endsWith("/")?e:`${e}/`)}function cd(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function $s(e,t){const n=e==null||e===""?"./":String(e);if(ld(n))return _t(n);const r=t??cd();if(!r)return _t(n);try{return _t(new URL(n,r).href)}catch{return _t(n)}}function dd(){return typeof __useblocks__<"u"&&__useblocks__?.publicPath?$s(__useblocks__.publicPath):$s("/")}var ud=()=>"",fd=()=>"714faf8a";function Hs(e){const t=e?"iframe-eblock":"iframe",n=ud();if(n){const o=n.replace(/\/?$/,"/");return Nr(`${o}${t}.html`,Ue())}const r=fd(),s=`${dd().replace(/\/?$/,"/")}iframe/`;return Nr(`${s}${t}${r?`.${r}`:""}.html`,Ue())}var Vs="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function bn(e){return/^file:/i.test(String(e||"").trim())}function pd(e){return bn(e)?`${Vs} allow-same-origin`:Vs}var jv="em:module-body",hd="em:module-body-ack";function md(e,t,n){try{const r=new URL("./",new URL(t,n)).href,s=new URL(e,r).href;return s.startsWith(r)?s:void 0}catch{return}}function yn(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.([0-9a-f]{6,}))?\.html$/.exec(t);return n?{name:n[1],hash:n[2]}:void 0}function gd(e){const t=yn(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function Ed(e,t){const n=yn(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(s=>e[s]?.file).filter(s=>!!s):[]}function vd(e,t){const n=yn(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const s=new Set([r]),o=[r],i=[];for(;o.length>0;)for(const a of e[o.shift()]??[])s.has(a)||(s.add(a),i.push(a),o.push(a));return i}async function _d(e,t){try{const n=await fetch(e,t?.priority?{priority:t.priority}:void 0);return n.ok?await n.blob():void 0}catch{return}}function bd(e){const t=new Map,n=(r,s)=>{const o=md(r,e.canvasSrc,e.origin);if(!o)return;const i=t.get(o);if(i!==void 0)return i;const a=e.fetchBody(o,s);return t.set(o,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,s){for(const o of r)n(o,s)},reset(){t.clear()},get size(){return t.size}}}var ce;function yd(e){try{return bn(new URL(e,window.location.href).href)}catch{return bn(window.location.href)}}function Gs(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof __useblocks__<"u"&&__useblocks__?.preload?.canvasCrossOrigin===!0}var Sd=()=>Promise.resolve(void 0);function Ys(){const e=Hs(!1);if(!yd(e)){if(!ce||ce.canvasSrc!==e){const t=Gs(e)?_d:Sd;ce={canvasSrc:e,store:bd({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return ce.store}}async function Id(e,t){try{const n=new URL(".vite/manifest.json",new URL("./",new URL(e,window.location.href))).href,r=await fetch(n);if(!r.ok)return;const s=await r.json();t(Ed(s,e))}catch{}}function Sn(e){const t=Ys();if(!t||!ce||ce.warmed||!Gs(ce.canvasSrc))return;ce.warmed=!0;const{canvasSrc:n}=ce,r=gd(n);r&&t.warm([r],e);const s={"js/iframe-eblock.js":["js/discussHandlers.sDXLf5I7.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.sDXLf5I7.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.sDXLf5I7.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]};s?t.warm(vd(s,n),e):Id(n,o=>t.warm(o,e))}function wd(e){const t=Ys();if(!t)return;Sn();const n=r=>{const s=r.data;if(!s||s.operationId!=="em:module-body"||!s.result)return;const o=r.source;o&&(o.postMessage({operationId:hd,for:s.result},"*"),t.take(s.data?.url??"").then(i=>{o.postMessage({operationId:s.result,data:i??null},"*")}))};window.addEventListener("message",n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",n)})}var Oe=/<script\b(?=[^>]*(?:\bbis_use(?:=|\s)|\bdata-bis-config(?:=|\s)|\bdata-dynamic-id(?:=|\s)|local\.adguard\.org|(?:chrome-extension|moz-extension|safari-extension):\/\/))[^>]*>[\s\S]*?<\/script>/gi,Td=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Le=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Ws=/display:\s*none\s*!important/gi,Cd=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,Ad=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Dd=/height\s*:\s*100%\s*!important/i,Pd=[".socialshare,",".advertisment,",".adHolder,",".adsbygoogle-noablate","#ab_adblock","#popmechanic-snippet","filter_ads_by_classname","clever-core-ads","--gn-ov-ad-height","pub_728x90.text-ad.textAd","html-load.com/player","content-loader.com/player",".adblock","#advblock","body { overflow: visible!important; }"];function Rd(e){return Ws.lastIndex=0,(e.match(Ws)||[]).length}function qs(e){const t=e.trim(),n=Rd(t);if(n===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||n>=3||t.length>2e3))return!0;const r=Pd.filter(s=>t.includes(s)).length;return r>=1&&(n>=3||t.length>2e3)||n>=5&&r>=1?!0:n>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function Od(e){Le.lastIndex=0;for(const t of e.matchAll(Le))if(qs(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Ld(e){let t=!1;return Le.lastIndex=0,{html:e.replace(Le,n=>qs(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Nd(e){return Oe.lastIndex=0,Oe.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||Od(e)}function Md(e){if(!Nd(e))return{html:e,found:!1};let t=!1,n=e;Oe.lastIndex=0,Oe.test(n)&&(Oe.lastIndex=0,n=n.replace(Oe,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(Td,""),t=!0);const r=Ld(n);return n=r.html,t=t||r.found,{html:n,found:t}}function xd(e){return!e||!Dd.test(e)?e:(Le.lastIndex=0,e.replace(Le,t=>t.replace(Cd,(n,r,s,o)=>`${r}${s.replace(Ad,"")}${o}`)))}function zs(e){const t=Md(e.replaceAll(`\r
|
|
2084
2108
|
`,`
|
|
2085
|
-
`));return{html:jl(t.html),hasBrowserExtensionArtifacts:t.found}}function Yt(e){return e?.getContent()??""}function ts(e,t){e?.mutate({content:gr(t)},{source:"remote"})}function qt(e){return a.createIdentifier$1(e)}function J(e,t){return e.getOrCreateInstance(t,()=>new a.AsyncEmitter)}function V(e,t){return e.getOrCreateInstance(t,()=>new a.AsyncEmitter).event}function zt(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var Ul=class extends Error{showId;constructor(e,t){super(`[useblocks] show() timed out after ${t}ms waiting for editor init (showId=${e}). Check earlier console errors: wrong host-plugin publicPath (chunks return HTML), mount element removed without destroy(), or sandbox init never completed. Search for [show-pipeline] and [AMD] messages.`),this.name="ShowPipelineTimeoutError",this.showId=e}},Hl=class{_activeRequest=null;_pending=new Map;_listeners=new Set;getActiveShowRequest(){return this._activeRequest}onShowRequested(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}requestShow(e,t,n){return this._rejectPending(a.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(a.createAbortError(n.reason)):(this._activeRequest=e,new Promise((r,s)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{s(new Ul(e.showId,t))})},t);o.unref?.();const i=()=>{this._settle(e.showId,()=>{s(a.createAbortError(n.reason))})};n.addEventListener("abort",i,{once:!0});const l=()=>{clearTimeout(o),n.removeEventListener("abort",i)};this._pending.set(e.showId,{request:e,resolve:r,reject:s,timeoutId:o,dispose:l});for(const c of this._listeners)c(e)}))}completeShow(e){this._settle(e,t=>{t.resolve()})}hasPendingShow(e){return this._pending.has(e)}failShow(e,t){this._settle(e,n=>{n.reject(t)})}rejectAll(e){this._rejectPending(e),this._activeRequest=null}_settle(e,t){const n=this._pending.get(e);n&&(n.dispose(),this._pending.delete(e),this._activeRequest?.showId===e&&(this._activeRequest=null),t(n))}_rejectPending(e){for(const[,t]of this._pending)t.dispose(),t.reject(e);this._pending.clear()}};function $l(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function Gl(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=lr(e),n=cr(e),r=Oi(e.sandbox);t<n+r}var ns=class{_controller=new AbortController;_externalSignalDisposable=new a.Disposable;_sessionChangeListeners=new Set;_showRegistry=new Hl;_timeouts;_generation=0;_sessionStarted=!1;_externalSignal;get signal(){return this._controller.signal}get externalSignal(){return this._externalSignal}get generation(){return this._generation}get contentReadyTimeoutMs(){return lr(this._timeouts)}getSandboxTimeoutMs(e){return ar(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return cr(this._timeouts)}bumpGeneration(){this._generation+=1}getActiveShowRequest(){return this._showRegistry.getActiveShowRequest()}onShowRequested(e){return this._showRegistry.onShowRequested(e)}requestShow(e){return this._showRegistry.requestShow(e,this.contentReadyTimeoutMs,this._controller.signal)}completeShow(e){this._showRegistry.completeShow(e)}hasPendingShow(e){return this._showRegistry.hasPendingShow(e)}failShow(e,t){this._showRegistry.failShow(e,t)}rejectAllPendingShows(e){this._showRegistry.rejectAll(e)}onSessionReplaced(e){return this._sessionChangeListeners.add(e),()=>{this._sessionChangeListeners.delete(e)}}configure(e){e.timeouts!==void 0&&(this._timeouts=$l(this._timeouts,e.timeouts),Gl(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,e.signal!==void 0&&(this._externalSignal=e.signal),t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}relinkExternalSignal(e){this._externalSignal=e,this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new a.Disposable,this._linkExternalSignal(e)}abort(e){const t=e??a.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new a.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new a.Disposable,this._showRegistry.rejectAll(a.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(a.createAbortError("Init session replaced")),this._controller=new AbortController,this._emitSessionReplaced()}_emitSessionReplaced(){for(const e of this._sessionChangeListeners)e()}_linkExternalSignal(e){if(!e)return;if(e.aborted){this._controller.signal.aborted||(this._controller.abort(e.reason??a.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??a.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},Wt=(()=>{const e=new ns;return e.configure({}),e})(),Vl=class extends Error{label;timeoutMs;constructor(e){super(`[sandbox:ready] iframe handshake timed out after ${e}ms`),this.name="SandboxReadyTimeoutError",this.label="sandbox:ready",this.timeoutMs=e}};function Yl(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.isInited=="function"&&typeof t.getTarget=="function"&&typeof t.onInit=="function"}function ql(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(a.throwIfAborted(n),new Promise((r,s)=>{let o=!1,i,l;const c=u=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),l?.dispose(),n?.removeEventListener("abort",d),u())},d=()=>{c(()=>s(a.createAbortError(n?.reason)))};if(l=e.onInit(()=>{e.isInited()&&e.getTarget()&&c(()=>r())}),e.isInited()&&e.getTarget()){c(()=>r());return}t>0&&(i=setTimeout(()=>{c(()=>s(new Vl(t)))},t)),n?.addEventListener("abort",d)}))}var zl=class extends Error{label;timeoutMs;constructor(e,t){super(`[${e}] timed out after ${t}ms`),this.name="OperationTimeoutError",this.label=e,this.timeoutMs=t}};function Wl(e,t,n){return t<=0?e:new Promise((r,s)=>{let o=!1,i;const l=c=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),c())};i=setTimeout(()=>{l(()=>s(new zl(n,t)))},t),e.then(c=>{l(()=>r(c))},c=>{l(()=>s(c))})})}var Kl=2,Ze=Symbol("sandbox:frame-replaced");function re(e,t,n,r,s,o,i){const l=`sandbox:${t}`,c=o?.getSandboxTimeoutMs(t)??At[t],d=()=>{let b=Wl(e.sendAsync(n,r),c,l);return b=a.raceWithAbortSignal(b,o?.signal),Oe(l,b,s)};if(t==="INIT_START"&&Yl(e)){const b=o?.getSandboxReadyTimeoutMs()??2e4,v=e,m=_=>{const y=ql(v,b,o?.signal);return Oe("sandbox:INIT_START:ready-wait",y,s).then(()=>{if(!i||_<=0)return d();const w=i.getGeneration();let A;const C=new Promise((I,f)=>{A=i.onChange(()=>{i.getGeneration()!==w&&f(Ze)})}),g=d();return g.catch(()=>{}),Promise.race([g,C]).finally(()=>A?.()).catch(I=>{if(I!==Ze)throw I;return{...s},m(_-1)})})};return m(Kl)}if(!i)return d();const u=i.getGeneration();let p;const E=new Promise((b,v)=>{p=i.onChange(()=>{i.getGeneration()!==u&&v(Ze)})}),h=d();return h.catch(()=>{}),Promise.race([h,E]).finally(()=>p?.()).catch(b=>{throw b===Ze&&{...s},b})}var Xl=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],Jl=200;function Ql(e=new Set){const t=new Set;return(n,r)=>{if(!Xl.some(([o,i])=>!e.has(o)&&i.test(n)))return;const s=r??`new:${n.length}:${n.slice(0,200)}`;t.has(s)||(t.size>=Jl&&t.clear(),t.add(s))}}function Zl(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:Ql()}}var ec=Zl();function ve(e){return e?.getInstance(a.TEMPLATE_DIRECTIVES_ID)??ec}function tc(e){const t=ae(e),n=K(e),r=()=>e.getInstance(a.INIT_PIPELINE_ID)??Wt;let s,o,i=!1,l=!1;const c=async(y,w,A)=>{const C=A.generation,g=()=>A.generation!==C||A.signal.aborted||t.current()!==y||l,I=le(n);i=!0;try{if(await re(n,"INIT_START",a.EVENT_TYPES.SANDBOX_INIT_START,{guid:w},void 0,A),g())return;const{html:f,hasBrowserExtensionArtifacts:S}=es(Yt(y));if(S&&J(e,a.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),ts(y,f),await re(n,"SET_ENTITY",a.EVENT_TYPES.SANDBOX_SET_ENTITY,zt(Yt(y),w,ve(e).editorPolicy,y.get().version),void 0,A),g())return;await re(n,"INITED",a.EVENT_TYPES.SANDBOX_INITED,{guid:w},void 0,A),s=w,o=I}finally{i=!1}},d=()=>ne(t.sessionKey())?t.current():void 0,u=()=>{if(l||i)return;const y=d(),w=y?.get().docId;if(!y||!w||s===w&&o===le(n)||!y.isReady())return;const A=r();A.signal.aborted||c(y,w,A).catch(()=>{})};let p=!1;const E=()=>{p||l||(p=!0,queueMicrotask(()=>{p=!1,u()}))};let h,b;const v=()=>{const y=d(),w=y?.get().docId;w!==b&&(h?.(),b=w,h=y?.subscribe(E)),E()},m=t.subscribe(v),_=qr(n,E);v(),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{l=!0,_(),h?.(),m()})}var nc=200;function rc({startVersion:e,limit:t=nc}){let n=[],r=e;const s=o=>{n=n.filter(i=>i.version>o),r=Math.max(r,o)};return{record(o){!o.changes?.length&&!o.contentReplaced||(n.push(o),n.length>t&&s(n[n.length-t-1].version))},rebase(o,i){if(i<r)return null;const l=n.filter(d=>d.version>i);s(i);let c=o;for(const d of l){if(d.fromCanvas||d.contentReplaced||!d.changes)return null;const u=d.changes,p=[];for(const E of c){const h=$i(E.range,u,"after");if(!h)return null;p.push({range:h,text:E.text})}c=p}return c}}}function sc(e,t){let n=0;return e.map(({start:r,end:s,text:o})=>{const i=new ee(r,t.slice(r,s),r+n,o);return n+=o.length-(s-r),i})}function oc(e,t){const n=[...e].sort((r,s)=>r.range.start-s.range.start);return sc(n.map(({range:r,text:s})=>({start:r.start,end:r.end,text:s})),t)}function ic(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Kt=a.createIdentifier$1("canvas.sandboxFill");function rs(e){return e.getInstance(Kt)?.pipeline.isEventsLocked()===!0}function Xt(e){Ye(e,{origin:"canvas-channel"})}function ac(e){const t=ae(e),n=K(e);let r;const s=(c,d)=>{const u=c.get().docId;let p=!1,E=null,h=null;const b=rc({startVersion:c.get().version});let v=c.getContent();const m=async(C,g)=>{if(h){h.push({edits:C,rev:g});return}h=[{edits:C,rev:g}];try{do{const I=h.splice(0,h.length);await n.sendAsync(a.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:I.map(f=>f.edits),guid:u,rev:I[I.length-1].rev})}while(h.length)}finally{h=null}},_=(C,g)=>{const I=h?.splice(0,h.length)??[];I.length&&n.sendAsync(a.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:I.map(f=>f.edits),guid:u,rev:I[I.length-1].rev}).catch(Xt),n.sendAsync(a.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:[C],guid:u,rev:c.get().version,...g!==null?{changeId:g}:{}}).catch(Xt)},y=C=>{const{guid:g,pushUndoStop:I}=C;if(g!==u)return;const f=Zi(C);let{edits:S}=C;if(f.baseRev!==null){const M=b.rebase(S,f.baseRev);if(!M){Ye(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),_([],f.changeId);return}S=M}const T=c.get().version;try{p=!0,E=f.changeId;const M=oc(S,c.getContent());I===!1?d.applyWithoutHistory(M):c.mutate({changes:M},{source:rs(e)?"system":"user"})}finally{p=!1,E=null}c.get().version===T&&f.baseRev!==null&&_([],f.changeId)},w=c.subscribe(({changes:C,version:g})=>{const I=c.getContent(),f=!C?.length&&I!==v;if(v=I,b.record({version:g,changes:C,contentReplaced:f,fromCanvas:p}),!C?.length)return;const S=ic(C);p?_(S,E):m(S,g).catch(Xt)}),A=n.addListener(a.EVENT_TYPES.APPLICATION_UPDATE_ENTITY,y);return()=>{w(),A.dispose()}};let o;const i=()=>{const c=t.current(),d=t.history(),u=c?.get().docId;u!==o&&(r?.(),r=void 0,o=u,c&&d&&(r=s(c,d)))},l=t.subscribe(i);i(),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r?.(),l()})}var lc=/^(?:ant|vscode|monaco|docs)-/;function cc(e){return lc.test(e)}function dc(){const e="ub".trim();if(!/^[a-z][a-z0-9]*$/i.test(e))throw new Error(`[cssVars] REACT_APP_CSS_VAR_PREFIX="${e}" is not a valid CSS identifier fragment.`);return e}var uc=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function fc(){return uc}var pc=new Set;function hc(e,t,n=pc){return e.startsWith(`${t}-`)?!1:!cc(e)&&!n.has(e)}function mc(e,t){return`--${t}-${e}`}function ss(e){const t=dc();return hc(e,t,fc())?mc(e,t):`--${e}`}function gc(e,t){const n=ss(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function Ec(e,t){return gc(e,t)}var os=300,is=15e3,as="em-canvas-busy-style";function vc(){if(document.getElementById(as))return;const e=document.createElement("style");e.id=as,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var bc="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z";function _c(e){const t=Ec("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(ss("colorPrimary")).trim()||t}function ls(e){vc();const t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("viewBox","0 0 1024 1024"),n.setAttribute("width","48"),n.setAttribute("height","48"),n.setAttribute("fill","currentColor"),n.setAttribute("aria-hidden","true");const r=document.createElementNS(t,"path");r.setAttribute("d",bc),n.appendChild(r);const s=document.createElement("span");return s.setAttribute("role","img"),s.setAttribute("aria-label","loading"),s.setAttribute("style",`display:inline-flex;color:${_c(e)};animation:em-canvas-busy-spin 1s linear infinite`),s.appendChild(n),s}function yc(e,t,n){const r=t??e,s=Math.max(r.left,e.left,0),o=Math.min(r.right,e.right,n.width),i=Math.max(r.top,e.top,0),l=Math.min(r.bottom,e.bottom,n.height);return o<=s||l<=i?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(s+o)/2-e.left,y:(i+l)/2-e.top}}function Sc(e,t){const n=e.getBoundingClientRect(),r=document.createElement("div");return r.setAttribute("aria-busy","true"),Object.assign(r.style,{position:"fixed",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,cursor:"progress"}),e.appendChild(r),{showSpinner(){r.style.background="rgba(128, 128, 128, 0.15)";const s=yc(n,t(),{width:window.innerWidth,height:window.innerHeight}),o=document.createElement("div");Object.assign(o.style,{position:"absolute",left:`${s.x}px`,top:`${s.y}px`,transform:"translate(-50%, -50%)",lineHeight:"0"}),o.appendChild(ls(e.querySelector(".ant-app")??e)),r.appendChild(o)},remove:()=>r.remove()}}function cs(e){const t=document.createElement("div");t.setAttribute("aria-busy","true"),Object.assign(t.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"progress"});const n=getComputedStyle(e).position!=="static";n||(e.style.position="relative"),e.appendChild(t);const r=setTimeout(()=>{t.appendChild(ls(e))},os);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var wc=8e3;function Ic(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,whenShown:()=>Promise.resolve(),alignTo:()=>{},resize:()=>{},dispose:()=>{}}}var Tc=e=>{for(let t=e?.parentElement??null;t;t=t.parentElement){const n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="hidden")return t}return null};function Ac(e,t){for(let n=e.parentElement;n;n=n.parentElement){const r=getComputedStyle(n),s=r.overflowX!=="visible"||r.overflowY!=="visible",o=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(i=>be(i)>0);if(s&&o)return n;if(n===t)return null}return null}function be(e){return Number.parseFloat(e)||0}function et(e,t){return Math.abs(e-t)<=1}function ds(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=be(n.borderTopWidth),s=be(n.borderRightWidth),o=be(n.borderBottomWidth),i=be(n.borderLeftWidth),l=(c,d,u)=>Math.max(0,be(c)-Math.max(d,u));return{top:t.top+r,bottom:t.bottom-o,left:t.left+i,right:t.right-s,radii:[l(n.borderTopLeftRadius,r,i),l(n.borderTopRightRadius,r,s),l(n.borderBottomRightRadius,o,s),l(n.borderBottomLeftRadius,o,i)]}}function Cc(e,t){const n=et(t.top,e.top),r=et(t.bottom,e.bottom),s=et(t.left,e.left),o=et(t.right,e.right),i=[n&&s?e.radii[0]:0,n&&o?e.radii[1]:0,r&&o?e.radii[2]:0,r&&s?e.radii[3]:0];return i.every(l=>l===0)?"":i.map(l=>`${l}px`).join(" ")}function Pc(e,t,n,r,s){const o=n.readyTimeoutMs??wc,i=document.createElement("div");i.dataset.canvasHost=e,r&&(i.dataset.canvasPlace=r),i.style.position="fixed",i.style.overflow="hidden",i.style.visibility="hidden";const l=n.resolveSrc(e),c=document.createElement("iframe");c.setAttribute("sandbox",n.resolveSandbox(l)),c.setAttribute("allow","clipboard-read; clipboard-write"),c.setAttribute("title","Email content"),c.style.width="100%",c.style.border="0",c.style.display="block",c.style.minHeight="600px",c.src=l,i.appendChild(c),t.appendChild(i),n.mark?.("created"),s||n.onCreated?.(c);const d=new a.Disposable;let u=!1,p=!1,E,h,b,v;const m=()=>{clearTimeout(v),v=setTimeout(()=>{p||(p=!0,h?.(new Error(`[canvas] ${e}: документ не загрузился за ${o} мс`)))},o)},_=()=>u?(b=Promise.resolve(),p=!0,b):(p=!1,b=new Promise((L,x)=>{E=L,h=x}),m(),b),y=()=>{if(clearTimeout(v),u=!0,p){b=Promise.resolve();return}p=!0,n.mark?.("loaded"),E?.()};c.addEventListener("load",y),d.addDispose(()=>{clearTimeout(v),c.removeEventListener("load",y)});let w;const A=()=>{w??=n.bindResizer?.(c)};let C=null,g=null,I;const f=()=>{if(!C){i.style.visibility="hidden",c.removeAttribute("id");return}n.elementId&&(c.id=n.elementId);const L=C.getBoundingClientRect(),x=g?.isConnected?g:Tc(C),$=x?ds(x):null,Y=$?Math.max(L.top,$.top):L.top,G=$?Math.min(L.bottom,$.bottom):L.bottom,se=Math.max(0,G-Y);i.style.visibility=se>0?"visible":"hidden",i.style.left=`${L.left}px`,i.style.top=`${Y}px`,i.style.width=`${L.width}px`,i.style.height=`${se}px`,c.style.transform=`translateY(${L.top-Y}px)`;const Ie=Ac(C,x);i.style.borderRadius=Ie?Cc(ds(Ie),{top:Y,bottom:G,left:L.left,right:L.right}):""};let S="",T="",M=0,k;const z=()=>{if(!C){k=void 0;return}k=window.requestAnimationFrame(z);const L=C.getBoundingClientRect(),x=g?.isConnected?g.getBoundingClientRect():void 0,$=`${Math.round(L.left)}:${Math.round(L.top)}:${Math.round(L.width)}:${Math.round(L.height)}:${x?`${Math.round(x.top)}:${Math.round(x.height)}`:"-"}`;$!==S&&(S=$,f());const Y=c.getBoundingClientRect().height;Y>0&&Y!==M&&(M=Y,C.style.height=`${Y}px`);const G=getComputedStyle(C).pointerEvents;G!==T&&(T=G,i.style.pointerEvents=G)},D=()=>{k===void 0&&C&&(k=window.requestAnimationFrame(z))},N=()=>{k!==void 0&&(window.cancelAnimationFrame(k),k=void 0)},j=()=>f();let P=[];const O=(L,x)=>{if(g=x,L&&P.length>0){const $=P;P=[],$.forEach(Y=>Y())}if(L===C){f();return}if(I?.disconnect(),I=void 0,C&&C.style.removeProperty("height"),S="",M=0,T="",C=L,!L){N(),f();return}n.onShown?.(c);try{if(typeof ResizeObserver=="function"){const $=new ResizeObserver(f);typeof $.observe=="function"&&(I=$,I.observe(L))}}catch{I=void 0}f(),A(),D()};window.addEventListener("scroll",j,!0),window.addEventListener("resize",j),d.addDispose(()=>{I?.disconnect(),k!==void 0&&window.cancelAnimationFrame(k),window.removeEventListener("scroll",j,!0),window.removeEventListener("resize",j)});const B=L=>{u=!1,L&&n.onReload?.(c);let x;p||b===void 0?x=_():(m(),x=b);try{c.contentWindow?.location.reload()}catch{c.src=l}return x};return{element:c,ready(){return b??_()},reload:()=>B(!0),reloadQuietly:()=>B(!1),get shown(){return C!==null},whenShown(){return C!==null?Promise.resolve():new Promise(L=>{P.push(L)})},alignTo(L,x){O(L,x??null)},scrollBy(L,x){let $=L,Y=x;for(let G=C?.parentElement??null;G;G=G.parentElement){if(Math.abs($)<1&&Math.abs(Y)<1)return;const se=getComputedStyle(G);if((se.overflowY==="auto"||se.overflowY==="scroll")&&G.scrollHeight>G.clientHeight){const Ie=G.scrollTop,Yn=G.scrollLeft;G.scrollBy({left:$,top:Y,behavior:"instant"}),$-=G.scrollLeft-Yn,Y-=G.scrollTop-Ie}}(Math.abs($)>=1||Math.abs(Y)>=1)&&window.scrollBy({left:$,top:Y,behavior:"instant"})},resize(){w?.resize()},dispose(){O(null,null),w?.dispose(),d.dispose(),i.remove()}}}function Dc(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",s=(h,b)=>h==="email"?`email:${b??n}`:h,o=new Map;let i,l=[],c=!1,d;const u=()=>{if(l.forEach(h=>clearTimeout(h)),l=[],i?.remove(),i=void 0,d?.remove(),d=void 0,c){c=!1;const h=o.get("email");t.get(s("email"))?.alignTo(h?.slot??null,h?.clip??null)}},p=(h,b,v)=>{const m=s(h,b),_=t.get(m);if(_)return _;const y=e.resolveMount();if(!y)return Ic();const w=Pc(h,y,e,h==="email"?b??n:void 0,v);return t.set(m,w),w},E={get:h=>p(h),current:h=>p(h),peek:h=>t.get(s(h)),spare:()=>t.get(s("email",r())),ensureSpare:()=>p("email",r(),!0),promote(){const h=t.get(s("email",r()));if(!h)return;const b=t.get(s("email"));n=r();const v=o.get("email");h.alignTo(v?.slot??null,v?.clip??null),b?.alignTo(null)},alignSurface(h,b,v){if(o.set(h,{slot:b,clip:v??null}),h==="email"&&c){d?.remove(),d=b?cs(b):void 0;return}(b?p(h):t.get(s(h)))?.alignTo(b,v??null)},visible(){for(const h of t.values())if(h.shown)return h},byWindow(h){if(h){for(const b of t.values())if(b.element.contentWindow===h)return b}},busy(h){if(u(),!h)return;if(!E.visible()){c=!0;const m=o.get("email");m?.slot&&(d=cs(m.slot)),l=[setTimeout(u,is)];return}const b=e.resolveMount();if(!b)return;const v=Sc(b,()=>E.visible()?.element.parentElement?.getBoundingClientRect()??null);i=v,l=[setTimeout(()=>v.showSpinner(),os),setTimeout(u,is)]},dispose(){u(),t.forEach(h=>h.dispose()),t.clear(),o.clear(),n="a"}};return E}var Rc=a.createIdentifier$1("canvas.resizerBinder"),Jt=a.createIdentifier$1("canvas.service"),Oc={created:W.canvasCreated,loaded:W.canvasLoaded};function Lc(e,t){if(e.getInstance(Jt))return;const n=Dc({resolveMount:()=>t.resolveMount(),resolveSrc:s=>t.resolveSrc(s),resolveSandbox:bl,elementId:t.elementId,bindResizer:s=>e.getInstance(Rc)?.(s),onCreated:s=>tt(e,s,"fresh"),onReload:s=>tt(e,s,"fresh"),onShown:s=>tt(e,s,"switch"),mark:s=>t.mark?.(Oc[s])}),r=K(e).addListener(a.EVENT_TYPES.SANDBOX_WHEEL,s=>{n.visible()?.scrollBy(s?.deltaX??0,s?.deltaY??0)});e.inject(Jt,n),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),n.dispose()})}function tt(e,t,n){const r=K(e),s=t.contentWindow;if(!s)return;const o=r.getTarget()===s;o&&n==="switch"||(n==="fresh"&&(r.forget(s),o&&r.setTarget(void 0)),r.setTarget(s),nl(r))}function Mc(e,t){tt(e,t,"promote")}function Nc(e,t){const n=t.contentWindow;n&&K(e).greet(n)}function xc(e,t){const n=t.contentWindow;n&&K(e).forget(n)}function de(e){return e.getInstance(Jt)}function kc(e){const t=K(e),n=()=>de(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(a.EVENT_TYPES.RELOAD,async()=>{await n()?.reload()}),s=t.addListener(i=>{i.data?.operation===a.EVENT_TYPES.SANDBOX_RESIZED&&n()?.resize()}),o=V(e,a.events.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),s.dispose(),o.dispose()})}var Hm=a.createIdentifier$1("HeadlessMode"),Fc=a.createIdentifier$1("HiddenMount");function Bc(e){return e.getOrCreateInstance(Fc,()=>ue(!1))}function us(){const e=document.createElement("div");return e.dataset.canvasOffscreen="true",e.style.position="absolute",e.style.left="-10000px",e.style.top="-10000px",e.style.width="1600px",e.style.height="1000px",document.body.appendChild(e),e}function jc(e){const t=e.getInstance(a.OPTIONS_SOURCE_ID);let n,r;e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r?.remove(),r=void 0}),Lc(e,{resolveMount:()=>n,resolveSrc:o=>Kr(o==="block"),elementId:"email_iframe",mark:o=>H(o)}),t?.watch(o=>{if(n)return;const i=o?.element;if(i instanceof HTMLElement)n=i;else if(o!==void 0)n=r??=us();else return;de(e)?.get("email")});let s;e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{s?.remove(),s=void 0}),Bc(e).watch(o=>{const i=de(e);if(i){if(o){s??=us(),i.alignSurface("email",s,s);return}s&&(i.alignSurface("email",null),s.remove(),s=void 0)}})}var fs=a.createIdentifier$1("canvas.headerFlow"),ps=["subject","preheader"],Uc=3e3,Hc={subject:a.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,preheader:a.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE};function $c(e){const t=ae(e),n=K(e),r=m=>m?"remote":rs(e)?"system":"user",s=(m,{guid:_,value:y,forced:w})=>{const A=Re(t);if(!A||typeof y!="string"||_&&_!==A.get().docId)return;const C=t.forcedHeaders();if(C?.[m]&&!w&&y!==C[m])return;w&&(p.delete(m),p.size===0&&t.endForcedHeaders());const g=A.get().attributes[m]??"";l=!0;try{Ke(A,{[m]:y},{source:r(w)})}finally{l=!1}o[m]=y,J(e,a.events.ON_HEADER_APPLIED_ID).fire({field:m,value:y,forced:!!w,isGenerated:y!==g&&!!y})};let o={},i,l=!1,c=Promise.resolve();const d=(m,_,y,w=!1)=>{c=n.sendAsync(Hc[m],{value:_,guid:Re(t)?.get().docId,...y?{force:!0,echo:!0}:{},...w?{undoStep:!0}:{}}).catch(A=>{})};let u;const p=new Set;e.inject(fs,{whenDelivered:async()=>{await c},reassert:m=>{const _=Re(t),y=ps.filter(w=>m[w]);if(!(!_||y.length===0)){l=!0;try{Ke(_,Object.fromEntries(y.map(w=>[w,m[w]])),{source:"system"})}finally{l=!1}t.beginForcedHeaders({subject:m.subject??"",preheader:m.preheader??""}),clearTimeout(u),u=setTimeout(()=>{p.clear(),t.endForcedHeaders()},Uc),p.clear();for(const w of y)p.add(w);for(const w of y)o[w]=m[w],d(w,m[w],!0)}}});const E=()=>{i?.(),i=void 0;const m=Re(t);if(!m){o={};return}const _=m.get().attributes;o={subject:_.subject,preheader:_.preheader},i=m.subscribe(({source:y})=>{if(l)return;const w=m.get().attributes,A=t.forcedHeaders();for(const C of ps){const g=w[C];g!==o[C]&&(o[C]=g,d(C,g??"",y==="system"&&A?.[C]!==void 0,y==="user"))}})};E();const h=t.subscribe(E),b=n.addListenerAsync(a.EVENT_TYPES.APPLICATION_SUBJECT_UPDATE,m=>s("subject",m)),v=n.addListenerAsync(a.EVENT_TYPES.APPLICATION_PREHEADER_UPDATE,m=>s("preheader",m));e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{b.dispose(),v.dispose(),h(),i?.(),clearTimeout(u)})}function hs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Qt(e,t){const n={...e};for(const r of Object.keys(t)){const s=t[r],o=e[r];hs(s)&&hs(o)?n[r]=Qt(o,s):s!==void 0&&(n[r]=s)}return n}function Gc(e,t){const n=a.COMMON_STYLES;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const s=JSON.parse(r);if(s&&typeof s=="object"&&!Array.isArray(s)&&Object.keys(s).length>0)return Qt(n,s)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?Qt(n,t):n}function Vc(){const e=window.localStorage.getItem(a.LOCAL_STORAGE_ITEMS.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?a.DARK:a.LIGHT;return e&&e!=="system"?e:t}function Yc(){const e=window.localStorage.getItem(a.LOCAL_STORAGE_ITEMS.em_code_mode_settings);if(!e)return!1;try{const t=JSON.parse(e);return!!(t?.isCodeMode&&(t.codeModeDirection==="left"||t.codeModeDirection==="right"))}catch{return!1}}function qc(e){const{config:t}=e;return{operation:a.EVENT_TYPES.UPDATE_PREVIEW,theme:e.theme,commonStyles:Gc(e.emailCommonStyles,e.defaultCommonStyles),pathEnabled:t.pathEnabled,copyPasteEnabled:t.copyPasteEnabled,saveBlockEnabled:t.saveBlockEnabled,editImageControlEnabled:t.editImageControlEnabled,codeMode:e.codeMode,elementAIimageEnabled:t.elementAIimageEnabled,imageCenterStockEnabled:t.imageCenterStockEnabled,imageCenterGifEnabled:t.imageCenterGifEnabled,imageCenterEditorEnabled:t.imageCenterEditorEnabled,blocksAddPanelEnabled:t.blocksAddPanelEnabled!==!1&&t.blocksSectionsShow!==!1,lockEditor:t.lockEditor,appName:e.appName}}function zc(e){const t=K(e),n=e.getInstance(a.CONFIG_SOURCE_ID),r=e.getInstance(a.OPTIONS_SOURCE_ID),s=ae(e);let o,i="";const l=()=>{const _=n?.get()??{},y=qc({config:_,emailCommonStyles:s.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:Vc(),codeMode:Yc(),appName:"useblocks"}),w=JSON.stringify(y);w!==i&&(i=w,t.send(y))},c=t.onInit(()=>{i="",l()}),d=()=>{t.isInited()&&l()},u=n?.watch(d),p=r?.watch(_=>{o=_?.commonStyles,d()});let E;const h=()=>{E?.(),E=s.current()?.subscribe(d),d()};h();const b=s.subscribe(h),v=matchMedia(a.PREFERS_COLOR_SCHEME_DARK),m=()=>d();v.addEventListener("change",m),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),u?.dispose(),p?.dispose(),E?.(),b(),v.removeEventListener("change",m)})}var Zt;(function(e){function t(s,o,i=(l,c)=>l===c){if(s===o)return!0;if(s.length!==o.length)return!1;for(let l=0;l<s.length;l++)if(!i(s[l],o[l]))return!1;return!0}e.isEqual=t;function n(s,o=i=>i){const i=new Set;return s.filter(l=>{const c=o(l);return i.has(c)?!1:(i.add(c),!0)})}e.unique=n;function r(s=[],o=[],i=(l,c)=>l===c){const l=[],c=[],d=[];for(const u of s){const p=o.find(E=>i(u,E));p?d.push({prev:u,next:p}):c.push(u)}for(const u of o)s.find(p=>i(u,p))||l.push(u);return{added:l,removed:c,exists:d}}e.diff=r})(Zt||(Zt={}));function Wc(e,t){return e.type===t.type&&e.key===t.key}function Kc(e){const t=K(e),n=()=>e.getServices(a.SANDBOX_EXTENSIONS_ID)??[];let r=[];const s=t.onInit(()=>{r=n(),t.send(a.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,r)}),o=a.getServiceContainerId(a.SANDBOX_EXTENSIONS_ID),i=e.onInject(l=>{if(l!==o)return;const c=n();if(!t.isInited()){r=c;return}const{added:d,removed:u}=Zt.diff(r,c,Wc);if(r=c,u.length){if(u.some(p=>p.type==="script")){t.send(a.EVENT_TYPES.RELOAD);return}t.send(a.EVENT_TYPES.SANDBOX_REMOVE_EXTENSIONS,u.map(p=>p.key))}d.length&&t.send(a.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,d)});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{s.dispose(),i?.dispose()})}var Xc=a.createIdentifier$1("prewarm.editorVisible");function Jc(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function Qc(e={}){const t=e.paint??Jc;let n=!1,r=!1,s=!1,o=!1,i=!1;const l=[],c=()=>{i||o||!n||!r||!s||(o=!0,t(()=>{i=!0,H(W.editorVisible);for(const d of l.splice(0))d()}))};return{noteShellVisible(){n=!0,c()},notePagePainted(){r=!0,c()},noteContentShown(){s=!0,c()},whenVisible(d){if(i){d();return}l.push(d)},contentShown:()=>s}}function Zc(e){return e.getOrCreateInstance(Xc,()=>Qc())}var ed=500,td=500,nd=5e3;function rd(e){const t=e.quietMs??ed,n=e.floorMs??td,r=e.ceilingMs??nd;let s,o,i=0;const l=()=>{clearTimeout(s),clearTimeout(o),s=void 0,o=void 0},c=()=>{l(),e.run()},d=()=>{clearTimeout(s);const u=n-(Date.now()-i);s=setTimeout(c,Math.max(t,u))};return{start(){l(),i=Date.now(),o=setTimeout(c,r),d()},notify(){s!==void 0&&d()},cancel:l}}function sd({attributes:e,readContent:t,docId:n,hasSession:r,serverId:s,show:o}){if(!r)return;const i={id:s??void 0,renderGuid:n,showId:o?.id,isNew:s==null,showToken:o?.token},l={...e,...i};return Object.defineProperty(l,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),l}var ms="self-init:";function od(e){return e.startsWith(ms)}function gs(e,t){const n=e.getActiveShowRequest();return od(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function id(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t();let s="";const o=()=>e.readDocument()?Yt(e.readDocument()):s,i=()=>ve(e.container).editorPolicy,l=()=>e.readEmail(),c=()=>{const d=l();return{...d,id:e.isTemplate()||d.isNew?void 0:d.id,html:o()}};return{readContent:o,publicEmail:c,sendInitStart:()=>re(n,"INIT_START",a.EVENT_TYPES.SANDBOX_INIT_START,{guid:l().renderGuid},void 0,r()),sendInited:()=>re(n,"INITED",a.EVENT_TYPES.SANDBOX_INITED,{guid:l().renderGuid},void 0,r()),async sendContent(){const d=l(),{html:u,hasBrowserExtensionArtifacts:p}=es(d?.html||"");p&&e.events.browserExtensionDetected(),ts(e.readDocument(),u),s=u,await re(n,"SET_ENTITY",a.EVENT_TYPES.SANDBOX_SET_ENTITY,zt(o(),d.renderGuid,i(),e.readDocument()?.get().version),{guid:d.renderGuid,emailId:d.id??null},r())},refreshContent:()=>re(n,"SET_ENTITY",a.EVENT_TYPES.SANDBOX_SET_ENTITY,zt(o(),l().renderGuid,i(),e.readDocument()?.get().version),void 0,r()),sendPreheader:async()=>{const d=l();if(d.preheader!==void 0)return re(n,"PREHEADER",a.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:d.preheader,guid:d.renderGuid,force:!0},void 0,r())},sendSubject:async()=>{const d=l();if(d.subject!==void 0)return re(n,"SUBJECT",a.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:d.subject,guid:d.renderGuid,force:!0},void 0,r())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:d=>e.showFilled?.(d),readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(c()),fireInit(d,u){if(!gs(t(),d)){t().getActiveShowRequest()?.showId;return}const p=l();p.id,p.renderGuid,t().completeShow(d),Ke(e.readDocument(),{is_inited:!0},{source:"system"});const E=c();return u&&(E.reset=!0),e.events.inited(E)},fireEmailChanged(){e.events.emailChanged(c())},fireContentChanged(){e.events.contentChanged(o())}}}function ad(e){const t=()=>e.initPipeline();let n=!1,r,s,o,i=0,l;const c=id({...e,waitScope:()=>({getSandboxTimeoutMs:m=>t().getSandboxTimeoutMs(m),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:l?.signal??t().signal})});let d;const u=(m,_)=>{if(d===m)return;d=m;const y=i;setTimeout(()=>{i!==y||t().signal.aborted||b(m,_).catch(()=>{})},0)},p=()=>{l?.abort(),l=void 0};let E;const h=()=>{const m=t().signal;m!==E&&(E?.removeEventListener("abort",p),E=m,m.addEventListener("abort",p))};async function b(m,_){const y=++i;p(),l=new AbortController,h();const w=()=>i!==y,A=c.readTarget(),C=t().generation,g=()=>C===t().generation&&!t().signal.aborted,I=_?"init:reset-":"init:";if(!_){const T=c.publicEmail();T?.id,T?.renderGuid,T?.preheader}let f=!1,S=!1;try{n=!0,await c.sendInitStart(),c.fireWillInit(),await(_?c.refreshContent():c.sendContent()),f=!0,_||c.publicEmail()?.id;try{await c.sendPreheader()}catch(T){`${I}`,String(T)}try{await c.sendSubject()}catch(T){`${I}`,String(T)}if(w()||c.showFilled(A),await c.sendInited(),S=!0,s===m){const T=e.readSandboxGeneration?.()??o;T!==void 0&&(r=T)}await c.revealFilled()}catch(T){throw w()||(`${I}`,{...e.describeSurface?.(),error:String(T)},void 0),!w()&&gs(t(),m)&&t().failShow(m,T),T}finally{v(m,_,I,{superseded:w(),sessionGeneration:C,contentApplied:f,sandboxInitedAcked:S,commit:g()})}}function v(m,_,y,w){const{superseded:A,contentApplied:C,sandboxInitedAcked:g}=w;if(A){`${y}`;return}g&&w.commit?c.fireInit(m,_||void 0):g?(`${y}`,w.sessionGeneration,t().generation,t().signal.aborted,void 0):C?(`${y}`,void 0):(`${y}`,void 0),n=!1,l=void 0,!g&&s===m&&(s=void 0,r===o&&(r=void 0)),!g&&C&&u(m,_)}return{channel:c,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:m=>{r=m},lastCorrelation:()=>s,markCorrelation:m=>{s=m},bumpRunSeq:()=>{i+=1},noteSandboxGeneration:m=>{o=m},fill:m=>b(m,!1),refill:m=>b(m,!0),stop:()=>{i+=1,p(),n=!1,E?.removeEventListener("abort",p),E=void 0}}}function ld(e,t,n){if(!e?.renderGuid||!e.showId||e.showId!==t.showId)return!1;if(t.isNew)return e.id==null;const r=t.emailId??t.navId;return r!=null&&String(e.id??"")!==String(r)?!1:Es(e,n)}function Es(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function cd(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:s,readSandboxGeneration:o}=e,i=u=>{const p=n(),E=s();if(!ld(p,u,E)){u.showId,u.navId,u.emailId,p?.id,p?.showId,p?.renderGuid;return}u.showId,p?.id,p?.renderGuid,t.markFilled(o()),t.markCorrelation(u.showId),t.fill(u.showId).catch(()=>{})};return{showRequested:u=>{i(u)},showRequestIdentityChanged:()=>{const u=e.initPipeline().getActiveShowRequest();u&&i(u)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const u=o();if(t.filledGeneration()===u)return;const p=n(),E=s();if(!p?.renderGuid||!Es(p,E))return;const h=`${ms}${p.renderGuid}`;t.markFilled(u),t.markCorrelation(h);const b=r()?.isReady()===!0;p.id,p.renderGuid,(b?v=>t.refill(v):v=>t.fill(v))(h).catch(()=>{t.lastCorrelation()===h&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id,r()}}}function dd(e){return e??""}function ud(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function fd(e){return e.length>0}function pd(e){const t=ae(e),n=K(e),r=()=>ne(t.sessionKey())?void 0:t.current(),s=()=>{const R=r();return sd({attributes:R?.get().attributes??{},readContent:()=>R?.getContent(),docId:R?.get().docId,hasSession:!!R,serverId:R?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(a.INIT_PIPELINE_ID)??Wt;let i={},l=!1;const c=e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(R=>{l=!!R?.element});let d=!1,u=!1,p=!1,E=0;const h=()=>{const R=de(e);if(!R)return;const q=++E,U=R.spare();return U&&xc(e,U.element),(U?U.reloadQuietly():R.ensureSpare()?.ready())?.then(()=>{if(q!==E)return;d=!0;const te=R.spare();te&&Nc(e,te.element),p&&(p=!1,S(),L())})},b=rd({run:()=>{p||h()?.catch(()=>{})}}),v=()=>{Zc(e).noteContentShown(),!d&&!p&&b.start()};let m=!1;const w=ad({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:s,revealFilled:()=>{const R=de(e);return m&&R&&(m=!1,b.start()),l?R?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:R=>{const q=de(e),U=q?.spare()?.element.contentWindow;u&&q&&U&&R===U&&(u=!1,q.promote(),q.busy(!1),m=!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!i.isTemplate,readSandboxGeneration:()=>le(n),describeSurface:()=>({canvasPath:f,promoted:u,spareClean:d,handshake:n.isInited(),generation:le(n)}),events:{willInit:R=>{J(e,a.events.WILL_EMAIL_INIT_ID).fire(R)},inited:R=>{v(),J(e,a.events.ON_EMAIL_INIT_ID).fire(R)},contentChanged:R=>{J(e,a.events.ON_CONTENT_CHANGED_ID).fire(R)},emailChanged:R=>{J(e,a.events.ON_EMAIL_CHANGED_ID).fire(R)},browserExtensionDetected:()=>{J(e,a.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),A=cd({pipeline:w,initPipeline:o,readEmail:s,readDocument:r,readRouteEmailId:()=>i.emailId,readSandboxGeneration:()=>le(n)});let C="",g="",I="",f="none";const S=()=>{const R=de(e)?.spare();R&&(n.sendNow({operation:a.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0}),d=!1,u=!0,Mc(e,R.element))},T=(R,q)=>{const U=de(e);if(!U)return!0;const te=U.spare(),he=te&&d?"spare":"prepare";if(f=he,U.busy(!0),te&&d)return S(),!0;b.cancel(),n.sendNow({operation:a.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0});const Te=h();if(Te===void 0)return f="reload",U.busy(!1),U.peek("email")?.reload(),!0;p=!0;const Ae=E;return Te.catch(()=>{!p||Ae!==E||(p=!1,f="reload",U.busy(!1),U.peek("email")?.reload())}),!1},M=()=>{Ie(),w.noteSandboxGeneration(le(n));const R=s(),q=ud(R?.renderGuid,R?.showId,R?.id,i.emailId),U=dd(R?.renderGuid);if(U!==g){const Te=fd(g),Ae=g;g=U,Te&&T(Ae,U)}if(p)return;q!==C&&(C=q,A.showRequestIdentityChanged());const te=r(),he=`${q}|${te?.get().docId??""}|${le(n)}`;he!==I&&te?.isReady()===!0&&(I=he,A.selfInitChanged()),A.saasChanged(),O()};let k=!1,z="",D="",N=!1,j=!1;const P=R=>{R.source==="user"?j=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(N=!0),L()},O=()=>{const R=s();if(!R?.renderGuid)return;const q=w.channel.readContent(),U=JSON.stringify([R.preheader,R.common_styles,R.meta,R.subject,R.utm_parameters?.utm_campaign??"",R.utm_parameters?.utm_content??"",R.utm_parameters?.utm_medium??"",R.utm_parameters?.utm_source??"",R.utm_parameters?.utm_term??""]),te=k&&q!==D,he=k&&U!==z;k=!0,D=q,z=U;const Te=N&&!j;if(N=!1,j=!1,w.isEventsLocked()||Te)return;const Ae={...R,id:i.isTemplate||R.isNew?void 0:R.id,html:q};if(te){J(e,a.events.ON_CONTENT_CHANGED_ID).fire(q),J(e,a.events.ON_EMAIL_CHANGED_ID).fire(Ae);return}he&&R.is_inited&&J(e,a.events.ON_EMAIL_CHANGED_ID).fire(Ae)};let B=!1;const L=()=>{B||(B=!0,queueMicrotask(()=>{B=!1,M()}))};e.inject(Kt,{pipeline:w,setRoute:R=>{R.emailId===i.emailId&&!!R.isTemplate==!!i.isTemplate||(i=R,L())}});let x,$;const Y=()=>{const R=r()?.get().docId;R!==$&&(x?.(),$=R,x=r()?.subscribe(P)),L()};let G,se;const Ie=()=>{const R=e.getInstance(a.INIT_PIPELINE_ID);!R||R===G||(se?.(),G=R,se=R.onShowRequested(q=>A.showRequested(q)))},Yn=n.addListener(R=>{R.data?.operation===a.EVENT_TYPES.SANDBOX_RESIZED&&b.notify()}),Dm=t.subscribe(Y),Rm=qr(n,L);Y(),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{c?.dispose(),se?.(),Rm(),Dm(),x?.(),Yn.dispose(),b.cancel(),w.stop()})}function hd(){return a.USEBLOCKS!=="useblocks"}var en={config:{mode:"freeUserBlocks",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formButtonFieldReplacerEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!1,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},md={config:{mode:"pro",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!0,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!0,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0,enableCopyFile:!0}},project:void 0,page:{isNew:!0,type:"email",project:0,id:"",showToken:0}},vs=en,gd=["freeUserBlocks","blocks"],bs={};function Ed(e){bs=e}var _s=e=>gd.includes(e)?vs:bs[e]??vs,tn={config:{mode:"simple",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!1,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!1,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0}},project:void 0},vd={config:{mode:"editor",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!1,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!1,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!0,emailDropdownMenuEnabled:!1,emailDropdownMenuClone:!0,emailDropdownMenuImport:!1,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportTextEnabled:!1,exportMarkdownEnabled:!1,exportZipEnabled:!0,exportClipboardEnabled:!1,exportWebHookEnabled:!1,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!1,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!1,aiAssistentEnabled:!1,optimizeEnabled:!1,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!1,tagsEnabled:!0,isTemplateEnabled:!1,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!1,deleteButtonEnabled:!0,toggleSidePanel:!1,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!1,formFieldImageTitleEnabled:!1,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!1,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!1,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!1,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!1,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},bd={...tn,config:{...tn.config,imageCenterFileManagerView:!1}};Ed({pro:md,editor:vd,simple:hd()?tn:bd,freeUserBlocks:en,blocks:en});var ys=a.createIdentifier$1("CodeMode");function Ss(){let e;try{const t=window.localStorage?.getItem(a.LOCAL_STORAGE_ITEMS.em_code_mode_settings);e=t?JSON.parse(t):void 0}catch{e=void 0}return{isCodeMode:!!(e?.isCodeMode||e?.isCodeMode===void 0),direction:e?.codeModeDirection||"left"}}function _d(e){try{window.localStorage?.setItem(a.LOCAL_STORAGE_ITEMS.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function yd(e){return e.getOrCreateInstance(ys,()=>{const t=ue(Ss());return t.watch(_d),t})}function Sd(e){return e?.getInstance(ys)?.get()??Ss()}function wd(e,t){const n=yd(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function Id(e,t,n=e.getInstance(a.CONFIG_SOURCE_ID)){n?.setMode(t),n?.get()?.codeEnabled===!1&&Sd(e).isCodeMode&&wd(e,!1)}var ws=new Set;function Td(){return window.localStorage.getItem(a.LOCAL_STORAGE_ITEMS.em_color_scheme)??void 0}function Ad(e){return ws.add(e),e(Td()),{dispose(){ws.delete(e)}}}function nt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Cd(e,t){return t.modeDefaults(nt(e,t.fallbackMode))}function Pd(e,t){const n=nt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Dd(e,t){const n=nt(e,t),r=e.user?.advancedConfigs?.[n],s=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...s}}function Rd(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function Od(e){return a.mergeResourceProxyLayers(e.map(t=>t?.resourceProxy))}function Ld(e){return a.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function Md(e){return a.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function Nd(e){return a.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function xd(e,t){return[e.base,Cd(e,t),e.profile,e.serverSide,Pd(e,t.fallbackMode),e.user,Dd(e,t.fallbackMode),e.local]}function nn(e,t){const n=xd(e,t),r=a.mergeShallowConfigLayers(n),s=Rd(n);s!==void 0&&(r.fileManager=s);const o=Od(n);o!==void 0&&(r.resourceProxy=o);const i=Ld(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const l=Md(n);l!==void 0&&(r.backendProxy=l);const c=Nd(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}var kd=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function Is(e){return e==="server"?"serverSide":e}function Fd({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},s=ue();let o={kind:"pending"},i;const l=new Promise(E=>{i=E}),c=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function d(){o.kind!=="pending"&&s.set(nn(r,e))}function u(E){if(o.kind!=="pending")return;clearTimeout(c),o=E;const h=nn(r,e);s.set(h),i(h)}function p(E,h){r[Is(E)]=h,E==="server"&&o.kind==="pending"?u({kind:"applied"}):d()}return{watch:E=>s.watch(E),select:E=>s.select(E),get:()=>s.get(),ready:()=>l,state:()=>o,layers:()=>({...r}),bootstrap(){const E=nn(r,e);return Object.fromEntries(kd.map(h=>[h,E[h]]))},merge(E,h){p(h,{...r[Is(h)],...E})},replace(E,h){p(h,E)},setMode(E){r.user={...r.user,mode:E},d()},setAdvancedConfigs(E){r.advancedConfigs=E,d()},serverAbsent(E){u({kind:"absent",reason:E})},applyServerResponse(E){o.kind==="pending"&&p("server",{...r.serverSide,...E})},dispose(){clearTimeout(c)}}}var Bd=5e3,jd="blocks";function Ud(){return{..._s(jd)?.config,mergeTags:void 0}}function Hd(e,t){e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function $d(e,t){let n;Bt(e).watch(({profile:r})=>{const s=`${r?.theme??""}|${r?.locale??""}`;if(s===n)return;n=s;const o={};r?.theme&&(o.theme=r.theme),r?.locale&&(o.locale=r.locale),t.replace(o,"profile")})}function Gd(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function Vd(e,t){let n,r=!1,s;const o=l=>{s??=nt(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==l&&Id(e,l,t)},i=Bt(e).watch(({profile:l})=>{const c=l?.email_builder_config,d=Gd(c);if(d===void 0||c===n)return;const u=n===void 0;n=c,!(u&&r)&&o(d)});e.getInstance(a.DISPOSABLE_ID)?.addDisposable(i),t.ready().then(l=>{if(!l.configSwither)return;const c=localStorage.getItem("configSwither")||(n===void 0?l.mode:s)||"editor";localStorage.setItem("configSwither",c),r=n===void 0,o(c)})}function Yd(e,t){let n=null;const r=Ad(s=>{const o=typeof s=="string"&&s?s:void 0;o!==n&&(n=o,t.replace(o?{theme:o}:{},"local"))});e.getInstance(a.DISPOSABLE_ID)?.addDisposable(r)}async function qd(e,t){if(e.getInstance(It)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(a.APP_ID);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function zd(e){e.injectFactory(a.CONFIG_SOURCE_ID,(t,n)=>{if(n)return n;const r=Fd({base:Ud(),env:{modeDefaults:s=>_s(s)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Bd});return Hd(e,r),$d(e,r),Vd(e,r),Yd(e,r),qd(e,r),e.getInstance(a.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var _e=class extends a.Disposable{_event;_listener;_disposeEvent;constructor(e){super(),this._event=e}setListener(e){this._listener!==e&&(this._listener=e,this._disposeEvent&&this._disposeEvent(),e?this._disposeEvent=this._event(e):this._disposeEvent=void 0)}dispose(){this._disposeEvent&&this._disposeEvent(),super.dispose()}};function F(e,t,n){const r=a.snapshot(e);return(s,o,i)=>{const l=r(async c=>{const d=t?t(c):c;i&&s.bind(i);const u=await s(d);return n?n(u):u},o,i);return()=>l.dispose()}}var Wd=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new a.Emitter;this.handleDestroy=F(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new _e(this.handleDestroy));e.lifetime.addDisposable(t),e.lifetime.addDisposable(e.options.watch(({handleDestroy:r})=>n.setListener(r))),e.lifetime.addDispose(()=>e.release())}destroy(){if(!this.deps.lifetime.isDisposed())try{this.deps.lifetime.dispose()}catch{}}},rn=a.createIdentifier$1("DestroyableService");function Kd(e){e.injectFactory(rn,(t,n)=>{if(n)return n;const r=e.getInstance(a.DISPOSABLE_ID);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new Wd({lifetime:r,options:e.getInstance(a.OPTIONS_SOURCE_ID),getInstance:()=>e.getInstance(a.INSTANCE_ID),release:()=>a.releaseContainer(e.getInstance(a.STORE_ID)??e)})},!0)}function Xd(e){const t=e.getInstance(rn);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var Jd=1e3;function Ts(e,t,n=Jd,r=0){if(r>n||e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(typeof e=="object"&&typeof t=="object"){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return!1;for(const i of s)if(!Ts(e[i],t[i],n,r+1))return!1;return!0}return!1}function Le(e,t){if(!e||typeof e!="object")return t;if(!t||typeof t!="object")return{};const n={};for(const r of Object.keys(t)){const s=t[r],o=e[r];Ts(s,o)||(n[r]=s)}return n}var Qd=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail did not respond within ${e}ms — the email was not saved`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}},Zd=({source:e,emailtags:t,group:n,tags:r,...s})=>s;async function eu({emails:e,saveTimeoutMs:t},n){const r=t?.()??Ct();let s;try{return await Promise.race([e.notifySave(n),new Promise((o,i)=>{s=setTimeout(()=>{const l=new Qd(r);n.value.id,i(l)},r)})])}finally{s!==void 0&&clearTimeout(s)}}function tu(e){const{emails:t}=e,n=async(r,s)=>{const o=Zd(s),i=r===void 0?void 0:await t.cache.getIfPresent(r),l=i?{...i,...o}:o,c=await eu(e,{prev:i,patch:i?Le(i,o):o,value:l,source:s.source??""}),d=String(c.id??r??a.generateUUID()),u=c.id===void 0?{...c,id:d}:c;return await t.cache.addOrUpdate(d,()=>u)};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const s=await n(void 0,r);return s?.renderGuid?s:{...s,renderGuid:a.generateUUID()}},async updateEmail(r,s){return await n(r,s)}}}var sn=20,nu=({source:e,emailtags:t,group:n,tags:r,...s})=>s;function ru({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r}){const s=async(o,i)=>(t.clear(),await t.get(o,{page:i}),(await e.cache.values()??[]).filter(l=>String(l?.parent)===String(o)));return{async readRevisions(o,i=1){const l=await s(o,i);return{revisions:l.slice(sn*(i-1),sn*i),page:i,hasMore:l.length>sn*i}},async readAutosave(o){const i=await r?.(o)??NaN,l=Number.isFinite(i)?i:void 0,c=await n?.(o);if(c?.asked){const d=c.revision?[{...c.revision,parent:o,isAutosave:!0}]:[];return ra(d,l)}return na(await s(o,1),l)},async saveAutosave(o,i){const l=nu(i);return await e.create({...l,parent:o,isAutosave:!0,modified:new Date().toString()})}}}var su=class extends a.BaseEmitter{async execute([e],t){for(const n of t){const r=await n(e);r&&(r.id===void 0&&(r.id=e.value.id),e.value=r)}return e.value}},ou=class extends a.AsyncEmitter{};function $m(e){return e}var As=class extends a.Disposable{_items=new Map;_onChangeEmitter=new a.Signal;async _getOrCreate(e,t){const n=this._items;let r;if(n.has(e))try{r=await n.get(e)}catch{t&&(r=await t())}else t&&(r=await t(),r&&this._onChangeEmitter.fire());return r}async _addOrUpdate(e,t){let n;const r=this._items;if(r.has(e))try{n=await r.get(e)}catch{}const s=await t(n);return a.deepEqual(n,s)||this._onChangeEmitter.fire(),s}entries(){return Promise.all([...this._items.entries()].map(([e,t])=>t.then(n=>[e,n]))).then(e=>e.filter(([t,n])=>!!n))}values(){return Promise.all([...this._items.values()].map(e=>e).filter(e=>!!e))}getOrCreate(e,t){const n=this._getOrCreate(e,()=>t(e));return this._items.set(e,n),n}addOrUpdate(e,t){const n=this._addOrUpdate(e,t);return this._items.set(e,n),n}async getIfPresent(e){if(this._items.has(e))try{return await this._items.get(e)}catch{return}}add(e,t){const n=Promise.resolve(t);return this._items.set(e,n),n}remove(e){if(this._items.has(e)){const t=this._items.get(e);return this._items.delete(e),this._onChangeEmitter.fire(),t}return Promise.resolve(void 0)}async setAll(e){try{this.suspendChange();const t=[],n=new Set(Array.from(e).map(([s,o])=>s)),r=(await this.entries()).filter(([s,o])=>!n.has(s));for(const[s,o]of e)t.push(this.addOrUpdate(s,()=>o)),n.add(s);for(const[s]of r)t.push(this.remove(s));return await Promise.all(t),r}finally{this.resumeChange()}}clear(){this._items.clear(),this._onChangeEmitter.fire()}suspendChange(){this._onChangeEmitter.suspend()}resumeChange(){this._onChangeEmitter.resume()}onChange=this._onChangeEmitter.event};function iu(e,{filter:t,order:n="asc",orderBy:r,page:s,pageSize:o=20}={}){const i=e.length;let l=e.length;if(t!==void 0){const c=Object.keys(t);e=e.filter(d=>{for(const u of c){const p=d[u],E=t[u];return u==="id"||typeof p!="string"?p===E:typeof E=="string"&&p.startsWith(E)}return!0}),l=e.length}return r&&(e=e.sort((c,d)=>(c[r]>d[r]?1:d[r]>c[r]?-1:0)*(n==="asc"?1:-1))),s!==void 0&&(e=e.slice(o*(s-1),o*s)),{data:e,filteredTotal:l,total:i,totalPages:Math.ceil(l/o)}}function au(e=[]){if(e=e.filter(n=>n),e.length<=1)return e[0];const t=new Map;for(const n of e)for(const r of n)if(r.id!==void 0){const s=t.get(r.id)||{};t.set(r.id,{...s,...r})}return[...t].map(([n,r])=>r)}function lu(e,t){return Cs(e)&&Cs(t)?String(e)===String(t):e===t}function Cs(e){return typeof e=="string"||typeof e=="number"}var cu=class extends a.Disposable{_cache=new As;_readEmitter=new a.AsyncEmitter;_saveEmitter=this.addDisposable(new su);_removeEmitter=this.addDisposable(new ou);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(n=>!!n)))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new a.Disposable);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new As),s=n.addDisposable(new a.AsyncEmitter);t=this._foreignCache[e]={get:async(o,i={})=>{await r.getOrCreate(o,async()=>{try{const c=au(await s.fire(o))||[];for(const d of c)d[e]=o,await this._cache.add(d.id,d);return c}catch{return[]}});const l=(await this._cache.values()||[]).filter(c=>{const d=c[e];return d==null||lu(d,o)});return iu(l,i)},first(o,i={}){return t.get(o,{...i,page:1,pageSize:1}).then(({data:l})=>l[0])},handleRead:s.event,clear(){r.clear()},dispose(){n.dispose()}}}return t}async create(e,{source:t="",silent:n}={}){let r=e;return n||(r=await this._saveEmitter.fire({prev:void 0,patch:e,value:r,source:t})),r.id===void 0&&(r.id=a.generateUUID()),await this._cache.addOrUpdate(r.id,()=>r)}notifySave(e){return this._saveEmitter.fire(e)}async update(e,t,{source:n="",silent:r}={}){return this._cache.addOrUpdate(e,async s=>{const o=s?{...s,...t}:t;if(!r)return t=s?Le(s,t):t,await this._saveEmitter.fire({prev:s,patch:t,value:o,source:n})})}async remove(e,{source:t="",silent:n}={}){const r=await this._cache.remove(e);return n||await this._removeEmitter.fire({value:r,source:t}),r}refresh(){this._cache.clear();for(const e of Object.values(this._foreignCache))e.clear()}suspendChange(){this._cache.suspendChange()}resumeChange(){this._cache.resumeChange()}handlerRead=this._readEmitter.event;onSave=this._saveEmitter.event;onRemove=this._removeEmitter.event;onChange=this._cache.onChange};function Me(e){const t=a.createIdentifier$1(e);return n=>n.getOrCreateInstance(t,()=>new cu)}function du(e){const t=e.getInstance(a.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}function Ps(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function uu(e,t,n){return e&&!Ps(t)&&Ps(e)?{...n,meta:e.meta}:n}var Ds=Me("plugin.dataSource.emails"),Rs=Me("plugin.dataSource.emailRevisions"),Os=qt("plugin.readEmailAutosave"),Ls=a.createIdentifier$1("emailDocuments.provided");function fu(e){const t=Ds(e),n=Rs(e),r=n.byForeignKey("parent");return e.getInstance(Ls)?{emails:t,emailRevisions:n}:(e.inject(Ls,!0),Pa(e,tu({emails:t,saveTimeoutMs:()=>Ct(e.getInstance(a.INIT_PIPELINE_ID)?.contentReadyTimeoutMs)})),La(e,ru({revisions:n,revisionsByEmail:r,readAutosave:async s=>{const o=await J(e,Os).fire(s);return o.length===0?{asked:!1}:{asked:!0,revision:o[0]??null}},savedAt:async s=>Date.parse((await t.cache.getIfPresent(s))?.modified??"")})),du(e).addDisposable(t.onSave(({prev:s,patch:o,value:i})=>uu(s,o,i),Number.MIN_VALUE)),{emails:t,emailRevisions:n})}function Ms(e,t){return!e?.data||!t||e.id!==t.locale?!1:t.contentHash?e.hash===t.contentHash:t.updatedAt>0&&t.updatedAt<=e.time}function pu(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var hu="po",rt=null;function mu(){const e=typeof __useblocks__<"u"?__useblocks__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([hu],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function gu(){return rt===null&&(rt=mu().catch(e=>{throw rt=null,e})),rt}async function Ns(e){if(typeof e=="object")return on(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?Eu(t):vu(t)}function on(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function Eu(e){try{return on(JSON.parse(e))}catch{return}}var xs=!1;async function vu(e){try{return on((await gu()).parsePoCatalog(e))}catch{xs||(xs=!0);return}}var bu="em_locale",_u="em_ant_locale",yu="locale",Su="ant_locale";function an(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function ks(e,t){const n=an(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function wu(){return an("em_locale")??ks(yu,"em_locale")}function Fs(e){try{localStorage.setItem(bu,JSON.stringify(e))}catch{}}function Iu(){return an("em_ant_locale")??ks(Su,"em_ant_locale")}function Tu(e,t){try{localStorage.setItem(_u,JSON.stringify({id:e,data:t}))}catch{}}var Gm="en_US",Au=8e3;function Cu(e,t){const n=e,r=t,s=Object.keys(n).filter(o=>o!=="");return s.length!==Object.keys(r).filter(o=>o!=="").length?!1:s.every(o=>JSON.stringify(n[o])===JSON.stringify(r[o]))}function Pu(e){const t=wu(),n=Iu();let r={ready:!1},s;const o=ue(r);let i=0;const l=m=>{r={...r,...m},o.set(r)},c=()=>{r.ready||l({ready:!0})},d=setTimeout(c,e.unlockAfterMs??Au),u=m=>m!==i;let p;async function E(m,_){if(n?.id===m&&n.data&&l({antd:n.data}),!p)return;const y=await p(m).catch(()=>{});!y||u(_)||(l({antd:y}),Tu(m,y))}async function h(m,_){const y=await e.askHost(m).catch(()=>null);if(u(_))return!0;if(y==null)return!1;const w=await Ns(y);return u(_)||(w&&l({catalog:w}),c()),!0}async function b(m,_){const y=await e.readList();if(u(_))return;if("error"in y){l({failure:{kind:"GET_LOCALES_ERROR",error:y.error}}),c();return}const w=y.data.find(C=>C.locale===m);if(!w){pu("em_locale")&&l({catalog:void 0}),c();return}if(Ms(t,w)&&(!s||s.catalog===t?.data)){c();return}if(s?.entry&&r.catalog===s.catalog&&Ms(s.entry,w)){Fs(s.entry),c();return}const A=await e.readCatalog(m);if(!u(_)){if("error"in A){l({failure:{kind:"GET_LOCALE_ERROR",error:A.error}}),c();return}A.data&&(s?.id===m&&r.catalog===s.catalog&&Cu(s.catalog,A.data)||l({catalog:A.data}),Fs({id:m,time:w.updatedAt||Math.floor(Date.now()/1e3),hash:w.contentHash,data:A.data})),c()}}async function v(m,_){if(!await h(m,_)){if(!u(_)&&(s?.id===m&&r.catalog===s.catalog||m==="en_US")&&c(),e.canUseNetwork&&!e.canUseNetwork()){c();return}await b(m,_)}}return{set(m){if(!m||m===r.id)return;const _=i+=1;l({id:m,failure:void 0});const y=s?.id===m&&r.catalog===s.catalog;(s&&!y&&r.catalog===s.catalog||m==="en_US"&&r.catalog)&&l({catalog:void 0}),t?.id===m&&t.data&&(l({catalog:t.data}),c()),E(m,_),v(m,_)},prime(m,_,y){r.id&&r.id!==m||r.catalog||!_||(s=t?.id===m&&t.data&&(!y||t.time>=y.time)?{id:m,catalog:t.data}:{id:m,catalog:_,entry:y?{id:m,time:y.time,hash:y.hash,data:_}:void 0},l({catalog:s.catalog}))},useAntdLoader(m){p=m,r.id&&E(r.id,i)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(d)}}var Du=class{http;constructor(e){this.http=e}jsonList=({locale:e},t={})=>this.http.request({path:`/translations/${e}.json`,method:"GET",format:"json",...t});getTranslations=({locale:e},t={})=>this.http.request({path:`/translations/${e}.po`,method:"GET",...t});localesList=(e={})=>this.http.request({path:"/translations/locales",method:"GET",format:"json",...e})},Ru=class{baseUrl="/api/v2";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(n=>this.encodeQueryParam(t,n)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(n=>typeof t[n]<"u").map(n=>Array.isArray(t[n])?this.addArrayQueryParam(t,n):this.addQueryParam(t,n)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,n)=>{const r=e[n];return t.append(n,r instanceof Blob?r:typeof r=="object"&&r!==null?JSON.stringify(r):`${r}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const n=this.abortControllers.get(e);return n?n.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:n,type:r,query:s,format:o,baseUrl:i,cancelToken:l,...c})=>{const d=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,d),p=s&&this.toQueryString(s),E=this.contentFormatters[r||"application/json"],h=o||u.format;return this.customFetch(`${i||this.baseUrl||""}${n}${p?`?${p}`:""}`,{...u,headers:{...u.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(l?this.createAbortSignal(l):u.signal)||null,body:typeof e>"u"||e===null?null:E(e)}).then(async b=>{const v=b;v.data=null,v.error=null;const m=h?b.clone():b,_=h?await m[h]().then(y=>(v.ok?v.data=y:v.error=y,v)).catch(y=>(v.error=y,v)):v;return l&&this.abortControllers.delete(l),_})}},Ou=a.createIdentifier$1("rest.v2.transport"),Bs=Symbol("rest.v2.secureRequest");function Lu(e){return e.getOrCreateInstance(Ou,()=>{const t=e.getInstance(a.CUSTOM_FETCH_ID)?.execute||fetch;return new Ru({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[Bs]:!0}),customFetch:(n,r={})=>{const{[Bs]:s,...o}=r;return t(n,{...o,[a.PUBLIC_REQUEST]:s!==!0})}})})}function Mu(e,t){const n=Lu(e);return Object.assign({},...t.map(r=>new r(n)))}function js(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function Us(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:js(n.details,"wp_code")??n.code,message:js(n.details,"wp_message")??n.message,details:n.details}}:t&&typeof t=="object"?{status:e.status,data:t}:{status:e.status,data:{message:e.statusText||"request failed"}}}function Hs(e){return!e.ok||!!e.error}function Nu(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function $s(){return Nu(a.LOCAL_STORAGE_ITEMS.em_translations_v2)??!0}function xu(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function ku(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Fu(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],s=r[0];return typeof s=="string"&&s!==""&&t.push({locale:s,updatedAt:xu(r[1])}),t},[]):[]}function Bu(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:ku(n.updated_at),contentHash:n.content_hash}),t),[])}function Gs(e){return Mu(e,[Du])}function st(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function ln(e){return!e.ok||e.error!=null}function cn(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function dn(e){return{data:await Ns(e)??null}}async function ju(e){if($s())try{const n=await Gs(e).localesList();return Hs(n)?{error:Us(n)}:{data:Bu(n.data)}}catch(n){return st(n)}const t=a.getApi(e,[tr]);try{const n=await t.get_translations2({file:"react_app"});return ln(n)?cn(n):{data:Fu(n.data)}}catch(n){return st(n)}}async function Uu(e,t){if($s())try{const r=await Gs(e).jsonList({locale:t});return Hs(r)?{error:Us(r)}:dn(r.data)}catch(r){return st(r)}const n=a.getApi(e,[tr]);try{const r=await n.get_translations3({id:t,file:"react_app"});return ln(r)?cn(r):dn(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return ln(r)?cn(r):dn(r.data)}catch(r){return st(r)}}}var ot=new WeakMap;function Hu(e){const t=ot.get(e);if(t!==void 0)return t;const n=ju(e).then(r=>("error"in r&&ot.delete(e),r),r=>{throw ot.delete(e),r});return ot.set(e,n),n}var Ne=a.createIdentifier$1("locale.service");function $u(e){if(e.getInstance(Ne))return;const t=Pu({readList:()=>Hu(e),readCatalog:n=>Uu(e,n),askHost:async n=>(await J(e,a.events.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(a.SECURITY_MODULE_ID)});e.inject(Ne,t),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>t.dispose())}function Gu(e){const t=e.getInstance(a.CONFIG_SOURCE_ID);if(!t)return;const n=e.getInstance(Ne);if(!n)return;const r=t.select(s=>s.locale).watch(s=>n.set(s||"en_US"));e.getInstance(a.DISPOSABLE_ID)?.addDisposable(r)}var Vu="user_id",Yu="project_id",Vs=a.createIdentifier$1("rest.identityHeadersProvided");function qu(e){if(e.getInstance(Vs))return;e.inject(Vs,!0);let t;e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(n=>{t=n}),e.addService(a.REQUEST_HANDLER_ID,{execute(n,r){if(r?.public)return;const s=t?.user?.id??kr(e).profile?.id;s!=null&&s!==""&&n.headers.set(Vu,String(s));const o=t?.project;o!=null&&o!==""&&n.headers.set(Yu,String(o))}})}function zu(e){if(!e)return!1;try{return e.getInstance(a.SECURITY_MODULE_ID)!==void 0}catch{return!1}}var Wu="Invalid standaloneKey.",Vm=a.createIdentifier$1("StandaloneMockGuard");function Ku(){const e=new Error(Wu);return e.name="InvalidStandaloneKeyError",e}function Xu(e){e.addService(a.REQUEST_HANDLER_ID,{execute:()=>{if(zu(e))throw Ku()}})}function Ju(e){a.registerRestTransport(e),Xu(e)}function Qu(e){const t=new ns;e.inject(a.INIT_PIPELINE_ID,t);const n=e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(s=>{if(!s)return;const o=s.signal??t.externalSignal;t.configure({replaceSession:!0,...s.timeouts!==void 0?{timeouts:s.timeouts}:{},...o!==void 0?{signal:o}:{}})}),r=e.getInstance(a.DISPOSABLE_ID);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var Zu=Me("plugin.dataSource.blocks"),ef=Me("plugin.dataSource.blockRevisions"),tf=Me("plugin.dataSource.comments"),nf=qt(),rf=qt(),Ys=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
2109
|
+
`));return{html:xd(t.html),hasBrowserExtensionArtifacts:t.found}}function bt(e){return e?.getContent()??""}function Ks(e,t){e?.mutate({content:os(t)},{source:"remote"})}function In(e){return l.createIdentifier$1(e)}function Z(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter)}function Y(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter).event}function yt(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var kd=class extends Error{showId;constructor(e,t){super(`[useblocks] show() timed out after ${t}ms waiting for editor init (showId=${e}). Check earlier console errors: wrong host-plugin publicPath (chunks return HTML), mount element removed without destroy(), or sandbox init never completed. Search for [show-pipeline] and [AMD] messages.`),this.name="ShowPipelineTimeoutError",this.showId=e}},Fd=class{_activeRequest=null;_pending=new Map;_listeners=new Set;getActiveShowRequest(){return this._activeRequest}onShowRequested(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}requestShow(e,t,n){return this._rejectPending(l.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(l.createAbortError(n.reason)):(this._activeRequest=e,new Promise((r,s)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{s(new kd(e.showId,t))})},t);o.unref?.();const i=()=>{this._settle(e.showId,()=>{s(l.createAbortError(n.reason))})};n.addEventListener("abort",i,{once:!0});const a=()=>{clearTimeout(o),n.removeEventListener("abort",i)};this._pending.set(e.showId,{request:e,resolve:r,reject:s,timeoutId:o,dispose:a});for(const c of this._listeners)c(e)}))}completeShow(e){this._settle(e,t=>{t.resolve()})}hasPendingShow(e){return this._pending.has(e)}failShow(e,t){this._settle(e,n=>{n.reject(t)})}rejectAll(e){this._rejectPending(e),this._activeRequest=null}_settle(e,t){const n=this._pending.get(e);n&&(n.dispose(),this._pending.delete(e),this._activeRequest?.showId===e&&(this._activeRequest=null),t(n))}_rejectPending(e){for(const[,t]of this._pending)t.dispose(),t.reject(e);this._pending.clear()}};function Bd(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function jd(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Wr(e),n=qr(e),r=tl(e.sandbox);t<n+r}var Xs=class{_controller=new AbortController;_externalSignalDisposable=new l.Disposable;_sessionChangeListeners=new Set;_showRegistry=new Fd;_timeouts;_generation=0;_sessionStarted=!1;_externalSignal;get signal(){return this._controller.signal}get externalSignal(){return this._externalSignal}get generation(){return this._generation}get contentReadyTimeoutMs(){return Wr(this._timeouts)}getSandboxTimeoutMs(e){return Yr(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return qr(this._timeouts)}bumpGeneration(){this._generation+=1}getActiveShowRequest(){return this._showRegistry.getActiveShowRequest()}onShowRequested(e){return this._showRegistry.onShowRequested(e)}requestShow(e){return this._showRegistry.requestShow(e,this.contentReadyTimeoutMs,this._controller.signal)}completeShow(e){this._showRegistry.completeShow(e)}hasPendingShow(e){return this._showRegistry.hasPendingShow(e)}failShow(e,t){this._showRegistry.failShow(e,t)}rejectAllPendingShows(e){this._showRegistry.rejectAll(e)}onSessionReplaced(e){return this._sessionChangeListeners.add(e),()=>{this._sessionChangeListeners.delete(e)}}configure(e){e.timeouts!==void 0&&(this._timeouts=Bd(this._timeouts,e.timeouts),jd(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,e.signal!==void 0&&(this._externalSignal=e.signal),t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}relinkExternalSignal(e){this._externalSignal=e,this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable,this._linkExternalSignal(e)}abort(e){const t=e??l.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable,this._showRegistry.rejectAll(l.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(l.createAbortError("Init session replaced")),this._controller=new AbortController,this._emitSessionReplaced()}_emitSessionReplaced(){for(const e of this._sessionChangeListeners)e()}_linkExternalSignal(e){if(!e)return;if(e.aborted){this._controller.signal.aborted||(this._controller.abort(e.reason??l.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??l.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},wn=(()=>{const e=new Xs;return e.configure({}),e})(),Ud=class extends Error{label;timeoutMs;constructor(e){super(`[sandbox:ready] iframe handshake timed out after ${e}ms`),this.name="SandboxReadyTimeoutError",this.label="sandbox:ready",this.timeoutMs=e}};function $d(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.isInited=="function"&&typeof t.getTarget=="function"&&typeof t.onInit=="function"}function Hd(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(l.throwIfAborted(n),new Promise((r,s)=>{let o=!1,i,a;const c=u=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),a?.dispose(),n?.removeEventListener("abort",d),u())},d=()=>{c(()=>s(l.createAbortError(n?.reason)))};if(a=e.onInit(()=>{e.isInited()&&e.getTarget()&&c(()=>r())}),e.isInited()&&e.getTarget()){c(()=>r());return}t>0&&(i=setTimeout(()=>{c(()=>s(new Ud(t)))},t)),n?.addEventListener("abort",d)}))}var Vd=class extends Error{label;timeoutMs;constructor(e,t){super(`[${e}] timed out after ${t}ms`),this.name="OperationTimeoutError",this.label=e,this.timeoutMs=t}};function Gd(e,t,n){return t<=0?e:new Promise((r,s)=>{let o=!1,i;const a=c=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),c())};i=setTimeout(()=>{a(()=>s(new Vd(n,t)))},t),e.then(c=>{a(()=>r(c))},c=>{a(()=>s(c))})})}var Yd=2,St=Symbol("sandbox:frame-replaced");function de(e,t,n,r,s,o,i){const a=`sandbox:${t}`,c=o?.getSandboxTimeoutMs(t)??en[t],d=()=>{let _=Gd(e.sendAsync(n,r),c,a);return _=l.raceWithAbortSignal(_,o?.signal),Ye(a,_,s)};if(t==="INIT_START"&&$d(e)){const _=o?.getSandboxReadyTimeoutMs()??2e4,v=e,p=b=>{const S=Hd(v,_,o?.signal);return Ye("sandbox:INIT_START:ready-wait",S,s).then(()=>{if(!i||b<=0)return d();const T=i.getGeneration();let C;const L=new Promise((y,A)=>{C=i.onChange(()=>{i.getGeneration()!==T&&A(St)})}),E=d();return E.catch(()=>{}),Promise.race([E,L]).finally(()=>C?.()).catch(y=>{if(y!==St)throw y;return{...s},p(b-1)})})};return p(Yd)}if(!i)return d();const u=i.getGeneration();let f;const g=new Promise((_,v)=>{f=i.onChange(()=>{i.getGeneration()!==u&&v(St)})}),m=d();return m.catch(()=>{}),Promise.race([m,g]).finally(()=>f?.()).catch(_=>{throw _===St&&{...s},_})}var Wd=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],qd=200;function Js(e=new Set){const t=new Set;return(n,r)=>{if(!Wd.some(([o,i])=>!e.has(o)&&i.test(n)))return;const s=r??`new:${n.length}:${n.slice(0,200)}`;t.has(s)||(t.size>=qd&&t.clear(),t.add(s))}}function Qs(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:Js()}}var zd=Qs();function _e(e){return e?.getInstance(l.TEMPLATE_DIRECTIVES_ID)??zd}function Kd(e){const t=he(e),n=z(e),r=()=>e.getInstance(l.INIT_PIPELINE_ID)??wn;let s,o,i=!1,a=!1;const c=async(S,T,C)=>{const L=C.generation,E=()=>C.generation!==L||C.signal.aborted||t.current()!==S||a,y=le(n);i=!0;try{if(await de(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:T},void 0,C),E())return;const{html:A,hasBrowserExtensionArtifacts:R}=zs(bt(S));if(R&&Z(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),Ks(S,A),await de(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,yt(bt(S),T,_e(e).editorPolicy,S.get().version),void 0,C),E())return;await de(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:T},void 0,C),s=T,o=y}finally{i=!1}},d=()=>ae(t.sessionKey())?t.current():void 0,u=()=>{if(a||i)return;const S=d(),T=S?.get().docId;if(!S||!T||s===T&&o===le(n)||!S.isReady())return;const C=r();C.signal.aborted||c(S,T,C).catch(()=>{})};let f=!1;const g=()=>{f||a||(f=!0,queueMicrotask(()=>{f=!1,u()}))};let m,_;const v=()=>{const S=d(),T=S?.get().docId;T!==_&&(m?.(),_=T,m=S?.subscribe(g)),g()},p=t.subscribe(v),b=Us(n,g);v(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a=!0,b(),m?.(),p()})}var Xd=200;function Jd({startVersion:e,limit:t=Xd}){let n=[],r=e;const s=o=>{n=n.filter(i=>i.version>o),r=Math.max(r,o)};return{record(o){!o.changes?.length&&!o.contentReplaced||(n.push(o),n.length>t&&s(n[n.length-t-1].version))},rebase(o,i){if(i<r)return null;const a=n.filter(d=>d.version>i);s(i);let c=o;for(const d of a){if(d.contentReplaced||!d.changes)return null;const u=d.changes,f=[];for(const g of c){if(d.fromCanvas&&u.some(_=>g.range.start<=_.oldEnd&&g.range.end>=_.oldPosition))return null;const m=fl(g.range,u,"after");if(!m)return null;f.push({range:m,text:g.text})}c=f}return c}}}function Qd(e,t){let n=0;return e.map(({start:r,end:s,text:o})=>{const i=new ne(r,t.slice(r,s),r+n,o);return n+=o.length-(s-r),i})}function Zd(e,t){const n=[...e].sort((r,s)=>r.range.start-s.range.start);return Qd(n.map(({range:r,text:s})=>({start:r.start,end:r.end,text:s})),t)}function eu(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Tn=l.createIdentifier$1("canvas.sandboxFill");function Zs(e){return e.getInstance(Tn)?.pipeline.isEventsLocked()===!0}function It(e){He(e,{origin:"canvas-channel"})}function tu(e){const t=he(e),n=z(e);let r;const s=(c,d)=>{const u=c.get().docId;let f=!1,g=null,m=null;const _=Jd({startVersion:c.get().version});let v=c.getContent(),p=!0;const b=(y,A)=>{!p||t.current()!==c||(He(A,{origin:"canvas-channel"}),n.sendAsync(l.EVENT_TYPES.SANDBOX_SET_ENTITY,yt(bt(c),u,_e(e).editorPolicy,c.get().version)).catch(It))},S=async(y,A)=>{if(m){m.push({edits:y,rev:A});return}m=[{edits:y,rev:A}];try{do{const R=m.splice(0,m.length);await n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:R.map(h=>h.edits),guid:u,rev:R[R.length-1].rev})}while(m.length)}catch(R){b("app edits failed to reach the canvas",R)}finally{m=null}},T=(y,A)=>{const R=m?.splice(0,m.length)??[];R.length&&n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:R.map(h=>h.edits),guid:u,rev:R[R.length-1].rev}).catch(It),n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:[y],guid:u,rev:c.get().version,...A!==null?{changeId:A}:{}}).catch(It)},C=y=>{const{guid:A,pushUndoStop:R}=y;if(A!==u)return;const h=Il(y);let{edits:w}=y;if(h.baseRev!==null){const k=_.rebase(w,h.baseRev);if(!k){He(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),T([],h.changeId);return}w=k}const D=c.get().version;try{f=!0,g=h.changeId;const k=Zd(w,c.getContent());R===!1?d.applyWithoutHistory(k):c.mutate({changes:k},{source:Zs(e)?"system":"user"})}catch(k){b("canvas batch failed to apply",k);return}finally{f=!1,g=null}c.get().version===D&&h.baseRev!==null&&T([],h.changeId)},L=c.subscribe(({changes:y,version:A})=>{const R=c.getContent(),h=!y?.length&&R!==v;if(v=R,_.record({version:A,changes:y,contentReplaced:h,fromCanvas:f}),!y?.length)return;const w=eu(y);f?T(w,g):S(w,A).catch(It)}),E=n.addListener(l.EVENT_TYPES.APPLICATION_UPDATE_ENTITY,C);return()=>{p=!1,L(),E.dispose()}};let o;const i=()=>{const c=t.current(),d=t.history(),u=c?.get().docId;u!==o&&(r?.(),r=void 0,o=u,c&&d&&(r=s(c,d)))},a=t.subscribe(i);i(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.(),a()})}var nu=/^(?:ant|vscode|monaco|docs)-/;function ru(e){return nu.test(e)}function su(){const e="ub".trim();if(!/^[a-z][a-z0-9]*$/i.test(e))throw new Error(`[cssVars] REACT_APP_CSS_VAR_PREFIX="${e}" is not a valid CSS identifier fragment.`);return e}var ou=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function iu(){return ou}var au=new Set;function lu(e,t,n=au){return e.startsWith(`${t}-`)?!1:!ru(e)&&!n.has(e)}function cu(e,t){return`--${t}-${e}`}function eo(e){const t=su();return lu(e,t,iu())?cu(e,t):`--${e}`}function du(e,t){const n=eo(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function uu(e,t){return du(e,t)}function be(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.parentNode;return n instanceof ShadowRoot&&n.host instanceof HTMLElement?n.host:null}function ye(e){return!e||e==="none"}function fu(e){const t=e.contain??"",n=e.willChange??"";return!ye(e.transform)||!ye(e.perspective)||!ye(e.filter)||!ye(e.backdropFilter)||!ye(e.translate)||!ye(e.rotate)||!ye(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function to(e){const t=/paint|strict|content/.test(e.contain??"");return{x:t||!!e.overflowX&&e.overflowX!=="visible",y:t||!!e.overflowY&&e.overflowY!=="visible"}}function pu(e){const t=[],n=document.documentElement,r=to(getComputedStyle(n)),s=r.x||r.y;let o="none";const i=getComputedStyle(e).position;(i==="absolute"||i==="fixed")&&(o=i);for(let a=be(e);a&&a!==n;a=be(a)){const c=getComputedStyle(a),d=o==="none"||fu(c)||o==="absolute"&&!!c.position&&c.position!=="static",u=a===document.body&&!s;if(d){o="none";const f=u?{x:!1,y:!1}:to(c);(f.x||f.y)&&t.push({node:a,...f})}(c.position==="absolute"||c.position==="fixed")&&(o==="none"||c.position==="fixed")&&(o=c.position==="fixed"?"fixed":"absolute")}return t}function no(e){const t=e.getBoundingClientRect(),n=e.offsetWidth>0&&t.width>0?t.width/e.offsetWidth:1;return{x:n,y:e.offsetHeight>0&&t.height>0?t.height/e.offsetHeight:n}}function wt(e){return Number.parseFloat(e)||0}function Cn(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=no(e),s=wt(n.borderLeftWidth),o=wt(n.borderTopWidth),i=wt(n.borderRightWidth),a=wt(n.borderBottomWidth),c=e.offsetWidth>0?Math.max(0,e.offsetWidth-e.clientWidth-s-i):0,d=e.offsetHeight>0?Math.max(0,e.offsetHeight-e.clientHeight-o-a):0;return{left:t.left+s*r.x,top:t.top+o*r.y,right:t.right-(i+c)*r.x,bottom:t.bottom-(a+d)*r.y}}function hu(e,t,n){const r={left:e.left,top:e.top,right:e.right,bottom:e.bottom},s=(o,i,a)=>{i&&(r.left=Math.max(r.left,o.left),r.right=Math.min(r.right,o.right)),a&&(r.top=Math.max(r.top,o.top),r.bottom=Math.min(r.bottom,o.bottom))};return t.forEach(o=>s(Cn(o.node),o.x,o.y)),n&&s(Cn(n),!0,!0),r}var An={originX:0,originY:0,scaleX:1,scaleY:1};function Tt(e,t){return{left:(e.left-t.originX)/t.scaleX,top:(e.top-t.originY)/t.scaleY,width:Math.max(0,e.right-e.left)/t.scaleX,height:Math.max(0,e.bottom-e.top)/t.scaleY}}function ro(e,t,n){const r=t.width>0&&e.width>0?e.width/t.width:n.scaleX,s=t.height>0&&e.height>0?e.height/t.height:r;return{originX:e.left-t.left*r,originY:e.top-t.top*s,scaleX:r,scaleY:s}}function so(e,t){return Math.abs(e.left-t.left)<=.5&&Math.abs(e.top-t.top)<=.5&&Math.abs(e.width-(t.right-t.left))<=.5&&Math.abs(e.height-(t.bottom-t.top))<=.5}var mu=1e3;function gu(e){const{slot:t,own:n}=e;let r,s=0,o=!1;const i=()=>{if(r=void 0,!o){if(!t.isConnected||!n.isConnected){e.onDetached();return}(e.measure()||performance.now()<s)&&(r=window.requestAnimationFrame(i))}},a=()=>{!o&&r===void 0&&(r=window.requestAnimationFrame(i))},c=()=>{s=performance.now()+mu,a()},d=[window],u=[document.documentElement];for(let p=t;p;p=be(p)){const b=p.getRootNode();b instanceof ShadowRoot&&!d.includes(b)&&(d.push(b),u.push(b))}const f=[["scroll",a],["load",a],["transitionrun",c],["transitionend",a],["transitioncancel",a],["animationstart",c],["animationend",a],["animationcancel",a]];d.forEach(p=>f.forEach(([b,S])=>p.addEventListener(b,S,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const g=typeof MutationObserver=="function"?new MutationObserver(p=>{p.some(b=>!n.contains(b.target))&&a()}):void 0;u.forEach(p=>g?.observe(p,{attributes:!0,childList:!0,subtree:!0,characterData:!0}));let m;try{if(typeof ResizeObserver=="function"){const p=new ResizeObserver(a);typeof p.observe=="function"&&(m=p)}}catch{m=void 0}let _=[];return{schedule:a,observe:p=>{!m||p.length===_.length&&p.every((b,S)=>b===_[S])||(m.disconnect(),_=p,p.forEach(b=>m?.observe(b)))},dispose(){o=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),d.forEach(p=>f.forEach(([b,S])=>p.removeEventListener(b,S,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),g?.disconnect(),m?.disconnect()}}}var oo=300,io=15e3,ao="em-canvas-busy-style";function Eu(){if(document.getElementById(ao))return;const e=document.createElement("style");e.id=ao,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var vu="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z";function _u(e){const t=uu("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(eo("colorPrimary")).trim()||t}function lo(e){Eu();const t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("viewBox","0 0 1024 1024"),n.setAttribute("width","48"),n.setAttribute("height","48"),n.setAttribute("fill","currentColor"),n.setAttribute("aria-hidden","true");const r=document.createElementNS(t,"path");r.setAttribute("d",vu),n.appendChild(r);const s=document.createElement("span");return s.setAttribute("role","img"),s.setAttribute("aria-label","loading"),s.setAttribute("style",`display:inline-flex;color:${_u(e)};animation:em-canvas-busy-spin 1s linear infinite`),s.appendChild(n),s}function bu(e,t,n){const r=t??e,s=Math.max(r.left,e.left,0),o=Math.min(r.right,e.right,n.width),i=Math.max(r.top,e.top,0),a=Math.min(r.bottom,e.bottom,n.height);return o<=s||a<=i?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(s+o)/2-e.left,y:(i+a)/2-e.top}}function yu(e,t){const n=e.getBoundingClientRect(),r=document.createElement("div");r.setAttribute("aria-busy","true"),Object.assign(r.style,{position:"fixed",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,cursor:"progress"}),e.appendChild(r);const s={left:n.left,top:n.top,right:n.right,bottom:n.bottom},o=r.getBoundingClientRect();if(o.width>0&&!so({left:o.left,top:o.top,width:o.width,height:o.height},s)){const i=Tt(s,ro(o,Tt(s,An),An));Object.assign(r.style,{left:`${i.left}px`,top:`${i.top}px`,width:`${i.width}px`,height:`${i.height}px`})}return{showSpinner(){r.style.background="rgba(128, 128, 128, 0.15)";const i=bu(n,t(),{width:window.innerWidth,height:window.innerHeight}),a=document.createElement("div");Object.assign(a.style,{position:"absolute",left:`${i.x}px`,top:`${i.y}px`,transform:"translate(-50%, -50%)",lineHeight:"0"}),a.appendChild(lo(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function co(e){const t=document.createElement("div");t.setAttribute("aria-busy","true"),Object.assign(t.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"progress"});const n=getComputedStyle(e).position!=="static";n||(e.style.position="relative"),e.appendChild(t);const r=setTimeout(()=>{t.appendChild(lo(e))},oo);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var Su=8e3;function Iu(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),moveTo:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,whenShown:()=>Promise.resolve(),alignTo:()=>{},resize:()=>{},dispose:()=>{}}}function wu(e,t){for(let n=be(e);n;n=be(n)){const r=getComputedStyle(n),s=r.overflowX!=="visible"||r.overflowY!=="visible",o=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(i=>Ne(i)>0);if(s&&o)return n;if(n===t)return null}return null}function Ne(e){return Number.parseFloat(e)||0}function Ct(e,t){return Math.abs(e-t)<=1}function Tu(e){const t=getComputedStyle(e),n=Ne(t.borderTopWidth),r=Ne(t.borderRightWidth),s=Ne(t.borderBottomWidth),o=Ne(t.borderLeftWidth),i=(a,c,d)=>Math.max(0,Ne(a)-Math.max(c,d));return{...Cn(e),radii:[i(t.borderTopLeftRadius,n,o),i(t.borderTopRightRadius,n,r),i(t.borderBottomRightRadius,s,r),i(t.borderBottomLeftRadius,s,o)]}}function Cu(e,t){const n=Ct(t.top,e.top),r=Ct(t.bottom,e.bottom),s=Ct(t.left,e.left),o=Ct(t.right,e.right),i=[n&&s?e.radii[0]:0,n&&o?e.radii[1]:0,r&&o?e.radii[2]:0,r&&s?e.radii[3]:0];return i.every(a=>a===0)?"":i.map(a=>`${a}px`).join(" ")}function Au(e,t,n,r,s){const o=n.readyTimeoutMs??Su,i=document.createElement("div");i.dataset.canvasHost=e,r&&(i.dataset.canvasPlace=r),i.style.position="fixed",i.style.overflow="hidden",i.style.visibility="hidden";const a=n.resolveSrc(e),c=document.createElement("iframe");c.setAttribute("sandbox",n.resolveSandbox(a)),c.setAttribute("allow","clipboard-read; clipboard-write"),c.setAttribute("title","Email content"),c.style.width="100%",c.style.border="0",c.style.display="block",c.style.minHeight="600px",c.src=a,i.appendChild(c),t.appendChild(i),n.mark?.("created"),s||n.onCreated?.(c);const d=new l.Disposable;let u=!1,f=!1,g,m,_,v;const p=()=>{clearTimeout(v),v=setTimeout(()=>{f||(f=!0,m?.(new Error(`[canvas] ${e}: документ не загрузился за ${o} мс`)))},o)},b=()=>u?(_=Promise.resolve(),f=!0,_):(f=!1,_=new Promise((M,j)=>{g=M,m=j}),p(),_),S=()=>{if(clearTimeout(v),u=!0,f){_=Promise.resolve();return}f=!0,n.mark?.("loaded"),g?.()};c.addEventListener("load",S),d.addDispose(()=>{clearTimeout(v),c.removeEventListener("load",S)});let T;const C=()=>{T??=n.bindResizer?.(c)},L=()=>{T?.dispose(),T=void 0};let E=null,y=null,A,R=An,h="",w="",D=0;const k=M=>{const j=JSON.stringify(M);return j===h?!1:(h=j,i.style.visibility=M.visibility,i.style.left=`${M.css.left}px`,i.style.top=`${M.css.top}px`,i.style.width=`${M.css.width}px`,i.style.height=`${M.css.height}px`,i.style.borderRadius=M.radius,c.style.width=M.elementWidth>0?`${M.elementWidth}px`:"100%",c.style.transform=M.shiftX!==0?`translate(${M.shiftX}px, ${M.shiftY}px)`:`translateY(${M.shiftY}px)`,!0)},N=()=>{if(!E)return h="",i.style.visibility="hidden",c.removeAttribute("id"),!1;n.elementId&&(c.id=n.elementId);const M=E.getBoundingClientRect(),j=pu(E),W=y?.isConnected?y:null;A?.observe([E,c,...j.map(B=>B.node),...W?[W]:[]]);const q=hu(M,j,W),K=Math.max(0,q.right-q.left),Te=Math.max(0,q.bottom-q.top),Ce=getComputedStyle(E).visibility==="visible",Ae=K<=0||Te<=0,ge=Ae?{left:q.left,top:q.top,right:q.left,bottom:q.top}:q,Wt=Ae?null:wu(E,W??j[0]?.node??null),Rr=Wt?Cu(Tu(Wt),ge):"",O=B=>k({visibility:Ce?"":"hidden",css:Tt(ge,B),elementWidth:M.width/B.scaleX,shiftX:(M.left-ge.left)/B.scaleX,shiftY:(M.top-ge.top)/B.scaleY,radius:Rr});let $=O(R);if(!Ae){const B=i.getBoundingClientRect();B.width>0&&!so({left:B.left,top:B.top,width:B.width,height:B.height},ge)&&(R=ro(B,Tt(ge,R),R),$=O(R)||$)}return $},U=()=>{if(!E)return!1;let M=N();const j=c.getBoundingClientRect().height;j>0&&j!==D&&(D=j,E.style.height=`${j/no(E).y}px`,M=!0);const W=getComputedStyle(E).pointerEvents;return W!==w&&(w=W,i.style.pointerEvents=W),M},I=()=>{A?.dispose(),A=void 0},P=M=>{A=gu({slot:M,own:i,measure:U,onDetached:I})};let x=[];const Q=(M,j)=>{if(y=j,M&&x.length>0){const W=x;x=[],W.forEach(q=>q())}if(M===E){M&&!A&&P(M),U();return}if(I(),E&&E.style.removeProperty("height"),h="",D=0,w="",E=M,!M){N(),L();return}n.onShown?.(c),P(M),U(),C()};d.addDispose(I);const we=M=>{u=!1,M&&n.onReload?.(c);let j;f||_===void 0?j=b():(p(),j=_);try{c.contentWindow?.location.reload()}catch{c.src=a}return j};return{element:c,ready(){return _??b()},reload:()=>we(!0),reloadQuietly:()=>we(!1),moveTo(M){if(i.parentNode===M)return _??b();u=!1;let j;return f||_===void 0?j=b():(p(),j=_),M.appendChild(i),n.onReload?.(c),h="",A?.schedule(),j},get shown(){return E!==null},whenShown(){return E!==null?Promise.resolve():new Promise(M=>{x.push(M)})},alignTo(M,j){Q(M,j??null)},scrollBy(M,j){let W=M,q=j;for(let K=E?be(E):null;K;K=be(K)){if(Math.abs(W)<1&&Math.abs(q)<1)return;const Te=getComputedStyle(K);if((Te.overflowY==="auto"||Te.overflowY==="scroll")&&K.scrollHeight>K.clientHeight){const Ce=K.scrollTop,Ae=K.scrollLeft;K.scrollBy({left:W,top:q,behavior:"instant"}),W-=K.scrollLeft-Ae,q-=K.scrollTop-Ce}}(Math.abs(W)>=1||Math.abs(q)>=1)&&window.scrollBy({left:W,top:q,behavior:"instant"})},resize(){T?.resize()},dispose(){Q(null,null),L(),d.dispose(),i.remove()}}}function Du(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",s=(m,_)=>m==="email"?`email:${_??n}`:m,o=new Map;let i,a=[],c=!1,d;const u=()=>{if(a.forEach(m=>clearTimeout(m)),a=[],i?.remove(),i=void 0,d?.remove(),d=void 0,c){c=!1;const m=o.get("email");t.get(s("email"))?.alignTo(m?.slot??null,m?.clip??null)}},f=(m,_,v)=>{const p=s(m,_),b=t.get(p);if(b)return b;const S=e.resolveMount();if(!S)return Iu();const T=Au(m,S,e,m==="email"?_??n:void 0,v);return t.set(p,T),T},g={get:m=>f(m),current:m=>f(m),peek:m=>t.get(s(m)),spare:()=>t.get(s("email",r())),ensureSpare:()=>f("email",r(),!0),promote(){const m=t.get(s("email",r()));if(!m)return;const _=t.get(s("email"));n=r();const v=o.get("email");m.alignTo(v?.slot??null,v?.clip??null),_?.alignTo(null)},alignSurface(m,_,v){if(o.set(m,{slot:_,clip:v??null}),m==="email"&&c){d?.remove(),d=_?co(_):void 0;return}(_?f(m):t.get(s(m)))?.alignTo(_,v??null)},visible(){for(const m of t.values())if(m.shown)return m},byWindow(m){if(m){for(const _ of t.values())if(_.element.contentWindow===m)return _}},busy(m){if(u(),!m)return;if(!g.visible()){c=!0;const p=o.get("email");p?.slot&&(d=co(p.slot)),a=[setTimeout(u,io)];return}const _=e.resolveMount();if(!_)return;const v=yu(_,()=>g.visible()?.element.parentElement?.getBoundingClientRect()??null);i=v,a=[setTimeout(()=>v.showSpinner(),oo),setTimeout(u,io)]},remount(m){u();const _=s("email");t.forEach((v,p)=>{if(p===_){v.moveTo(m).catch(()=>{});return}v.dispose(),t.delete(p)})},dispose(){u(),t.forEach(m=>m.dispose()),t.clear(),o.clear(),n="a"}};return g}var Pu=l.createIdentifier$1("canvas.resizerBinder"),Dn=l.createIdentifier$1("canvas.service"),Ru={created:X.canvasCreated,loaded:X.canvasLoaded};function Ou(e,t){if(e.getInstance(Dn))return;const n=Du({resolveMount:()=>t.resolveMount(),resolveSrc:s=>t.resolveSrc(s),resolveSandbox:pd,elementId:t.elementId,bindResizer:s=>e.getInstance(Pu)?.(s),onCreated:s=>At(e,s,"fresh"),onReload:s=>At(e,s,"fresh"),onShown:s=>At(e,s,"switch"),mark:s=>t.mark?.(Ru[s])}),r=z(e).addListener(l.EVENT_TYPES.SANDBOX_WHEEL,s=>{n.visible()?.scrollBy(s?.deltaX??0,s?.deltaY??0)});e.inject(Dn,n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),n.dispose()})}function At(e,t,n){const r=z(e),s=t.contentWindow;if(!s)return;const o=r.getTarget()===s;o&&n==="switch"||(n==="fresh"&&(r.forget(s),o&&r.setTarget(void 0)),r.setTarget(s),Kc(r))}function Lu(e,t){At(e,t,"promote")}function Nu(e,t){const n=t.contentWindow;n&&z(e).greet(n)}function Mu(e,t){const n=t.contentWindow;n&&z(e).forget(n)}function re(e){return e.getInstance(Dn)}function xu(e){const t=z(e),n=()=>re(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(l.EVENT_TYPES.RELOAD,async()=>{await n()?.reload()}),s=t.addListener(i=>{i.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&n()?.resize()}),o=Y(e,l.events.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),s.dispose(),o.dispose()})}function uo(){const e=document.createElement("div");return e.dataset.canvasOffscreen="true",e.style.position="absolute",e.style.left="-10000px",e.style.top="-10000px",e.style.width="1600px",e.style.height="1000px",document.body.appendChild(e),e}function ku(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);let n,r;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.remove(),r=void 0}),Ou(e,{resolveMount:()=>n,resolveSrc:o=>Hs(o==="block"),elementId:"email_iframe",mark:o=>V(o)}),t?.watch(o=>{const i=o?.element;if(n&&i instanceof HTMLElement&&i!==n){n=i,re(e)?.remount(i),r?.remove(),r=void 0;return}if(!n){if(i instanceof HTMLElement)n=i;else if(o!==void 0){n=r??=uo(),re(e)?.alignSurface("email",r,r);return}else return;re(e)?.get("email")}});let s;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{s?.remove(),s=void 0}),Rc(e).watch(o=>{const i=re(e);if(i){if(o){s??=uo(),i.alignSurface("email",s,s);return}s&&(i.alignSurface("email",null),s.remove(),s=void 0)}})}var fo=l.createIdentifier$1("canvas.headerFlow"),po=["subject","preheader"],Fu=3e3,Bu={subject:l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,preheader:l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE};function ju(e){const t=he(e),n=z(e),r=p=>p?"remote":Zs(e)?"system":"user",s=(p,{guid:b,value:S,forced:T})=>{const C=Ge(t);if(!C||typeof S!="string"||b&&b!==C.get().docId)return;const L=t.forcedHeaders();if(L?.[p]&&!T&&S!==L[p])return;T&&(f.delete(p),f.size===0&&t.endForcedHeaders());const E=C.get().attributes[p]??"";a=!0;try{qe(C,{[p]:S},{source:r(T)})}finally{a=!1}o[p]=S,Z(e,l.events.ON_HEADER_APPLIED_ID).fire({field:p,value:S,forced:!!T,isGenerated:S!==E&&!!S})};let o={},i,a=!1,c=Promise.resolve();const d=(p,b,S,T=!1)=>{c=n.sendAsync(Bu[p],{value:b,guid:Ge(t)?.get().docId,...S?{force:!0,echo:!0}:{},...T?{undoStep:!0}:{}}).catch(C=>{})};let u;const f=new Set;e.inject(fo,{whenDelivered:async()=>{await c},reassert:p=>{const b=Ge(t),S=po.filter(T=>p[T]);if(!(!b||S.length===0)){a=!0;try{qe(b,Object.fromEntries(S.map(T=>[T,p[T]])),{source:"system"})}finally{a=!1}t.beginForcedHeaders({subject:p.subject??"",preheader:p.preheader??""}),clearTimeout(u),u=setTimeout(()=>{f.clear(),t.endForcedHeaders()},Fu),f.clear();for(const T of S)f.add(T);for(const T of S)o[T]=p[T],d(T,p[T],!0)}}});const g=()=>{i?.(),i=void 0;const p=Ge(t);if(!p){o={};return}const b=p.get().attributes;o={subject:b.subject,preheader:b.preheader},i=p.subscribe(({source:S})=>{if(a)return;const T=p.get().attributes,C=t.forcedHeaders();for(const L of po){const E=T[L];E!==o[L]&&(o[L]=E,d(L,E??"",S==="system"&&C?.[L]!==void 0,S==="user"))}})};g();const m=t.subscribe(g),_=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_SUBJECT_UPDATE,p=>s("subject",p)),v=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_PREHEADER_UPDATE,p=>s("preheader",p));e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{_.dispose(),v.dispose(),m(),i?.(),clearTimeout(u)})}function ho(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Pn(e,t){const n={...e};for(const r of Object.keys(t)){const s=t[r],o=e[r];ho(s)&&ho(o)?n[r]=Pn(o,s):s!==void 0&&(n[r]=s)}return n}function Uu(e,t){const n=l.COMMON_STYLES;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const s=JSON.parse(r);if(s&&typeof s=="object"&&!Array.isArray(s)&&Object.keys(s).length>0)return Pn(n,s)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?Pn(n,t):n}function $u(){const e=window.localStorage.getItem(l.LOCAL_STORAGE_ITEMS.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?l.DARK:l.LIGHT;return e&&e!=="system"?e:t}function Hu(){const e=window.localStorage.getItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings);if(!e)return!1;try{const t=JSON.parse(e);return!!(t?.isCodeMode&&(t.codeModeDirection==="left"||t.codeModeDirection==="right"))}catch{return!1}}function Vu(e){const{config:t}=e;return{operation:l.EVENT_TYPES.UPDATE_PREVIEW,theme:e.theme,commonStyles:Uu(e.emailCommonStyles,e.defaultCommonStyles),pathEnabled:t.pathEnabled,copyPasteEnabled:t.copyPasteEnabled,saveBlockEnabled:t.saveBlockEnabled,editImageControlEnabled:t.editImageControlEnabled,codeMode:e.codeMode,elementAIimageEnabled:t.elementAIimageEnabled,imageCenterStockEnabled:t.imageCenterStockEnabled,imageCenterGifEnabled:t.imageCenterGifEnabled,imageCenterEditorEnabled:t.imageCenterEditorEnabled,blocksAddPanelEnabled:t.blocksAddPanelEnabled!==!1&&t.blocksSectionsShow!==!1,lockEditor:t.lockEditor,appName:e.appName}}var Gu=l.createIdentifier$1("DefaultCommonStyles");function mo(e){return e.getOrCreateInstance(Gu,()=>ie(void 0))}function Yu(e,t){mo(e).set(t)}function Wu(e){const t=z(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=e.getInstance(l.OPTIONS_SOURCE_ID),s=he(e);let o,i="";const a=()=>{const S=n?.get()??{},T=Vu({config:S,emailCommonStyles:s.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:$u(),codeMode:Hu(),appName:"useblocks"}),C=JSON.stringify(T);C!==i&&(i=C,t.send(T))},c=t.onInit(()=>{i="",a()}),d=()=>{t.isInited()&&a()},u=n?.watch(d),f=mo(e).watch(S=>{o=S,d()}),g=r?.watch(S=>{S&&"commonStyles"in S&&(o=S.commonStyles),d()});let m;const _=()=>{m?.(),m=s.current()?.subscribe(d),d()};_();const v=s.subscribe(_),p=matchMedia(l.PREFERS_COLOR_SCHEME_DARK),b=()=>d();p.addEventListener("change",b),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),u?.dispose(),f.dispose(),g?.dispose(),m?.(),v(),p.removeEventListener("change",b)})}var Rn;(function(e){function t(s,o,i=(a,c)=>a===c){if(s===o)return!0;if(s.length!==o.length)return!1;for(let a=0;a<s.length;a++)if(!i(s[a],o[a]))return!1;return!0}e.isEqual=t;function n(s,o=i=>i){const i=new Set;return s.filter(a=>{const c=o(a);return i.has(c)?!1:(i.add(c),!0)})}e.unique=n;function r(s=[],o=[],i=(a,c)=>a===c){const a=[],c=[],d=[];for(const u of s){const f=o.find(g=>i(u,g));f?d.push({prev:u,next:f}):c.push(u)}for(const u of o)s.find(f=>i(u,f))||a.push(u);return{added:a,removed:c,exists:d}}e.diff=r})(Rn||(Rn={}));function qu(e,t){return e.type===t.type&&e.key===t.key}function zu(e){const t=z(e),n=()=>e.getServices(l.SANDBOX_EXTENSIONS_ID)??[];let r=[];const s=t.onInit(()=>{r=n(),t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,r)}),o=l.getServiceContainerId(l.SANDBOX_EXTENSIONS_ID),i=e.onInject(a=>{if(a!==o)return;const c=n();if(!t.isInited()){r=c;return}const{added:d,removed:u}=Rn.diff(r,c,qu);if(r=c,u.length){if(u.some(f=>f.type==="script")){t.send(l.EVENT_TYPES.RELOAD);return}t.send(l.EVENT_TYPES.SANDBOX_REMOVE_EXTENSIONS,u.map(f=>f.key))}d.length&&t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,d)});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{s.dispose(),i?.dispose()})}var Ku=new Set([...Object.values(l.EVENT_TYPES).map(e=>String(e)),"INIT_MESSAGE","FETCH_USER","USER_LOGGED_IN",String(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID)]);function Xu(e){return e.length>0&&!e.startsWith("em:")&&!Ku.has(e)}function Ju(e){const t=z(e),n=new Map;let r=!1,s=-1,o=new Set;const i=d=>(d!==s&&(s=d,o=new Set),o),a=t.observeOutgoing((d,u)=>{if(!r||!Xu(d))return;const f=le(t);n.set(d,{data:u,generation:f,scripts:new Set(i(f))})}),c=t.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,d=>{if(d.phase!=="ready"||d.status!=="success")return;r=!0;const u=le(t),f=i(u);f.add(d.key);for(const[g,m]of n)m.generation===u||![...m.scripts].every(_=>f.has(_))||(m.generation=u,t.send(l.createIdentifier(g),m.data))});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a.dispose(),c.dispose()})}var Qu=l.createIdentifier$1("prewarm.editorVisible");function Zu(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function ef(e={}){const t=e.paint??Zu;let n=!1,r=!1,s=!1,o=!1,i=!1;const a=[],c=()=>{i||o||!n||!r||!s||(o=!0,t(()=>{i=!0,V(X.editorVisible);for(const d of a.splice(0))d()}))};return{noteShellVisible(){n=!0,c()},notePagePainted(){r=!0,c()},noteContentShown(){s=!0,c()},whenVisible(d){if(i){d();return}a.push(d)},contentShown:()=>s}}function tf(e){return e.getOrCreateInstance(Qu,()=>ef())}var nf=500,rf=500,sf=5e3;function of(e){const t=e.quietMs??nf,n=e.floorMs??rf,r=e.ceilingMs??sf;let s,o,i=0;const a=()=>{clearTimeout(s),clearTimeout(o),s=void 0,o=void 0},c=()=>{a(),e.run()},d=()=>{clearTimeout(s);const u=n-(Date.now()-i);s=setTimeout(c,Math.max(t,u))};return{start(){a(),i=Date.now(),o=setTimeout(c,r),d()},notify(){s!==void 0&&d()},cancel:a}}function af({attributes:e,readContent:t,docId:n,hasSession:r,serverId:s,show:o}){if(!r)return;const i={id:s??void 0,renderGuid:n,showId:o?.id,isNew:s==null,showToken:o?.token},a={...e,...i};return Object.defineProperty(a,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),a}var go="self-init:";function lf(e){return e.startsWith(go)}function Eo(e,t){const n=e.getActiveShowRequest();return lf(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function cf(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t();let s="";const o=()=>e.readDocument()?bt(e.readDocument()):s,i=()=>_e(e.container).editorPolicy,a=()=>e.readEmail(),c=()=>{const f=a();return{...f,id:e.isTemplate()||f.isNew?void 0:f.id,html:o()}};let d=!1;const u={readContent:o,publicEmail:c,sendInitStart:()=>de(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:a().renderGuid},void 0,r()),sendInited:()=>de(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:a().renderGuid},void 0,r()),async sendContent(){const f=a(),{html:g,hasBrowserExtensionArtifacts:m}=zs(f?.html||"");m&&e.events.browserExtensionDetected(),Ks(e.readDocument(),g),s=g,await de(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,yt(o(),f.renderGuid,i(),e.readDocument()?.get().version),{guid:f.renderGuid,emailId:f.id??null},r())},refreshContent:()=>de(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,yt(o(),a().renderGuid,i(),e.readDocument()?.get().version),void 0,r()),sendPreheader:async()=>{const f=a();if(f.preheader!==void 0)return de(n,"PREHEADER",l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:f.preheader,guid:f.renderGuid,force:!0},void 0,r())},sendSubject:async()=>{const f=a();if(f.subject!==void 0)return de(n,"SUBJECT",l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:f.subject,guid:f.renderGuid,force:!0},void 0,r())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:f=>e.showFilled?.(f),readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(c()),fireInit(f,g){if(!Eo(t(),f)){t().getActiveShowRequest()?.showId;return}const m=a();m.id,m.renderGuid,t().completeShow(f);const _=e.readDocument();qe(_,{is_inited:!0},{source:"system"});const v=()=>{const b=c();g&&(b.reset=!0);const S=e.events.inited(b);return g||(d&&u.fireEmailChanged(),d=!0),S};if(!_||_.isReady())return v();const{docId:p}=_.get();return _.whenReady().then(()=>e.readDocument()?.get().docId===p?v():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(c())},fireContentChanged(){e.events.contentChanged(o())}};return u}function df(e){const t=()=>e.initPipeline();let n=!1,r,s,o,i=0,a;const c=cf({...e,waitScope:()=>({getSandboxTimeoutMs:p=>t().getSandboxTimeoutMs(p),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal})});let d;const u=(p,b)=>{if(d===p)return;d=p;const S=i;setTimeout(()=>{i!==S||t().signal.aborted||_(p,b).catch(()=>{})},0)},f=()=>{a?.abort(),a=void 0};let g;const m=()=>{const p=t().signal;p!==g&&(g?.removeEventListener("abort",f),g=p,p.addEventListener("abort",f))};async function _(p,b){const S=++i;f(),a=new AbortController,m();const T=()=>i!==S,C=c.readTarget(),L=t().generation,E=()=>L===t().generation&&!t().signal.aborted,y=b?"init:reset-":"init:";if(!b){const h=c.publicEmail();h?.id,h?.renderGuid,h?.preheader}let A=!1,R=!1;try{n=!0,await c.sendInitStart(),c.fireWillInit(),await(b?c.refreshContent():c.sendContent()),A=!0,b||c.publicEmail()?.id;try{await c.sendPreheader()}catch(h){`${y}`,String(h)}try{await c.sendSubject()}catch(h){`${y}`,String(h)}if(T()||c.showFilled(C),await c.sendInited(),R=!0,s===p){const h=e.readSandboxGeneration?.()??o;h!==void 0&&(r=h)}await c.revealFilled()}catch(h){throw T()||(`${y}`,{...e.describeSurface?.(),error:String(h)},void 0),!(!T()&&e.recoverFailedFill?.(C)===!0)&&!T()&&Eo(t(),p)&&t().failShow(p,h),h}finally{v(p,b,y,{superseded:T(),sessionGeneration:L,contentApplied:A,sandboxInitedAcked:R,commit:E()})}}function v(p,b,S,T){const{superseded:C,contentApplied:L,sandboxInitedAcked:E}=T;if(C){`${S}`;return}E&&T.commit?c.fireInit(p,b||void 0):E?(`${S}`,T.sessionGeneration,t().generation,t().signal.aborted,void 0):L?(`${S}`,void 0):(`${S}`,void 0),n=!1,a=void 0,!E&&s===p&&(s=void 0,r===o&&(r=void 0)),!E&&L&&u(p,b)}return{channel:c,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:p=>{r=p},lastCorrelation:()=>s,markCorrelation:p=>{s=p},bumpRunSeq:()=>{i+=1},noteSandboxGeneration:p=>{o=p},fill:p=>_(p,!1),refill:p=>_(p,!0),stop:()=>{i+=1,f(),n=!1,g?.removeEventListener("abort",f),g=void 0}}}function uf(e,t,n){if(!e?.renderGuid||!e.showId||e.showId!==t.showId)return!1;if(t.isNew)return e.id==null;const r=t.emailId??t.navId;return r!=null&&String(e.id??"")!==String(r)?!1:vo(e,n)}function vo(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function ff(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:s,readSandboxGeneration:o}=e,i=u=>{const f=n(),g=s();if(!uf(f,u,g)){u.showId,u.navId,u.emailId,f?.id,f?.showId,f?.renderGuid;return}u.showId,f?.id,f?.renderGuid,t.markFilled(o()),t.markCorrelation(u.showId),t.fill(u.showId).catch(()=>{})};return{showRequested:u=>{i(u)},showRequestIdentityChanged:()=>{const u=e.initPipeline().getActiveShowRequest();u&&i(u)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const u=o();if(t.filledGeneration()===u)return;const f=n(),g=s();if(!f?.renderGuid||!vo(f,g))return;const m=`${go}${f.renderGuid}`;t.markFilled(u),t.markCorrelation(m);const _=r()?.isReady()===!0;f.id,f.renderGuid,(_?v=>t.refill(v):v=>t.fill(v))(m).catch(()=>{t.lastCorrelation()===m&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id,r()}}}function pf(e){return e??""}function hf(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function mf(e){return e.length>0}function gf(e){const t=he(e),n=z(e),r=()=>ae(t.sessionKey())?void 0:t.current(),s=()=>{const O=r();return af({attributes:O?.get().attributes??{},readContent:()=>O?.getContent(),docId:O?.get().docId,hasSession:!!O,serverId:O?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(l.INIT_PIPELINE_ID)??wn;let i={},a=!1;const c=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(O=>{a=!!O?.element});let d=!1,u=!1,f=!1,g=0;const m=()=>{const O=re(e);if(!O)return;const $=++g,B=O.spare();return B&&Mu(e,B.element),(B?B.reloadQuietly():O.ensureSpare()?.ready())?.then(()=>{if($!==g)return;d=!0;const oe=O.spare();oe&&Nu(e,oe.element),f&&(f=!1,w(),j())})},_=of({run:()=>{f||m()?.catch(()=>{})}}),v=()=>{tf(e).noteContentShown(),!d&&!f&&_.start()};let p=!1;const b=O=>{const $=re(e),B=$?.spare()?.element.contentWindow;u&&$&&B&&O===B&&(u=!1,$.promote(),$.busy(!1),p=!0)};let S=!1;const L=df({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:s,revealFilled:()=>{const O=re(e);return p&&O&&(p=!1,_.start()),a?O?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:b,recoverFailedFill:O=>{const $=re(e),B=$?.spare()?.element.contentWindow;return!u||!$||!B||O!==B?!1:(u=!1,d=!1,h="reload",$.busy(!1),$.peek("email")?.reload(),S=!0,j(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!i.isTemplate,readSandboxGeneration:()=>le(n),describeSurface:()=>({canvasPath:h,promoted:u,spareClean:d,handshake:n.isInited(),generation:le(n)}),events:{willInit:O=>{Z(e,l.events.WILL_EMAIL_INIT_ID).fire(O)},inited:O=>{v(),Z(e,l.events.ON_EMAIL_INIT_ID).fire(O)},contentChanged:O=>{Z(e,l.events.ON_CONTENT_CHANGED_ID).fire(O)},emailChanged:O=>{Z(e,l.events.ON_EMAIL_CHANGED_ID).fire(O)},browserExtensionDetected:()=>{Z(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),E=ff({pipeline:L,initPipeline:o,readEmail:s,readDocument:r,readRouteEmailId:()=>i.emailId,readSandboxGeneration:()=>le(n)});let y="",A="",R="",h="none";const w=()=>{const O=re(e)?.spare();O&&(n.sendNow({operation:l.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0}),d=!1,u=!0,Lu(e,O.element))},D=(O,$)=>{const B=re(e);if(!B)return!0;const oe=B.spare(),De=oe&&d?"spare":"prepare";if(h=De,B.busy(!0),oe&&d)return w(),!0;_.cancel(),n.sendNow({operation:l.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0});const Be=m();if(Be===void 0)return h="reload",B.busy(!1),B.peek("email")?.reload(),!0;f=!0;const je=g;return Be.catch(()=>{!f||je!==g||(f=!1,h="reload",B.busy(!1),B.peek("email")?.reload())}),!1},k=()=>{Ae(),L.noteSandboxGeneration(le(n));const O=s(),$=hf(O?.renderGuid,O?.showId,O?.id,i.emailId),B=pf(O?.renderGuid);if(B!==A){const Be=mf(A),je=A;A=B,Be&&D(je,B)}if(f)return;($!==y||S)&&(S=!1,y=$,E.showRequestIdentityChanged());const oe=r(),De=`${$}|${oe?.get().docId??""}|${le(n)}`;De!==R&&oe?.isReady()===!0&&(R=De,E.selfInitChanged()),E.saasChanged(),we()};let N=!1,U="",I="",P=!1,x=!1;const Q=O=>{O.source==="user"?x=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(P=!0),j()},we=()=>{const O=s();if(!O?.renderGuid)return;const $=L.channel.readContent(),B=JSON.stringify([O.preheader,O.common_styles,O.meta,O.subject,O.utm_parameters?.utm_campaign??"",O.utm_parameters?.utm_content??"",O.utm_parameters?.utm_medium??"",O.utm_parameters?.utm_source??"",O.utm_parameters?.utm_term??""]),oe=N&&$!==I,De=N&&B!==U;N=!0,I=$,U=B;const Be=P&&!x;if(P=!1,x=!1,L.isEventsLocked()||Be)return;const je={...O,id:i.isTemplate||O.isNew?void 0:O.id,html:$};if(oe){Z(e,l.events.ON_CONTENT_CHANGED_ID).fire($),Z(e,l.events.ON_EMAIL_CHANGED_ID).fire(je);return}De&&O.is_inited&&Z(e,l.events.ON_EMAIL_CHANGED_ID).fire(je)};let M=!1;const j=()=>{M||(M=!0,queueMicrotask(()=>{M=!1,k()}))};e.inject(Tn,{pipeline:L,setRoute:O=>{O.emailId===i.emailId&&!!O.isTemplate==!!i.isTemplate||(i=O,j())}});let W,q;const K=()=>{const O=r()?.get().docId;O!==q&&(W?.(),q=O,W=r()?.subscribe(Q)),j()};let Te,Ce;const Ae=()=>{const O=e.getInstance(l.INIT_PIPELINE_ID);!O||O===Te||(Ce?.(),Te=O,Ce=O.onShowRequested($=>E.showRequested($)))},ge=n.addListener(O=>{O.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&_.notify()}),Wt=t.subscribe(K),Rr=Us(n,j);K(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c?.dispose(),Ce?.(),Rr(),Wt(),W?.(),ge.dispose(),_.cancel(),L.stop()})}function Ef(){return l.USEBLOCKS!=="useblocks"}var _o={config:{mode:"freeUserBlocks",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formButtonFieldReplacerEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!1,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},vf={config:{mode:"pro",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!0,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0,enableCopyFile:!0}},project:void 0,page:{isNew:!0,type:"email",project:0,id:"",showToken:0}},bo=_o,_f=["freeUserBlocks","blocks"],On={};function bf(e){On=e}var yo=e=>_f.includes(e)?bo:On[e]??On.editor??bo,Ln={config:{mode:"simple",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!1,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!1,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0}},project:void 0},yf={config:{mode:"editor",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!1,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!1,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!1,emailDropdownMenuClone:!0,emailDropdownMenuImport:!1,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportTextEnabled:!1,exportMarkdownEnabled:!1,exportZipEnabled:!0,exportClipboardEnabled:!1,exportWebHookEnabled:!1,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!1,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!1,aiAssistentEnabled:!1,optimizeEnabled:!1,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!1,tagsEnabled:!0,isTemplateEnabled:!1,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!1,deleteButtonEnabled:!0,toggleSidePanel:!1,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!1,formFieldImageTitleEnabled:!1,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!1,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!1,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!1,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!1,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},Sf={...Ln,config:{...Ln.config,imageCenterFileManagerView:!1}};bf({pro:vf,editor:yf,simple:Ef()?Ln:Sf,blocks:_o});var So=l.createIdentifier$1("CodeMode");function Io(){let e;try{const t=window.localStorage?.getItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings);e=t?JSON.parse(t):void 0}catch{e=void 0}return{isCodeMode:!!(e?.isCodeMode||e?.isCodeMode===void 0),direction:e?.codeModeDirection||"left"}}function If(e){try{window.localStorage?.setItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function wo(e){return e.getOrCreateInstance(So,()=>{const t=ie(Io());return t.watch(If),t})}function To(e){return e?.getInstance(So)?.get()??Io()}function Nn(e,t){const n=wo(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function wf(e,t){const n=wo(e);n.set({...n.get(),direction:t})}function Tf(e,t,n=e.getInstance(l.CONFIG_SOURCE_ID)){n?.setMode(t),n?.get()?.codeEnabled===!1&&To(e).isCodeMode&&Nn(e,!1)}function Cf(e){e.getInstance(l.STANDALONE_ACTIVATED_ID)||e.inject(l.SECURITY_MODULE_ID,void 0)}function Dt(e){return String(e.standaloneKey||"").trim()||void 0}function Af(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function Mn(e){return Af(e)?!!Dt(e):!1}function Ke(e){return!!Dt(e)&&!Mn(e)}var Df=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function Co(e){return e==="server"?"serverSide":e}function Pf({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},s=ie();let o={kind:"pending"},i;const a=new Promise(g=>{i=g}),c=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function d(){o.kind!=="pending"&&s.set(mn(r,e))}function u(g){if(o.kind!=="pending")return;clearTimeout(c),o=g;const m=mn(r,e);s.set(m),i(m)}function f(g,m){r[Co(g)]=m,g==="server"&&o.kind==="pending"?u({kind:"applied"}):d()}return{watch:g=>s.watch(g),select:g=>s.select(g),get:()=>s.get(),ready:()=>a,state:()=>o,layers:()=>({...r}),bootstrap(){const g=mn(r,e);return Object.fromEntries(Df.map(m=>[m,g[m]]))},merge(g,m){f(m,{...r[Co(m)],...g})},replace(g,m){f(m,g)},setMode(g){r.user={...r.user,mode:g},d()},setAdvancedConfigs(g){r.advancedConfigs=g,d()},serverAbsent(g){u({kind:"absent",reason:g})},applyServerResponse(g){o.kind==="pending"&&f("server",{...r.serverSide,...g})},dispose(){clearTimeout(c)}}}var Rf=5e3,Of="blocks";function Lf(){return{...yo(Of)?.config,mergeTags:void 0}}function Nf(e,t){e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function Mf(e,t){let n;hn(e).watch(({profile:r})=>{const s=`${r?.theme??""}|${r?.locale??""}`;if(s===n)return;n=s;const o={};r?.theme&&(o.theme=r.theme),r?.locale&&(o.locale=r.locale),t.replace(o,"profile")})}function xf(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function kf(e,t){let n,r=!1,s;const o=a=>{s??=vt(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&Tf(e,a,t)},i=hn(e).watch(({profile:a})=>{const c=a?.email_builder_config,d=xf(c);if(d===void 0||c===n)return;const u=n===void 0;n=c,!(u&&r)&&o(d)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(i),t.ready().then(a=>{if(!a.configSwither)return;const c=localStorage.getItem("configSwither")||(n===void 0?a.mode:s)||"editor";localStorage.setItem("configSwither",c),r=n===void 0,o(c)})}var Ao="замкнутый контур: app_init не выполняется";function Ff(e,t){if(e.getInstance(l.SECURITY_MODULE_ID)){t.serverAbsent(Ao);return}const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(r=>{Ke(r)&&t.serverAbsent(Ao)});n&&e.getInstance(l.DISPOSABLE_ID)?.addDisposable(n)}async function Bf(e,t){if(e.getInstance(Qt)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(l.APP_ID);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function jf(e){e.injectFactory(l.CONFIG_SOURCE_ID,(t,n)=>{if(n)return n;const r=Pf({base:Lf(),env:{modeDefaults:s=>yo(s)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Rf});return Nf(e,r),Mf(e,r),kf(e,r),Ff(e,r),Bf(e,r),e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var Me=class extends l.Disposable{_event;_listener;_disposeEvent;constructor(e){super(),this._event=e}setListener(e){this._listener!==e&&(this._listener=e,this._disposeEvent&&this._disposeEvent(),e?this._disposeEvent=this._event(e):this._disposeEvent=void 0)}dispose(){this._disposeEvent&&this._disposeEvent(),super.dispose()}};function F(e,t,n){const r=l.snapshot(e);return(s,o,i)=>{const a=r(async c=>{const d=t?t(c):c;i&&s.bind(i);const u=await s(d);return n?n(u):u},o,i);return()=>a.dispose()}}var Uf=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new l.Emitter;this.handleDestroy=F(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Me(this.handleDestroy));e.lifetime.addDisposable(t),e.lifetime.addDisposable(e.options.watch(({handleDestroy:r})=>n.setListener(r))),e.lifetime.addDispose(()=>e.release())}destroy(){if(!this.deps.lifetime.isDisposed())try{this.deps.lifetime.dispose()}catch{}}},xn=l.createIdentifier$1("DestroyableService");function $f(e){e.injectFactory(xn,(t,n)=>{if(n)return n;const r=e.getInstance(l.DISPOSABLE_ID);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new Uf({lifetime:r,options:e.getInstance(l.OPTIONS_SOURCE_ID),getInstance:()=>e.getInstance(l.INSTANCE_ID),release:()=>l.releaseContainer(e.getInstance(l.STORE_ID)??e)})},!0)}function Hf(e){const t=e.getInstance(xn);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var Vf=1e3;function Do(e,t,n=Vf,r=0){if(r>n||e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(typeof e=="object"&&typeof t=="object"){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return!1;for(const i of s)if(!Do(e[i],t[i],n,r+1))return!1;return!0}return!1}function Xe(e,t){if(!e||typeof e!="object")return t;if(!t||typeof t!="object")return{};const n={};for(const r of Object.keys(t)){const s=t[r],o=e[r];Do(s,o)||(n[r]=s)}return n}var Gf=({source:e,emailtags:t,group:n,tags:r,...s})=>s;async function Yf(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function Wf({emails:e,saveTimeoutMs:t},n,r){const s=t?.()??tn();let o;try{const i=e.notifySave(n);return await Promise.race([i,new Promise((a,c)=>{o=setTimeout(()=>{const d=new sn(s);n.value.id,Al(d,Yf(i,r)),c(d)},s)})])}catch(i){throw ns(i),i}finally{o!==void 0&&clearTimeout(o)}}function qf(e){const{emails:t}=e,n=async(r,s)=>{const o=Gf(s),i=r===void 0?void 0:await t.cache.getIfPresent(r),a=i?{...i,...o}:o,c=i?Xe(i,o):o,d=u=>{const f=String(u.id??r??l.generateUUID()),g=u.id===void 0?{...u,id:f}:u;return t.cache.addOrUpdate(f,()=>g)};return await d(await Wf(e,{prev:i,patch:c,value:a,source:s.source??""},d))};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const s=await n(void 0,r);return s?.renderGuid?s:{...s,renderGuid:l.generateUUID()}},async updateEmail(r,s){return await n(r,s)}}}var kn=20;function zf(e){const t=Kf(e);return e.saveTimeoutMs?Xf(t,e.saveTimeoutMs):t}function Kf({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r,emailAuthor:s,integratorProject:o}){const i=async(a,c)=>(t.clear(),await t.get(a,{page:c}),(await e.cache.values()??[]).filter(d=>String(d?.parent)===String(a)));return{async readRevisions(a,c=1){const d=await i(a,c);return{revisions:d.slice(kn*(c-1),kn*c),page:c,hasMore:d.length>kn*c}},async readAutosave(a){const c=await r?.(a)??NaN,d=Number.isFinite(c)?c:void 0,u=await n?.(a);if(!u?.asked)return kl(await i(a,1),d);if(!u.revision)return ss([],d);const f={...u.revision,parent:a,isAutosave:!0};return ss([f],d,await i(a,1))},async saveAutosave(a,c){const d=await s?.(a),u=o?.();return await e.create({...Hl(c),...d!==void 0?{author:d}:{},...u!==void 0?{project:u}:{},parent:a,isAutosave:!0,modified:new Date().toString()})}}}function Xf(e,t){return{...e,async saveAutosave(n,r){const s=t();let o;try{return await Promise.race([e.saveAutosave(n,r),new Promise((i,a)=>{o=setTimeout(()=>a(new Qr(s)),s)})])}catch(i){throw ns(i),i}finally{o!==void 0&&clearTimeout(o)}}}}var Jf=class extends l.BaseEmitter{async execute([e],t){for(const n of t){const r=await n(e);r&&(r.id===void 0&&(r.id=e.value.id),e.value=r)}return e.value}},Qf=class extends l.AsyncEmitter{};function Uv(e){return e}var Po=class extends l.Disposable{_items=new Map;_onChangeEmitter=new l.Signal;async _getOrCreate(e,t){const n=this._items;let r;if(n.has(e))try{r=await n.get(e)}catch{t&&(r=await t())}else t&&(r=await t(),r&&this._onChangeEmitter.fire());return r}async _addOrUpdate(e,t){let n;const r=this._items;if(r.has(e))try{n=await r.get(e)}catch{}const s=await t(n);return l.deepEqual(n,s)||this._onChangeEmitter.fire(),s}entries(){return Promise.all([...this._items.entries()].map(([e,t])=>t.then(n=>[e,n]))).then(e=>e.filter(([t,n])=>!!n))}values(){return Promise.all([...this._items.values()].map(e=>e).filter(e=>!!e))}getOrCreate(e,t){const n=this._getOrCreate(e,()=>t(e));return this._items.set(e,n),n}addOrUpdate(e,t){const n=this._addOrUpdate(e,t);return this._items.set(e,n),n}async getIfPresent(e){if(this._items.has(e))try{return await this._items.get(e)}catch{return}}add(e,t){const n=Promise.resolve(t);return this._items.set(e,n),n}remove(e){if(this._items.has(e)){const t=this._items.get(e);return this._items.delete(e),this._onChangeEmitter.fire(),t}return Promise.resolve(void 0)}async setAll(e){try{this.suspendChange();const t=[],n=new Set(Array.from(e).map(([s,o])=>s)),r=(await this.entries()).filter(([s,o])=>!n.has(s));for(const[s,o]of e)t.push(this.addOrUpdate(s,()=>o)),n.add(s);for(const[s]of r)t.push(this.remove(s));return await Promise.all(t),r}finally{this.resumeChange()}}clear(){this._items.clear(),this._onChangeEmitter.fire()}suspendChange(){this._onChangeEmitter.suspend()}resumeChange(){this._onChangeEmitter.resume()}onChange=this._onChangeEmitter.event};function Zf(e,{filter:t,order:n="asc",orderBy:r,page:s,pageSize:o=20}={}){const i=e.length;let a=e.length;if(t!==void 0){const c=Object.keys(t);e=e.filter(d=>{for(const u of c){const f=d[u],g=t[u];return u==="id"||typeof f!="string"?f===g:typeof g=="string"&&f.startsWith(g)}return!0}),a=e.length}return r&&(e=e.sort((c,d)=>(c[r]>d[r]?1:d[r]>c[r]?-1:0)*(n==="asc"?1:-1))),s!==void 0&&(e=e.slice(o*(s-1),o*s)),{data:e,filteredTotal:a,total:i,totalPages:Math.ceil(a/o)}}function ep(e=[]){if(e=e.filter(n=>n),e.length<=1)return e[0];const t=new Map;for(const n of e)for(const r of n)if(r.id!==void 0){const s=t.get(r.id)||{};t.set(r.id,{...s,...r})}return[...t].map(([n,r])=>r)}function tp(e,t){return Ro(e)&&Ro(t)?String(e)===String(t):e===t}function Ro(e){return typeof e=="string"||typeof e=="number"}var np=class extends l.Disposable{_cache=new Po;_readEmitter=new l.AsyncEmitter;_saveEmitter=this.addDisposable(new Jf);_removeEmitter=this.addDisposable(new Qf);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(n=>!!n)))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new l.Disposable);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new Po),s=n.addDisposable(new l.AsyncEmitter);t=this._foreignCache[e]={get:async(o,i={})=>{await r.getOrCreate(o,async()=>{try{const c=ep(await s.fire(o))||[];for(const d of c)d[e]=o,await this._cache.add(d.id,d);return c}catch{return[]}});const a=(await this._cache.values()||[]).filter(c=>{const d=c[e];return d==null||tp(d,o)});return Zf(a,i)},first(o,i={}){return t.get(o,{...i,page:1,pageSize:1}).then(({data:a})=>a[0])},handleRead:s.event,clear(){r.clear()},dispose(){n.dispose()}}}return t}async create(e,{source:t="",silent:n}={}){let r=e;return n||(r=await this._saveEmitter.fire({prev:void 0,patch:e,value:r,source:t})),r.id===void 0&&(r.id=l.generateUUID()),await this._cache.addOrUpdate(r.id,()=>r)}notifySave(e){return this._saveEmitter.fire(e)}async update(e,t,{source:n="",silent:r}={}){return this._cache.addOrUpdate(e,async s=>{const o=s?{...s,...t}:t;if(!r)return t=s?Xe(s,t):t,await this._saveEmitter.fire({prev:s,patch:t,value:o,source:n})})}async remove(e,{source:t="",silent:n}={}){const r=await this._cache.remove(e);return n||await this._removeEmitter.fire({value:r,source:t}),r}refresh(){this._cache.clear();for(const e of Object.values(this._foreignCache))e.clear()}suspendChange(){this._cache.suspendChange()}resumeChange(){this._cache.resumeChange()}handlerRead=this._readEmitter.event;onSave=this._saveEmitter.event;onRemove=this._removeEmitter.event;onChange=this._cache.onChange};function Je(e){const t=l.createIdentifier$1(e);return n=>n.getOrCreateInstance(t,()=>new np)}function Oo(e){const t=e.getInstance(l.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}function Lo(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Fn(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function rp(e,t,n){return e&&!Lo(t)&&Lo(e)?{...n,meta:e.meta}:n}var sp=l.createIdentifier$1("CurrentProject"),op={};function Qe(e){return e?.getInstance(sp)?.get()??op}function Bn(e){const t=Qe(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var No=Je("plugin.dataSource.emails"),Mo=Je("plugin.dataSource.emailRevisions"),xo=In("plugin.readEmailAutosave"),ko=l.createIdentifier$1("emailDocuments.provided");function ip(e){const t=No(e),n=Mo(e),r=n.byForeignKey("parent");if(e.getInstance(ko))return{emails:t,emailRevisions:n};e.inject(ko,!0);const s=()=>tn(e.getInstance(l.INIT_PIPELINE_ID)?.contentReadyTimeoutMs),o=qf({emails:t,saveTimeoutMs:s}),i=new Map,a=(c,d)=>u=>{const f=u?.id??d;return(typeof f=="string"||typeof f=="number")&&i.set(String(f),c),u};return uc(e,{...o,createEmail:c=>o.createEmail(c).then(a(Date.now())),updateEmail:(c,d)=>o.updateEmail(c,d).then(a(Date.now(),c))}),mc(e,zf({revisions:n,revisionsByEmail:r,readAutosave:async c=>{const d=await Z(e,xo).fire(c);return d.length===0?{asked:!1}:{asked:!0,revision:d[0]??null}},savedAt:async c=>{const d=Ml((await t.cache.getIfPresent(c))?.modified),u=i.get(String(c))??NaN;return Number.isFinite(u)&&!(d>=u)?u:d},emailAuthor:async c=>(await t.cache.getIfPresent(c))?.author,saveTimeoutMs:s,integratorProject:()=>Qe(e).requested})),Oo(e).addDisposable(t.onSave(({prev:c,patch:d,value:u})=>rp(c,d,u),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function Fo(e,t){return!e?.data||!t||e.id!==t.locale?!1:t.contentHash?e.hash===t.contentHash:t.updatedAt>0&&t.updatedAt<=e.time}function ap(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var lp="po",Pt=null;function cp(){const e=typeof __useblocks__<"u"?__useblocks__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([lp],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function dp(){return Pt===null&&(Pt=cp().catch(e=>{throw Pt=null,e})),Pt}async function Bo(e){if(typeof e=="object")return jn(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?up(t):fp(t)}function jn(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function up(e){try{return jn(JSON.parse(e))}catch{return}}var jo=!1;async function fp(e){try{return jn((await dp()).parsePoCatalog(e))}catch{jo||(jo=!0);return}}var pp="em_locale",hp="em_ant_locale",mp="locale",gp="ant_locale";function Un(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function Uo(e,t){const n=Un(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function Ep(){return Un("em_locale")??Uo(mp,"em_locale")}function $o(e){try{localStorage.setItem(pp,JSON.stringify(e))}catch{}}function vp(){return Un("em_ant_locale")??Uo(gp,"em_ant_locale")}function _p(e,t){try{localStorage.setItem(hp,JSON.stringify({id:e,data:t}))}catch{}}var $v="en_US",bp=8e3;function yp(e,t){const n=e,r=t,s=Object.keys(n).filter(o=>o!=="");return s.length!==Object.keys(r).filter(o=>o!=="").length?!1:s.every(o=>JSON.stringify(n[o])===JSON.stringify(r[o]))}function Sp(e){const t=Ep(),n=vp();let r={ready:!1},s;const o=ie(r);let i=0;const a=p=>{r={...r,...p},o.set(r)},c=()=>{r.ready||a({ready:!0})},d=setTimeout(c,e.unlockAfterMs??bp),u=p=>p!==i;let f;async function g(p,b){if(n?.id===p&&n.data&&a({antd:n.data}),!f)return;const S=await f(p).catch(()=>{});!S||u(b)||(a({antd:S}),_p(p,S))}async function m(p,b){const S=await e.askHost(p).catch(()=>null);if(u(b))return!0;if(S==null)return!1;const T=await Bo(S);return u(b)||(T&&a({catalog:T}),c()),!0}async function _(p,b){const S=await e.readList();if(u(b))return;if("error"in S){a({failure:{kind:"GET_LOCALES_ERROR",error:S.error}}),c();return}const T=S.data.find(L=>L.locale===p);if(!T){ap("em_locale")&&a({catalog:void 0}),c();return}if(Fo(t,T)&&(!s||s.catalog===t?.data)){c();return}if(s?.entry&&r.catalog===s.catalog&&Fo(s.entry,T)){$o(s.entry),c();return}const C=await e.readCatalog(p);if(!u(b)){if("error"in C){a({failure:{kind:"GET_LOCALE_ERROR",error:C.error}}),c();return}C.data&&(s?.id===p&&r.catalog===s.catalog&&yp(s.catalog,C.data)||a({catalog:C.data}),$o({id:p,time:T.updatedAt||Math.floor(Date.now()/1e3),hash:T.contentHash,data:C.data})),c()}}async function v(p,b){if(!await m(p,b)){if(!u(b)&&(s?.id===p&&r.catalog===s.catalog||p==="en_US")&&c(),e.canUseNetwork&&!e.canUseNetwork()){c();return}await _(p,b)}}return{set(p){if(!p||p===r.id)return;const b=i+=1;a({id:p,failure:void 0});const S=s?.id===p&&r.catalog===s.catalog;(s&&!S&&r.catalog===s.catalog||p==="en_US"&&r.catalog)&&a({catalog:void 0}),t?.id===p&&t.data&&(a({catalog:t.data}),c()),g(p,b),v(p,b)},prime(p,b,S){r.id&&r.id!==p||r.catalog||!b||(s=t?.id===p&&t.data&&(!S||t.time>=S.time)?{id:p,catalog:t.data}:{id:p,catalog:b,entry:S?{id:p,time:S.time,hash:S.hash,data:b}:void 0},a({catalog:s.catalog}))},useAntdLoader(p){f=p,r.id&&g(r.id,i)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(d)}}var Ip=class{http;constructor(e){this.http=e}jsonList=({locale:e},t={})=>this.http.request({path:`/translations/${e}.json`,method:"GET",format:"json",...t});getTranslations=({locale:e},t={})=>this.http.request({path:`/translations/${e}.po`,method:"GET",...t});localesList=(e={})=>this.http.request({path:"/translations/locales",method:"GET",format:"json",...e})},wp=class{baseUrl="/api/v2";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(n=>this.encodeQueryParam(t,n)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(n=>typeof t[n]<"u").map(n=>Array.isArray(t[n])?this.addArrayQueryParam(t,n):this.addQueryParam(t,n)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,n)=>{const r=e[n];return t.append(n,r instanceof Blob?r:typeof r=="object"&&r!==null?JSON.stringify(r):`${r}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const n=this.abortControllers.get(e);return n?n.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:n,type:r,query:s,format:o,baseUrl:i,cancelToken:a,...c})=>{const d=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,d),f=s&&this.toQueryString(s),g=this.contentFormatters[r||"application/json"],m=o||u.format;return this.customFetch(`${i||this.baseUrl||""}${n}${f?`?${f}`:""}`,{...u,headers:{...u.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(a?this.createAbortSignal(a):u.signal)||null,body:typeof e>"u"||e===null?null:g(e)}).then(async _=>{const v=_;v.data=null,v.error=null;const p=m?_.clone():_,b=m?await p[m]().then(S=>(v.ok?v.data=S:v.error=S,v)).catch(S=>(v.error=S,v)):v;return a&&this.abortControllers.delete(a),b})}},Tp=l.createIdentifier$1("rest.v2.transport"),Ho=Symbol("rest.v2.secureRequest");function Cp(e){return e.getOrCreateInstance(Tp,()=>{const t=e.getInstance(l.CUSTOM_FETCH_ID)?.execute||fetch;return new wp({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[Ho]:!0}),customFetch:(n,r={})=>{const{[Ho]:s,...o}=r;return t(n,{...o,[l.PUBLIC_REQUEST]:s!==!0})}})})}function Ap(e,t){const n=Cp(e);return Object.assign({},...t.map(r=>new r(n)))}function Vo(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function Go(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Vo(n.details,"wp_code")??n.code,message:Vo(n.details,"wp_message")??n.message,details:n.details}}:t&&typeof t=="object"?{status:e.status,data:t}:{status:e.status,data:{message:e.statusText||"request failed"}}}function Yo(e){return!e.ok||!!e.error}function Dp(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function Wo(){return Dp(l.LOCAL_STORAGE_ITEMS.em_translations_v2)??!0}function Pp(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Rp(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Op(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],s=r[0];return typeof s=="string"&&s!==""&&t.push({locale:s,updatedAt:Pp(r[1])}),t},[]):[]}function Lp(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:Rp(n.updated_at),contentHash:n.content_hash}),t),[])}function qo(e){return Ap(e,[Ip])}function Rt(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function $n(e){return!e.ok||e.error!=null}function Hn(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function Vn(e){return{data:await Bo(e)??null}}async function Np(e){if(Wo())try{const n=await qo(e).localesList();return Yo(n)?{error:Go(n)}:{data:Lp(n.data)}}catch(n){return Rt(n)}const t=l.getApi(e,[Br]);try{const n=await t.get_translations2({file:"react_app"});return $n(n)?Hn(n):{data:Op(n.data)}}catch(n){return Rt(n)}}async function Mp(e,t){if(Wo())try{const r=await qo(e).jsonList({locale:t});return Yo(r)?{error:Go(r)}:Vn(r.data)}catch(r){return Rt(r)}const n=l.getApi(e,[Br]);try{const r=await n.get_translations3({id:t,file:"react_app"});return $n(r)?Hn(r):Vn(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return $n(r)?Hn(r):Vn(r.data)}catch(r){return Rt(r)}}}var Ot=new WeakMap;function xp(e){const t=Ot.get(e);if(t!==void 0)return t;const n=Np(e).then(r=>("error"in r&&Ot.delete(e),r),r=>{throw Ot.delete(e),r});return Ot.set(e,n),n}var Ze=l.createIdentifier$1("locale.service");function kp(e){if(e.getInstance(Ze))return;const t=Sp({readList:()=>xp(e),readCatalog:n=>Mp(e,n),askHost:async n=>(await Z(e,l.events.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(l.SECURITY_MODULE_ID)});e.inject(Ze,t),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t.dispose())}function Fp(e){const t=e.getInstance(l.CONFIG_SOURCE_ID);if(!t)return;const n=e.getInstance(Ze);if(!n)return;const r=t.select(s=>s.locale).watch(s=>n.set(s||"en_US"));e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r)}var Bp="user_id",jp="project_id",zo=l.createIdentifier$1("rest.identityHeadersProvided");function Up(e){if(e.getInstance(zo))return;e.inject(zo,!0);let t;e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(n=>{t=n}),e.addService(l.REQUEST_HANDLER_ID,{execute(n,r){if(r?.public)return;const s=t?.user?.id??Cs(e).profile?.id;s!=null&&s!==""&&n.headers.set(Bp,String(s));const o=t?.project;o!=null&&o!==""&&n.headers.set(jp,String(o))}})}function $p(e){if(!e)return!1;try{return e.getInstance(l.SECURITY_MODULE_ID)!==void 0}catch{return!1}}var Hp="Invalid standaloneKey.",Hv=l.createIdentifier$1("StandaloneMockGuard");function Vp(){const e=new Error(Hp);return e.name="InvalidStandaloneKeyError",e}function Gp(e){e.addService(l.REQUEST_HANDLER_ID,{execute:()=>{if($p(e))throw Vp()}})}function Yp(e){l.registerRestTransport(e),Gp(e)}function Wp(e){const t=new Xs;e.inject(l.INIT_PIPELINE_ID,t);const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(s=>{if(!s)return;const o=s.signal??t.externalSignal;t.configure({replaceSession:!0,...s.timeouts!==void 0?{timeouts:s.timeouts}:{},...o!==void 0?{signal:o}:{}})}),r=e.getInstance(l.DISPOSABLE_ID);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var qp=Je("plugin.dataSource.blocks"),zp=Je("plugin.dataSource.blockRevisions"),Kp=Je("plugin.dataSource.comments"),Xp=In(),Jp=In(),Ko=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
2086
2110
|
<html>
|
|
2087
2111
|
<head>
|
|
2088
2112
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
@@ -2123,10 +2147,10 @@ __useblocks__.define("useblocks.js",["require","exports","module","static/umd/99
|
|
|
2123
2147
|
</tr>
|
|
2124
2148
|
</table>
|
|
2125
2149
|
</body>
|
|
2126
|
-
</html>`;function
|
|
2150
|
+
</html>`;function Qp(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:Ko,project:e?.id,project_title:e?.title??"",tags:[],utm_parameters:{utm_source:"",utm_medium:"",utm_campaign:"",utm_term:"",utm_content:""},parent_email:null,common_styles:"{}",title:"",emailtags:[],isAmp:!1}}var Xo=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function Zp(e){return!Object.keys(e).some(t=>Xo.has(t))}function eh(e){const t={},n={};for(const[r,s]of Object.entries(e))Xo.has(r)?t[r]=s:n[r]=s;return{showOptions:t,misplacedEmailFields:n}}function Jo(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function Vv(e){}function et(e){return{emails:No(e),blocks:qp(e),emailRevisions:Mo(e),blocksRevision:zp(e),comments:Kp(e)}}function th(e){const t=Object.values(et(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function Lt(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(Zp(e))return{email:Jo(e)};{const{showOptions:n,misplacedEmailFields:r}=eh(e),s=Object.keys(r);t&&s.length>0&&void 0;const o=typeof e.email=="string"?{code:e.email}:e.email;return{...n,email:Jo({...r,...o})}}}function Gn(e){return En(e)?.current()}function Nt(e){return Gn(e)?.getContent()}function Qo(e,t){const n=t??Qp(),r=Gn(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:Nt(e)??n.html}:n}async function Mt(e){return(await e.getInstanceAsync(l.APP_ID))?.project}async function nh(e){return Bn(e)??await Mt(e)}function Zo(e){if(!e)return;const t=Lt(e,!1).email.id;return t==null?void 0:String(t)}function rh(e,t){return e.ticket===t.ticket?!1:e.emailId===void 0||e.emailId!==t.emailId}function sh(e){return typeof e=="object"&&e!==null&&"reload"in e&&e.reload===!0}function xe({code:e,project:t,...n},r){const s=pe(n),o=Bn(r),i=_e(r);return e&&i.warnAboutUnconfiguredInput(e,n.id),{...s,...e?{html:i.toEditorForm(e)}:{},...o===void 0?{}:{project:o},..."utm_parameters"in s?{utm_parameters:s.utm_parameters||{}}:{},_embedded:void 0}}function ee({html:e,renderGuid:t,showToken:n,showId:r,...s},o){const{requested:i}=Qe(o),a=Ps(o);return pe({...s,code:_e(o).toOutputForm(e),project:i===void 0?s.project:i,utm_parameters:a.UTMEnabled?s.utm_parameters:void 0,tags:void 0,template:void 0,guid:void 0,emailtags:void 0,project_title:void 0,project_author:void 0,is_template:void 0,is_inited:void 0})}function Yn(e){return e==null?"":e.replaceAll(`\r
|
|
2127
2151
|
`,`
|
|
2128
|
-
`)}function Js(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function hf(e,t,n,r){const s=mf(e,t,n,r);return s===void 0}function mf(e,t,n,r){const{email:s}=lt(t,!1),o=ye(s,e),i=o.id;if(i===void 0)return"no-id";if(r!==void 0&&r!==i)return"other-id-shown";const l=jt(e)?.current();if(!l)return"no-session";const c=l.get(),d=c.attributes;if(c.serverId!==i)return"document-id";if(d.is_inited!==!0)return"not-inited";const u=Js(fn(n??l.getContent()));if(o.html!==void 0&&Js(fn(o.html))!==u)return"html";if(o.subject!==void 0&&o.subject!==d.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==d.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==d.common_styles)return"common_styles"}function Qs(e,t){const{email:n}=lt(t,!1),r=ye(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:fn(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function gf(e,t){const n={...e};return delete n.id,{...n,...t}}function Ef(e){return e.html?e:{...e,html:Ys}}function xe({code:e,project:t,...n},r,s){const o=s??qs(r);return{...n,...e?{html:ve(r).toEditorForm(e)}:{},renderGuid:a.generateUUID(),...o===void 0?{}:{project:o}}}function dt({html:e,renderGuid:t,...n},r){const{requested:s}=it(r);return ie({...n,code:ve(r).toOutputForm(e),project:s===void 0?n.project:s,guid:void 0,link:void 0,status:void 0,slug:void 0,password:void 0,comment_status:void 0,template:void 0,blocktags:void 0,project_title:void 0,ping_status:void 0,lock:void 0,tag:void 0,is_template:void 0})}function Zs(e){return jt(e)?.current()?.get().serverId??void 0}function pn(e,t,n){return n===void 0&&(n=e.post===void 0?Zs(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function ut(e,t){return ie({...e,link:void 0,comment_status:void 0})}function ft({code:e,autosave:t,...n},r,s){return s===void 0&&(s=n.parent===void 0?Zs(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0,parent:s}}function eo({html:e,isAutosave:t,...n},r){return ie({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:ie({html:e,ampHtml:e&&""})})}var hn=a.createIdentifier$1("NotificationService"),vf=a.createIdentifier$1("emailTemplate.reads");async function bf(e,t){try{return await fe(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,yf(e,t,n);return}}var _f=a.createIdentifier$1("emailTemplate.notifiedFailures");function yf(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(_f,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(hn).then(()=>{a.getEmitter(e,a.events.ON_NOTIFICATION).fire({type:"error",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function Sf(e,t){const n=e.getOrCreateInstance(vf,()=>new Map),r=n.get(t);if(r!==void 0)return r;const s=bf(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,s),s}var wf="EXTERNAL";function If(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var Tf="email_id",Af=class extends a.Disposable{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_dataSources;_eventLock;_queue=a.createQueue();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=at(t),this._eventLock=df(t);const n=V(e,a.events.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(a.REQUEST_HANDLER_ID,{execute:(r,s)=>{!s?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(Tf,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(a.INIT_PIPELINE_ID)??Wt}_throwIfDestroyed(){if(this.isDisposed())throw St()}async getTemplateEmail(e){const t=await Sf(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,n}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await un(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,xe(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,ft(s,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,pn(s,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,s){const o=this._dataSources.emails,i=o.cache,l=await un(this._container),c=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let d=ye(e,this._container);const u=d.id;let p=u;if(u!==void 0){const E=await o.get(u);d={...E??{},...d,utm_parameters:d.utm_parameters??E?.utm_parameters??{},renderGuid:E?.renderGuid??a.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:l}}else{p=n??a.generateUUID();const E=await o.get(p);d={...d,utm_parameters:d.utm_parameters??{},renderGuid:E?.renderGuid??a.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:l},delete d.project}if(t){const E=await this.getTemplateEmail(String(t));E&&(d=gf(E,d))}return u===void 0&&(d=Ef(d)),await i.addOrUpdate(p,()=>d),d}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==Qs(this._container,e))return!1;const n=ct(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=Qs(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:ct(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&ff({ticket:t,emailId:Xs(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId})){this._showRequests;return}if(!e)return;const n=this._getInitPipeline();a.throwIfAborted(n.signal);const r=pf(e);if(!r&&hf(this._container,e,ct(this._container),this._prevCommand?.id)||!r&&this._isRepeatOfLastShow(e))return;const s=lt(e);s.email.id,this._prevCommand?.id;let o,i="",l=0,c=!1,d,u=Promise.resolve(),p,E=!1;try{this._eventLock.suspendChange();const{email:h,blocks:b,autosaves:v,comments:m,templateId:_,reload:y}=s;o=h.id;const w=ye(h,this._container),A=w.id,C=A??a.generateUUID(),g=await Oe("getProject",un(this._container));a.throwIfAborted(n.signal),i=a.generateUUID();const I={isNew:A===void 0,id:String(C),project:g},f=y===!0&&A!==void 0;f&&(await this._dataSources.emails.remove(String(A),{silent:!0}),String(A)),l=++this._showToken,String(C);const S=[];S.push(this.setBlocks(b)),h.id!==void 0&&(S.push(this.setComments(m)),S.push(this.setEmailRevisions(v,String(h.id)))),S.push(this.setEmail(h,Number(_),A===void 0?String(C):void 0,l,i)),await Oe("setEmail+blocks+revisions",Promise.all(S),{emailId:A??String(C),showId:i,targetShowToken:l}),a.throwIfAborted(n.signal);const T=await this._dataSources.emails.get(String(C)),M=ae(this._container),k={id:i,token:l};A===void 0?p=M.startNewDraft(T??w,{patch:w,show:k}):f?p=M.reload(A,{email:T??w,patch:w,show:k}):M.sessionKey()===me(A)?p=M.show(w,k):p=M.open(A,{email:T??w,patch:w,show:k});const z=!!this._prevCommand&&a.deepEqual(this._prevCommand,I);I.id,!this._prevCommand||a.deepEqual(this._prevCommand,I),this._prevCommand?.id,this._rememberShow(I),u=n.requestShow({showId:i,navId:String(C),emailId:A,isNew:A===void 0}),E=!0,String(C),c=!0}catch(h){d=h,E&&i&&n.failShow(i,h),a.isAbortError(h)||(dr(h),void 0)}finally{this._eventLock.resumeChange()}if(!c)throw d instanceof Error?d:new Error(`[useblocks] show() setup failed: ${String(d??"unknown error")}`);return Oe("show-init-deferred",Promise.all([u,p?.whenReady().catch(h=>{if(h instanceof ze){const b=Ar(h);throw b?new Error(`[useblocks] show(): email open failed (${b})`,{cause:h}):h}})??Promise.resolve()]).then(()=>{}),{showId:i,emailId:o??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();a.throwIfAborted(e.signal);const t=ae(this._container),n=await t.save("publish",{source:wf});if(a.throwIfAborted(e.signal),!n)throw If(t.saveState().error);return Q(uf(this._container,this._currentEmail),this._container)}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;return this._latestShowEmailId=Xs(e),this._queuedShow(e,t)};save=this._queue.decorate(this._save,this)};function Cf(e){return String(e).replace(/"/g,""")}function Pf(e=new Date){const t=n=>String(n).padStart(2,"0");return String(e.getFullYear())+t(e.getMonth()+1)+t(e.getDate())+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}function Df(e){const t=/<(table|tr|div)(\s[^>]*)>/gi;let n;for(;(n=t.exec(e))!==null;){const r=n[2]??"";if(/\bem\s*=\s*["']block["']/i.test(r))return{full:n[0],index:n.index}}return null}function to(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),s=Cf(n);return r.test(e)?e.replace(r,`${t}="${s}"`):e.replace(/>$/,` ${t}="${s}">`)}function Rf(e,t,n){if(!e?.trim()||!t)return e;const r=Df(e);if(!r)return e;const s=String(t),o=Pf(n??new Date);let{full:i,index:l}=r;const c=i.length;return/\bem-block-id\s*=/.test(i)||(i=to(i,"em-block-id",s)),i=to(i,"em-block-version",o),e.slice(0,l)+i+e.slice(l+c)}function Of(e){if(e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object")return e.meta;const t=e.catalogExtra?.meta;if(t!=null&&typeof t=="object")return t}function Lf(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),s=t?.project??(e.project!==void 0&&e.project!==null?String(e.project):void 0);return{type:t?.type??n,insertFrom:n,name:t?.name??e.name,blockId:r,project:s,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:Of(e)}}function mn(e,t){return t?Lf(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var no=["title","slug","type","tags","blocktags","modified","author","lock","subject","description","excerpt","status","is_template","link","renderGuid","date","date_gmt","modified_gmt","comment_status","ping_status","template","related_email","project_title","project_author","isAmp","meta"],Mf=[...no,"html","id","project","password"],qm=new Set(["html",...no,"global_block","project"]);function Nf(e){if(!e||typeof e!="object")return{};const t={};e.id!=null&&e.id!==""&&(t.id=String(e.id)),e.title!=null&&e.title!==""&&(t.title=e.title),e.slug!=null&&e.slug!==""&&(t.slug=e.slug),e.type!=null&&e.type!==""&&(t.type=e.type),e.tags!=null&&(t.tags=e.tags),e.blocktags!=null&&(t.blocktags=e.blocktags),e.modified!=null&&e.modified!==""&&(t.modified=e.modified),e.author!=null&&e.author!==""&&(t.author=String(e.author)),e.lock!=null&&(t.lock=e.lock),e.subject!=null&&e.subject!==""&&(t.subject=e.subject),e.description!=null&&e.description!==""&&(t.description=e.description),e.excerpt!=null&&e.excerpt!==""&&(t.excerpt=e.excerpt),e.status!=null&&e.status!==""&&(t.status=e.status),e.is_template!=null&&(t.is_template=e.is_template),e.link!=null&&e.link!==""&&(t.link=e.link),e.renderGuid!=null&&e.renderGuid!==""&&(t.renderGuid=e.renderGuid),e.date!=null&&e.date!==""&&(t.date=e.date),e.date_gmt!=null&&e.date_gmt!==""&&(t.date_gmt=e.date_gmt),e.modified_gmt!=null&&e.modified_gmt!==""&&(t.modified_gmt=e.modified_gmt),e.comment_status!=null&&e.comment_status!==""&&(t.comment_status=e.comment_status),e.ping_status!=null&&e.ping_status!==""&&(t.ping_status=e.ping_status),e.template!=null&&e.template!==""&&(t.template=e.template),e.related_email!=null&&e.related_email!==""&&(t.related_email=e.related_email),e.project_title!=null&&e.project_title!==""&&(t.project_title=e.project_title),e.project_author!=null&&e.project_author!==""&&(t.project_author=e.project_author),e.isAmp!=null&&(t.isAmp=e.isAmp),e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object"&&(t.meta=e.meta);const n=new Set(Mf),r={};for(const s of Object.keys(e))n.has(s)||(r[s]=e[s]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function xf(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...Nf(e),html:typeof e.html=="string"?e.html:"",insertFrom:t.type,name:t.name,project:t.project??e.project,id:e.id!=null&&e.id!==""?String(e.id):t.blockId}}var gn=new WeakMap;function kf(e){let t=gn.get(e);return t||(t={byId:new Map,fallback:[]},gn.set(e,t)),t}function Ff(e){gn.delete(e)}function Bf(e,t){const{byId:n,fallback:r}=kf(t);if(e.blockId){const s=n.get(e.blockId);if(s){n.delete(e.blockId);const o=r.indexOf(s);return o>=0&&r.splice(o,1),s}return}for(let s=r.length-1;s>=0;s--){const o=r[s],i=e.name!=null&&e.name!==""&&o.name!=null&&o.name!==""&&o.name===e.name,l=e.type!=null&&e.type!==""&&o.insertFrom===e.type;if(i&&l)return r.splice(s,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function jf(e,t){const{blocks:n}=at(e);return await n.cache.getIfPresent(t)??void 0}async function Uf(e,t){if(!t.blockId)return;const n=await jf(e,t.blockId);if(n)return xf(n,t)}async function Hf(e,t){const n=Bf(e,t);if(n)return mn(e,n);const r=await Uf(t,e);return r?mn(e,r):mn(e,void 0)}var $f=a.createIdentifier("application_block_inserted"),Gf=-1e3,ro=new WeakSet;function Vf(e){if(e===null||typeof e!="object")return!1;const t=e;return typeof t.type=="string"||typeof t.name=="string"||typeof t.blockId=="string"||typeof t.project=="string"||typeof t.project=="number"}function Yf(e){if(!e||ro.has(e))return;ro.add(e);const t=new a.Disposable,n=K(e);return t.addDisposable(n.addListenerAsyncPipe($f,async(r,s)=>{const o=Vf(r)?await Hf(r,e):r;return s?s(o):o},Gf)),t.addDisposable({dispose:()=>{Ff(e)}}),t}var so=100,qf=class extends a.Disposable{_container;_events;constructor(e){super(),this._container=e;const t=Yf(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:s}=at(e),o=V(e,a.events.ON_SHARE_ID),i=V(e,a.events.ON_SHOW_PREVIEW_ID),l=V(e,a.events.ON_EMAIL_CLONE_ID),c=V(e,a.events.ON_CODE_VALIDATE_ID),d=V(e,a.events.ON_SUBJECT_CHANGED_ID),u=V(e,a.events.ON_EMAIL_CHANGED_ID),p=V(e,a.events.ON_PREHEADER_CHANGED_ID),E=V(e,a.events.ON_SAVEBUTTON_CLICK_ID),h=V(e,a.events.ON_NEXTBUTTON_CLICK_ID),b=V(e,a.events.ON_SEND_LIVEPREVIEW_ID),v=V(e,a.events.ON_SEND_TESTEMAIL_ID),m=V(e,rf),_=V(e,a.events.ON_CONTENT_CHANGED_ID),y=V(e,nf),w=V(e,a.events.ON_PREVIOUSBUTTON_CLICK_ID),A=V(e,a.events.ON_SEND_EMAIL_MODAL_ID),C=a.filter(V(e,a.events.ON_EMAIL_INIT_ID),g=>!g.reset);return{handlePreheaderChanged:F(p),handleSubjectChanged:F(d),handleValidate:F(c),handleReadEmail:F(n.handlerRead,g=>g,g=>g&&ye(g,e)),handleSaveEmail:F(n.onSave,function({prev:g,patch:I,value:f,source:S}){const T=g?Q(g,e):void 0;return{prev:T,patch:Le(T,Q(I,e)),value:Q(f,e),source:S}},g=>g?ye(g,e):void 0),handleRemoveEmail:F(n.onRemove,({value:g,source:I})=>({value:Q(g,e),source:I}),()=>{}),handleReadCommonBlocks:F(m,g=>g.project,g=>g?.map(I=>xe(I,e))),handleReadTemplateBlocks:F(y,g=>g,g=>g?.map(I=>xe(I,e))),handleReadBlocks:F(t.byForeignKey("project").handleRead,g=>it(e).requested||String(g),g=>g?.map(I=>xe(I,e))),handleSaveBlock:F(t.onSave,function({prev:g,patch:I,value:f,source:S}){const T=f.global_block===!0&&f.id&&typeof f.html=="string"?{...f,html:Rf(f.html,String(f.id))}:f,M=g?dt(g,e):void 0;return{prev:M,patch:Le(M,dt(I,e)),value:dt(T,e),source:S}},g=>g?xe(g,e):void 0),handleRemoveBlock:F(t.onRemove,({value:g,source:I})=>({value:dt(g,e),source:I}),()=>{}),handleReadComments:F(r.byForeignKey("post").handleRead,g=>g,g=>g?.map(I=>pn(I,e))),handleSaveComment:F(r.onSave,function({prev:g,patch:I,value:f,source:S}){const T=g?ut(g,e):void 0;return{prev:T,patch:Le(T,ut(I,e)),value:ut(f,e),source:S}},g=>g?pn(g,e):void 0),handleRemoveComment:F(r.onRemove,({value:g,source:I})=>({value:ut(g,e),source:I}),()=>{}),handleReadEmailRevisions:F(s.byForeignKey("parent").handleRead,g=>g,g=>g?.map(I=>ft(I,e))),handleReadEmailAutosave:F(V(e,Os),g=>g,g=>g?ft(g,e):null),handleEmailAutosave:F(s.onSave,function({prev:g,patch:I,value:f,source:S}){return{value:eo(f,e),source:S}},g=>g?ft(g,e):void 0),handleRemoveEmailAutoSave:F(s.onRemove,({value:g,source:I})=>({value:eo(g,e),source:I}),()=>{}),handleEmailChanged:F(a.debounce(u,so),g=>Q(g,e)),handleEmailInit:F(C,g=>Q(g,e)),handlePreviousButtonClick:F(w,g=>Q(g,e)),handleNextButtonClick:F(h,g=>Q(g,e)),handleSaveButtonClick:F(E,g=>Q(g,e)),handleHtmlChanged:F(a.debounce(_,so)),handleTestEmailSend:F(v,({html:g,...I})=>({...I,code:g,compiled:{html:g,ampHtml:""}})),handleTestEmailModal:F(A,g=>Q(g,e)),handleCloneEmail:F(l,g=>Q(g,e)),handleShareEmail:F(o),handlePreviewEmail:F(i),handleLivePreviewEmail:F(b)}}get(){return this._events||(this._events=this._get())}_listenersUpdaters;setOptions(e={}){const t=this.get();let n=this._listenersUpdaters;if(!n){n=this._listenersUpdaters={};for(const r of Object.keys(t))n[r]=this.addDisposable(new _e(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},zf=a.createIdentifier$1("DataController"),Wf=a.createIdentifier$1("DataEvents");function oo(e){return e.getOrCreateInstance(zf,()=>{const t=new Af(e);return e.getInstance(a.DISPOSABLE_ID)?.addDisposable(t),t})}function io(e){return e.getOrCreateInstance(Wf,()=>new qf(e))}var Kf=a.createIdentifier$1("plugin.startupShow");function Xf(e){const t=oo(e),n=io(e),r=e.getInstance(a.OPTIONS_SOURCE_ID),s=e.getInstance(a.DISPOSABLE_ID),o={current:Promise.resolve()};e.inject(Kf,o);const i=r?.watch(c=>{c&&n.setOptions(c),o.current=o.current.catch(()=>{})}),l=r?.select(c=>c?.content).watch(c=>{if(c===void 0)return;H(W.showStart);const d=t.show(c).finally(()=>H(W.showEnd));d.catch(()=>{}),o.current=d});i&&s?.addDisposable(i),l&&s?.addDisposable(l)}function Jf(e){const t=oo(e);return{...io(e).get(),show(n){return H(W.showStart),t.show(n).finally(()=>H(W.showEnd))},save(){return t.save()}}}function zm(e){return e}var Qf=[{name:"rest.client",setup:Ju},{name:"auth.oauth",setup:a.provideOAuth},{name:"rest.identityHeaders",setup:qu},{name:"lifetime.destroyable",provides:[rn],setup:Kd},{name:"appInit",provides:[a.APP_ID,It],setup:wi},{name:"config",provides:[a.CONFIG_SOURCE_ID],setup:zd},{name:"email.documents",setup:fu},{name:"show.initPipeline",provides:[a.INIT_PIPELINE_ID],setup:Qu},{name:"show",setup:Xf},{name:"locale.service",provides:[Ne],setup:$u},{name:"locale.fromConfig",awaits:{services:[a.CONFIG_SOURCE_ID,Ne]},setup:Gu},{name:"canvas.early",setup:jc},{name:"canvas.previewSettings",setup:zc},{name:"canvas.sandboxExtensions",setup:Kc},{name:"canvas.headerSync",provides:[fs],setup:$c},{name:"canvas.ampSync",setup:rl},{name:"canvas.moduleBridge",setup:Pl},{name:"canvas.port",setup:fl},{name:"canvas.images",setup:dl},{name:"canvas.edits",setup:ac},{name:"canvas.blockContent",setup:tc},{name:"canvas.sandboxFill",provides:[Kt],setup:pd},{name:"canvas.reactions",setup:kc}],Zf=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function ep(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const s=t.get(r)??[];s.push(n),t.set(r,s)}return t}function tp(e,t){const n=[];for(const r of e.awaits?.services??[])for(const s of t.get(r)??[])s!==e&&n.push(s);return n}function ao(e){const t=ep(e),n=[],r=new Set,s=[],o=new Set,i=l=>{if(!r.has(l)){if(o.has(l)){const c=s.indexOf(l);throw new Zf([...s.slice(c),l].map(d=>d.name))}o.add(l),s.push(l);for(const c of tp(l,t))i(c);s.pop(),o.delete(l),r.add(l),n.push(l)}};for(const l of e)i(l);return n}var lo;function En(e){const t=e.getInstance(a.OPTIONS_SOURCE_ID);if(t)return t;e.getInstance(a.DISPOSABLE_ID)||e.inject(a.DISPOSABLE_ID,new a.Disposable);const n=ue();e.inject(a.OPTIONS_SOURCE_ID,n),lo??=ao(Qf);for(const r of lo)r.setup(e);return n}function np(e){}var rp=[{name:"save.previewFollow",setup:np}],co=a.createIdentifier$1("plugin.lateUnitsInstalled");function sp(e){if(!e.getInstance(co)){e.inject(co,!0);for(const t of ao(rp))t.setup(e)}}function op(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function ip(e){if(!e)return;const t=a.decodeJwt(e)?.data,n=t?.data?.scope??t?.scope;return(Array.isArray(n)?n.flatMap(r=>typeof r=="string"?r.split(/\s+/):[]):typeof n=="string"?n.split(/\s+/):[]).find(r=>/^project_\d+$/.test(r))?.replace(/^project_/,"")||void 0}var ap=a.defineMixin(e=>{let t,n,r;return{async setOptions(s){const o=r!==s.getAuthToken,i=!a.deepEqual(t,s.user),l=n!==s.project;if(r=s.getAuthToken,t=s.user,n=s.project,!(!e.getInstance(a.SECURITY_MODULE_ID)||!s.getAuthToken)&&!(!o&&!i&&!l))try{const c=await s.getAuthToken(s.user,s.project);e.inject(a.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(c||""));const d=ip(c);if(!d)return;e.inject(a.STANDALONE_PROJECT_ID,d);const u=e.getInstance(a.APP_ID),p=u?await u.catch(()=>{}):void 0;e.inject(a.APP_ID,Promise.resolve(op(d,p)))}catch{}}}});function lp(e,t){if(e.getInstance(a.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(a.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=a.getEvent(e,a.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}function cp(e){e.getInstance(a.STANDALONE_ACTIVATED_ID)||e.inject(a.SECURITY_MODULE_ID,void 0)}function pt(e){return String(e.standaloneKey||"").trim()||void 0}function dp(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function vn(e){return dp(e)?!!pt(e):!1}function ht(e){return!!pt(e)&&!vn(e)}var up=a.defineMixin(e=>{let t,n=!1;return{setOptions(r){const s=n;if(n=!0,!ht(r)){t&&(cp(e),vn(r)),t=void 0;return}const o=pt(r);if(!o||t===o&&e.getInstance(a.SECURITY_MODULE_ID))return;t=o,e.inject(a.SECURITY_MODULE_ID,o);const i=e.getInstance(a.DISPOSABLE_ID);i&&lp(e,i)}}}),fp=a.defineMixin(e=>{const t=e.getInstance(a.DISPOSABLE_ID),n=a.getEvent(e,a.APP_LOAD_EVENT_ID),r=F(n),s=t.addDisposable(new _e(r));return{setOptions({handleLoad:o}){s.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}}),pp=a.defineMixin(e=>{const t=e.getInstance(a.DISPOSABLE_ID),n=t.addDisposable(new a.AsyncEmitter),r=t.addDisposable(new a.AsyncEmitter),s=a.getEmitter(e,a.CONFIG_CHANGED_EVENT_ID),o=F(n.event),i=F(r.event),l=F(s.event),c=t.addDisposable(new _e(o)),d=t.addDisposable(new _e(i)),u=t.addDisposable(new _e(l));return{instance:{handleSetOptions:o,handleOptionsChanged:i,handleConfigChanged:l},async setOptions(p){c.setListener(p.handleSetOptions),d.setListener(p.handleOptionsChanged),u.setListener(p.handleConfigChanged),await n.fire(p),await r.fire(p)},dispose(){}}}),bn,uo="core";function hp(){const e=__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([uo],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function mp(e){const t=__useblocks__?.require?.warm;return typeof t!="function"?ke().then(()=>{}):t([uo],e)}function ke(){return bn===void 0&&(bn=hp().then(e=>(Ce()&&e.installDiagnostics().catch(t=>{}),e))),bn}var _n=null,yn=null;async function gp(e){typeof e?.prefetch=="function"&&await e.prefetch()}function Sn(){return _n||(_n=ke().then(()=>{})),_n}function fo(e){return yn||(yn=gp(e)),yn}function Ep(){return fo(typeof __useblocks__<"u"?__useblocks__:void 0)}function vp(e){return Promise.all([Sn(),fo(e)]).then(()=>{})}function bp(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function po(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>mp(t?{priority:t}:void 0)).then(()=>(Vt(t?{priority:t}:void 0),n?Sn():void 0)).catch(()=>{})}function _p(e){const t=bp(e);if(t==="eager")po(e);else if(t==="idle"){const n=()=>po(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var ho="PluginRegistry";function yp(e=a.resolveContainer()){return e.getOrCreateInstance(ho,()=>new ri)}var mo=new si(()=>yp()),Sp=a.defineMixin(e=>{let t;function n(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(r){const s=e.getInstance(a.INSTANCE_ID),o=e.getInstance(ho);t||(t=new ni(s,o,{ensureHostRuntimeReady:Ep}),e.inject(a.PLUGIN_COLLECTION_ID,t));const i=r?.plugins||[];s&&await t.setPlugins(i)},instance:{use(r){return typeof r=="function"?n().useByCtor(r):n().useByKey(r)},useAsync(r){return n().useAsync(r)},waitPlugin(r){return n().waitFor(r)}},dispose(){t?.dispose(),t=void 0}}}),go=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const s=this._listeners.indexOf(r);s>=0&&this._listeners.splice(s,1)}}}async run(e){const t=[...this._listeners].sort((n,r)=>r.priority-n.priority);for(const{fn:n}of t){const r=await n(e);r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp)&&Object.assign(e,r)}return e}},wp=a.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),Ip=a.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE"),Tp="application_block_inserted",Ap=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Ip,()=>new go).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService),s=n?e.bind(n):e;return r.addListener(Tp,s,t)}},Cp=a.createIdentifier$1("ComponentRegistry"),Eo;function Fe(e,t=Cp){const n=a.DependencyResolver.getInstance(t);if(n)return n;if(!Eo)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return a.DependencyResolver.getOrCreateInstance(t,Eo)}var Pp=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=this._container.addService(a.ATOMS_HANDLERS_ID,{execute:n=>{t.dispose(),e(n.value.map(r=>({name:r.name,html:r.html})))}})})}update(e,t){const n=this._container,r=Fe(n);return n.addService(a.ATOMS_HANDLERS_ID,{execute:s=>{const o=s.value.find(i=>i.name===e);if(o){const{icon:i,title:l,fallbackTooltip:c,...d}=t;i&&(o.icon=r.getReactNode(i)),l&&(o.title=r.getReactNode(l)),c&&(o.fallbackTooltip=r.getReactNode(c)),Object.assign(o,d)}}})}delete(e){this._container.addService(a.ATOMS_HANDLERS_ID,{execute:t=>{const n=t.value.findIndex(r=>r.name===e);n>=0&&t.value.splice(n,1)}})}insert(e,t){const n=this._container,r=Fe(n);return n.addService(a.ATOMS_HANDLERS_ID,{execute:s=>{s.value.splice(t??s.value.length,0,{...e,title:r.getReactNode(e.title),icon:r.getReactNode(e.icon),fallbackTooltip:r.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(wp,()=>new go).add(e,t??0,n)}handleInject(e,t,n){return a.getEmitter$1(this._container,a.HANDLE_ATOM_INSERT_ID).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},Dp=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService)}send(e,t,n){this._messageService.send(e,t,n)}sendAsync(e,t,n=!0){return this._messageService.sendAsync(e,t,n)}addListener(e,t,n){return this._messageService.addListener(e,t,n)}addListenerAsync(e,t,n=0){return this._messageService.addListenerAsync(e,t,n)}onInit(e,t=!0,n=0){return this._messageService.onInit(e,t,n)}isInited(){return this._messageService.isInited()}};function Rp(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}var Op=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=a.getEmitter$1(t,a.MODAL_SHOW_EVENT),this._closeModalEmitter=a.getEmitter$1(t,a.MODAL_CLOSE_EVENT),this._updateModalEmitter=a.getEmitter$1(t,a.MODAL_UPDATE_EVENT)}get _container(){return this._context.container}show(e){const t=Fe(this._container),n=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,r=e.modalProps;return this._showModalEmitter.fire({...e,content:t.getReactNode(e.content),title:t.getReactNode(e.title),id:n,modalProps:r?{...r,footer:t.getReactNode(r.footer),okText:t.getReactNode(r.okText),cancelText:t.getReactNode(r.cancelText),closeIcon:t.getReactNode(r.closeIcon)}:void 0}),n}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=Fe(this._container),r=t.modalProps;this._updateModalEmitter.fire(Rp({...t,content:n.getReactNode(t.content),title:n.getReactNode(t.title),id:e,modalProps:r?{...r,footer:n.getReactNode(r.footer),okText:n.getReactNode(r.okText),cancelText:n.getReactNode(r.cancelText),closeIcon:n.getReactNode(r.closeIcon)}:void 0}))}},Lp=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{const s=()=>this._loadedDisposable.dispose(),o=()=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&s(),n())},i=l=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&s(),r(l))};this._resolveLoaded=o,this._rejectLoaded=i}),this.ready=new Promise((n,r)=>{const s=()=>this._loadedDisposable.dispose(),o=()=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&s(),n())},i=l=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&s(),r(l))};this._resolveReady=o,this._rejectReady=i})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady()}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},Mp=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService)}_createScriptHandle(e,t){const n=this._messageService.addListener(a.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,s=>{if(s.key===e){if(s.phase==="load"&&s.status==="success"){r.resolveLoaded();return}if(s.phase==="ready"&&s.status==="success"){r.resolveReady();return}if(s.phase==="load"){r.rejectLoad(new Error(s.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(s.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new Lp(t,n);return r}registerSandboxCSS(e){return this._container.addService(a.SANDBOX_EXTENSIONS_ID,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(a.SANDBOX_EXTENSIONS_ID,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(a.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,t)}registerSandboxScriptCode(e,t){const n=this._container.addService(a.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},Np=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function wn(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&Np.has(t)}function vo(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}return`nohwcrypto-${Date.now()}`}function In(){return`__settingsPanel:${vo()}`}function Tn(e,t){return{type:e,props:t}}function xp(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!wn(e)}function bo(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(wn(t)){const r=In();return n(e.add(r,t)),Tn(r,{})}if(typeof t=="function"){const r=In();return n(e.add(r,t)),Tn(r,{})}if(xp(t)){const r=t.type;if(typeof r=="string")return t;if(wn(r)||typeof r=="function"){const s=In();return n(e.add(s,r)),Tn(s,t.props)}return t}return t}var kp=class{_context;_panelRegistrationDisposables=[];constructor(e){this._context=e}get _container(){return this._context.container}_clearPanelRegistrations(){for(const e of this._panelRegistrationDisposables)e.dispose();this._panelRegistrationDisposables.length=0}_trackRegistration(e){this._panelRegistrationDisposables.push(e)}showSettingsPanel(e){this._clearPanelRegistrations();const t=Fe(this._container),n=i=>this._trackRegistration(i),r=bo(t,e.content,n),s=e.advancedTabs?.map(i=>({...i,content:bo(t,i.content,n)})),o=e.instanceKey??vo();a.getEmitter$1(this._container,a.SETTINGS_PANEL_EVENT).fire({...e,content:r,advancedTabs:s,instanceKey:o,type:a.ADVANCED_SETTINGS_PANEL})}closeSettingsPanel(){this._clearPanelRegistrations(),a.getEmitter$1(this._container,a.SETTINGS_PANEL_EVENT).fire(null)}},_o={SandboxScriptApi:Mp,ElementsApi:Pp,BlocksApi:Ap,MessageService:Dp,SettingsPanelApi:kp,ModalApi:Op};function An(e,t,n,r={}){const s=Object.assign({},e);for(const[o,i]of Object.entries(t))if(i!==void 0)if(n.includes(o)&&typeof i=="object"&&i!==null){const l=s[o],c=r[o]??{};s[o]=Object.assign({},typeof l=="object"&&l!==null?l:c,i)}else s[o]=i;return s}var Z={border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:5,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},borderRadiusCards:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},padding:{all:null,top:null,right:null,bottom:null,left:null}},Fp={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",lineHeight:21,lineHeightDim:"px",color:"#5a5a5a",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},Cn={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:24,fontSizeDim:"px",lineHeight:32,lineHeightDim:"px",color:"#333333",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},yo={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},Se={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1C52DC",bold:!1,italic:!1,backgroundColor:"#1C52DC",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:Z.border,borderRadius:Z.borderRadius,textAlign:"center",padding:Z.padding},So={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:Z.padding},Pn={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:Z.border,borderRadius:Z.borderRadiusCards};function Bp(e){return{...Fp,...e}}function jp(e){return{...Cn,...e,bold:e?.bold??Cn.bold,italic:e?.italic??Cn.italic}}function Up(e){return{...yo,...e,underline:e?.underline??yo.underline}}function Hp(e){return{...Se,...e,bold:e?.bold??Se.bold,italic:e?.italic??Se.italic,border:{...Se.border,...e?.border},borderRadius:{...Se.borderRadius,...e?.borderRadius},padding:{...Se.padding,...e?.padding}}}function $p(e){return{...So,...e,padding:{...So.padding,...e?.padding}}}function Gp(e){return{...Pn,...e,border:{...Pn.border,...e?.border},borderRadius:{...Pn.borderRadius,...e?.borderRadius}}}function Dn(e={}){return{backgroundColor:e.backgroundColor||"",backgroundImage:(e.backgroundImage||[]).map(t=>({type:"url",value:t?.value||""})),backgroundPositionX:e.backgroundPositionX||"",backgroundPositionY:e.backgroundPositionY||"",backgroundRepeat:e.backgroundRepeat||"",backgroundSize:e.backgroundSize||"",backgroundColorContent:e.backgroundColorContent||"",textStrong:e.textStrong||!1,textItalic:e.textItalic||!1,textUnderline:e.textUnderline||!1,width:e.width,responsive:e.responsive}}function wo(e){let t={...a.COMMON_STYLES};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function Rn(e){return{text:Bp(e.text),headings:jp(e.headings),links:Up(e.links),buttons:Hp(e.buttons),block:$p(e.block),cards:Gp(e.cards)}}var Io=a.createIdentifier$1("EmailSettingsPort"),Vp=1e4,To=class{_editor;_layoutSettingsChanged=new a.Emitter;_contentStylesChanged=new a.Emitter;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_settings(e=this._editor.container){const t=e.getInstance(Io);if(!t)throw new Error("[extensions] настройки письма ещё не загружены — работа с UI начинается с init()");return t}_getCurrentLayoutSettings(){return Dn(this._settings().read())}_getCurrentContentStyles(){const e=De(this._editor.container)?.current()?.get().attributes.common_styles;return Rn(wo(e))}_getLayoutSnapshot(e){return JSON.stringify(e)}_getContentSnapshot(e){return JSON.stringify(e)}async _ensureMessageSubscription(){if(!this._messageSubscription){if(this._messageSubscriptionPromise)return this._messageSubscriptionPromise;this._messageSubscriptionPromise=(async()=>{if(await this._editor.container.getInstanceAsync(Io),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const s=r?.data,o=s?.operation;if(o===a.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){const c=Dn(s?.settings),d=this._getLayoutSnapshot(c);d!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=d,this._layoutSettingsChanged.fire(c));return}if(o!==a.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE)return;const i=Rn(r.data?.settings?.commonStyles??{...a.COMMON_STYLES}),l=this._getContentSnapshot(i);l!==this._prevContentSnapshot&&(this._prevContentSnapshot=l,this._contentStylesChanged.fire(i))})})();try{await this._messageSubscriptionPromise}finally{this._messageSubscriptionPromise=void 0}}}async getEmailLayoutSettings(){return await this._waitForEmailSettingsFromIframe(),this._getCurrentLayoutSettings()}async setEmailLayoutSettings(e){await this._waitForEmailSettingsFromIframe();const t=this._settings(),n={...t.read(),...e};t.write(n);const r=Dn(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=Vp){const t=De(this._editor.container)?.current()?.get().attributes.is_inited,n=this._settings().read();if(t&&n&&Object.keys(n).length>0&&(n.backgroundColor||n.backgroundImage?.[0]?.value||n.width?.value||n.responsive!==void 0)||t)return;const r=this._editor.container,s=a.getEvent(r,a.events.ON_EMAIL_INIT_ID);return new Promise(o=>{let i=!1,l;const c=()=>{l&&(clearTimeout(l),l=void 0)},d=s(()=>{i||(i=!0,c(),d.dispose(),o())});l=setTimeout(()=>{i||(i=!0,d.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=De(this._editor.container)?.current();if(!t)return;const n=wo(t.get().attributes.common_styles);e.text!==void 0&&(n.text={...n.text||{},...e.text}),e.headings!==void 0&&(n.headings={...n.headings||{},...e.headings}),e.links!==void 0&&(n.links={...n.links||{},...e.links}),e.buttons!==void 0&&(n.buttons=An(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:Z.border,borderRadius:Z.borderRadius,padding:Z.padding})),e.block!==void 0&&(n.block=An(n.block||{},e.block,["padding"],{padding:Z.padding})),e.cards!==void 0&&(n.cards=An(n.cards||{},e.cards,["border","borderRadius"],{border:Z.border,borderRadius:Z.borderRadiusCards}));const r=JSON.stringify(n);Ke(t,{common_styles:r}),this._settings().markAppearanceChanged();const s=Rn(n);this._prevContentSnapshot=this._getContentSnapshot(s),this._contentStylesChanged.fire(s)}},Yp={..._o,EmailSettingsApi:To},qp={..._o},Wm={...qp,EmailSettingsApi:To},zp={...Yp};function Wp(){mo.addAll(zp)}var Kp=[a.defineMixin(()=>{Wp()}),fp,pp,up,a.JWTMixin,ap,a.OAuthMixin];async function Xp(){return(await ke()).asyncMixins}var Jp=Sp,Qp=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let s;try{s=await Xp()}catch(i){throw e.failPendingWaits(i),i}t=s(e);const o=await e.getInstanceAsync(a.INSTANCE_ID);Object.assign(o,t.instance||{});for(const i of e.getInstance(a.LATE_SURFACE_LISTENERS_ID)??[])i()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},Zp=a.combineMixins([...Kp]);function On(){let e,t=!1;const n=new Map,r=new Map;function s(){for(const o of r.values())o();r.clear()}return{event(o,i,l){const c=Symbol("subscription");return t||(n.set(c,{listener:o,priority:i,thisArg:l}),e&&r.set(c,e(o,i,l))),()=>{n.delete(c),r.get(c)?.(),r.delete(c)}},attach(o){s(),e=o;for(const[i,{listener:l,priority:c,thisArg:d}]of n)r.set(i,o(l,c,d))},dispose(){t=!0,s(),n.clear(),e=void 0}}}function eh(e){const t=On(),n=On(),r=On();return e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(hn).then(s=>{t.attach(s.onNotify),n.attach(s.onError),r.attach(s.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(s){const o=e.getInstance(hn);if(!o)throw new Error("[plugin] notify() вызван до загрузки редактора");o.notify(s)}}}var th=[Xd,Jf,eh];function nh(e,t=th){const n=En(e);sp(e);const r=Zp(e),s=Jp(e),o=Qp(e),i={...r.instance,...s.instance,...o.instance};for(const c of t)Object.assign(i,c(e));let l=!0;return{instance:i,async setOptions(c){await r.setOptions(c);const d=l&&n.get()===c;l=!1,d||n.set(c),await s.setOptions(c),await o.setOptions(c)}}}var rh=class{_storage=Object.create(null);get(e){const t=this._storage[e];return t&&(!t.expires||t.expires<Date.now())?t.value:""}set(e,t,n){this._storage[e]={value:t,expires:n.expires?n.expires*1e3+Date.now():void 0}}remove(e){delete this._storage[e]}},sh="editor-runtime.react.copies",Ln=8;function Be(e){return e&&typeof e=="object"?e:void 0}function Ao(e){const t=Be(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=Be(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function oh(e){const t=Be(e),n=t&&typeof t.version=="string"?t.version:void 0,r=Be(t?.default),s=r&&typeof r.version=="string"?r.version:void 0;return n??s??"unknown"}function ih(e,t,n){return e.package===t&&e.version===n}function ah({ourReact:e,entries:t,packageName:n,version:r}){const s=Ao(e);if(!s||!Array.isArray(t))return[];const o=[],i=new Set;for(const l of t){const c=Be(l);if(!c||!ih(c,n,r))continue;const d=Ao(c.react);!d||d===s||i.has(d)||(i.add(d),o.push({package:n,version:r,reactVersion:oh(c.react),react:c.react}))}return o}function lh({packageName:e,copies:t}){const n=[`[${e}] A second copy of React is on this page (singleton invariant broken).`,`The editor runs on its own React, the plugin got another one from ${e}/runtime/react.`,`This shows up as "Cannot read properties of null (reading 'useState')" and takes down the whole`,"editor, not just the plugin panel: plugin components render inside the editor tree.","","Found:"];for(const r of t.slice(0,Ln))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>Ln&&n.push(` …and ${t.length-Ln} more`),n.push("","Likely root cause: the editor is loaded from its UMD entry (a <script> on the page), while the","plugin was built as an ESM package by the host bundler. Those two never share a React.","","Fix it either way:"," • build the plugin on globals — it then takes React from the page registry, or"," • load the editor from its ESM entry and build both with the same bundler."),n.join(`
|
|
2129
|
-
`)}var
|
|
2152
|
+
`)}function ei(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function oh(e,t,n,r){const s=ih(e,t,n,r);return s===void 0}function ih(e,t,n,r){const{email:s}=Lt(t,!1),o=xe(s,e),i=o.id;if(i===void 0)return"no-id";if(r!==void 0&&r!==i)return"other-id-shown";const a=En(e)?.current();if(!a)return"no-session";const c=a.get(),d=c.attributes;if(c.serverId!==i)return"document-id";if(d.is_inited!==!0)return"not-inited";const u=ei(Yn(n??a.getContent()));if(o.html!==void 0&&ei(Yn(o.html))!==u)return"html";if(o.subject!==void 0&&o.subject!==d.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==d.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==d.common_styles)return"common_styles"}function ti(e,t){const{email:n}=Lt(t,!1),r=xe(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:Yn(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function ah(e,t){const n={...e};return delete n.id,{...n,...t}}function lh(e){return e.html?e:{...e,html:Ko}}function tt({code:e,project:t,...n},r,s){const o=s??Bn(r);return{...n,...e?{html:_e(r).toEditorForm(e)}:{},renderGuid:l.generateUUID(),...o===void 0?{}:{project:o}}}function nt({html:e,renderGuid:t,...n},r){const{requested:s}=Qe(r);return pe({...n,code:_e(r).toOutputForm(e),project:s===void 0?n.project:s,guid:void 0,link:void 0,status:void 0,slug:void 0,password:void 0,comment_status:void 0,template:void 0,blocktags:void 0,project_title:void 0,ping_status:void 0,lock:void 0,tag:void 0,is_template:void 0})}function ni(e){return En(e)?.current()?.get().serverId??void 0}function Wn(e,t,n){return n===void 0&&(n=e.post===void 0?ni(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function rt(e,t){return pe({...e,link:void 0,comment_status:void 0})}function xt({code:e,autosave:t,...n},r,s){return s===void 0&&(s=n.parent===void 0?ni(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||Gl(n.slug),parent:s}}function qn({html:e,isAutosave:t,...n},r){return pe({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:pe({html:e,ampHtml:e&&""})})}var ke=l.createIdentifier$1("NotificationService"),ch=l.createIdentifier$1("emailTemplate.reads");async function dh(e,t){try{return await Ee(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,fh(e,t,n);return}}var uh=l.createIdentifier$1("emailTemplate.notifiedFailures");function fh(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(uh,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(ke).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function ph(e,t){const n=e.getOrCreateInstance(ch,()=>new Map),r=n.get(t);if(r!==void 0)return r;const s=dh(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,s),s}var hh="EXTERNAL",ri=Symbol("supersededShow");function mh(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var gh="email_id",Eh=class extends l.Disposable{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_latestShow=Promise.resolve();_dataSources;_eventLock;_queue=l.createQueue();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=et(t),this._eventLock=th(t);const n=Y(e,l.events.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(l.REQUEST_HANDLER_ID,{execute:(r,s)=>{!s?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(gh,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(l.INIT_PIPELINE_ID)??wn}_throwIfDestroyed(){if(this.isDisposed())throw fe()}async getTemplateEmail(e){const t=await ph(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,n}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await Mt(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,tt(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,xt(s,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,Wn(s,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,s){const o=this._dataSources.emails,i=o.cache,a=await Mt(this._container),c=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let d=xe(e,this._container);const u=d.id;let f=u;if(u!==void 0){const g=await o.get(u);d={...g??{},...d,utm_parameters:d.utm_parameters??g?.utm_parameters??{},renderGuid:g?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:a}}else{f=n??l.generateUUID();const g=await o.get(f);d={...d,utm_parameters:d.utm_parameters??{},renderGuid:g?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:a},delete d.project}if(t){const g=await this.getTemplateEmail(String(t));g&&(d=ah(g,d))}return u===void 0&&(d=lh(d)),await i.setAll([[f,d]]),d}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==ti(this._container,e))return!1;const n=Nt(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=ti(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:Nt(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&rh({ticket:t,emailId:Zo(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,ri;if(!e)return;const n=this._getInitPipeline();l.throwIfAborted(n.signal);const r=sh(e);if(!r&&oh(this._container,e,Nt(this._container),this._prevCommand?.id)||!r&&this._isRepeatOfLastShow(e))return;const s=Lt(e);s.email.id,this._prevCommand?.id;let o,i="",a=0,c=!1,d,u=Promise.resolve(),f,g=!1;try{this._eventLock.suspendChange();const{email:m,blocks:_,autosaves:v,comments:p,templateId:b,reload:S}=s;o=m.id;const T=xe(m,this._container),C=T.id,L=C??l.generateUUID(),E=await Ye("getProject",Mt(this._container));l.throwIfAborted(n.signal),i=l.generateUUID();const y={isNew:C===void 0,id:String(L),project:E},A=S===!0&&C!==void 0;A&&(await this._dataSources.emails.remove(String(C),{silent:!0}),String(C)),a=++this._showToken,String(L);const R=[];R.push(this.setBlocks(_)),m.id!==void 0&&(R.push(this.setComments(p)),R.push(this.setEmailRevisions(v,String(m.id)))),R.push(this.setEmail(m,Number(b),C===void 0?String(L):void 0,a,i)),await Ye("setEmail+blocks+revisions",Promise.all(R),{emailId:C??String(L),showId:i,targetShowToken:a}),l.throwIfAborted(n.signal);const h=await this._dataSources.emails.get(String(L)),w=he(this._container),D={id:i,token:a};C===void 0?f=w.startNewDraft(h??T,{patch:T,show:D}):A?f=w.reload(C,{email:h??T,patch:T,show:D}):w.sessionKey()===Re(C)?f=w.show(T,D):f=w.open(C,{email:h??T,patch:T,show:D});const k=!!this._prevCommand&&l.deepEqual(this._prevCommand,y);y.id,!this._prevCommand||l.deepEqual(this._prevCommand,y),this._prevCommand?.id,this._rememberShow(y),u=n.requestShow({showId:i,navId:String(L),emailId:C,isNew:C===void 0}),g=!0,String(L),c=!0}catch(m){d=m,g&&i&&n.failShow(i,m),l.isAbortError(m)||(zr(m),void 0)}finally{this._eventLock.resumeChange()}if(!c)throw d instanceof Error?d:new Error(`[useblocks] show() setup failed: ${String(d??"unknown error")}`);return Ye("show-init-deferred",Promise.all([u,f?.whenReady().catch(m=>{if(m instanceof gt){const _=ms(m);throw _?new Error(`[useblocks] show(): email open failed (${_})`,{cause:m}):m}})??Promise.resolve()]).then(()=>{}),{showId:i,emailId:o??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();l.throwIfAborted(e.signal);const t=he(this._container),n=await t.save("publish",{source:hh,fallbackTitle:Ms(this._container)});if(l.throwIfAborted(e.signal),!n)throw mh(t.saveState().error);return ee(Qo(this._container,this._currentEmail),this._container)}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;this._latestShowEmailId=Zo(e);const n=this._queuedShow(e,t).then(r=>r===ri?this._latestShow.catch(()=>{}):void 0);return this._latestShow=n,n};save=this._queue.decorate(this._save,this)};function vh(e){return String(e).replace(/"/g,""")}function _h(e=new Date){const t=n=>String(n).padStart(2,"0");return String(e.getFullYear())+t(e.getMonth()+1)+t(e.getDate())+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}function bh(e){const t=/<(table|tr|div)(\s[^>]*)>/gi;let n;for(;(n=t.exec(e))!==null;){const r=n[2]??"";if(/\bem\s*=\s*["']block["']/i.test(r))return{full:n[0],index:n.index}}return null}function si(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),s=vh(n);return r.test(e)?e.replace(r,`${t}="${s}"`):e.replace(/>$/,` ${t}="${s}">`)}function yh(e,t,n){if(!e?.trim()||!t)return e;const r=bh(e);if(!r)return e;const s=String(t),o=_h(n??new Date);let{full:i,index:a}=r;const c=i.length;return/\bem-block-id\s*=/.test(i)||(i=si(i,"em-block-id",s)),i=si(i,"em-block-version",o),e.slice(0,a)+i+e.slice(a+c)}function Sh(e){if(e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object")return e.meta;const t=e.catalogExtra?.meta;if(t!=null&&typeof t=="object")return t}function Ih(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),s=t?.project??(e.project!==void 0&&e.project!==null?String(e.project):void 0);return{type:t?.type??n,insertFrom:n,name:t?.name??e.name,blockId:r,project:s,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:Sh(e)}}function zn(e,t){return t?Ih(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var oi=["title","slug","type","tags","blocktags","modified","author","lock","subject","description","excerpt","status","is_template","link","renderGuid","date","date_gmt","modified_gmt","comment_status","ping_status","template","related_email","project_title","project_author","isAmp","meta"],wh=[...oi,"html","id","project","password"],Gv=new Set(["html",...oi,"global_block","project"]);function Th(e){if(!e||typeof e!="object")return{};const t={};e.id!=null&&e.id!==""&&(t.id=String(e.id)),e.title!=null&&e.title!==""&&(t.title=e.title),e.slug!=null&&e.slug!==""&&(t.slug=e.slug),e.type!=null&&e.type!==""&&(t.type=e.type),e.tags!=null&&(t.tags=e.tags),e.blocktags!=null&&(t.blocktags=e.blocktags),e.modified!=null&&e.modified!==""&&(t.modified=e.modified),e.author!=null&&e.author!==""&&(t.author=String(e.author)),e.lock!=null&&(t.lock=e.lock),e.subject!=null&&e.subject!==""&&(t.subject=e.subject),e.description!=null&&e.description!==""&&(t.description=e.description),e.excerpt!=null&&e.excerpt!==""&&(t.excerpt=e.excerpt),e.status!=null&&e.status!==""&&(t.status=e.status),e.is_template!=null&&(t.is_template=e.is_template),e.link!=null&&e.link!==""&&(t.link=e.link),e.renderGuid!=null&&e.renderGuid!==""&&(t.renderGuid=e.renderGuid),e.date!=null&&e.date!==""&&(t.date=e.date),e.date_gmt!=null&&e.date_gmt!==""&&(t.date_gmt=e.date_gmt),e.modified_gmt!=null&&e.modified_gmt!==""&&(t.modified_gmt=e.modified_gmt),e.comment_status!=null&&e.comment_status!==""&&(t.comment_status=e.comment_status),e.ping_status!=null&&e.ping_status!==""&&(t.ping_status=e.ping_status),e.template!=null&&e.template!==""&&(t.template=e.template),e.related_email!=null&&e.related_email!==""&&(t.related_email=e.related_email),e.project_title!=null&&e.project_title!==""&&(t.project_title=e.project_title),e.project_author!=null&&e.project_author!==""&&(t.project_author=e.project_author),e.isAmp!=null&&(t.isAmp=e.isAmp),e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object"&&(t.meta=e.meta);const n=new Set(wh),r={};for(const s of Object.keys(e))n.has(s)||(r[s]=e[s]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function Ch(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...Th(e),html:typeof e.html=="string"?e.html:"",insertFrom:t.type,name:t.name,project:t.project??e.project,id:e.id!=null&&e.id!==""?String(e.id):t.blockId}}var Kn=new WeakMap;function Ah(e){let t=Kn.get(e);return t||(t={byId:new Map,fallback:[]},Kn.set(e,t)),t}function Dh(e){Kn.delete(e)}function Ph(e,t){const{byId:n,fallback:r}=Ah(t);if(e.blockId){const s=n.get(e.blockId);if(s){n.delete(e.blockId);const o=r.indexOf(s);return o>=0&&r.splice(o,1),s}return}for(let s=r.length-1;s>=0;s--){const o=r[s],i=e.name!=null&&e.name!==""&&o.name!=null&&o.name!==""&&o.name===e.name,a=e.type!=null&&e.type!==""&&o.insertFrom===e.type;if(i&&a)return r.splice(s,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function Rh(e,t){const{blocks:n}=et(e);return await n.cache.getIfPresent(t)??void 0}async function Oh(e,t){if(!t.blockId)return;const n=await Rh(e,t.blockId);if(n)return Ch(n,t)}async function Lh(e,t){const n=Ph(e,t);if(n)return zn(e,n);const r=await Oh(t,e);return r?zn(e,r):zn(e,void 0)}var Nh=l.createIdentifier("application_block_inserted"),Mh=-1e3,ii=new WeakSet;function xh(e){if(e===null||typeof e!="object")return!1;const t=e;return typeof t.type=="string"||typeof t.name=="string"||typeof t.blockId=="string"||typeof t.project=="string"||typeof t.project=="number"}function kh(e){if(!e||ii.has(e))return;ii.add(e);const t=new l.Disposable,n=z(e);return t.addDisposable(n.addListenerAsyncPipe(Nh,async(r,s)=>{const o=xh(r)?await Lh(r,e):r;return s?s(o):o},Mh)),t.addDisposable({dispose:()=>{Dh(e)}}),t}var ai=l.createIdentifier$1("plugin.earlyWindow");function Fh(e){return e.getOrCreateInstance(ai,()=>({depth:0}))}function Bh(e){const t=Fh(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function li(e){return(e?.getInstance(ai)?.depth??0)>0}function ci(e,t){let n,r=!1;return e(s=>{n=s,r=!0}),(s,o,i)=>{const a=e(s,o,i);if(r&&li(t)){const c=n;queueMicrotask(()=>{s.call(i,c)})}return a}}var di=100,jh=class extends l.Disposable{_container;_events;constructor(e){super(),this._container=e;const t=kh(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:s}=et(e),o=Y(e,l.events.ON_SHARE_ID),i=Y(e,l.events.ON_SHOW_PREVIEW_ID),a=Y(e,l.events.ON_EMAIL_CLONE_ID),c=Y(e,l.events.ON_CODE_VALIDATE_ID),d=Y(e,l.events.ON_SUBJECT_CHANGED_ID),u=Y(e,l.events.ON_EMAIL_CHANGED_ID),f=Y(e,l.events.ON_PREHEADER_CHANGED_ID),g=Y(e,l.events.ON_SAVEBUTTON_CLICK_ID),m=Y(e,l.events.ON_NEXTBUTTON_CLICK_ID),_=Y(e,l.events.ON_SEND_LIVEPREVIEW_ID),v=Y(e,l.events.ON_SEND_TESTEMAIL_ID),p=Y(e,Jp),b=Y(e,l.events.ON_CONTENT_CHANGED_ID),S=Y(e,Xp),T=Y(e,l.events.ON_PREVIOUSBUTTON_CLICK_ID),C=Y(e,l.events.ON_SEND_EMAIL_MODAL_ID),L=l.filter(Y(e,l.events.ON_EMAIL_INIT_ID),E=>!E.reset);return{handlePreheaderChanged:F(f),handleSubjectChanged:F(d),handleValidate:F(c),handleReadEmail:F(n.handlerRead,E=>E,E=>E&&xe(E,e)),handleSaveEmail:F(n.onSave,function({prev:E,patch:y,value:A,source:R}){const h=E?ee(E,e):void 0;return{prev:h,patch:Xe(h,ee(y,e)),value:ee(A,e),source:R}},E=>E?xe(E,e):void 0),handleRemoveEmail:F(n.onRemove,({value:E,source:y})=>({value:ee(E,e),source:y}),()=>{}),handleReadCommonBlocks:F(p,E=>E.project,E=>E?.map(y=>tt(y,e))),handleReadTemplateBlocks:F(S,E=>E,E=>E?.map(y=>tt(y,e))),handleReadBlocks:F(t.byForeignKey("project").handleRead,E=>Qe(e).requested||String(E),E=>E?.map(y=>tt(y,e))),handleSaveBlock:F(t.onSave,function({prev:E,patch:y,value:A,source:R}){const h=A.global_block===!0&&A.id&&typeof A.html=="string"?{...A,html:yh(A.html,String(A.id))}:A,w=E?nt(E,e):void 0;return{prev:w,patch:Xe(w,nt(y,e)),value:nt(h,e),source:R}},E=>E?tt(E,e):void 0),handleRemoveBlock:F(t.onRemove,({value:E,source:y})=>({value:nt(E,e),source:y}),()=>{}),handleReadComments:F(r.byForeignKey("post").handleRead,E=>E,E=>E?.map(y=>Wn(y,e))),handleSaveComment:F(r.onSave,function({prev:E,patch:y,value:A,source:R}){const h=E?rt(E,e):void 0;return{prev:h,patch:Xe(h,rt(y,e)),value:rt(A,e),source:R}},E=>E?Wn(E,e):void 0),handleRemoveComment:F(r.onRemove,({value:E,source:y})=>({value:rt(E,e),source:y}),()=>{}),handleReadEmailRevisions:F(s.byForeignKey("parent").handleRead,E=>E,E=>E?.map(y=>xt(y,e))),handleReadEmailAutosave:F(Y(e,xo),E=>E,E=>E?xt(E,e):null),handleEmailAutosave:F(s.onSave,function({prev:E,patch:y,value:A,source:R}){return{value:qn(A,e),source:R}},E=>E?xt(E,e):void 0),handleRemoveEmailAutoSave:F(s.onRemove,({value:E,source:y})=>({value:qn(E,e),source:y}),()=>{}),handleEmailChanged:F(l.debounce(u,di),E=>ee(E,e)),handleEmailInit:ci(F(L,E=>ee(E,e)),e),handlePreviousButtonClick:F(T,E=>ee(E,e)),handleNextButtonClick:F(m,E=>ee(E,e)),handleSaveButtonClick:F(g,E=>ee(E,e)),handleHtmlChanged:F(l.debounce(b,di)),handleTestEmailSend:F(v,({html:E,...y})=>({...y,code:E,compiled:{html:E,ampHtml:""}})),handleTestEmailModal:F(C,E=>ee(E,e)),handleCloneEmail:F(a,E=>ee(E,e)),handleShareEmail:F(o),handlePreviewEmail:F(i),handleLivePreviewEmail:F(_)}}get(){return this._events||(this._events=this._get())}_listenersUpdaters;setOptions(e={}){const t=this.get();let n=this._listenersUpdaters;if(!n){n=this._listenersUpdaters={};for(const r of Object.keys(t))n[r]=this.addDisposable(new Me(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},Uh=l.createIdentifier$1("DataController"),$h=l.createIdentifier$1("DataEvents");function ui(e){return e.getOrCreateInstance(Uh,()=>{const t=new Eh(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function fi(e){return e.getOrCreateInstance($h,()=>new jh(e))}var Hh=l.createIdentifier$1("plugin.pluginStart");function pi(e){return e.getOrCreateInstance(Hh,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t()),{done:n,finish:t}})}function Vh(e){return pi(e).done}function Gh(e){const t=pi(e);return t.run===void 0&&(t.run=(e.getInstance(l.PLUGIN_COLLECTION_ID)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var Yh=l.createIdentifier$1("plugin.startupShow");function Wh(e){const t=ui(e),n=fi(e),r=e.getInstance(l.OPTIONS_SOURCE_ID),s=e.getInstance(l.DISPOSABLE_ID),o={current:Promise.resolve()};e.inject(Yh,o);let i=!1;const a=r?.watch(d=>{d&&n.setOptions(d),i=(d?.plugins?.length??0)>0,o.current=o.current.catch(()=>{})}),c=r?.select(d=>d?.content).watch(d=>{if(d===void 0)return;const u=()=>(V(X.showStart),t.show(d).finally(()=>V(X.showEnd))),f=i?Vh(e).then(u):u();f.catch(()=>{}),o.current=f});a&&s?.addDisposable(a),c&&s?.addDisposable(c)}function qh(e){const t=ui(e);return{...fi(e).get(),show(n){return V(X.showStart),t.show(n).finally(()=>V(X.showEnd))},save(){return t.save()}}}function hi(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function kt(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",s=!1;for(let o=t;o<e.length;o++){const i=e[o];if(s){s=!1;continue}if(i==="\\"){s=!0;continue}if(r){i===r&&(r="");continue}if(i==='"'||i==="'"){r=i;continue}if(i==="("){n++;continue}if(i===")"&&(n--,n<0))return!1}return n===0}function zh(e){return(t,n,r)=>kt(t)?e(t,n,r):!1}function Kh(e){return t=>kt(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function Xh(e){return(t,n,r)=>kt(t)?hi(t)?e(t,n,r):t:!1}function Jh(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return kt(n)?hi(n)?e(t):t:!1}}function Qh(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function Xn(e,t){const n=e.length;for(let r=0;r<n;r++){const s=e.charCodeAt(r);if(s===0||t==='"'&&s===34||t==="'"&&s===39||t===""&&(s===32||s===9||s===10||s===13||s===12||s===34||s===39||s===60||s===62||s===61||s===96))return!1}return!0}function Zh(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let s="";for(let o=0;o<e;o++){const i=r[o]%62;s+=t.charAt(i)}return s}var em=8,tm=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=Zh(em),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},Ft=new tm;function mi(e,t){return t!==void 0&&!Xn(e,t)?`%|{${Ft.getOrCreateByKey(e)}}|%`:e}function nm(e){const t=Ft.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function G(e,t,n){return t!==void 0?Xn(e,t)?e:`%|{${Ft.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function rm(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function H(e){return e.startsWith("<!--")&&e.endsWith("-->")?rm(e.slice(4,-3)):e}function sm(e){const t=/^(IF|ELSE|ELSIF|ELSEIF|END|FOREACH|WHILE|NEXT|LAST|BREAK|DO|UNLESS|CONTINUE|SET|UNSET|DEFINE|INCLUDE)\b/i,n=/\w+\s*\(/;let r=e;const s=e.match(/\[%\s*([^%]*?)\s*%\]/);s&&(r=s[1]);const o=r.trim();return t.test(o)||n.test(o)}function om(e,t,n){return t!==void 0?Xn(e,t)?e:`%|{${Ft.getOrCreateByKey(e)}}|%`:n||Qh(e)||sm(e)?`<!--${e}-->`:e}var Se=zh(G),Ie=Kh(H),im=Xh(G),am=Jh(H),gi=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",nm),e.escape("@{","}",G,!0).unescape("<!--@{","}-->",H,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",mi,!0),e.escape("{{","}}",mi,!0),e.createSyntax("brace-percent").escape("{%","%}",G).unescape("<!--{%","%}-->",H),e.createSyntax("brace-hash").escape("{#","#}",G).unescape("<!--{#","#}-->",H),e.createSyntax("proscript").escape("[%","%]",om,!0).unescape("<!--[%","%]-->",H,!0),e.createSyntax("getresponse").escape("[[IF","]]",G).escape("[[if","]]",G).escape("[[ELSE]]","",G).escape("[[else]]","",G).escape("[[ENDIF]]","",G).escape("[[endif]]","",G).unescape("<!--[[IF","]]-->",H).unescape("<!--[[if","]]-->",H).unescape("<!--[[ELSE]]","-->",H).unescape("<!--[[else]]","-->",H).unescape("<!--[[ENDIF]]","-->",H).unescape("<!--[[endif]]","-->",H),e.createSyntax("expert-sender").escape("<if",">",G).escape("</if",">",G).escape("<else",">",G).escape("</else",">",G).escape("<var ",">",G,!0).unescape("<!--<if ",">-->",H).unescape("<!--</if",">-->",H).unescape("<!--<else ",">-->",H).unescape("<!--</else",">-->",H).unescape("<!--<var",">-->",H,!0),e.createSyntax("velocity").escape("#if",")",Se).escape("#elseif",")",Se).escape("#else","",G).escape("#foreach",")",Se).escape("#macro",")",Se).escape("#set",")",im,!0).escape("#parse",")",Se).escape("#include",")",Se).escape("#evaluate",")",Se).escape("#end","",G).escape("#break","",G).escape("#stop","",G).unescape("<!--#macro","-->",Ie).unescape("<!--#if","-->",Ie).unescape("<!--#elseif","-->",Ie).unescape("<!--#else","-->",H).unescape("<!--#foreach","-->",Ie).unescape("<!--#parse","-->",Ie).unescape("<!--#include","-->",Ie).unescape("<!--#evaluate","-->",Ie).unescape("<!--#end","-->",H).unescape("<!--#break","-->",H).unescape("<!--#stop","-->",H).unescape("<!--#set","-->",am,!0),e.createSyntax("mailchimp").escape("*|","|*",G).unescape("<!--*|","|*-->",H)},Jn="bare",lm=new Map;function cm(e){return e?lm.get(e)??Jn:Jn}var Ei=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function vi(e){return Ei.includes(e)}function st(e){return e==="bare"||e==="html-comment"}function Qn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function dm(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!st(e))return t(`templateDirectives: unknown form "${String(e)}", falling back to the default ("bare").`),n;r={output:e}}else if(typeof e=="object"&&!Array.isArray(e))r=e;else return t(`templateDirectives: expected a string or an object, got ${typeof e}. Ignored.`),n;for(const[d,u]of[["output",r.output],["editor",r.editor]])if(u!==void 0&&!st(u))return t(`templateDirectives.${d}: unknown form "${String(u)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!Qn(r.syntaxes))return t("templateDirectives.syntaxes: expected an object, configuration ignored."),n;if(r.syntaxes){for(const[d,u]of Object.entries(r.syntaxes))if(!(!vi(d)||u===void 0||st(u))){if(!Qn(u))return t(`templateDirectives.syntaxes.${d}: expected a form or an object, configuration ignored.`),n;for(const f of["output","editor"]){const g=u[f];if(g!==void 0&&!st(g))return t(`templateDirectives.syntaxes.${d}.${f}: unknown form "${String(g)}", configuration ignored.`),n}}}if(r.output===void 0&&r.editor===void 0&&r.syntaxes===void 0)return n;const s=r.output??Jn;let o=r.editor;s==="bare"&&r.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),o=void 0);const i=[];if(r.syntaxes)for(const d of Object.keys(r.syntaxes)){if(!vi(d)){t(`templateDirectives.syntaxes: unknown syntax id "${d}", entry ignored.`);continue}i.push(d)}else i.push(...Ei);const a={},c={};for(const d of i){const u=r.syntaxes?.[d],f=Qn(u)?u:void 0,g=(st(u)?u:f?.output)??s;let m=f?.editor??o??g;g==="bare"&&m==="html-comment"&&(t(`templateDirectives.syntaxes.${d}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),m="bare"),a[d]=g,c[d]=m}return{output:a,editor:c}}function _i(e,t,n,r){for(let s=t;s<n;s++){const o=e[s];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?o===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(o)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):o==="<"?r.insideTag=!0:o===">"?r.insideTag=!1:r.insideTag&&(o==='"'||o==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=o,r.unquotedAttr=!1):r.insideTag&&/\S/.test(o)&&r.attributeQuoteChar===void 0&&e[s-1]==="="&&!['"',"'","`"].includes(o)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function ot(e,t){return e.start<t.end&&t.start<e.end}function bi(e,t,n,r,s=[]){if(n&&(t=t.filter(u=>u.isVariable)),!t.length)return[];const o=t.flatMap(u=>u.match(e).flatMap(f=>!Number.isInteger(f.start)||!Number.isInteger(f.end)||f.start<0||f.end>e.length||f.start>=f.end?[]:[{range:f,mapFn:u.mapFn,overrideBuiltins:u.overrideBuiltins,syntax:u.syntax,isVariable:u.isVariable}])).sort((u,f)=>u.range.start-f.range.start||u.range.end-f.range.end),i=[],a=s.slice().sort((u,f)=>u.start-f.start),c={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let d=0;for(const{range:u,mapFn:f,overrideBuiltins:g,syntax:m,isVariable:_}of o){if(r?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):_i(e,d,u.start,c),d=u.end,a.some(S=>ot(S,u)))continue;const v=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,p=e.substring(u.start,u.end),b=f(p,v,c.insideTag);b!==!1&&b!==p&&(i.push({range:u,text:b,overrideBuiltins:g,syntax:m,isVariable:_}),a.push(u))}return i.sort((u,f)=>u.range.start-f.range.start||u.range.end-f.range.end)}function um(e,t){const n=t.reduce((a,{mapFn:c,start:d,end:u,syntax:f,isVariable:g})=>(a[d]||(a[d]=[]),a[d].push({value:u,mapFn:c,syntax:f,isVariable:g}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),s=new RegExp(r,"g"),o=[];let i;for(;(i=s.exec(e))!==null;){const a=i[0];o.push({start:i.index,startToken:a,endTokens:n[a]})}return o}function Zn(e,t,n,r,s=!1){const o=[];if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return o;const i=um(e,t),a={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(let d=0;d<i.length;d++){const{start:u,startToken:f,endTokens:g}=i[d];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):_i(e,c,u,a),c=u;const m=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let _=!1;for(const{mapFn:v,value:p,syntax:b,isVariable:S}of g){let T=u+f.length,C=e.indexOf(p,T);for(;C!==-1;){let L=C,E=u+f.length,y=0;for(;L!==-1;){const D=e.indexOf(f,E);if(D!==-1&&D<L)y++,E=D+f.length,L=e.indexOf(p,E);else if(y>0)y--,E=L+p.length,L=e.indexOf(p,E);else break}if(L<0)break;const A=L+p.length,R=e.substring(u,A),h=v(R,m,a.insideTag);if(h===!1){T=C+Math.max(p.length,1),C=e.indexOf(p,T);continue}(s||h!==R)&&o.push({range:{start:u,end:A},text:s?R:h,syntax:b,isVariable:S});const w=i.findIndex(({start:D})=>D>=A);w>d?d=w-1:d=i.length,_=!0;break}if(_)break}}return o}function Bt(e,t){if(!t.length)return e;const n=t.slice().sort((s,o)=>o.range.start-s.range.start);let r=e;for(const{text:s,range:o}of n)r=r.slice(0,o.start)+s+r.slice(o.end);return r}var fm=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=gi){const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,s,o,i){return t.push({start:r,end:s,mapFn:o,isVariable:i,syntax:this.syntax||r}),this},unescape(r,s,o,i){return n.push({start:r,end:s,mapFn:o,isVariable:i,syntax:this.syntax||r}),this}})}registerMatcherPair(e){const t=e.syntax||"matcher",n={syntax:t,match:e.escape.match,mapFn:e.escape.mapFn,isVariable:e.escape.isVariable,overrideBuiltins:e.escape.overrideBuiltins},r={syntax:t,match:e.unescape.match,mapFn:e.unescape.mapFn,isVariable:e.unescape.isVariable,overrideBuiltins:e.unescape.overrideBuiltins};this._escapeMatchers.push(n),this._unescapeMatchers.push(r);let s=!1;const o={dispose:()=>{s||(s=!0,this._escapeMatchers=this._escapeMatchers.filter(i=>i!==n),this._unescapeMatchers=this._unescapeMatchers.filter(i=>i!==r))}};return this.addDisposable(o),o}_collectMappings(e,t,n){const r=Zn(e,this._escapes,t,n),s=bi(e,this._escapeMatchers,t,n),o=s.filter(c=>c.overrideBuiltins).map(c=>c.range),i=r.filter(c=>!o.some(d=>ot(d,c.range))),a=s.filter(c=>c.overrideBuiltins||!i.some(d=>ot(c.range,d.range)));return[...i,...a].sort((c,d)=>c.range.start-d.range.start||c.range.end-d.range.end)}getMappings(e,t,n){return this._collectMappings(e,t,n)}_collectRevertMappings(e,t){const n=Zn(e,this._unescapes,t),r=bi(e,this._unescapeMatchers,t,!1),s=r.filter(a=>a.overrideBuiltins).map(a=>a.range),o=n.filter(a=>!s.some(c=>ot(c,a.range))),i=r.filter(a=>a.overrideBuiltins||!o.some(c=>ot(a.range,c.range)));return[...o,...i].sort((a,c)=>a.range.start-c.range.start||a.range.end-c.range.end)}getRevertMappings(e,t,n){const r=n?s=>s!==void 0&&n.has(s):s=>cm(s)==="html-comment";return this._collectRevertMappings(e,t).filter(s=>s.isVariable||!r(s.syntax))}getDetectedMappings(e,t,n){return Zn(e,this._escapes,t,n,!0)}getEscapedText(e,t){return Bt(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return Bt(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=o=>o===void 0?void 0:t[o],r=Object.values(t);let s=e;return r.includes("bare")&&(s=Bt(s,this._collectRevertMappings(s).filter(o=>n(o.syntax)==="bare"))),r.includes("html-comment")&&(s=Bt(s,this._collectMappings(s).filter(o=>!o.isVariable&&n(o.syntax)==="html-comment"&&o.text.startsWith("<!--")&&o.text.endsWith("-->")))),s}hasDetectedMappings(e,t,n){return this.getDetectedMappings(e,t,n).length>0}addDisposable(e){this._disposables.push(e)}dispose(){for(const e of this._disposables)e.dispose()}};function yi(e){return e.replace("<script","<___script").replace("<\/script>","</___script>")}var Si=new fm(e=>{e.escape("<script","<\/script>",t=>yi(t)).unescape("<___script","</___script>",t=>t.replace("<___script","<script").replace("</___script>","<\/script>")),e.escape("<script","/>",t=>yi(t)).unescape("<___script","/>",t=>t.replace("<___script","<script")),gi(e)});function pm(e){const t=dm(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return Qs();const n=new Set(Object.keys(t.output).filter(s=>t.output[s]==="html-comment")),r=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:s=>Si.normalizeToPolicy(s,t.editor),toOutputForm:s=>Si.normalizeToPolicy(s,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:Js(r)}}function hm(e){let t;e.injectFactory(l.TEMPLATE_DIRECTIVES_ID,()=>{const n=e.getInstance(l.CONFIG_SOURCE_ID)?.layers().user.templateDirectives;return(!t||t.raw!==n)&&(t={raw:n,policy:pm(n)}),t.policy})}function Yv(e){return e}var mm=[{name:"rest.client",setup:Yp},{name:"auth.oauth",setup:l.provideOAuth},{name:"rest.identityHeaders",setup:Up},{name:"lifetime.destroyable",provides:[xn],setup:$f},{name:"appInit",provides:[l.APP_ID,Qt],setup:za},{name:"config",provides:[l.CONFIG_SOURCE_ID],setup:jf},{name:"templateDirectives",provides:[l.TEMPLATE_DIRECTIVES_ID],setup:hm},{name:"email.documents",setup:ip},{name:"show.initPipeline",provides:[l.INIT_PIPELINE_ID],setup:Wp},{name:"show",setup:Wh},{name:"locale.service",provides:[Ze],setup:kp},{name:"locale.fromConfig",awaits:{services:[l.CONFIG_SOURCE_ID,Ze]},setup:Fp},{name:"canvas.early",setup:ku},{name:"canvas.previewSettings",setup:Wu},{name:"canvas.sandboxExtensions",setup:zu},{name:"canvas.sandboxScriptRelay",setup:Ju},{name:"canvas.headerSync",provides:[fo],setup:ju},{name:"canvas.ampSync",setup:Xc},{name:"canvas.moduleBridge",setup:wd},{name:"canvas.port",setup:id},{name:"canvas.images",setup:sd},{name:"canvas.edits",setup:tu},{name:"canvas.blockContent",setup:Kd},{name:"canvas.sandboxFill",provides:[Tn],setup:gf},{name:"canvas.reactions",setup:xu}],gm=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Em(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const s=t.get(r)??[];s.push(n),t.set(r,s)}return t}function vm(e,t){const n=[];for(const r of e.awaits?.services??[])for(const s of t.get(r)??[])s!==e&&n.push(s);return n}function Ii(e){const t=Em(e),n=[],r=new Set,s=[],o=new Set,i=a=>{if(!r.has(a)){if(o.has(a)){const c=s.indexOf(a);throw new gm([...s.slice(c),a].map(d=>d.name))}o.add(a),s.push(a);for(const c of vm(a,t))i(c);s.pop(),o.delete(a),r.add(a),n.push(a)}};for(const a of e)i(a);return n}var wi;function er(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);if(t)return t;e.getInstance(l.DISPOSABLE_ID)||e.inject(l.DISPOSABLE_ID,new l.Disposable);const n=ie();e.inject(l.OPTIONS_SOURCE_ID,n),wi??=Ii(mm);for(const r of wi)r.setup(e);return n}function _m(e){}var bm=[{name:"save.previewFollow",setup:_m}],Ti=l.createIdentifier$1("plugin.lateUnitsInstalled");function ym(e){if(!e.getInstance(Ti)){e.inject(Ti,!0);for(const t of Ii(bm))t.setup(e)}}function Sm(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Im(e){if(!e)return;const t=l.decodeJwt(e)?.data,n=t?.data?.scope??t?.scope;return(Array.isArray(n)?n.flatMap(r=>typeof r=="string"?r.split(/\s+/):[]):typeof n=="string"?n.split(/\s+/):[]).find(r=>/^project_\d+$/.test(r))?.replace(/^project_/,"")||void 0}var wm=l.defineMixin(e=>{let t,n,r;return{async setOptions(s){const o=r!==s.getAuthToken,i=!l.deepEqual(t,s.user),a=n!==s.project;if(r=s.getAuthToken,t=s.user,n=s.project,!(!e.getInstance(l.SECURITY_MODULE_ID)||!s.getAuthToken)&&!(!o&&!i&&!a))try{const c=await s.getAuthToken(s.user,s.project);e.inject(l.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(c||""));const d=Im(c);if(!d)return;e.inject(l.STANDALONE_PROJECT_ID,d);const u=e.getInstance(l.APP_ID),f=u?await u.catch(()=>{}):void 0;e.inject(l.APP_ID,Promise.resolve(Sm(d,f)))}catch{}}}});function Tm(e,t){if(e.getInstance(l.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(l.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=l.getEvent(e,l.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}var Cm=l.defineMixin(e=>{let t,n=!1;return{setOptions(r){const s=n;if(n=!0,!Ke(r)){t&&(Cf(e),Mn(r)),t=void 0;return}const o=Dt(r);if(!o||t===o&&e.getInstance(l.SECURITY_MODULE_ID))return;t=o,e.inject(l.SECURITY_MODULE_ID,o);const i=e.getInstance(l.DISPOSABLE_ID);i&&Tm(e,i)}}}),Am=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=l.getEvent(e,l.APP_LOAD_EVENT_ID),r=F(n),s=t.addDisposable(new Me(r));return{setOptions({handleLoad:o}){s.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function Ci(e,t,n=!0){const r=e,s=t;for(const o of Object.keys(s)){const i=s[o];i!=null&&(n&&typeof i=="object"?r[o]=Ci(r[o]||{},i,!0):r[o]=i)}return e}async function Dm(e){const t=(await _a.__vitePreload(()=>Promise.resolve().then(()=>qt.__toESM(pt("./static/umd/6639d610.js").default)),void 0,{}.url)).default;return new Promise((n,r)=>{t.load({google:{families:[e]},classes:!1,active:()=>n(),inactive:()=>r(new Error(`Шрифт не загрузился: ${e}`))})})}var Ai=l.createIdentifier$1("EditorOptions"),tr=l.MONACO_EDITOR_OPTIONS;function Pm(e){const t=typeof e.font_family=="string"?`${e.font_family}, sans-serif`:void 0,n=e.word_wrap===void 0?void 0:e.word_wrap?"on":"off";return{tabSize:e.tab_size,fontFamily:t,fontSize:e.font_size,wordWrap:n,insertSpaces:e.insert_spaces,minimap:{enabled:e.minimap}}}function Rm(e){return e.getOrCreateInstance(Ai,()=>{const t=ie(tr);let n=tr.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(Dm(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function Om(e){return e?.getInstance(Ai)?.get()??tr}function Lm(e,t={}){const n=Rm(e);n.set(Ci({...n.get()},Pm(t)))}function Nm(e){return{font_size:e.fontSize,font_family:e.fontFamily,tab_size:e.tabSize,word_wrap:e.wordWrap,minimap:e.minimap,insert_spaces:e.insertSpaces}}function Mm(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var xm=l.createIdentifier$1("plugin.publicConfig");function nr(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function Di(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function Pi(e){const t=To(e),n=nr(e);return{...n,locale:n.locale||"en_US",theme:n.theme||"light",editor:Mm(Om(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function Ri(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()!==void 0}function km(e){const t=l.createQueue(),n=Z(e,l.CONFIG_CHANGED_EVENT_ID);let r,s,o=!1;const i=async()=>{try{return e.getInstance(l.APP_ID)===void 0?{}:(await e.getInstanceAsync(l.APP_ID))?.app_config||{}}catch{return{}}},a=async({onlyChangedCodeMode:f=!1}={})=>{await e.getInstance(l.CONFIG_SOURCE_ID)?.ready(),jr(e).set(nr(e).revisionService===!0);const{codeModeDirection:g,editor:m}=nr(e);m&&Lm(e,Nm(m)),g!==void 0&&!(f&&g===s)&&(s=g,g==="none"?Nn(e,!1):(Nn(e,!0),wf(e,g)))},c=async()=>{if(!Ri(e))return;const f=Pi(e),g=JSON.stringify(f);g!==r&&(r=g,await n.fire(f))},d=async f=>{const g=e.getInstance(l.CONFIG_SOURCE_ID),m={advancedConfigs:Di(e).advancedConfigs,serverSide:await i(),user:f};g?.setAdvancedConfigs({...m.advancedConfigs,...m.user?.advancedConfigs}),g?.replace(m.user,"user"),g?.replace(m.serverSide,"server"),await a(),await c()},u=f=>{const{commonStyles:g,...m}=f;return"commonStyles"in f&&Yu(e,g===void 0?void 0:g),m};return{queue:t,reactToConfig:a,emitConfigChanged:c,resolveServerSideConfig:i,getConfig:()=>Ri(e)?Pi(e):{},setConfig:t.decorate(async f=>{await d(u(f))}),updateConfig:t.decorate(async f=>{const g=u(f);await d({...Di(e).user,...g})}),announceAssembled(){o||(o=!0,e.getInstance(l.CONFIG_SOURCE_ID)?.ready().then(t.decorate(async()=>{await a({onlyChangedCodeMode:!0}),await c()})))}}}function Oi(e){return e.getOrCreateInstance(xm,()=>km(e))}function Fm(e){const t=Oi(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var Bm=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=t.addDisposable(new l.AsyncEmitter),r=t.addDisposable(new l.AsyncEmitter),s=l.getEmitter(e,l.CONFIG_CHANGED_EVENT_ID),o=F(n.event),i=F(r.event),a=ci(F(s.event),e),c=t.addDisposable(new Me(o)),d=t.addDisposable(new Me(i)),u=t.addDisposable(new Me(a));return{instance:{handleSetOptions:o,handleOptionsChanged:i,handleConfigChanged:a},async setOptions(f){c.setListener(f.handleSetOptions),d.setListener(f.handleOptionsChanged),u.setListener(f.handleConfigChanged),Oi(e).announceAssembled(),await n.fire(f),await r.fire(f)},dispose(){}}}),rr,Li="core";function jm(){const e=__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([Li],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function Um(e){const t=__useblocks__?.require?.warm;return typeof t!="function"?it().then(()=>{}):t([Li],e)}function it(){return rr===void 0&&(rr=jm().then(e=>(Ue()&&e.installDiagnostics().catch(t=>{}),e))),rr}var sr=null,or=null;async function $m(e){typeof e?.prefetch=="function"&&await e.prefetch()}function ir(){return sr||(sr=it().then(()=>{})),sr}function Ni(e){return or||(or=$m(e)),or}function Hm(){return Ni(typeof __useblocks__<"u"?__useblocks__:void 0)}function Vm(){const e=typeof __useblocks__<"u"?__useblocks__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function Gm(e){return Promise.all([ir(),Ni(e)]).then(()=>{})}function Ym(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function Mi(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>Um(t?{priority:t}:void 0)).then(()=>(Sn(t?{priority:t}:void 0),n?ir():void 0)).catch(()=>{})}function Wm(e){const t=Ym(e);if(t==="eager")Mi(e);else if(t==="idle"){const n=()=>Mi(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var xi="PluginRegistry";function qm(e=l.resolveContainer()){return e.getOrCreateInstance(xi,()=>new Aa)}var ki=new Da(()=>qm()),zm=["handleAIImageRequest","handleAITextRequest","handleCloneEmail","handleConfigChanged","handleDestroy","handleEmailAutosave","handleEmailChanged","handleEmailInit","handleError","handleFileProxy","handleHtmlChanged","handleLimitUsage","handleLivePreviewEmail","handleLoad","handleLoadImage","handleNextButtonClick","handleNotify","handleOptionsChanged","handlePreheaderChanged","handlePreviewEmail","handlePreviousButtonClick","handleReadBlocks","handleReadComments","handleReadCommonBlocks","handleReadEmail","handleReadEmailAutosave","handleReadEmailRevisions","handleReadLocale","handleReadTemplateBlocks","handleRemoveBlock","handleRemoveComment","handleRemoveEmail","handleRemoveEmailAutoSave","handleSaveBlock","handleSaveButtonClick","handleSaveComment","handleSaveEmail","handleSetOptions","handleShareEmail","handleSubjectChanged","handleSuccess","handleTestEmailModal","handleTestEmailSend","handleTranslate","handleUrlProxy","handleValidate"],Km=["compileEmail","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","save","setConfig","show","updateConfig","useAsync","validateCode","waitPlugin"],jt=new Map([...zm.map(e=>[e,"event"]),...Km.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),Xm=new Map([["use","use `useAsync()` or await `ready` first"]]);function Jm(e){return Xm.get(e)??"await `ready` first"}var Qm=new Set(["async","queued"]),Zm=Symbol.for("emailmaker.earlyCtxPlaceholder");function Fi(e){return e[Zm]=!0,e}function eg(e){return new Error(`[emailmaker] ${e}() is not available in a plugin constructor: the editor core is still loading. Call it from init() or later (${Jm(e)}).`)}function tg(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function ng(e){return[...jt].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function rg(e,t){for(const n of ng(e)){const r=jt.get(n);if(r!==void 0&&Qm.has(r)){const s=async(...o)=>{await t;const i=e[n];if(typeof i!="function"||i===s)throw tg(n);return i.apply(e,o)};e[n]=Fi(s);continue}e[n]=Fi(()=>{throw eg(n)})}}function sg(e,t,n){e.getInstanceAsync(ke).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function og(e,t){e.getInstanceAsync(ke).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_LOAD_ERROR",data:{plugin:t.name,url:t.url,message:t.error.message},innerException:t.error})},()=>{})}var ig=l.defineMixin(e=>{let t;function n(){return new Promise(s=>{const o=e.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),i=()=>{o.delete(i),s()};o.add(i)})}function r(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(s){const o=e.getInstance(l.INSTANCE_ID),i=e.getInstance(xi);if(!t){t=new Ca(o,i,{ensureHostRuntimeReady:Hm,explainScriptFailure:Vm,openEarlyWindow:()=>Bh(e),reportLoadFailure:d=>og(e,d)}),e.inject(l.PLUGIN_COLLECTION_ID,t);const c=t.onLifecycle(d=>{d.type==="create:error"&&sg(e,d.name,d.error)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(c)}const a=s?.plugins||[];o&&(Ds(e),a.length>0&&rg(o,n()),await t.setPlugins(a))},instance:{use(s){return typeof s=="function"?r().useByCtor(s):r().useByKey(s)},useAsync(s){return r().useAsync(s)},waitPlugin(s){return r().waitFor(s)}},dispose(){t?.dispose(),t=void 0}}}),Bi=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const s=this._listeners.indexOf(r);s>=0&&this._listeners.splice(s,1)}}}async run(e){const t=[...this._listeners].sort((n,r)=>r.priority-n.priority);for(const{fn:n}of t){const r=await n(e);r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp)&&Object.assign(e,r)}return e}},ag=l.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),lg=l.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE"),cg="application_block_inserted",dg=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(lg,()=>new Bi).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),s=n?e.bind(n):e;return r.addListener(cg,s,t)}},ar=l.createIdentifier$1("ComponentRegistry"),ug=l.createIdentifier$1("ComponentRegistryGate");function lr(){return l.DependencyResolver.getOrCreateInstance(ug,()=>({pending:[]}))}function fg(e=ar){return lr().factory!==void 0||l.DependencyResolver.getInstance(e)!==void 0}function cr(e,t,n=ar){if(fg(n)){t(Ut(e,n));return}lr().pending.push(()=>t(Ut(e,n)))}function Ut(e,t=ar){const n=l.DependencyResolver.getInstance(t);if(n)return n;const r=lr().factory;if(!r)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return l.DependencyResolver.getOrCreateInstance(t,r)}var pg=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=[];let n=!1;const r=o=>{if(!n){n=!0;for(const i of t)i.dispose();e(o)}};t.push(this._container.addService(l.ATOMS_HANDLERS_ID,{execute:o=>{r(o.value.map(i=>({name:i.name,html:i.html})))}}));const s=this._container.getInstance(l.HEADLESS_MODE_ID)?.watch(o=>{o&&r([])});s&&(n?s.dispose():t.push(s))})}update(e,t){const n=this._container;return n.addService(l.ATOMS_HANDLERS_ID,{execute:r=>{const s=Ut(n),o=r.value.find(i=>i.name===e);if(o){const{icon:i,title:a,fallbackTooltip:c,...d}=t;i&&(o.icon=s.getReactNode(i)),a&&(o.title=s.getReactNode(a)),c&&(o.fallbackTooltip=s.getReactNode(c)),Object.assign(o,d)}}})}delete(e){this._container.addService(l.ATOMS_HANDLERS_ID,{execute:t=>{const n=t.value.findIndex(r=>r.name===e);n>=0&&t.value.splice(n,1)}})}insert(e,t){const n=this._container;return n.addService(l.ATOMS_HANDLERS_ID,{execute:r=>{const s=Ut(n);r.value.splice(t??r.value.length,0,{...e,title:s.getReactNode(e.title),icon:s.getReactNode(e.icon),fallbackTooltip:s.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(ag,()=>new Bi).add(e,t??0,n)}handleInject(e,t,n){return l.getEmitter$1(this._container,l.HANDLE_ATOM_INSERT_ID).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},hg=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}send(e,t,n){this._messageService.send(e,t,n)}sendAsync(e,t,n=!0){return this._messageService.sendAsync(e,t,n)}addListener(e,t,n){return this._messageService.addListener(e,t,n)}addListenerAsync(e,t,n=0){return this._messageService.addListenerAsync(e,t,n)}onInit(e,t=!0,n=0){return this._messageService.onInit(e,t,n)}isInited(){return this._messageService.isInited()}};function mg(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}var gg=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=l.getEmitter$1(t,l.MODAL_SHOW_EVENT),this._closeModalEmitter=l.getEmitter$1(t,l.MODAL_CLOSE_EVENT),this._updateModalEmitter=l.getEmitter$1(t,l.MODAL_UPDATE_EVENT)}get _container(){return this._context.container}show(e){const t=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,n=e.modalProps;return cr(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:n?{...n,footer:r.getReactNode(n.footer),okText:r.getReactNode(n.okText),cancelText:r.getReactNode(n.cancelText),closeIcon:r.getReactNode(n.closeIcon)}:void 0})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;cr(this._container,r=>{this._updateModalEmitter.fire(mg({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:n?{...n,footer:r.getReactNode(n.footer),okText:r.getReactNode(n.okText),cancelText:r.getReactNode(n.cancelText),closeIcon:r.getReactNode(n.closeIcon)}:void 0}))})}},Eg=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;_readyListeners=new Set;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{this._resolveLoaded=()=>{this._loadedSettled||(this._loadedSettled=!0,n())},this._rejectLoaded=s=>{this._loadedSettled||(this._loadedSettled=!0,r(s))}}),this.ready=new Promise((n,r)=>{this._resolveReady=()=>{this._readySettled||(this._readySettled=!0,n())},this._rejectReady=s=>{this._readySettled||(this._readySettled=!0,r(s))}})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady();for(const e of Array.from(this._readyListeners))try{e()}catch{}}onReady(e){return this._readyListeners.add(e),this._readySettled&&e(),{dispose:()=>{this._readyListeners.delete(e)}}}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose(),this._loadedDisposable.dispose(),this._readyListeners.clear();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},vg=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}_createScriptHandle(e,t){const n=this._messageService.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,s=>{if(s.key===e){if(s.phase==="load"&&s.status==="success"){r.resolveLoaded();return}if(s.phase==="ready"&&s.status==="success"){r.resolveReady();return}if(s.phase==="load"){r.rejectLoad(new Error(s.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(s.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new Eg(t,n);return r}registerSandboxCSS(e){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,t)}registerSandboxScriptCode(e,t){const n=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},_g=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function dr(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&_g.has(t)}function ji(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}return`nohwcrypto-${Date.now()}`}function ur(){return`__settingsPanel:${ji()}`}function fr(e,t){return{type:e,props:t}}function bg(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!dr(e)}function Ui(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(dr(t)){const r=ur();return n(e.add(r,t)),fr(r,{})}if(typeof t=="function"){const r=ur();return n(e.add(r,t)),fr(r,{})}if(bg(t)){const r=t.type;if(typeof r=="string")return t;if(dr(r)||typeof r=="function"){const s=ur();return n(e.add(s,r)),fr(s,t.props)}return t}return t}var yg=class{_context;_panelRegistrationDisposables=[];constructor(e){this._context=e}get _container(){return this._context.container}_clearPanelRegistrations(){for(const e of this._panelRegistrationDisposables)e.dispose();this._panelRegistrationDisposables.length=0}_trackRegistration(e){this._panelRegistrationDisposables.push(e)}showSettingsPanel(e){this._clearPanelRegistrations();const t=e.instanceKey??ji();cr(this._container,n=>{const r=i=>this._trackRegistration(i),s=Ui(n,e.content,r),o=e.advancedTabs?.map(i=>({...i,content:Ui(n,i.content,r)}));l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire({...e,content:s,advancedTabs:o,instanceKey:t,type:l.ADVANCED_SETTINGS_PANEL})})}closeSettingsPanel(){this._clearPanelRegistrations(),l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire(null)}},$i={SandboxScriptApi:vg,ElementsApi:pg,BlocksApi:dg,MessageService:hg,SettingsPanelApi:yg,ModalApi:gg};function pr(e,t,n,r={}){const s=Object.assign({},e);for(const[o,i]of Object.entries(t))if(i!==void 0)if(n.includes(o)&&typeof i=="object"&&i!==null){const a=s[o],c=r[o]??{};s[o]=Object.assign({},typeof a=="object"&&a!==null?a:c,i)}else s[o]=i;return s}var te={border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:5,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},borderRadiusCards:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},padding:{all:null,top:null,right:null,bottom:null,left:null}},Sg={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",lineHeight:21,lineHeightDim:"px",color:"#5a5a5a",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},hr={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:24,fontSizeDim:"px",lineHeight:32,lineHeightDim:"px",color:"#333333",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},Hi={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},Fe={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1C52DC",bold:!1,italic:!1,backgroundColor:"#1C52DC",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:te.border,borderRadius:te.borderRadius,textAlign:"center",padding:te.padding},Vi={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:te.padding},mr={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:te.border,borderRadius:te.borderRadiusCards};function Ig(e){return{...Sg,...e}}function wg(e){return{...hr,...e,bold:e?.bold??hr.bold,italic:e?.italic??hr.italic}}function Tg(e){return{...Hi,...e,underline:e?.underline??Hi.underline}}function Cg(e){return{...Fe,...e,bold:e?.bold??Fe.bold,italic:e?.italic??Fe.italic,border:{...Fe.border,...e?.border},borderRadius:{...Fe.borderRadius,...e?.borderRadius},padding:{...Fe.padding,...e?.padding}}}function Ag(e){return{...Vi,...e,padding:{...Vi.padding,...e?.padding}}}function Dg(e){return{...mr,...e,border:{...mr.border,...e?.border},borderRadius:{...mr.borderRadius,...e?.borderRadius}}}function gr(e={}){return{backgroundColor:e.backgroundColor||"",backgroundImage:(e.backgroundImage||[]).map(t=>({type:"url",value:t?.value||""})),backgroundPositionX:e.backgroundPositionX||"",backgroundPositionY:e.backgroundPositionY||"",backgroundRepeat:e.backgroundRepeat||"",backgroundSize:e.backgroundSize||"",backgroundColorContent:e.backgroundColorContent||"",textStrong:e.textStrong||!1,textItalic:e.textItalic||!1,textUnderline:e.textUnderline||!1,width:e.width,responsive:e.responsive}}function Gi(e){let t={...l.COMMON_STYLES};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function Er(e){return{text:Ig(e.text),headings:wg(e.headings),links:Tg(e.links),buttons:Cg(e.buttons),block:Ag(e.block),cards:Dg(e.cards)}}var Yi=l.createIdentifier$1("EmailSettingsPort"),Pg=1e4,Wi=class{_editor;_layoutSettingsChanged=new l.Emitter;_contentStylesChanged=new l.Emitter;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentLayoutSettings()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentContentStyles()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_replayToEarlyPlugin(e,t){if(!li(this._editor.container)||!Pe(this._editor.container)?.current()?.get().attributes.is_inited)return;const n=t();queueMicrotask(()=>e(n))}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_settings(e=this._editor.container){const t=e.getInstance(Yi);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return gr(this._settings().read())}_getCurrentContentStyles(){const e=Pe(this._editor.container)?.current()?.get().attributes.common_styles;return Er(Gi(e))}_getLayoutSnapshot(e){return JSON.stringify(e)}_getContentSnapshot(e){return JSON.stringify(e)}async _ensureMessageSubscription(){if(!this._messageSubscription){if(this._messageSubscriptionPromise)return this._messageSubscriptionPromise;this._messageSubscriptionPromise=(async()=>{if(await this._editor.container.getInstanceAsync(Yi),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const s=r?.data,o=s?.operation;if(o===l.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){const c=gr(s?.settings),d=this._getLayoutSnapshot(c);d!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=d,this._layoutSettingsChanged.fire(c));return}if(o!==l.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE)return;const i=Er(r.data?.settings?.commonStyles??{...l.COMMON_STYLES}),a=this._getContentSnapshot(i);a!==this._prevContentSnapshot&&(this._prevContentSnapshot=a,this._contentStylesChanged.fire(i))})})();try{await this._messageSubscriptionPromise}finally{this._messageSubscriptionPromise=void 0}}}async getEmailLayoutSettings(){return await this._waitForEmailSettingsFromIframe(),this._getCurrentLayoutSettings()}async setEmailLayoutSettings(e){await this._waitForEmailSettingsFromIframe();const t=this._settings(),n={...t.read(),...e};t.write(n);const r=gr(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=Pg){const t=Pe(this._editor.container)?.current()?.get().attributes.is_inited,n=this._settings().read();if(t&&n&&Object.keys(n).length>0&&(n.backgroundColor||n.backgroundImage?.[0]?.value||n.width?.value||n.responsive!==void 0)||t)return;const r=this._editor.container,s=l.getEvent(r,l.events.ON_EMAIL_INIT_ID);return new Promise(o=>{let i=!1,a;const c=()=>{a&&(clearTimeout(a),a=void 0)},d=s(()=>{i||(i=!0,c(),d.dispose(),o())});a=setTimeout(()=>{i||(i=!0,d.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Pe(this._editor.container)?.current();if(!t)return;const n=Gi(t.get().attributes.common_styles);e.text!==void 0&&(n.text={...n.text||{},...e.text}),e.headings!==void 0&&(n.headings={...n.headings||{},...e.headings}),e.links!==void 0&&(n.links={...n.links||{},...e.links}),e.buttons!==void 0&&(n.buttons=pr(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:te.border,borderRadius:te.borderRadius,padding:te.padding})),e.block!==void 0&&(n.block=pr(n.block||{},e.block,["padding"],{padding:te.padding})),e.cards!==void 0&&(n.cards=pr(n.cards||{},e.cards,["border","borderRadius"],{border:te.border,borderRadius:te.borderRadiusCards}));const r=JSON.stringify(n);qe(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const s=Er(n);this._prevContentSnapshot=this._getContentSnapshot(s),this._contentStylesChanged.fire(s)}},Rg={...$i,EmailSettingsApi:Wi},Og={...$i},Wv={...Og,EmailSettingsApi:Wi},Lg={...Rg};function Ng(){ki.addAll(Lg)}var Mg=[l.defineMixin(()=>{Ng()}),Am,Bm,Cm,l.JWTMixin,wm,l.OAuthMixin];async function xg(){return(await it()).asyncMixins}var kg=ig,Fg=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let s;try{s=await xg()}catch(i){throw e.failPendingWaits(i),i}t=s(e);const o=await e.getInstanceAsync(l.INSTANCE_ID);Object.assign(o,t.instance||{});for(const i of e.getInstance(l.LATE_SURFACE_LISTENERS_ID)??[])i()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},Bg=l.combineMixins([...Mg]);function vr(){let e,t=!1;const n=new Map,r=new Map;function s(){for(const o of r.values())o();r.clear()}return{event(o,i,a){const c=Symbol("subscription");return t||(n.set(c,{listener:o,priority:i,thisArg:a}),e&&r.set(c,e(o,i,a))),()=>{n.delete(c),r.get(c)?.(),r.delete(c)}},attach(o){s(),e=o;for(const[i,{listener:a,priority:c,thisArg:d}]of n)r.set(i,o(a,c,d))},dispose(){t=!0,s(),n.clear(),e=void 0}}}function jg(e){const t=vr(),n=vr(),r=vr();return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(ke).then(s=>{t.attach(s.onNotify),n.attach(s.onError),r.attach(s.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(s){const o=e.getInstance(ke);if(o){o.notify(s);return}e.getInstanceAsync(ke).then(i=>i.notify(s),()=>{})}}}var qi=l.createIdentifier$1("CodeErrors"),Ug=[];function $g(e){return e?.getInstance(qi)?.get()??Ug}function Hg(e){return e?.getInstance(qi)!==void 0}var Vg=class extends l.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=et(e),this.addDisposable(l.getEvent(e,l.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){return Qo(this._container,this._currentEmail)}async getBlocks(){const e=await this._readProjectBlocks();return await this._blockMetaWrites,(await this._dataSources.blocks.cache.values()).filter(t=>String(t.project)===String(e)).map(t=>nt(t,this._container))}async _readProjectBlocks(){const e=await nh(this._container);return await this._dataSources.blocks.byForeignKey("project").get(e),e}async getComments(){const{cache:e}=this._dataSources.comments,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.post===t.id).map(n=>rt(n,this._container))}async getEmailRevisions(){const{cache:e}=this._dataSources.emailRevisions,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.parent===t.id).map(n=>qn(n,this._container))}async getEmailSnapshot(){return ee(this.openEmail(),this._container)}setEmailMeta(e){const t=Gn(this._container);if(!t)return;const n=t.get().attributes.meta;qe(t,{meta:Fn({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,s=>s&&Fn(s,e))}setBlockMeta(e,t){const n=async()=>{await this._readProjectBlocks();const{cache:r}=this._dataSources.blocks;await r.getIfPresent(e)&&await r.addOrUpdate(e,s=>s&&Fn(s,t))};this._blockMetaWrites=this._blockMetaWrites.then(n).catch(()=>{})}getCodeErrors(){return Hg(this._container)?$g(this._container):void 0}},Gg=l.createIdentifier$1("EmailDataController");function Yg(e){return e.getOrCreateInstance(Gg,()=>{const t=new Vg(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function Wg(e){const t=Yg(e);return{getEmailSnapshot:()=>t.getEmailSnapshot(),getCodeErrors:()=>t.getCodeErrors(),getBlocks:()=>t.getBlocks(),getComments:()=>t.getComments(),getEmailRevisions:()=>t.getEmailRevisions(),setEmailMeta:n=>t.setEmailMeta(n),setBlockMeta:(n,r)=>t.setBlockMeta(n,r)}}function qg(e){return{undo:()=>e.undo(),redo:()=>e.redo(),clear:()=>e.clear(),canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo(),createSnapshot:()=>e.createSnapshot(),restoreSnapshot:t=>{e.restoreSnapshot(t)},getPast:t=>e.getPast(t).map(n=>({changes:n})),getFuture:t=>e.getFuture(t).map(n=>({changes:n}))}}function zg(e){let t;const n=Oo(e),r=l.getEvent(e,l.events.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:o})=>{t=o}));const s=()=>t?qg(t):void 0;return{undoRedoService:{undo:()=>s()?.undo(),redo:()=>s()?.redo(),clear:()=>s()?.clear(),getPast:o=>s()?.getPast(o)??[],getFuture:o=>s()?.getFuture(o)??[],canUndo:()=>s()?.canUndo()??!1,canRedo:()=>s()?.canRedo()??!1,createSnapshot:()=>s()?.createSnapshot(),restoreSnapshot:o=>s()?.restoreSnapshot(o)}}}var Kg=l.createIdentifier$1("plugin.mountElement");function Xg(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.element;if(typeof Element<"u"&&t instanceof Element||typeof DocumentFragment<"u"&&t instanceof DocumentFragment)return t}function Jg(e){return e.getOrCreateInstance(Kg,()=>{let t=!1,n;return{get:()=>t?n:Xg(e),set(r){t=!0,n=r}}})}function Qg(e){const t=Jg(e);return{getElement:()=>t.get()}}function Zg(e){return{handleLoadImage:F(l.getEvent(e,l.events.UPLOAD_EVENT_ID)),handleFileProxy:F(l.getEvent(e,l.events.FILE_PROXY_EVENT_ID)),handleUrlProxy:F(l.getEvent(e,l.events.PROXY_URL_EVENT_ID)),handleAITextRequest:F(l.getEvent(e,l.events.AI_TEXT_REQUEST_ID)),handleAIImageRequest:F(l.getEvent(e,l.events.AI_IMAGE_REQUEST_ID)),handleReadLocale:F(l.getEvent(e,l.events.READ_LOCALE)),handleLimitUsage:F(l.getEvent(e,l.events.ON_LIMIT_ID)),handleTranslate:F(l.getEvent(e,l.events.ON_TRANSLATE_ID))}}var eE=[Hf,qh,jg,Fm,Wg,zg,Qg,Zg];function tE(e,t=eE){const n=er(e);ym(e);const r=Bg(e),s=kg(e),o=Fg(e),i={...r.instance,...s.instance,...o.instance};for(const c of t)Object.assign(i,c(e));let a=!0;return{instance:i,async setOptions(c){await r.setOptions(c);const d=a&&n.get()===c;a=!1,d||n.set(c),await s.setOptions(c),await o.setOptions(c)}}}var nE=class{_storage=Object.create(null);get(e){const t=this._storage[e];return t&&(!t.expires||t.expires<Date.now())?t.value:""}set(e,t,n){this._storage[e]={value:t,expires:n.expires?n.expires*1e3+Date.now():void 0}}remove(e){delete this._storage[e]}},rE="editor-runtime.react.copies",_r=8;function at(e){return e&&typeof e=="object"?e:void 0}function zi(e){const t=at(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=at(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function sE(e){const t=at(e),n=t&&typeof t.version=="string"?t.version:void 0,r=at(t?.default),s=r&&typeof r.version=="string"?r.version:void 0;return n??s??"unknown"}function oE(e,t,n){return e.package===t&&e.version===n}function iE({ourReact:e,entries:t,packageName:n,version:r}){const s=zi(e);if(!s||!Array.isArray(t))return[];const o=[],i=new Set;for(const a of t){const c=at(a);if(!c||!oE(c,n,r))continue;const d=zi(c.react);!d||d===s||i.has(d)||(i.add(d),o.push({package:n,version:r,reactVersion:sE(c.react),react:c.react}))}return o}function aE({packageName:e,copies:t}){const n=[`[${e}] A second copy of React is on this page (singleton invariant broken).`,`The editor runs on its own React, the plugin got another one from ${e}/runtime/react.`,`This shows up as "Cannot read properties of null (reading 'useState')" and takes down the whole`,"editor, not just the plugin panel: plugin components render inside the editor tree.","","Found:"];for(const r of t.slice(0,_r))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>_r&&n.push(` …and ${t.length-_r} more`),n.push("","Likely root cause: the editor is loaded from its UMD entry (a <script> on the page), while the","plugin was built as an ESM package by the host bundler. Those two never share a React.","","Fix it either way:"," • build the plugin on globals — it then takes React from the page registry, or"," • load the editor from its ESM entry and build both with the same bundler."),n.join(`
|
|
2153
|
+
`)}var Ki=new Set;function lE({packageName:e="useblocks",version:t="1.1.85-dev.11",log:n=r=>{}}={}){const r=s=>{try{const o=globalThis[Symbol.for(rE)],i=iE({ourReact:s,entries:o,packageName:e,version:t}).filter(a=>!Ki.has(a.react));if(!i.length)return;i.forEach(a=>Ki.add(a.react)),n(aE({packageName:e,copies:i}))}catch{}};try{const s=Xt()?.modules?.React;if(s&&typeof s.then=="function"){s.then(r,()=>{});return}r(s)}catch{}}async function cE(e,t,n){l.throwIfAborted(e.signal);const r=t??l.DependencyResolver.createChild();er(r);const s=r.getInstance(l.DISPOSABLE_ID);let o;async function i(){r.inject(l.COOKIE_MANAGER_ID,new nE),lE();const a=tE(r),c={...a.instance,container:r,get ready(){return o??Promise.resolve(c)},async reset(d){if(l.throwIfAborted(d.signal),s.isDisposed())throw fe();return await a.setOptions(d),c}};r.inject(l.INSTANCE_ID,c);try{if(n?.onInstance?.(c),await a.setOptions(e),l.throwIfAborted(e.signal),s.isDisposed()||await Gh(r),e.devTools)try{const d=r.getInstance(l.PLUGIN_COLLECTION_ID);d&&await(await it()).initDevTools(r,d)}catch{}return l.throwIfAborted(e.signal),l.getEmitter(r,l.APP_LOAD_EVENT_ID).fire(c),c}catch(d){throw s.dispose(),d}}try{return o=l.raceWithAbortSignal(i(),e.signal),o.catch(()=>{}),await o}catch(a){throw s.isDisposed()||s.dispose(),a}}var lt=new WeakMap;function dE(e){return e?lt.get(e):void 0}function Xi(e){try{e.getInstance(l.DISPOSABLE_ID)?.dispose()}catch{}try{e.dispose()}catch{}}function uE(e,t){if(!e)return;const n=lt.get(e);n&&n!==t&&Xi(n),lt.set(e,t)}function fE(e,t){e&<.get(e)===t&<.delete(e)}function pE(e){const t=l.DependencyResolver.createChild();return Ke(e)&&t.inject(l.SECURITY_MODULE_ID,Dt(e)),t}var ct=new WeakMap,hE="data-useblocks-config-styles";function mE(e){return typeof e=="string"?e.trim():""}function Ji(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function gE(e,t,n){if(!e||typeof document>"u")return null;const r=mE(t),s=ct.get(e),o=n||e;if(!r)return s&&(s.remove(),ct.delete(e)),null;if(s)return s.textContent!==r&&(s.textContent=r),(s.parentNode!==o||s!==o.firstChild)&&Ji(o,s),s;const i=document.createElement("style");return i.setAttribute(hE,"true"),i.textContent=r,Ji(o,i),ct.set(e,i),i}function EE(e){if(!e)return;const t=ct.get(e);t&&(t.remove(),ct.delete(e))}var qv=!1;function Qi(){return!1}var zv=28,vE=`
|
|
2130
2154
|
.blocks-app-initial-spinner-wrapper {
|
|
2131
2155
|
width: 100%;
|
|
2132
2156
|
height: 100%;
|
|
@@ -2155,11 +2179,11 @@ __useblocks__.define("useblocks.js",["require","exports","module","static/umd/99
|
|
|
2155
2179
|
100% {
|
|
2156
2180
|
transform: rotate(360deg);
|
|
2157
2181
|
}
|
|
2158
|
-
}`;function _h(){return()=>{}}function yh(e,t){if(!Ro()||!e||typeof document>"u")return _h();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=document.createElement("div");n.classList.add("blocks-app-initial-spinner-wrapper");const r=document.createElement("div");r.classList.add("blocks-app-initial-spinner"),n.appendChild(r);const s=document.createElement("style");s.setAttribute(t,"true"),s.textContent=bh,document.head?.appendChild(s),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),s.remove())}}function Sh(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function wh({report:e}={}){const t=new Map,n=new Set,r=e??(s=>{});return{run(s,o){const i=t.get(s);if(i!==void 0)return i;const l=o().catch(c=>{throw n.has(s)||(n.add(s),r(c)),Sh(c)||t.delete(s),c});return t.set(s,l),l},clear(){t.clear(),n.clear()},size(){return t.size}}}var Mn=wh();function Oo(){Mn.clear()}a.setApiOriginFailoverHook(()=>Mn.clear());var Lo=new WeakMap,Mo=new WeakMap;function Ih(e,t){let n=Mo.get(t);n||(n=new Map,Mo.set(t,n));const r=n.get(e);if(r!==void 0)return r;const s=t.getInstance(a.CUSTOM_FETCH_ID),o=a.createTransport({baseUrl:e,customFetch:s?.execute??fetch},t);return n.set(e,o),o}function Nn(e){return a.resolveExplicitApiBaseUrl(e)}function Th(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function Ah(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function Ch(e){if(!e.getAuthToken)return;const t=await e.getAuthToken(e.user,e.project,void 0),n=String(t||"").trim();return n?`Bearer ${n}`:void 0}var xn=new WeakMap;function kn(e,t){xn.set(e,t)}function Ph(e){return xn.get(e)}function Dh(e,t){return async({baseUrl:n})=>{const r=t();if(!r)throw new Error("[Loader] appInit requires the instance container");const s=xn.get(r)??e,o=Nn(n);if(!o)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const i=new Headers({Accept:"application/json"});if(s.getAuthToken&&!await Ch(s))throw Ah();const l=new er(Ih(o,r)),c={headers:Object.fromEntries(i.entries()),credentials:"same-origin",failoverAttemptTimeout:vn(s)||void 0},d=await l.app_init_create({},c);if(!d.ok)throw Th(d.status,d.statusText);return d.data}}function Rh(e){return JSON.stringify({baseUrl:Nn(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function Oh(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function Lh(e){return t=>Mn.run(Rh(t),()=>(H("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>H("appInit:end",{kind:"network"}))))}function Mh(e,t){if(ht(e)||!e.appInit&&!Nn(e.baseUrl)||!Oh(e))return e;const n=e.appInit??Dh(e,t);let r=Lo.get(n);return r||(r=Lh(n),Lo.set(n,r)),{...e,appInit:r}}var No=0;function Nh(){return No}function xh(){No+=1,Oo()}var xo=new WeakMap,ko=new WeakMap,kh=3e4;function Fh(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function Bh(e,t){try{const n=a.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+kh}function jh(e){const t=new Map,n=new Map;return async(r,s,o)=>{const i=Fh(r,s);if(o)return n.delete(i),t.delete(i),Oo(),e(r,s,o);const l=n.get(i);if(l&&!t.has(i)){if(l.expiresAtMs>Date.now())return l.token;n.delete(i)}let c=t.get(i);return c===void 0&&(H("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,s,o)).then(d=>{const u=String(d||"").trim();return u&&n.set(i,{token:d,expiresAtMs:Bh(u,Date.now())}),d}).finally(()=>{H("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,c)),c}}function Uh(e){if(ht(e))return e;const t=e.getAuthToken;if(!t)return e;let n=xo.get(t);const r=Nh();return(!n||ko.get(t)!==r)&&(n=jh(t),xo.set(t,n),ko.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(s=>{}),{...e,getAuthToken:n}}var Hh="[emailmaker] This editor instance was taken over by a later init()/create() into the same element. Get the current one with getInstance(element).";function $h(){const e=new Error(Hh);return e.name="EditorReleasedError",e}var Gh="[emailmaker] This editor was destroyed: a later init()/create() into the same element failed to start, and the editor could not be handed back. Call init() again; the reason is in `cause`.";function Vh(e){const t=new Error(Gh,{cause:e});return t.name="EditorStartFailedError",t}var we=new WeakMap,mt=new WeakMap;function Fo(e,t){we.set(e,t),mt.get(e)?.forEach(n=>n())}function Yh(e,t){const n=mt.get(e)??new Set;return n.add(t),mt.set(e,n),()=>n.delete(t)}function Fn(e){const t=(we.get(e)??0)+1;return Fo(e,t),t}var gt=new WeakMap;function qh(e,t){const n=gt.get(e)??new Set;n.add(t),gt.set(e,n)}function zh(e,t,n){return we.get(e)!==t?!0:gt.get(e)?.has(n)?!1:(Fo(e,n),!0)}function Bo(e,t){return gt.get(e)?.has(t)===!0}var jo=new WeakMap;function Wh(e,t){jo.set(e,{reason:t}),mt.get(e)?.forEach(n=>n())}function Bn(e){return jo.get(e)}function Et(e,t){return we.get(e)===t}var jn=new WeakMap;function Kh(e,t){const n=jn.get(e)??new Set;n.add(t),jn.set(e,n)}function Xh(e,t){const n=we.get(e);return n!==void 0&&n!==t&&jn.get(e)?.has(n)===!0}function Uo(e){return we.get(e)??0}var Jh=new Set(["setConfig","updateConfig","show","save","getEmailSnapshot","getEmail","compileEmail","getBlocks","getEmailRevisions","getComments","validateCode","reset","useAsync"]),Qh=new Set(["setEmailMeta","setBlockMeta","notify"]),Ho=new Map([["getConfig","await `ready` first"],["use","use `useAsync()` or await `ready` first"],["container","await `ready` first"],["undoRedoService","await `ready` first"]]);function $o(e){if(/^handle[A-Z]/.test(e))return"event";if(Jh.has(e))return"async";if(Qh.has(e))return"queued";if(e==="getElement")return"element";if(e==="getCodeErrors")return"codeErrors";if(Ho.has(e))return"notReady"}function Zh(e){return Ho.get(e)??"await `ready` first"}function Go(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}function em(e,t){let n,r=0,s,o,i="pending",l,c,d,u;const p=new Set,E=[];let h,b;const v=new Promise((P,O)=>{h=P,b=O});v.catch(()=>{});const m=P=>n?.[P],_=()=>i==="pending"||n!==void 0&&Et(n,r)&&Bn(n)===void 0,y=P=>{const O=m(P.name);P.dispose||typeof O!="function"||!_()||(P.dispose=O(...P.args))},w=()=>p.forEach(y),A=()=>{for(const P of p)P.dispose?.(),P.dispose=void 0},C=()=>w(),g=()=>{i==="ready"&&(_()?w():A())},I=()=>{d?.delete(C),d=void 0},f=()=>{u?.(),u=void 0,A(),p.clear(),I(),E.length=0,n=void 0},S=()=>i==="failed"?l:St(),T=()=>{if(i!=="ready"||n===void 0)return;if(Xh(n,r))return $h();const P=Bn(n);return P?Vh(P.reason):void 0},M=(P,O,B)=>{if(i==="failed"||i==="destroyed")throw S();const L=T();if(L)throw L;const x=m(P);if(typeof x!="function")throw Go(P);return x.apply(B,O)},k=()=>i==="ready"?Promise.resolve():i==="pending"?v:Promise.reject(S()),z=(P,O)=>{if(i==="failed"||i==="destroyed")throw S();if(i==="ready"&&typeof m(P)!="function")throw Go(P);const B={name:P,args:O};return p.add(B),y(B),()=>{p.delete(B),B.dispose?.(),B.dispose=void 0}},D=()=>{const P=e.element;return P!==void 0&&typeof P!="string"?P:void 0},N=new Proxy({},{get(P,O,B){if(typeof O!="string"||O==="then")return;const L=$o(O);if(L==="event")return(...x)=>z(O,x);if(O==="reset")return(...x)=>k().then(()=>M(O,x,B)).then(()=>j);if(i==="pending"&&(L==="queued"||L==="codeErrors"))return L==="codeErrors"?()=>[]:(...x)=>{E.push({name:O,args:x})};if(n&&O in n){const x=T();if(x){if(typeof m(O)!="function")throw x;return L==="async"?()=>Promise.reject(x):()=>{throw x}}return Reflect.get(n,O,B)}switch(L){case"async":return(...x)=>k().then(()=>M(O,x,B));case"queued":return(...x)=>{if(i!=="pending")return M(O,x,B);E.push({name:O,args:x})};case"element":return D;case"codeErrors":return()=>[];case"notReady":throw new Error(`[emailmaker] \`${O}\` is not available before the editor is ready: ${Zh(O)}`);default:return O in Object.prototype?Reflect.get(Object.prototype,O,B):void 0}},has(P,O){return typeof O!="string"?!1:n!==void 0&&O in n||$o(O)!==void 0}}),j=Object.create(N);return Object.defineProperty(j,"ready",{get:()=>c,enumerable:!0}),Object.defineProperty(j,"destroy",{enumerable:!0,value:()=>{if(i==="destroyed"||i==="failed")return;if(i==="pending"){const L=s!==void 0&&n!==void 0&&Et(n,r),x=n;i="destroyed",c?.catch(()=>{}),t(a.createAbortError("[emailmaker] editor was destroyed before it was ready")),L&&(f(),x?.destroy());return}const P=n!==void 0&&Et(n,r),O=n,B=O!==void 0&&Bn(O)!==void 0;i="destroyed",f(),!B&&(P?O?.destroy():O&&qh(O,r))}}),{handle:j,bind:(P,O)=>{O?.adopt&&i==="pending"&&s===void 0?(s=Uo(P),o=P,r=Fn(P)):!O?.adopt&&n!==P&&(s=void 0,o=void 0),n!==P&&(A(),I(),n=P,w(),i==="pending"&&(d=P.container.getOrCreateInstance(a.LATE_SURFACE_LISTENERS_ID,()=>new Set),d.add(C)))},settle:()=>{const P=n;if(i==="destroyed"){f(),P&&(Fn(P),P.destroy());const O=a.createAbortError("[emailmaker] editor was destroyed before it was ready");throw l=O,b(O),O}P&&s===void 0&&Uo(P)===0&&(r=Fn(P)),i="ready",P&&(Kh(P,r),u=Yh(P,g),g()),I();for(const O of E.splice(0))try{M(O.name,O.args,j)}catch(B){queueMicrotask(()=>{throw B})}h()},fail:P=>{i!=="destroyed"&&(i="failed",l=P),f(),b(P)},canHandBack:()=>o!==void 0&&s!==void 0&&i!=="destroyed"&&Et(o,r)&&!Bo(o,s),finishAdoption:(P,O)=>{const B=o,L=s;if(o=void 0,s=void 0,!B||L===void 0||i==="destroyed")return;const x=!P||Bo(B,L);if(x&&Wh(B,O),!zh(B,r,L)||x)try{B.destroy()}catch{}},setReady:P=>{c=P},isCurrent:()=>i==="pending"||i==="ready"&&T()===void 0}}var Un="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function tm(){return a.createAbortError(Un)}function Vo(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Un}function nm(e,t,n){if(typeof document>"u")return;let r=!1,s;const o=()=>{r=!0,s?.disconnect(),s=void 0},i=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(i);return}s=new MutationObserver(()=>{e.isConnected||i()});let l=e.parentNode;for(;l;)s.observe(l,{childList:!0}),l=l.parentNode}function rm(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:s}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return nm(n,()=>{n.id,o.abort(tm())},s),a.composeAbortSignals(r,o.signal)}var Hn="Superseded by newer init() on the same mount element";function sm(){return a.createAbortError(Hn)}function Yo(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Hn}var He=new Map,vt=new WeakMap;function om(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function im(e){if(!e)return{previous:Promise.resolve(),release:()=>{}};const t=om(e);(t?He.get(t):void 0)?.forEach(c=>{c.element!==e&&c.controller.abort(sm())});const n=vt.get(e)??Promise.resolve();let r;const s=new Promise(c=>{r=c}),o=n.then(()=>s);vt.set(e,o),o.then(()=>{vt.get(e)===o&&vt.delete(e)});const i=new AbortController,l={element:e,controller:i};if(t){const c=He.get(t)??new Set;c.add(l),He.set(t,c)}return{signal:i.signal,previous:n,release:()=>{r();const c=t?He.get(t):void 0;t&&c?.delete(l)&&c.size===0&&He.delete(t)}}}var bt=new WeakMap;function qo(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function $n(e){return Object.entries(e).filter(([t,n])=>qo(t,n)).map(([t])=>t).sort()}function zo(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!qo(n,r)&&(t[n]=r);return t}function Gn(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:bt.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},bt.set(e,r));const{current:s,trampolines:o}=r;s.clear();const i={...t};for(const l of $n(t)){s.set(l,t[l]);let c=o.get(l);c||(c=(...d)=>s.get(l)?.(...d),o.set(l,c)),i[l]=c}return r.lastOptions=t,i}function am(e){const t=e?bt.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((s,o)=>t.current.set(o,s)),t.lastOptions=r}}function lm(e,t,n){const r=e?bt.get(e):void 0;if(!r||!n)return!1;const s=$n(t),o=a.deepEqual(s,$n(r.lastOptions)),i=s.every(l=>l==="getAuthToken"||n[l]===r.trampolines.get(l));return!o||!i||!a.deepEqual(zo(t),zo(r.lastOptions))?!1:(Gn(e,t),!0)}var $e=new WeakMap;function cm(e,t){const n=$e.get(e)??[];n.push(t),$e.set(e,n)}function dm(e){const t=$e.get(e);if(!t)return;const n=t.filter(r=>r.isCurrent());if(n.length===0){$e.delete(e);return}return $e.set(e,n),n[n.length-1].handle}var um=zn({FileManagerApiError:()=>fm}),fm=class Xo extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,s){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=s,Error.captureStackTrace&&Error.captureStackTrace(this,Xo)}},pm=zn({mapHttpStatusToErrorCode:()=>a.mapHttpStatusToErrorCode});function hm(e,t){return{...e,element:t}}function Vn(){return()=>{}}function mm(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Vn():(Eh(t,e.config?.styles,t),()=>{vh(t)})}function gm(e){if(!Ro()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Vn()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Vn()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=yh(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Em(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function Wo(e){try{e.destroy()}catch{}}function Ge(e,...t){const n=a.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&a.ELEMENT_MAP.delete(e)}var vm="1.1.85-dev.10";async function bm(e){Vt(),await vp(typeof __useblocks__<"u"?__useblocks__:void 0)}async function _m(e){return Ko(e).ready}function Ko(e){H(W.initStart);const t=new AbortController,n=a.composeAbortSignals(e.signal,t.signal),r=em(e,i=>t.abort(i)),s=i=>cm(i,r),o=Am({...e,signal:n},r,s).then(()=>(H(W.initEnd),r.settle(),r.handle),i=>{throw r.fail(i),i});return r.setReady(o),r.handle}function ym(e){const t=typeof e=="string"?document.querySelector(e):e;return t?dm(t):void 0}function Sm(e){let t,n,r=!1;try{t=e.container.getInstance(a.OPTIONS_SOURCE_ID)?.get(),n=e.container.getInstance(a.INIT_PIPELINE_ID)?.externalSignal;const s=De(e.container)?.current();r=s!==void 0&&s.get().savedVersion!==null&&s.isDirty()}catch{t=void 0}return{options:t,signal:n,email:wm(e),dirty:r}}async function wm(e){try{return await e.getEmailSnapshot()}catch{return}}function Im(e){const t=De(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}async function Tm(e,t,n,r,s){if(r.fail(s),Yo(s)||Vo(s)||!r.canHandBack()){r.finishAdoption(!0,s);return}const{options:o}=n;if(!o){Ge(t,e),r.finishAdoption(!1,s);return}const i=await n.email,l=i&&(o.content!==void 0||i.id!==void 0)?i:void 0,c=typeof o.content=="object"&&"email"in o.content?o.content:void 0;try{await e.reset({...o,signal:o.signal??n.signal,content:l?{...c,email:l}:o.content}),n.dirty&&l&&Im(e),r.canHandBack()&&a.ELEMENT_MAP.set(t,e),r.finishAdoption(!0,s)}catch{Ge(t,e),r.finishAdoption(!1,s)}}async function Am(e,t,n){a.throwIfAborted(e.signal);const r=new a.Disposable;let s,o;try{const i=await a.waitForElement(e.element,r,e.signal);i&&n(i);const l=rm({hostElementOption:e.element,resolvedElement:i,externalSignal:e.signal,disposable:r}),c=im(i);s=c.release;const d=a.composeAbortSignals(l,c.signal);return a.throwIfAborted(d),await a.raceWithAbortSignal(c.previous,d),o=Cm(e,i,t,d),await a.raceWithAbortSignal(o,d)}finally{const i=s;o!==void 0&&i?o.then(i,i):i?.(),r.dispose()}}async function Cm(e,t,n,r){const{bind:s}=n;a.throwIfAborted(r);let o;const i=h=>{xh();const b=Uh(hm(h,t)),v=Mh(b,()=>o);return{preparedOptions:v,preparedOptionsWithSignal:r!=null?{...v,signal:r}:v}};let l;if(t){const h=a.ELEMENT_MAP.get(t);if(h){let b;try{b=await h,a.throwIfAborted(r)}catch{a.throwIfAborted(r),Ge(t,h),b=void 0}if(b)if(b.getElement()===t){const v=uh(t);o=v;const m=b.container.getInstance(a.OPTIONS_SOURCE_ID)?.get();if(lm(t,e,m))return s(b,{adopt:!0}),r&&b.container.getInstance(a.INIT_PIPELINE_ID)?.relinkExternalSignal(r),a.ELEMENT_MAP.set(t,b),b;const _=am(t);l=i(Gn(t,e));const{preparedOptions:y,preparedOptionsWithSignal:w}=l,A=v&&Ph(v),C=Sm(b);try{v&&kn(v,y),s(b,{adopt:!0});const g=await b.reset(Em(e,w));return a.throwIfAborted(r),a.ELEMENT_MAP.set(t,b),g}catch(g){if(v&&A&&kn(v,A),!bi(g))throw _(),await Tm(b,t,C,n,g),g;n.finishAdoption(!1,g),Ge(t,h,b),Wo(b),a.throwIfAborted(r)}}else Ge(t,h,b),Wo(b)}}a.throwIfAborted(r),l??=i(Gn(t,e,{fresh:!0}));const{preparedOptions:c}=l,d=mm(c),u=gm(c),p=r!=null?{...u.options,signal:r}:u.options;let E;try{o=hh(p),fh(t,o),kn(o,c),En(o).set(p),await Sn(),H(W.coreReady),a.throwIfAborted(r),a.throwIfAborted(r),E=dh(p,o,{onInstance:s}),t&&a.ELEMENT_MAP.set(t,E);const h=await E;if(r?.aborted&&(h.destroy(),a.throwIfAborted(r)),t)if(a.ELEMENT_MAP.get(t)===E)a.ELEMENT_MAP.set(t,h);else throw h.destroy(),a.throwIfAborted(r),a.createAbortError(r?.reason);return h}catch(h){throw d(),u.cleanup(),o&&(Po(o),ph(t,o)),t&&E&&a.ELEMENT_MAP.get(t)===E&&a.ELEMENT_MAP.delete(t),h}}async function Pm(e){return(await ke()).parseAMP(e)}typeof window<"u"&&(Ce()&&Ei(),_p(typeof __useblocks__<"u"?__useblocks__:void 0)),X.ELEMENT_DETACHED_ABORT_MESSAGE=Un,X.SUPERSEDED_INIT_ABORT_MESSAGE=Hn,X.create=Ko,Object.defineProperty(X,"errors",{enumerable:!0,get:function(){return um}}),X.getInstance=ym,Object.defineProperty(X,"helpers",{enumerable:!0,get:function(){return pm}}),X.init=_m,X.isElementDetachedError=Vo,X.isSupersededInitError=Yo,X.parseAMP=Pm,X.pluginRegistry=mo,X.preload=bm,X.version=vm});
|
|
2182
|
+
}`;function _E(){return()=>{}}function bE(e,t){if(!Qi()||!e||typeof document>"u")return _E();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=document.createElement("div");n.classList.add("blocks-app-initial-spinner-wrapper");const r=document.createElement("div");r.classList.add("blocks-app-initial-spinner"),n.appendChild(r);const s=document.createElement("style");s.setAttribute(t,"true"),s.textContent=vE,document.head?.appendChild(s),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),s.remove())}}function yE(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function SE({report:e}={}){const t=new Map,n=new Set,r=e??(s=>{});return{run(s,o){const i=t.get(s);if(i!==void 0)return i;const a=o().catch(c=>{throw n.has(s)||(n.add(s),r(c)),yE(c)||t.delete(s),c});return t.set(s,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var br=SE();function Zi(){br.clear()}l.setApiOriginFailoverHook(()=>br.clear());var ea=new WeakMap;function yr(e){return l.resolveExplicitApiBaseUrl(e)}function IE(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function wE(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function TE(e){if(!e.getAuthToken)return;const t=await e.getAuthToken(e.user,e.project,void 0),n=String(t||"").trim();return n?`Bearer ${n}`:void 0}var Sr=new WeakMap;function Ir(e,t){Sr.set(e,t)}function CE(e){return Sr.get(e)}function AE(e,t){return async({baseUrl:n})=>{const r=t(),s=r&&Sr.get(r)||e,o=yr(n);if(!o)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const i=new Headers({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),a=await TE(s);if(s.getAuthToken&&!a)throw wE();a&&i.set("authorization",a);const c=await l.fetchWithApiOriginFailover("/app/v1/app_init",{method:"POST",headers:i,body:new URLSearchParams,credentials:"same-origin"},o,{attemptTimeout:Mn(s)||void 0});if(!c.ok)throw IE(c.status,c.statusText);return await c.json()}}function DE(e){return JSON.stringify({baseUrl:yr(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function PE(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function RE(e){return t=>br.run(DE(t),()=>(V("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>V("appInit:end",{kind:"network"}))))}function OE(e,t){if(Ke(e)||!e.appInit&&!yr(e.baseUrl)||!PE(e))return e;const n=e.appInit??AE(e,t);let r=ea.get(n);return r||(r=RE(n),ea.set(n,r)),{...e,appInit:r}}var ta=0;function LE(){return ta}function NE(){ta+=1,Zi()}var na=new WeakMap,ra=new WeakMap,ME=3e4;function xE(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function kE(e,t){try{const n=l.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+ME}function FE(e){const t=new Map,n=new Map;return async(r,s,o)=>{const i=xE(r,s);if(o)return n.delete(i),t.delete(i),Zi(),e(r,s,o);const a=n.get(i);if(a&&!t.has(i)){if(a.expiresAtMs>Date.now())return a.token;n.delete(i)}let c=t.get(i);return c===void 0&&(V("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,s,o)).then(d=>{const u=String(d||"").trim();return u&&n.set(i,{token:d,expiresAtMs:kE(u,Date.now())}),d}).finally(()=>{V("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,c)),c}}function BE(e){if(Ke(e))return e;const t=e.getAuthToken;if(!t)return e;let n=na.get(t);const r=LE();return(!n||ra.get(t)!==r)&&(n=FE(t),na.set(t,n),ra.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(s=>{}),{...e,getAuthToken:n}}var jE="[emailmaker] This editor was destroyed: a later init()/create() into the same element failed to start, and the editor could not be handed back. Call init() again; the reason is in `cause`.";function UE(e){const t=new Error(jE,{cause:e});return t.name="EditorStartFailedError",t}var $E={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function sa(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var oa=["handleLoad","handleDestroy"];function ia(e,t){let n=e;for(const r of oa){const s=e?.[r];typeof s=="function"&&(n={...n,[r]:(o,...i)=>s(t,...i)})}return n}function HE(e){let t,n="pending",r,s,o,i;const a=new Set,c=[],d=new Set;let u,f;const g=new Promise((I,P)=>{u=I,f=P});g.catch(()=>{});const m={},_=I=>t?.[I],v=()=>r??fe(),p=(I,P)=>{const x=_(I);if(typeof x!="function")throw sa(I);return x.apply(t,P)},b=(I,P)=>{try{return Promise.resolve(p(I,P))}catch(x){return Promise.reject(x)}},S=()=>{const I=t?.container?.getInstance?.(l.DISPOSABLE_ID);if(!(n!=="ready"||I?.isDisposed()||typeof _("getConfig")!="function"))try{i=p("getConfig",[])}catch{}},T=()=>n==="dead"?Promise.reject(v()):n==="ready"?Promise.resolve():g,C=()=>{for(const[I,P]of jt)P==="field"&&(m[I]=_(I))},L=I=>{const P=_(I.name);I.dispose||typeof P!="function"||n==="dead"||(I.dispose=P.apply(t,I.args))},E=()=>a.forEach(L),y=()=>{for(const I of a){try{I.dispose?.()}catch{}I.dispose=void 0}},A=()=>{C(),E()},R=()=>{o?.delete(A),o=void 0},h=(I,P)=>{const[x,...Q]=P;return!oa.includes(I)||typeof x!="function"?P:[(we,...M)=>x(m,...M),...Q]},w=(I,P)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof _(I)!="function")throw sa(I);const x={name:I,args:h(I,P)};return a.add(x),L(x),()=>{a.delete(x),x.dispose?.(),x.dispose=void 0}},D=()=>t?.container?.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.content,k=()=>{const I=e.element();return I!==void 0&&typeof I!="string"?I:void 0},N=(I,P)=>{switch(P){case"event":return(...x)=>w(I,x);case"async":return(...x)=>(I==="show"&&x[0]!==void 0&&e.shown?.(x[0]),n!=="dead"&&typeof _(I)=="function"?b(I,x):T().then(()=>p(I,x)));case"queued":return(...x)=>{if(n==="dead"){if(I==="notify")return;throw v()}if(n==="pending"){c.push({name:I,args:x});return}return p(I,x)};case"sync":return(...x)=>{if(n==="dead"){if(I==="getConfig")return i;throw v()}if(typeof _(I)!="function")throw new Error(`[emailmaker] \`${I}\` is not available before the editor is ready: ${$E[I]??"await `ready` first"}`);const Q=p(I,x);return I==="getConfig"&&(i=Q),Q};case"element":return()=>{if(typeof _(I)!="function")return k();try{return p(I,[])}catch{return k()}};case"codeErrors":return()=>n==="ready"&&typeof _(I)=="function"?p(I,[]):[];case"field":return}};for(const[I,P]of jt)m[I]=N(I,P);m.reset=I=>(I?.content!==void 0&&e.shown?.(I.content),T().then(async()=>{const P=I?.content!==void 0&&l.deepEqual(I.content,D());await p("reset",[ia(I,U)]),P&&await p("show",[I.content])}).then(()=>m)),m.destroy=()=>{if(n==="dead")return;const I=l.createAbortError("[emailmaker] editor was destroyed before it was ready");s?.catch(()=>{}),d.forEach(P=>P(I)),S(),e.destroy()},Object.defineProperty(m,"ready",{get:()=>s,enumerable:!0,configurable:!0});const U=m;return{object:U,get state(){return n},get editor(){return t},bind:I=>{n==="dead"||t===I||(y(),R(),t=I,C(),E(),n==="pending"&&(o=I.container.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),o.add(A)))},settle:()=>{if(n==="pending"){n="ready",R(),C(),E();for(const I of c.splice(0))try{p(I.name,I.args)}catch(P){queueMicrotask(()=>{throw P})}u()}},kill:(I,P)=>{n!=="dead"&&(S(),n="dead",r=I,c.length=0,d.forEach(x=>x(I)),R(),P?.keepSubscriptions||(y(),a.clear()),f(I))},detach:()=>{y(),a.clear()},setReady:I=>{s=I},trackCall:I=>(d.add(I),()=>d.delete(I)),hasCalls:()=>d.size>0}}var wr="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function VE(){return l.createAbortError(wr)}function aa(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===wr}function GE(e,t,n){if(typeof document>"u")return;let r=!1,s;const o=()=>{r=!0,s?.disconnect(),s=void 0},i=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(i);return}s=new MutationObserver(()=>{e.isConnected||i()});let a=e.parentNode;for(;a;)s.observe(a,{childList:!0}),a=a.parentNode}function YE(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:s}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return GE(n,()=>{n.id,o.abort(VE())},s),l.composeAbortSignals(r,o.signal)}var Tr="Superseded by newer init() on the same mount element";function la(){return l.createAbortError(Tr)}function ca(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Tr}var dt=new Map,da=new WeakMap,$t=new WeakMap;function WE(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function qE(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=WE(e);(n?dt.get(n):void 0)?.forEach(u=>{u.element!==e&&u.controller.abort(la())});const r=da.get(e)??new Set;t&&r.forEach(u=>{u.supersedable&&u.controller.abort(la())});const s=$t.get(e)??Promise.resolve();let o;const i=new Promise(u=>{o=u}),a=s.then(()=>i);$t.set(e,a),a.then(()=>{$t.get(e)===a&&$t.delete(e)});const c=new AbortController,d={element:e,controller:c,supersedable:t};if(r.add(d),da.set(e,r),n){const u=dt.get(n)??new Set;u.add(d),dt.set(n,u)}return{signal:c.signal,previous:s,release:()=>{o(),r.delete(d);const u=n?dt.get(n):void 0;n&&u?.delete(d)&&u.size===0&&dt.delete(n)}}}var ut=new WeakMap;function Cr(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function Ar(e){return Object.entries(e).filter(([t,n])=>Cr(t,n)).map(([t])=>t).sort()}function ua(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!Cr(n,r)&&(t[n]=r);return t}function Dr(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:ut.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},ut.set(e,r));const{current:s,trampolines:o}=r;s.clear();const i={...t};for(const a of Ar(t)){s.set(a,t[a]);let c=o.get(a);c||(c=(...d)=>s.get(a)?.(...d),o.set(a,c)),i[a]=c}return r.lastOptions=t,i}function fa(e,t){const n=e?ut.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const s=t[r];Cr(r,s)?n.current.set(r,s):n.current.delete(r)}}function zE(e){const t=e?ut.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((s,o)=>t.current.set(o,s)),t.lastOptions=r}}function KE(e,t,n){const r=e?ut.get(e):void 0;if(!r||!n)return!1;const s=Ar(t),o=l.deepEqual(s,Ar(r.lastOptions)),i=s.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!o||!i||!l.deepEqual(ua(t),ua(r.lastOptions))?!1:(Dr(e,t),!0)}var se=new WeakMap,Kv=0;function Ht(e){let t=se.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},se.set(e,t)),t}var me=e=>e!==void 0&&e.state!=="dead";function XE(e){const t=se.get(e)?.shared;return me(t)?t:void 0}function JE(e,t){Ht(e).shared=t}function QE(e,t){!(me(e.shared)&&[...e.counted].some(me))||e.warned||!t.devTools||(e.warned=!0)}function ZE(e,t,n,r){const s=Ht(e);return s.latestCall+=1,s.releaseTimer!==void 0&&(clearTimeout(s.releaseTimer),s.releaseTimer=void 0),s.leaving.forEach(o=>o.detach()),s.leaving.clear(),n==="single"?s.shared=t:s.counted.add(t),s.options.set(t,r),s.order=[...s.order.filter(o=>o!==t&&me(o)),t],QE(s,r),s.latestCall}function ev(e,t){return se.get(e)?.latestCall===t}function tv(e){const t=se.get(e);if(t)return t.order=t.order.filter(me),t.order.at(-1)?.object}function ft(e,t){const n=se.get(e);return n?me(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&me(r)):!1}function nv(e,t){const n=se.get(e),r=n?.order.filter(s=>s!==t&&me(s)).at(-1);return r?n?.options.get(r):void 0}function pa(e,t){Ht(e).content={value:t}}function rv(e){return se.get(e)?.content}function sv(e,t,n,r){const s=Ht(e);if(s.counted.delete(t),s.options.delete(t),ft(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),s.leaving.add(t),ha(e,r)}function ha(e,t){const n=se.get(e);!n||ft(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!ft(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function ov(e,t){const n=se.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);se.delete(e)}}var iv=qt.__exportAll({FileManagerApiError:()=>av,IntegratorSaveTimeoutError:()=>sn,SaveRefusedError:()=>Ve}),av=class va extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,s){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=s,Error.captureStackTrace&&Error.captureStackTrace(this,va)}},lv=qt.__exportAll({mapHttpStatusToErrorCode:()=>l.mapHttpStatusToErrorCode});function cv(e,t){return{...e,element:t}}function Pr(){return()=>{}}function dv(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Pr():(gE(t,e.config?.styles,t),()=>{EE(t)})}function uv(e){if(!Qi()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Pr()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Pr()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=bE(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function fv(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function Vt(e){try{e.destroy()}catch{}}function Gt(e,...t){const n=l.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&l.ELEMENT_MAP.delete(e)}var pv="1.1.85-dev.11";async function hv(e){Sn(),await Gm(typeof __useblocks__<"u"?__useblocks__:void 0)}async function mv(e){return ma(e).ready}function gv(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function Ev(e){const t=l.ELEMENT_MAP.get(e);return t&&!(t instanceof Promise)?t:void 0}function Yt(e,t,n){const r=t??Ev(e);r&&(Gt(e,r),Vt(r)),ov(e,n)}function vv(e){const{control:t,mode:n,ref:r}=e,s=r.host;if(!s){const i=t.editor;_v(i),t.kill(fe());return}if(n==="single"){Yt(s,t.editor,fe());return}const o=nv(s,t);sv(s,t,fe(),()=>Yt(s,t.editor,fe())),o&&ft(s)&&fa(s,o)}function _v(e){e&&Vt(e)}function ma(e){V(X.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=l.composeAbortSignals(e.signal,n.signal),s=t==="single"?gv(e.element):void 0,o=s?XE(s):void 0;let i;if(o)i={control:o,mode:t,ref:{host:s}};else{const u={},f=HE({element:()=>u.host??e.element,destroy:()=>vv(i),shown:g=>{u.host&&pa(u.host,g)}});i={control:f,mode:t,ref:u},s&&JE(s,f)}const{control:a}=i,c=a.trackCall(u=>n.abort(u)),d=Tv(ia({...e,signal:r},a.object),i).then(()=>(c(),V(X.initEnd),a.settle(),a.object),u=>{c(),a.state==="pending"&&!a.hasCalls()&&a.kill(u);const f=i.ref.host;throw f&&ha(f,()=>Yt(f,void 0,fe())),u});return a.setReady(d),a.object}function bv(e){const t=typeof e=="string"?document.querySelector(e):e;return t?tv(t):void 0}function yv(e){let t,n,r=!1;try{t=e.container.getInstance(l.OPTIONS_SOURCE_ID)?.get(),n=e.container.getInstance(l.INIT_PIPELINE_ID)?.externalSignal;const s=Pe(e.container)?.current();r=s!==void 0&&s.get().savedVersion!==null&&s.isDirty()}catch{t=void 0}return{options:t,signal:n,email:Sv(e),dirty:r}}async function Sv(e){try{return await e.getEmailSnapshot()}catch{return}}function Iv(e){const t=Pe(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function ga(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||ft(e,n)}async function wv(e,t,n,r,s){if(r.mode==="counted"&&r.control.detach(),ca(s)||aa(s))return;const o=()=>Yt(t,e,UE(s)),{options:i}=n;if(!i||!ga(t,r)){o();return}const a=await n.email,c=a&&(i.content!==void 0||a.id!==void 0)?a:void 0,d=typeof i.content=="object"&&"email"in i.content?i.content:void 0;try{await e.reset({...i,signal:i.signal??n.signal,content:c?{...d,email:c}:i.content}),n.dirty&&c&&Iv(e),ga(t,r)?l.ELEMENT_MAP.set(t,e):o()}catch{o()}}async function Tv(e,t){l.throwIfAborted(e.signal);const n=new l.Disposable;let r,s,o,i,a=0;try{const c=await l.waitForElement(e.element,n,e.signal);c&&(i=c,t.ref.host=c,a=ZE(c,t.control,t.mode,e));const d=YE({hostElementOption:e.element,resolvedElement:c,externalSignal:e.signal,disposable:n}),u=qE(c,{supersede:t.mode==="single"});r=u.release;const f=l.composeAbortSignals(d,u.signal);l.throwIfAborted(f),o=zE(c),fa(c,e),await l.raceWithAbortSignal(u.previous,f),s=Cv(e,c,t,f,o);const g=await l.raceWithAbortSignal(s,f);return c&&e.content!==void 0&&pa(c,e.content),g}catch(c){throw i&&o&&ev(i,a)&&o(),c}finally{const c=r;s!==void 0&&c?s.then(c,c):c?.(),n.dispose()}}async function Ea(e,t,n,r){const s=rv(t);n===void 0||r||!s||l.deepEqual(n,s.value)||await e.show(n)}async function Cv(e,t,n,r,s){const{control:o}=n,i=v=>o.bind(v);l.throwIfAborted(r);let a;const c=v=>{NE();const p=BE(cv(v,t)),b=OE(p,()=>a);return{preparedOptions:b,preparedOptionsWithSignal:r!=null?{...b,signal:r}:b}};let d;if(t){const v=l.ELEMENT_MAP.get(t);if(v){let p;try{p=await v,l.throwIfAborted(r)}catch{l.throwIfAborted(r),Gt(t,v),p=void 0}if(p)if(p.getElement()===t){const b=dE(t);a=b;const S=p.container.getInstance(l.OPTIONS_SOURCE_ID)?.get();if(KE(t,e,S))return i(p),r&&p.container.getInstance(l.INIT_PIPELINE_ID)?.relinkExternalSignal(r),l.ELEMENT_MAP.set(t,p),await Ea(p,t,e.content,!1),p;const T=!l.deepEqual(e.content,S?.content);d=c(Dr(t,e));const{preparedOptions:C,preparedOptionsWithSignal:L}=d,E=b&&CE(b),y=yv(p);try{b&&Ir(b,C),i(p);const A=await p.reset(fv(e,L));return l.throwIfAborted(r),l.ELEMENT_MAP.set(t,p),await Ea(p,t,e.content,T),A}catch(A){if(b&&E&&Ir(b,E),!Va(A))throw s(),await wv(p,t,y,n,A),A;Gt(t,v,p),Vt(p),l.throwIfAborted(r)}}else Gt(t,v,p),Vt(p)}}l.throwIfAborted(r),d??=c(Dr(t,e,{fresh:!0}));const{preparedOptions:u}=d,f=dv(u),g=uv(u),m=r!=null?{...g.options,signal:r}:g.options;let _;try{a=pE(m),uE(t,a),Ir(a,u),er(a).set(m),await ir(),V(X.coreReady),l.throwIfAborted(r),l.throwIfAborted(r),_=cE(m,a,{onInstance:i}),t&&l.ELEMENT_MAP.set(t,_);const v=await _;if(r?.aborted&&(v.destroy(),l.throwIfAborted(r)),t)if(l.ELEMENT_MAP.get(t)===_)l.ELEMENT_MAP.set(t,v);else throw v.destroy(),l.throwIfAborted(r),l.createAbortError(r?.reason);return v}catch(v){throw f(),g.cleanup(),a&&(Xi(a),fE(t,a)),t&&_&&l.ELEMENT_MAP.get(t)===_&&l.ELEMENT_MAP.delete(t),v}}async function Av(e){return(await it()).parseAMP(e)}typeof window<"u"&&(Ue()&&$a(),Wm(typeof __useblocks__<"u"?__useblocks__:void 0)),J.ELEMENT_DETACHED_ABORT_MESSAGE=wr,J.SUPERSEDED_INIT_ABORT_MESSAGE=Tr,J.create=ma,Object.defineProperty(J,"errors",{enumerable:!0,get:function(){return iv}}),J.getInstance=bv,Object.defineProperty(J,"helpers",{enumerable:!0,get:function(){return lv}}),J.init=mv,J.isElementDetachedError=aa,J.isSupersededInitError=ca,J.parseAMP=Av,J.pluginRegistry=ki,J.preload=hv,J.version=pv});
|
|
2159
2183
|
|
|
2160
2184
|
|
|
2161
2185
|
// Возвращаем API из entry модуля
|
|
2162
2186
|
return __useblocks__.syncRequire("useblocks.js");
|
|
2163
2187
|
});
|
|
2164
2188
|
|
|
2165
|
-
__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/
|
|
2189
|
+
__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/11bc33e0.js":[],"static/core/1ed86ed3.js":[],"static/core/248de796.js":[],"static/core/274b5d7a.js":[],"static/core/3fd50a29.js":[],"static/core/4067c5be.js":[],"static/core/453596ac.js":["static/core/e47dcbb0.js","__delivery__/libs","monaco"],"static/core/48da14fd.js":[],"static/core/4b12ae50.js":[],"static/core/50d547f6.js":[],"static/core/549c0ef1.js":[],"static/core/563a690f.js":[],"static/core/5c62f38b.js":["static/core/a3f7b4c9.js"],"static/core/5f949f39.js":[],"static/core/60aa31a3.js":[],"static/core/6561b34a.js":[],"static/core/66619f08.js":[],"static/core/7052d050.js":["__delivery__/libs"],"static/core/7555e955.js":["static/core/a494cc9f.js"],"static/core/7b850506.js":[],"static/core/7c89682e.js":["static/core/e7620593.js","static/core/ff7d14e8.js","__delivery__/libs"],"static/core/83c17079.js":["static/core/8c5284f6.js","static/core/7c89682e.js","static/core/958fe93e.js","static/core/d61988e0.js","__delivery__/libs"],"static/core/8c5284f6.js":[],"static/core/958fe93e.js":["static/core/7c89682e.js","__delivery__/libs"],"static/core/a3f7b4c9.js":[],"static/core/a494cc9f.js":[],"static/core/a6303cb2.js":["static/core/ff7d14e8.js"],"static/core/b8a0f663.js":[],"static/core/bb65f553.js":["static/core/8c5284f6.js","static/core/7c89682e.js","__delivery__/libs"],"static/core/c2f990cf.js":["static/core/ff7d14e8.js","static/core/7c89682e.js","__delivery__/libs"],"static/core/c8d6258e.js":["static/core/a3f7b4c9.js","static/core/a494cc9f.js","static/core/7555e955.js"],"static/core/d58ae4ac.js":["static/core/958fe93e.js","static/core/7052d050.js","__delivery__/libs","static/core/7c89682e.js"],"static/core/d61988e0.js":["static/core/7052d050.js","__delivery__/libs"],"static/core/d887672a.js":[],"static/core/dcc37768.js":[],"static/core/e47dcbb0.js":[],"static/core/e50befab.js":[],"static/core/e50f64f6.js":["static/core/a494cc9f.js"],"static/core/e7620593.js":[],"static/core/fb2fe2db.js":[],"static/core/ff7d14e8.js":[],"static/monaco/editor.api-C9c1WLns.js":[],"monaco":["static/monaco/editor.api-C9c1WLns.js","static/monaco/lspLanguageFeatures-DY3n8M13.js"],"static/monaco/lspLanguageFeatures-DY3n8M13.js":["static/monaco/editor.api-C9c1WLns.js"],"useblocks.js":[],"static/umd/450a82ad.js":[],"static/umd/6639d610.js":["static/umd/b11043e6.js"],"static/umd/b11043e6.js":[],"static/umd/d786efbb.js":[]},"bundles":{"static/core/7052d050.js":["static/core/2827ff97.js","static/core/36f4021e.js","static/core/5ae1e3a3.js"],"static/core/5c62f38b.js":["static/core/a71c4cd8.js"],"static/core/c2f990cf.js":["static/core/8daf15a4.js"],"static/core/d61988e0.js":["static/core/a73da823.js"],"static/core/d58ae4ac.js":["static/core/5b4f83da.js"],"core":["static/core/2ff39ddf.js","static/core/734b5dbf.js","static/core/41d2fa95.js","static/core/727fabd0.js","static/core/caadce3e.js"]}});
|