{"version":3,"file":"module.js","sources":["src/constants/constants.js","src/systems/dnd4e.js","node_modules/svelte/internal/index.mjs","src/helpers/caches.js","src/helpers/sharing-utilities.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/util/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/cssVariables.js","node_modules/svelte/store/index.mjs","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/store/index.js","node_modules/svelte/easing/index.mjs","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/action/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/math/index.js","node_modules/svelte/transition/index.mjs","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/transition/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/TJSGlassPane.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/AppShellContextInternal.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/helper/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/TJSHeaderButton.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/TJSApplicationHeader.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/TJSFocusWrap.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/ResizableHandle.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/ApplicationShell.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/dialog/DialogContent.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/dialog/DialogShell.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/index.js","src/applications/components/SliderInput.svelte","src/applications/dialogs/drop-item-dialog/drop-item-dialog-shell.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationControl.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationManager.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/constants.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/convertRelative.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationAPI.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationGroupControl.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationGroupAPI.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/initial/Centered.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/initial/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/PositionChangeSet.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/PositionData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/PositionStateAPI.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/StyleCache.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/transform/TransformData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/AdapterValidators.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/BasicBounds.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/TransformBounds.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/transform/Transforms.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/update/UpdateElementData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/animate/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/update/UpdateElementManager.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/Position.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/ApplicationState.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/GetSvelteData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/loadSvelteConfig.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/SvelteReactive.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/SvelteApplication.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/TJSDialogData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/TJSDialog.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/index.js","src/applications/dialogs/drop-item-dialog/drop-item-dialog.js","src/applications/item-pile-inventory-app/ListEntry.svelte","src/applications/item-pile-inventory-app/ItemList.svelte","src/applications/item-pile-inventory-app/CurrencyList.svelte","src/applications/components/ActorPicker.svelte","src/plugins/base-plugin.js","src/helpers/transaction.js","src/plugins/simple-calendar.js","src/plugins/levels-3d-preview.js","src/plugins/rarity-colors.js","src/plugins/main.js","src/helpers/compendium-utilities.js","src/stores/pile-item.js","src/applications/dialogs/drop-currency-dialog/drop-currency-dialog-shell.svelte","src/applications/dialogs/drop-currency-dialog/drop-currency-dialog.js","src/stores/item-pile-store.js","src/applications/item-pile-inventory-app/CategorizedItemList.svelte","src/applications/item-pile-inventory-app/item-pile-inventory-shell.svelte","src/applications/components/Tabs.svelte","node_modules/@typhonjs-fvtt/svelte-standard/_dist/fvtt/index.js","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/internal/cssVariables.js","node_modules/@typhonjs-fvtt/svelte-standard/_dist/prosemirror/index.js","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/standard/editor/prosemirror/TJSProseMirror.svelte","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/standard/label/TJSToggleLabel.svelte","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/standard/menu/TJSMenu.svelte","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/standard/menu/context/TJSContextMenuImpl.svelte","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/standard/index.js","src/applications/components/PriceSelector.svelte","src/applications/dialogs/trade-merchant-item-dialog/trade-merchant-item-dialog-shell.svelte","src/applications/dialogs/trade-merchant-item-dialog/trade-merchant-item-dialog.js","src/applications/merchant-app/components/CustomColumn.svelte","src/applications/merchant-app/components/QuantityColumn.svelte","src/applications/merchant-app/components/ItemEntry.svelte","src/applications/item-editor/ItemPriceStore.js","src/applications/components/FilePicker.svelte","node_modules/svelte/animate/index.mjs","node_modules/svelte-dnd-action/src/helpers/dispatcher.js","node_modules/svelte-dnd-action/src/constants.js","node_modules/svelte-dnd-action/src/helpers/intersection.js","node_modules/svelte-dnd-action/src/helpers/listUtil.js","node_modules/svelte-dnd-action/src/helpers/scroller.js","node_modules/svelte-dnd-action/src/helpers/util.js","node_modules/svelte-dnd-action/src/helpers/observer.js","node_modules/svelte-dnd-action/src/helpers/windowScroller.js","node_modules/svelte-dnd-action/src/helpers/svelteNodeClone.js","node_modules/svelte-dnd-action/src/featureFlags.js","node_modules/svelte-dnd-action/src/helpers/styler.js","node_modules/svelte-dnd-action/src/pointerAction.js","node_modules/svelte-dnd-action/src/helpers/aria.js","node_modules/svelte-dnd-action/src/keyboardAction.js","node_modules/svelte-dnd-action/src/action.js","src/applications/components/DropZone.svelte","src/applications/components/PriceList.svelte","src/applications/components/MacroSelector.svelte","src/applications/components/CustomCategoryInput.svelte","src/applications/item-editor/item-editor-shell.svelte","src/applications/item-editor/item-editor.js","src/applications/merchant-app/components/EntryButtons.svelte","src/stores/merchant-store.js","src/applications/dialogs/text-editor-dialog/text-editor-dialog-shell.svelte","src/applications/dialogs/text-editor-dialog/text-editor-dialog.js","src/applications/merchant-app/MerchantLeftPane.svelte","src/applications/merchant-app/MerchantItemEntry.svelte","src/applications/merchant-app/components/CategoryHeader.svelte","src/applications/merchant-app/MerchantItemTab.svelte","src/applications/components/CustomDialog.svelte","src/applications/merchant-app/MerchantPopulateItemsTab.svelte","src/applications/components/CurrencyListEntry.svelte","src/applications/components/CurrencyList.svelte","src/applications/merchant-app/MerchantFooter.svelte","src/applications/merchant-app/MerchantActivityLog.svelte","src/applications/merchant-app/MerchantRightPane.svelte","src/applications/merchant-app/MerchantTopBar.svelte","src/applications/merchant-app/merchant-app-shell.svelte","src/applications/dialogs/user-select-dialog/user-select-dialog-shell.svelte","src/applications/dialogs/user-select-dialog/user-select-dialog.js","src/applications/merchant-app/merchant-app.js","node_modules/@typhonjs-fvtt/svelte-standard/_dist/application/TJSContextMenu.js","src/applications/components/Grid/grid-utils.js","src/applications/components/Grid/GridItem.svelte","src/applications/components/Grid/Grid.svelte","src/applications/vault-app/VaultItemEntry.svelte","src/stores/vault-store.js","src/applications/vault-app/VaultExpanderEntry.svelte","src/applications/components/FloatingElement/FloatingElementImpl.svelte","src/applications/components/FloatingElement/FloatingElement.js","src/applications/vault-app/vault-shell.svelte","src/applications/vault-app/vault-app.js","src/applications/editors/currencies-editor/CurrencyList.svelte","src/applications/editors/currencies-editor/currency-store.js","src/applications/editors/currencies-editor/currencies-editor-shell.svelte","src/applications/editors/Editor.js","src/applications/editors/currencies-editor/currencies-editor.js","src/applications/editors/item-filters-editor/item-filters-editor.svelte","src/applications/editors/item-filters-editor/item-filters-editor.js","src/applications/item-pile-config/settings/main.svelte","src/applications/editors/item-type-price-modifiers-editor/item-type-price-modifiers-editor.svelte","src/applications/editors/item-type-price-modifiers-editor/item-type-price-modifiers-editor.js","src/applications/editors/price-modifiers-editor/price-modifiers-editor-shell.svelte","src/applications/editors/price-modifiers-editor/price-modifiers-editor.js","src/applications/components/PropertyPathInput.svelte","src/applications/editors/string-list-editor/string-list-editor.svelte","src/applications/editors/string-list-editor/string-list-editor.js","src/applications/editors/merchant-columns-editor/merchant-columns-editor-shell.svelte","src/applications/editors/merchant-columns-editor/merchant-columns-editor.js","src/applications/item-pile-config/settings/merchant.svelte","src/applications/item-pile-config/settings/itempile.svelte","src/applications/item-pile-config/settings/container.svelte","src/applications/item-pile-config/settings/sharing.svelte","src/applications/editors/vault-access-editor/vault-access-editor-shell.svelte","src/applications/editors/vault-access-editor/vault-access-editor.js","src/applications/item-pile-config/settings/vault.svelte","src/applications/item-pile-config/settings/custom.svelte","src/applications/item-pile-config/item-pile-config.svelte","src/applications/item-pile-config/item-pile-config.js","src/applications/item-pile-inventory-app/item-pile-inventory-app.js","src/applications/dialogs/receive-items-dialog/receive-items-shell.svelte","src/API/private-api.js","src/hotkeys.js","src/helpers/pile-utilities.js","node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs","node_modules/@floating-ui/core/dist/floating-ui.core.mjs","node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.mjs","node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","node_modules/svelte-floating-ui/index.js","node_modules/svelte-select/filter.js","node_modules/svelte-select/get-items.js","node_modules/svelte-select/ChevronIcon.svelte","node_modules/svelte-select/ClearIcon.svelte","node_modules/svelte-select/LoadingIcon.svelte","node_modules/svelte-select/Select.svelte","src/applications/dialogs/give-items-dialog/give-items-shell.svelte","src/applications/dialogs/give-items-dialog/give-items-dialog.js","src/systems/dnd5e.js","src/systems/dnd5e-2.0.3.js","src/systems/pf1.js","src/applications/components/BasicItemDialog.svelte","src/systems/pf2e.js","src/systems/ds4.js","src/systems/d35e.js","src/systems/sfrpg.js","src/systems/swade.js","src/systems/tormenta20.js","src/systems/wfrp4e.js","src/systems/splittermond.js","src/systems/forbidden-lands.js","src/systems/icrpg.js","src/systems/swse.js","src/systems/sw5e.js","src/systems/sw5e-2.0.3.2.3.8.js","src/systems/fallout.js","src/systems/cyberpunk-red-core.js","src/systems/knave.js","src/systems/t2k4e.js","src/systems/yzecoriolis.js","src/systems/kamigakari.js","src/systems/symbaroum.js","src/systems/wwn.js","src/systems/cyphersystem.js","src/systems/ptu.js","src/systems/dcc.js","src/systems/a5e.js","src/systems/dark-heresy.js","src/systems/naheulbeuk.js","src/systems/icrpgme.js","src/systems/blade-runner.js","src/systems/alienrpg.js","src/systems/pirateborg.js","src/systems/starwarsffg.js","src/systems/demonlord.js","src/systems.js","src/applications/settings-app/Setting.svelte","src/applications/editors/price-preset-editor/price-preset-editor-shell.svelte","src/applications/editors/price-preset-editor/price-preset-editor.js","src/applications/editors/unstackable-item-types-editor/unstackable-item-types-editor.svelte","src/applications/editors/unstackable-item-types-editor/unstackable-item-types-editor.js","src/applications/editors/styles-editor/styles-editor.svelte","src/applications/editors/styles-editor/styles-editor.js","src/applications/editors/vault-styles-editor/StyleEntry.svelte","src/applications/editors/vault-styles-editor/vault-styles-editor.svelte","src/applications/editors/vault-styles-editor/vault-styles-editor.js","src/applications/editors/index.js","src/applications/settings-app/SettingButton.svelte","src/applications/settings-app/settings-shell.svelte","src/applications/settings-app/settings-app.js","src/settings.js","src/constants/settings.js","src/helpers/utilities.js","src/applications/trade-dialogs/ActorDropSelect.svelte","src/applications/trade-dialogs/trade-dialog-prompt.svelte","node_modules/svelte/motion/index.mjs","src/applications/trade-dialogs/trade-dialog-request.svelte","src/applications/trade-dialogs/trade-dialogs.js","src/applications/trading-app/trade-store.js","src/applications/trading-app/TradeEntry.svelte","src/applications/trading-app/trading-app-shell.svelte","src/applications/trading-app/trading-app.js","src/API/trade-api.js","src/API/chat-api.js","src/socket.js","src/helpers/helpers.js","src/foundry-ui-overrides.js","src/libwrapper.js","src/API/api.js","src/migrations.js","src/module.js"],"sourcesContent":["/** @module item_piles_constants */\r\nconst module_name = \"item-piles\";\r\nconst module_path = `modules/${module_name}/`;\r\nconst baseFlag = `flags.${module_name}`\r\n\r\nconst CONSTANTS = {\r\n\r\n\tMODULE_NAME: module_name,\r\n\tPATH: module_path,\r\n\r\n\tACTOR_DELTA_PROPERTY: \"actorData\",\r\n\r\n\tFLAGS: {\r\n\t\tVERSION: `${baseFlag}.version`,\r\n\t\tPILE: `${baseFlag}.data`,\r\n\t\tITEM: `${baseFlag}.item`,\r\n\t\tNO_VERSION: `${baseFlag}.-=version`,\r\n\t\tNO_PILE: `${baseFlag}.-=data`,\r\n\t\tNO_ITEM: `${baseFlag}.-=item`,\r\n\t\tLOG: `${baseFlag}.log`,\r\n\t\tSHARING: `${baseFlag}.sharing`,\r\n\t\tPUBLIC_TRADE_ID: `${baseFlag}.publicTradeId`,\r\n\t\tTRADE_USERS: `${baseFlag}.tradeUsers`,\r\n\t\tTEMPORARY_ITEM: `${baseFlag}.temporary_item`,\r\n\t\tCUSTOM_CATEGORY: `${baseFlag}.item.customCategory`\r\n\t},\r\n\r\n\tSIMPLE_FLAGS: {\r\n\t\tVERSION: `${module_name}.version`,\r\n\t\tPILE: `${module_name}.data`,\r\n\t\tITEM: `${module_name}.item`,\r\n\t\tNO_VERSION: `${module_name}.-=version`,\r\n\t\tNO_PILE: `${module_name}.-=data`,\r\n\t\tNO_ITEM: `${module_name}.-=item`,\r\n\t\tLOG: `${module_name}.log`,\r\n\t\tSHARING: `${module_name}.sharing`,\r\n\t\tPUBLIC_TRADE_ID: `${module_name}.publicTradeId`,\r\n\t\tTRADE_USERS: `${module_name}.tradeUsers`,\r\n\t\tTEMPORARY_ITEM: `${module_name}.temporary_item`,\r\n\t\tCUSTOM_CATEGORY: `${module_name}.item.customCategory`\r\n\t},\r\n\r\n\tITEM_DEFAULTS: {\r\n\t\t// Merchants\r\n\t\thidden: false,\r\n\t\tnotForSale: false,\r\n\t\tinfiniteQuantity: \"default\",\r\n\t\tdisplayQuantity: \"default\",\r\n\t\tfree: false,\r\n\t\tkeepZeroQuantity: false,\r\n\t\tdisableNormalCost: false,\r\n\t\tcantBeSoldToMerchants: false,\r\n\t\tisService: false,\r\n\t\tkeepOnMerchant: false,\r\n\t\tmacro: \"\",\r\n\t\tcustomCategory: \"\",\r\n\t\tprices: [],\r\n\r\n\t\t// Vaults\r\n\t\tvaultExpander: false,\r\n\t\tvaultSlot: null,\r\n\t\taddsCols: 0,\r\n\t\taddsRows: 0,\r\n\t\tx: null,\r\n\t\ty: null,\r\n\t\twidth: 1,\r\n\t\theight: 1,\r\n\t\tflipped: false,\r\n\t\tvaultImage: \"\",\r\n\t\tvaultImageFlipped: \"\",\r\n\t\tcanStack: \"default\"\r\n\t},\r\n\r\n\tPILE_TYPES: {\r\n\t\tPILE: \"pile\",\r\n\t\tCONTAINER: \"container\",\r\n\t\tMERCHANT: \"merchant\",\r\n\t\tVAULT: \"vault\"\r\n\t},\r\n\r\n\tVAULT_LOGGING_TYPES: {\r\n\t\tUSER_ACTOR: \"user_actor\",\r\n\t\tUSER: \"user\",\r\n\t\tACTOR: \"actor\",\r\n\t},\r\n\r\n\tCUSTOM_PILE_TYPES: {},\r\n\r\n\tPILE_DEFAULTS: {\r\n\t\t// Core settings\r\n\t\tenabled: false,\r\n\t\ttype: \"pile\",\r\n\t\tdistance: 1,\r\n\t\tmacro: \"\",\r\n\t\tdeleteWhenEmpty: \"default\",\r\n\t\tcanStackItems: \"yes\",\r\n\t\tcanInspectItems: true,\r\n\t\tdisplayItemTypes: false,\r\n\t\tdescription: \"\",\r\n\r\n\t\t// Overrides\r\n\t\toverrideItemFilters: false,\r\n\t\toverrideCurrencies: false,\r\n\t\toverrideSecondaryCurrencies: false,\r\n\r\n\t\t// Token settings\r\n\t\tdisplayOne: false,\r\n\t\tshowItemName: false,\r\n\t\toverrideSingleItemScale: false,\r\n\t\tsingleItemScale: 1.0,\r\n\r\n\t\t// Sharing settings\r\n\t\tshareItemsEnabled: false,\r\n\t\tshareCurrenciesEnabled: true,\r\n\t\ttakeAllEnabled: false,\r\n\t\tsplitAllEnabled: true,\r\n\t\tactivePlayers: false,\r\n\r\n\t\t// Container settings\r\n\t\tclosed: false,\r\n\t\tlocked: false,\r\n\t\tclosedImage: \"\",\r\n\t\tclosedImages: [],\r\n\t\temptyImage: \"\",\r\n\t\temptyImages: [],\r\n\t\topenedImage: \"\",\r\n\t\topenedImages: [],\r\n\t\tlockedImage: \"\",\r\n\t\tlockedImages: [],\r\n\t\tcloseSound: \"\",\r\n\t\tcloseSounds: [],\r\n\t\topenSound: \"\",\r\n\t\topenSounds: [],\r\n\t\tlockedSound: \"\",\r\n\t\tlockedSounds: [],\r\n\t\tunlockedSound: \"\",\r\n\t\tunlockedSounds: [],\r\n\r\n\t\t// Merchant settings\r\n\t\tmerchantImage: \"\",\r\n\t\tinfiniteQuantity: false,\r\n\t\tinfiniteCurrencies: true,\r\n\t\tpurchaseOnly: false,\r\n\t\thideNewItems: false,\r\n\t\thideItemsWithZeroCost: false,\r\n\t\tkeepZeroQuantity: false,\r\n\t\tonlyAcceptBasePrice: true,\r\n\t\tdisplayQuantity: \"yes\",\r\n\t\tbuyPriceModifier: 1,\r\n\t\tsellPriceModifier: 0.5,\r\n\t\titemTypePriceModifiers: [],\r\n\t\tactorPriceModifiers: [],\r\n\t\ttablesForPopulate: [],\r\n\t\tmerchantColumns: [],\r\n\t\thideTokenWhenClosed: false,\r\n\t\topenTimes: {\r\n\t\t\tenabled: false,\r\n\t\t\tstatus: \"open\",\r\n\t\t\t/*\r\n\t\t\tauto = rely on simple calendar\r\n\t\t\topen = always open\r\n\t\t\tclosed = always closed\r\n\t\t\t */\r\n\t\t\topen: {\r\n\t\t\t\thour: 9,\r\n\t\t\t\tminute: 0\r\n\t\t\t},\r\n\t\t\tclose: {\r\n\t\t\t\thour: 18,\r\n\t\t\t\tminute: 0\r\n\t\t\t},\r\n\t\t},\r\n\t\tclosedDays: [],\r\n\t\tclosedHolidays: [],\r\n\t\trefreshItemsOnOpen: false,\r\n\t\trefreshItemsDays: [],\r\n\t\trefreshItemsHolidays: [],\r\n\t\tlogMerchantActivity: false,\r\n\r\n\t\t// Vault settings\r\n\t\tcols: 10,\r\n\t\trows: 5,\r\n\t\trestrictVaultAccess: false,\r\n\t\tvaultExpansion: false,\r\n\t\tbaseExpansionCols: 0,\r\n\t\tbaseExpansionRows: 0,\r\n\t\tvaultAccess: [],\r\n\t\tlogVaultActions: false,\r\n\t\tvaultLogType: \"user_actor\"\r\n\t}\r\n}\r\n\r\nCONSTANTS.ITEM_FORCED_UNIQUE_KEYS = [\"vaultExpander\"]\r\n\t.map(val => CONSTANTS.FLAGS.ITEM + \".\" + val);\r\n\r\nconst prefix = (string) => (strings, ...expressions) => `${string}-${strings.reduce((a, c, i) => a + expressions[i - 1] + c)}`\r\nconst module = prefix(CONSTANTS.MODULE_NAME);\r\n\r\nCONSTANTS.HOOKS = {\r\n\tREADY: module`ready`,\r\n\tRESET_SETTINGS: module`resetSettings`,\r\n\tDRAG_DOCUMENT: module`onDragDocument`,\r\n\tDROP_DOCUMENT: module`onDropDocument`,\r\n\tPRE_TRANSFER_EVERYTHING: module`preTransferEverything`,\r\n\tTRANSFER_EVERYTHING: module`transferEverything`,\r\n\tPRE_RENDER_SHEET: module`preRenderActorSheet`,\r\n\tPRE_RENDER_INTERFACE: module`preRenderInterface`,\r\n\tPRE_OPEN_INTERFACE: module`preOpenInterface`,\r\n\tOPEN_INTERFACE: module`openInterface`,\r\n\tPRE_CLOSE_INTERFACE: module`preCloseInterface`,\r\n\tCLOSE_INTERFACE: module`closeInterface`,\r\n\tRENDER_VAULT_GRID_ITEM: module`renderVaultGridItem`,\r\n\tPILE: {\r\n\t\tPRE_CREATE: module`preCreateItemPile`,\r\n\t\tCREATE: module`createItemPile`,\r\n\t\tPRE_UPDATE: module`preUpdateItemPile`,\r\n\t\tUPDATE: module`updateItemPile`,\r\n\t\tPRE_DELETE: module`preDeleteItemPile`,\r\n\t\tDELETE: module`deleteItemPile`,\r\n\t\tPRE_CLOSE: module`preCloseItemPile`,\r\n\t\tCLOSE: module`closeItemPile`,\r\n\t\tPRE_OPEN: module`preOpenItemPile`,\r\n\t\tOPEN: module`openItemPile`,\r\n\t\tPRE_LOCK: module`preLockItemPile`,\r\n\t\tLOCK: module`lockItemPile`,\r\n\t\tPRE_UNLOCK: module`preUnlockItemPile`,\r\n\t\tUNLOCK: module`unlockItemPile`,\r\n\t\tPRE_RATTLE: module`preRattleItemPile`,\r\n\t\tRATTLE: module`rattleItemPile`,\r\n\t\tPRE_TURN_INTO: module`preTurnIntoItemPiles`,\r\n\t\tTURN_INTO: module`turnIntoItemPiles`,\r\n\t\tPRE_REVERT_FROM: module`preRevertFromItemPiles`,\r\n\t\tREVERT_FROM: module`revertFromItemPiles`,\r\n\t\tPRE_SPLIT_INVENTORY: module`preSplitItemPileContent`,\r\n\t\tSPLIT_INVENTORY: module`splitItemPileContent`,\r\n\t\tPRE_CLICK: module`preClickItemPile`,\r\n\t\tPRE_DIRECTORY_CLICK: module`preClickDirectoryItemPile`,\r\n\t\tPRE_RIGHT_CLICK_ITEM: module`preRightClickItem`,\r\n\t\tPRE_REFRESH_INVENTORY: module`preRefreshInventory`\r\n\t},\r\n\tITEM: {\r\n\t\tPRE_DROP_DETERMINED: module`preDropItemDetermined`,\r\n\t\tPRE_DROP: module`preDropItem`,\r\n\t\tDROP: module`dropItem`,\r\n\t\tPRE_TRANSFER: module`preTransferItems`,\r\n\t\tTRANSFER: module`transferItems`,\r\n\t\tPRE_ADD: module`preAddItems`,\r\n\t\tADD: module`addItems`,\r\n\t\tPRE_REMOVE: module`preRemoveItems`,\r\n\t\tREMOVE: module`removeItems`,\r\n\t\tPRE_TRANSFER_ALL: module`preTransferAllItems`,\r\n\t\tTRANSFER_ALL: module`transferAllItems`,\r\n\t\tPRE_CALC_TRADE: module`preCalculateTradeItems`,\r\n\t\tPRE_TRADE: module`preTradeItems`,\r\n\t\tTRADE: module`tradeItems`,\r\n\t\tPRE_GIVE: module`preGiveItem`,\r\n\t\tGIVE: module`giveItem`,\r\n\t},\r\n\tCURRENCY: {\r\n\t\tPRE_TRANSFER: module`preTransferCurrencies`,\r\n\t\tTRANSFER: module`transferCurrencies`,\r\n\t\tPRE_ADD: module`preAddCurrencies`,\r\n\t\tADD: module`addCurrencies`,\r\n\t\tPRE_REMOVE: module`preRemoveCurrencies`,\r\n\t\tREMOVE: module`removeCurrencies`,\r\n\t\tPRE_TRANSFER_ALL: module`preTransferAllCurrencies`,\r\n\t\tTRANSFER_ALL: module`transferAllCurrencies`,\r\n\t},\r\n\tATTRIBUTE: {\r\n\t\tPRE_TRANSFER: module`preTransferAttributes`,\r\n\t\tTRANSFER: module`transferAttributes`,\r\n\t\tPRE_SET: module`preSetAttributes`,\r\n\t\tSET: module`setAttributes`,\r\n\t\tPRE_ADD: module`preAddAttributes`,\r\n\t\tADD: module`addAttributes`,\r\n\t\tPRE_REMOVE: module`preRemoveAttributes`,\r\n\t\tREMOVE: module`removeAttributes`,\r\n\t\tPRE_TRANSFER_ALL: module`preTransferAllAttributes`,\r\n\t\tTRANSFER_ALL: module`transferAllAttributes`,\r\n\t},\r\n\tTRADE: {\r\n\t\tSTARTED: module`tradeStarted`,\r\n\t\tCOMPLETE: module`tradeComplete`\r\n\t}\r\n}\r\n\r\nexport default CONSTANTS;\r\n","export default {\r\n\r\n\t\"VERSION\": \"1.0.4\",\r\n\r\n\t// The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n\t\"ACTOR_CLASS_TYPE\": \"Player Character\",\r\n\r\n\t// The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n\t\"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n\t// The item price attribute is the path to the attribute on each item that determine how much it costs\r\n\t\"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n\t// Item filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n\t\"ITEM_FILTERS\": [\r\n\t\t{\r\n\t\t\t\"path\": \"type\",\r\n\t\t\t\"filters\": \"classFeats,feat,raceFeats,pathFeats,destinyFeats,ritual,power\"\r\n\t\t}\r\n\t],\r\n\r\n\t// This function is an optional system handler that specifically transforms an item when it is added to actors\r\n\t\"ITEM_TRANSFORMER\": async (itemData) => {\r\n\t\t[\"equipped\", \"proficient\", \"prepared\"].forEach(key => {\r\n\t\t\tif (itemData?.system?.[key] !== undefined) {\r\n\t\t\t\tdelete itemData.system[key];\r\n\t\t\t}\r\n\t\t});\r\n\t\tsetProperty(itemData, \"system.attunement\", false);\r\n\t\treturn itemData;\r\n\t},\r\n\r\n\t// Item similarities determines how item piles detect similarities and differences in the system\r\n\t\"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n\t// Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n\t// In the case of attributes, the path is relative to the \"actor.system\"\r\n\t// In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n\t\"CURRENCIES\": [\r\n\t\t{\r\n\t\t\ttype: \"attribute\",\r\n\t\t\tname: \"DND4EBETA.CurrencyAD\",\r\n\t\t\timg: \"icons/commodities/gems/gem-faceted-round-white.webp\",\r\n\t\t\tabbreviation: \"{#}AD\",\r\n\t\t\tdata: {\r\n\t\t\t\tpath: \"system.currency.ad\"\r\n\t\t\t},\r\n\t\t\tprimary: false,\r\n\t\t\texchangeRate: 10000\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"attribute\",\r\n\t\t\tname: \"DND4EBETA.CurrencyPP\",\r\n\t\t\timg: \"icons/commodities/currency/coin-inset-snail-silver.webp\",\r\n\t\t\tabbreviation: \"{#}PP\",\r\n\t\t\tdata: {\r\n\t\t\t\tpath: \"system.currency.pp\"\r\n\t\t\t},\r\n\t\t\tprimary: false,\r\n\t\t\texchangeRate: 100\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"attribute\",\r\n\t\t\tname: \"DND4EBETA.CurrencyGP\",\r\n\t\t\timg: \"icons/commodities/currency/coin-embossed-crown-gold.webp\",\r\n\t\t\tabbreviation: \"{#}GP\",\r\n\t\t\tdata: {\r\n\t\t\t\tpath: \"system.currency.gp\",\r\n\t\t\t},\r\n\t\t\tprimary: true,\r\n\t\t\texchangeRate: 1\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"attribute\",\r\n\t\t\tname: \"DND4EBETA.CurrencySP\",\r\n\t\t\timg: \"icons/commodities/currency/coin-engraved-moon-silver.webp\",\r\n\t\t\tabbreviation: \"{#}SP\",\r\n\t\t\tdata: {\r\n\t\t\t\tpath: \"system.currency.sp\",\r\n\t\t\t},\r\n\t\t\tprimary: false,\r\n\t\t\texchangeRate: 0.1\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"attribute\",\r\n\t\t\tname: \"DND4EBETA.CurrencyCP\",\r\n\t\t\timg: \"icons/commodities/currency/coin-engraved-waves-copper.webp\",\r\n\t\t\tabbreviation: \"{#}CP\",\r\n\t\t\tdata: {\r\n\t\t\t\tpath: \"system.currency.cp\",\r\n\t\t\t},\r\n\t\t\tprimary: false,\r\n\t\t\texchangeRate: 0.01\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"attribute\",\r\n\t\t\tname: \"DND4EBETA.RitualCompAR\",\r\n\t\t\timg: \"icons/commodities/materials/bowl-powder-teal.webp\",\r\n\t\t\tabbreviation: \"{#}AR\",\r\n\t\t\tdata: {\r\n\t\t\t\tpath: \"system.ritualcomp.ar\",\r\n\t\t\t},\r\n\t\t\tprimary: false,\r\n\t\t\texchangeRate: 1\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"attribute\",\r\n\t\t\tname: \"DND4EBETA.RitualCompMS\",\r\n\t\t\timg: \"icons/commodities/materials/bowl-liquid-white.webp\",\r\n\t\t\tabbreviation: \"{#}MS\",\r\n\t\t\tdata: {\r\n\t\t\t\tpath: \"system.ritualcomp.ms\",\r\n\t\t\t},\r\n\t\t\tprimary: false,\r\n\t\t\texchangeRate: 1\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"attribute\",\r\n\t\t\tname: \"DND4EBETA.RitualCompRH\",\r\n\t\t\timg: \"icons/commodities/materials/plant-sprout-seed-brown-green.webp\",\r\n\t\t\tabbreviation: \"{#}RH\",\r\n\t\t\tdata: {\r\n\t\t\t\tpath: \"system.ritualcomp.rh\",\r\n\t\t\t},\r\n\t\t\tprimary: false,\r\n\t\t\texchangeRate: 1\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"attribute\",\r\n\t\t\tname: \"DND4EBETA.RitualCompSI\",\r\n\t\t\timg: \"icons/commodities/materials/bowl-liquid-red.webp\",\r\n\t\t\tabbreviation: \"{#}SI\",\r\n\t\t\tdata: {\r\n\t\t\t\tpath: \"system.ritualcomp.si\",\r\n\t\t\t},\r\n\t\t\tprimary: false,\r\n\t\t\texchangeRate: 1\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype: \"attribute\",\r\n\t\t\tname: \"DND4EBETA.RitualCompRS\",\r\n\t\t\timg: \"icons/commodities/gems/gem-faceted-cushion-teal.webp\",\r\n\t\t\tabbreviation: \"{#}RS\",\r\n\t\t\tdata: {\r\n\t\t\t\tpath: \"system.ritualcomp.rs\",\r\n\t\t\t},\r\n\t\t\tprimary: false,\r\n\t\t\texchangeRate: 1\r\n\t\t}\r\n\t]\r\n}\r\n","function noop() { }\nconst identity = x => x;\nfunction assign(tar, src) {\n // @ts-ignore\n for (const k in src)\n tar[k] = src[k];\n return tar;\n}\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\nfunction is_promise(value) {\n return !!value && (typeof value === 'object' || typeof value === 'function') && typeof value.then === 'function';\n}\nfunction add_location(element, file, line, column, char) {\n element.__svelte_meta = {\n loc: { file, line, column, char }\n };\n}\nfunction run(fn) {\n return fn();\n}\nfunction blank_object() {\n return Object.create(null);\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === 'function';\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');\n}\nlet src_url_equal_anchor;\nfunction src_url_equal(element_src, url) {\n if (!src_url_equal_anchor) {\n src_url_equal_anchor = document.createElement('a');\n }\n src_url_equal_anchor.href = url;\n return element_src === src_url_equal_anchor.href;\n}\nfunction not_equal(a, b) {\n return a != a ? b == b : a !== b;\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nfunction validate_store(store, name) {\n if (store != null && typeof store.subscribe !== 'function') {\n throw new Error(`'${name}' is not a store with a 'subscribe' method`);\n }\n}\nfunction subscribe(store, ...callbacks) {\n if (store == null) {\n return noop;\n }\n const unsub = store.subscribe(...callbacks);\n return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\nfunction get_store_value(store) {\n let value;\n subscribe(store, _ => value = _)();\n return value;\n}\nfunction component_subscribe(component, store, callback) {\n component.$$.on_destroy.push(subscribe(store, callback));\n}\nfunction create_slot(definition, ctx, $$scope, fn) {\n if (definition) {\n const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n return definition[0](slot_ctx);\n }\n}\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n return definition[1] && fn\n ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))\n : $$scope.ctx;\n}\nfunction get_slot_changes(definition, $$scope, dirty, fn) {\n if (definition[2] && fn) {\n const lets = definition[2](fn(dirty));\n if ($$scope.dirty === undefined) {\n return lets;\n }\n if (typeof lets === 'object') {\n const merged = [];\n const len = Math.max($$scope.dirty.length, lets.length);\n for (let i = 0; i < len; i += 1) {\n merged[i] = $$scope.dirty[i] | lets[i];\n }\n return merged;\n }\n return $$scope.dirty | lets;\n }\n return $$scope.dirty;\n}\nfunction update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {\n if (slot_changes) {\n const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n slot.p(slot_context, slot_changes);\n }\n}\nfunction update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) {\n const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn);\n}\nfunction get_all_dirty_from_scope($$scope) {\n if ($$scope.ctx.length > 32) {\n const dirty = [];\n const length = $$scope.ctx.length / 32;\n for (let i = 0; i < length; i++) {\n dirty[i] = -1;\n }\n return dirty;\n }\n return -1;\n}\nfunction exclude_internal_props(props) {\n const result = {};\n for (const k in props)\n if (k[0] !== '$')\n result[k] = props[k];\n return result;\n}\nfunction compute_rest_props(props, keys) {\n const rest = {};\n keys = new Set(keys);\n for (const k in props)\n if (!keys.has(k) && k[0] !== '$')\n rest[k] = props[k];\n return rest;\n}\nfunction compute_slots(slots) {\n const result = {};\n for (const key in slots) {\n result[key] = true;\n }\n return result;\n}\nfunction once(fn) {\n let ran = false;\n return function (...args) {\n if (ran)\n return;\n ran = true;\n fn.call(this, ...args);\n };\n}\nfunction null_to_empty(value) {\n return value == null ? '' : value;\n}\nfunction set_store_value(store, ret, value) {\n store.set(value);\n return ret;\n}\nconst has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\nfunction action_destroyer(action_result) {\n return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\nfunction split_css_unit(value) {\n const split = typeof value === 'string' && value.match(/^\\s*(-?[\\d.]+)([^\\s]*)\\s*$/);\n return split ? [parseFloat(split[1]), split[2] || 'px'] : [value, 'px'];\n}\nconst contenteditable_truthy_values = ['', true, 1, 'true', 'contenteditable'];\n\nconst is_client = typeof window !== 'undefined';\nlet now = is_client\n ? () => window.performance.now()\n : () => Date.now();\nlet raf = is_client ? cb => requestAnimationFrame(cb) : noop;\n// used internally for testing\nfunction set_now(fn) {\n now = fn;\n}\nfunction set_raf(fn) {\n raf = fn;\n}\n\nconst tasks = new Set();\nfunction run_tasks(now) {\n tasks.forEach(task => {\n if (!task.c(now)) {\n tasks.delete(task);\n task.f();\n }\n });\n if (tasks.size !== 0)\n raf(run_tasks);\n}\n/**\n * For testing purposes only!\n */\nfunction clear_loops() {\n tasks.clear();\n}\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n */\nfunction loop(callback) {\n let task;\n if (tasks.size === 0)\n raf(run_tasks);\n return {\n promise: new Promise(fulfill => {\n tasks.add(task = { c: callback, f: fulfill });\n }),\n abort() {\n tasks.delete(task);\n }\n };\n}\n\nconst globals = (typeof window !== 'undefined'\n ? window\n : typeof globalThis !== 'undefined'\n ? globalThis\n : global);\n\n/**\n * Resize observer singleton.\n * One listener per element only!\n * https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ\n */\nclass ResizeObserverSingleton {\n constructor(options) {\n this.options = options;\n this._listeners = 'WeakMap' in globals ? new WeakMap() : undefined;\n }\n observe(element, listener) {\n this._listeners.set(element, listener);\n this._getObserver().observe(element, this.options);\n return () => {\n this._listeners.delete(element);\n this._observer.unobserve(element); // this line can probably be removed\n };\n }\n _getObserver() {\n var _a;\n return (_a = this._observer) !== null && _a !== void 0 ? _a : (this._observer = new ResizeObserver((entries) => {\n var _a;\n for (const entry of entries) {\n ResizeObserverSingleton.entries.set(entry.target, entry);\n (_a = this._listeners.get(entry.target)) === null || _a === void 0 ? void 0 : _a(entry);\n }\n }));\n }\n}\n// Needs to be written like this to pass the tree-shake-test\nResizeObserverSingleton.entries = 'WeakMap' in globals ? new WeakMap() : undefined;\n\n// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM\n// at the end of hydration without touching the remaining nodes.\nlet is_hydrating = false;\nfunction start_hydrating() {\n is_hydrating = true;\n}\nfunction end_hydrating() {\n is_hydrating = false;\n}\nfunction upper_bound(low, high, key, value) {\n // Return first index of value larger than input value in the range [low, high)\n while (low < high) {\n const mid = low + ((high - low) >> 1);\n if (key(mid) <= value) {\n low = mid + 1;\n }\n else {\n high = mid;\n }\n }\n return low;\n}\nfunction init_hydrate(target) {\n if (target.hydrate_init)\n return;\n target.hydrate_init = true;\n // We know that all children have claim_order values since the unclaimed have been detached if target is not \n let children = target.childNodes;\n // If target is , there may be children without claim_order\n if (target.nodeName === 'HEAD') {\n const myChildren = [];\n for (let i = 0; i < children.length; i++) {\n const node = children[i];\n if (node.claim_order !== undefined) {\n myChildren.push(node);\n }\n }\n children = myChildren;\n }\n /*\n * Reorder claimed children optimally.\n * We can reorder claimed children optimally by finding the longest subsequence of\n * nodes that are already claimed in order and only moving the rest. The longest\n * subsequence of nodes that are claimed in order can be found by\n * computing the longest increasing subsequence of .claim_order values.\n *\n * This algorithm is optimal in generating the least amount of reorder operations\n * possible.\n *\n * Proof:\n * We know that, given a set of reordering operations, the nodes that do not move\n * always form an increasing subsequence, since they do not move among each other\n * meaning that they must be already ordered among each other. Thus, the maximal\n * set of nodes that do not move form a longest increasing subsequence.\n */\n // Compute longest increasing subsequence\n // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j\n const m = new Int32Array(children.length + 1);\n // Predecessor indices + 1\n const p = new Int32Array(children.length);\n m[0] = -1;\n let longest = 0;\n for (let i = 0; i < children.length; i++) {\n const current = children[i].claim_order;\n // Find the largest subsequence length such that it ends in a value less than our current value\n // upper_bound returns first greater value, so we subtract one\n // with fast path for when we are on the current longest subsequence\n const seqLen = ((longest > 0 && children[m[longest]].claim_order <= current) ? longest + 1 : upper_bound(1, longest, idx => children[m[idx]].claim_order, current)) - 1;\n p[i] = m[seqLen] + 1;\n const newLen = seqLen + 1;\n // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.\n m[newLen] = i;\n longest = Math.max(newLen, longest);\n }\n // The longest increasing subsequence of nodes (initially reversed)\n const lis = [];\n // The rest of the nodes, nodes that will be moved\n const toMove = [];\n let last = children.length - 1;\n for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {\n lis.push(children[cur - 1]);\n for (; last >= cur; last--) {\n toMove.push(children[last]);\n }\n last--;\n }\n for (; last >= 0; last--) {\n toMove.push(children[last]);\n }\n lis.reverse();\n // We sort the nodes being moved to guarantee that their insertion order matches the claim order\n toMove.sort((a, b) => a.claim_order - b.claim_order);\n // Finally, we move the nodes\n for (let i = 0, j = 0; i < toMove.length; i++) {\n while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {\n j++;\n }\n const anchor = j < lis.length ? lis[j] : null;\n target.insertBefore(toMove[i], anchor);\n }\n}\nfunction append(target, node) {\n target.appendChild(node);\n}\nfunction append_styles(target, style_sheet_id, styles) {\n const append_styles_to = get_root_for_style(target);\n if (!append_styles_to.getElementById(style_sheet_id)) {\n const style = element('style');\n style.id = style_sheet_id;\n style.textContent = styles;\n append_stylesheet(append_styles_to, style);\n }\n}\nfunction get_root_for_style(node) {\n if (!node)\n return document;\n const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;\n if (root && root.host) {\n return root;\n }\n return node.ownerDocument;\n}\nfunction append_empty_stylesheet(node) {\n const style_element = element('style');\n append_stylesheet(get_root_for_style(node), style_element);\n return style_element.sheet;\n}\nfunction append_stylesheet(node, style) {\n append(node.head || node, style);\n return style.sheet;\n}\nfunction append_hydration(target, node) {\n if (is_hydrating) {\n init_hydrate(target);\n if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentNode !== target))) {\n target.actual_end_child = target.firstChild;\n }\n // Skip nodes of undefined ordering\n while ((target.actual_end_child !== null) && (target.actual_end_child.claim_order === undefined)) {\n target.actual_end_child = target.actual_end_child.nextSibling;\n }\n if (node !== target.actual_end_child) {\n // We only insert if the ordering of this node should be modified or the parent node is not target\n if (node.claim_order !== undefined || node.parentNode !== target) {\n target.insertBefore(node, target.actual_end_child);\n }\n }\n else {\n target.actual_end_child = node.nextSibling;\n }\n }\n else if (node.parentNode !== target || node.nextSibling !== null) {\n target.appendChild(node);\n }\n}\nfunction insert(target, node, anchor) {\n target.insertBefore(node, anchor || null);\n}\nfunction insert_hydration(target, node, anchor) {\n if (is_hydrating && !anchor) {\n append_hydration(target, node);\n }\n else if (node.parentNode !== target || node.nextSibling != anchor) {\n target.insertBefore(node, anchor || null);\n }\n}\nfunction detach(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\nfunction destroy_each(iterations, detaching) {\n for (let i = 0; i < iterations.length; i += 1) {\n if (iterations[i])\n iterations[i].d(detaching);\n }\n}\nfunction element(name) {\n return document.createElement(name);\n}\nfunction element_is(name, is) {\n return document.createElement(name, { is });\n}\nfunction object_without_properties(obj, exclude) {\n const target = {};\n for (const k in obj) {\n if (has_prop(obj, k)\n // @ts-ignore\n && exclude.indexOf(k) === -1) {\n // @ts-ignore\n target[k] = obj[k];\n }\n }\n return target;\n}\nfunction svg_element(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n}\nfunction text(data) {\n return document.createTextNode(data);\n}\nfunction space() {\n return text(' ');\n}\nfunction empty() {\n return text('');\n}\nfunction comment(content) {\n return document.createComment(content);\n}\nfunction listen(node, event, handler, options) {\n node.addEventListener(event, handler, options);\n return () => node.removeEventListener(event, handler, options);\n}\nfunction prevent_default(fn) {\n return function (event) {\n event.preventDefault();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_propagation(fn) {\n return function (event) {\n event.stopPropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_immediate_propagation(fn) {\n return function (event) {\n event.stopImmediatePropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction self(fn) {\n return function (event) {\n // @ts-ignore\n if (event.target === this)\n fn.call(this, event);\n };\n}\nfunction trusted(fn) {\n return function (event) {\n // @ts-ignore\n if (event.isTrusted)\n fn.call(this, event);\n };\n}\nfunction attr(node, attribute, value) {\n if (value == null)\n node.removeAttribute(attribute);\n else if (node.getAttribute(attribute) !== value)\n node.setAttribute(attribute, value);\n}\n/**\n * List of attributes that should always be set through the attr method,\n * because updating them through the property setter doesn't work reliably.\n * In the example of `width`/`height`, the problem is that the setter only\n * accepts numeric values, but the attribute can also be set to a string like `50%`.\n * If this list becomes too big, rethink this approach.\n */\nconst always_set_through_set_attribute = ['width', 'height'];\nfunction set_attributes(node, attributes) {\n // @ts-ignore\n const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n for (const key in attributes) {\n if (attributes[key] == null) {\n node.removeAttribute(key);\n }\n else if (key === 'style') {\n node.style.cssText = attributes[key];\n }\n else if (key === '__value') {\n node.value = node[key] = attributes[key];\n }\n else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) {\n node[key] = attributes[key];\n }\n else {\n attr(node, key, attributes[key]);\n }\n }\n}\nfunction set_svg_attributes(node, attributes) {\n for (const key in attributes) {\n attr(node, key, attributes[key]);\n }\n}\nfunction set_custom_element_data_map(node, data_map) {\n Object.keys(data_map).forEach((key) => {\n set_custom_element_data(node, key, data_map[key]);\n });\n}\nfunction set_custom_element_data(node, prop, value) {\n if (prop in node) {\n node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;\n }\n else {\n attr(node, prop, value);\n }\n}\nfunction set_dynamic_element_data(tag) {\n return (/-/.test(tag)) ? set_custom_element_data_map : set_attributes;\n}\nfunction xlink_attr(node, attribute, value) {\n node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\nfunction get_binding_group_value(group, __value, checked) {\n const value = new Set();\n for (let i = 0; i < group.length; i += 1) {\n if (group[i].checked)\n value.add(group[i].__value);\n }\n if (!checked) {\n value.delete(__value);\n }\n return Array.from(value);\n}\nfunction init_binding_group(group) {\n let _inputs;\n return {\n /* push */ p(...inputs) {\n _inputs = inputs;\n _inputs.forEach(input => group.push(input));\n },\n /* remove */ r() {\n _inputs.forEach(input => group.splice(group.indexOf(input), 1));\n }\n };\n}\nfunction init_binding_group_dynamic(group, indexes) {\n let _group = get_binding_group(group);\n let _inputs;\n function get_binding_group(group) {\n for (let i = 0; i < indexes.length; i++) {\n group = group[indexes[i]] = group[indexes[i]] || [];\n }\n return group;\n }\n function push() {\n _inputs.forEach(input => _group.push(input));\n }\n function remove() {\n _inputs.forEach(input => _group.splice(_group.indexOf(input), 1));\n }\n return {\n /* update */ u(new_indexes) {\n indexes = new_indexes;\n const new_group = get_binding_group(group);\n if (new_group !== _group) {\n remove();\n _group = new_group;\n push();\n }\n },\n /* push */ p(...inputs) {\n _inputs = inputs;\n push();\n },\n /* remove */ r: remove\n };\n}\nfunction to_number(value) {\n return value === '' ? null : +value;\n}\nfunction time_ranges_to_array(ranges) {\n const array = [];\n for (let i = 0; i < ranges.length; i += 1) {\n array.push({ start: ranges.start(i), end: ranges.end(i) });\n }\n return array;\n}\nfunction children(element) {\n return Array.from(element.childNodes);\n}\nfunction init_claim_info(nodes) {\n if (nodes.claim_info === undefined) {\n nodes.claim_info = { last_index: 0, total_claimed: 0 };\n }\n}\nfunction claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {\n // Try to find nodes in an order such that we lengthen the longest increasing subsequence\n init_claim_info(nodes);\n const resultNode = (() => {\n // We first try to find an element after the previous one\n for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n return node;\n }\n }\n // Otherwise, we try to find one before\n // We iterate in reverse so that we don't go too far back\n for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n else if (replacement === undefined) {\n // Since we spliced before the last_index, we decrease it\n nodes.claim_info.last_index--;\n }\n return node;\n }\n }\n // If we can't find any matching node, we create a new one\n return createNode();\n })();\n resultNode.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n return resultNode;\n}\nfunction claim_element_base(nodes, name, attributes, create_element) {\n return claim_node(nodes, (node) => node.nodeName === name, (node) => {\n const remove = [];\n for (let j = 0; j < node.attributes.length; j++) {\n const attribute = node.attributes[j];\n if (!attributes[attribute.name]) {\n remove.push(attribute.name);\n }\n }\n remove.forEach(v => node.removeAttribute(v));\n return undefined;\n }, () => create_element(name));\n}\nfunction claim_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, element);\n}\nfunction claim_svg_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, svg_element);\n}\nfunction claim_text(nodes, data) {\n return claim_node(nodes, (node) => node.nodeType === 3, (node) => {\n const dataStr = '' + data;\n if (node.data.startsWith(dataStr)) {\n if (node.data.length !== dataStr.length) {\n return node.splitText(dataStr.length);\n }\n }\n else {\n node.data = dataStr;\n }\n }, () => text(data), true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements\n );\n}\nfunction claim_space(nodes) {\n return claim_text(nodes, ' ');\n}\nfunction claim_comment(nodes, data) {\n return claim_node(nodes, (node) => node.nodeType === 8, (node) => {\n node.data = '' + data;\n return undefined;\n }, () => comment(data), true);\n}\nfunction find_comment(nodes, text, start) {\n for (let i = start; i < nodes.length; i += 1) {\n const node = nodes[i];\n if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {\n return i;\n }\n }\n return nodes.length;\n}\nfunction claim_html_tag(nodes, is_svg) {\n // find html opening tag\n const start_index = find_comment(nodes, 'HTML_TAG_START', 0);\n const end_index = find_comment(nodes, 'HTML_TAG_END', start_index);\n if (start_index === end_index) {\n return new HtmlTagHydration(undefined, is_svg);\n }\n init_claim_info(nodes);\n const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);\n detach(html_tag_nodes[0]);\n detach(html_tag_nodes[html_tag_nodes.length - 1]);\n const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);\n for (const n of claimed_nodes) {\n n.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n }\n return new HtmlTagHydration(claimed_nodes, is_svg);\n}\nfunction set_data(text, data) {\n data = '' + data;\n if (text.data === data)\n return;\n text.data = data;\n}\nfunction set_data_contenteditable(text, data) {\n data = '' + data;\n if (text.wholeText === data)\n return;\n text.data = data;\n}\nfunction set_data_maybe_contenteditable(text, data, attr_value) {\n if (~contenteditable_truthy_values.indexOf(attr_value)) {\n set_data_contenteditable(text, data);\n }\n else {\n set_data(text, data);\n }\n}\nfunction set_input_value(input, value) {\n input.value = value == null ? '' : value;\n}\nfunction set_input_type(input, type) {\n try {\n input.type = type;\n }\n catch (e) {\n // do nothing\n }\n}\nfunction set_style(node, key, value, important) {\n if (value == null) {\n node.style.removeProperty(key);\n }\n else {\n node.style.setProperty(key, value, important ? 'important' : '');\n }\n}\nfunction select_option(select, value, mounting) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n if (option.__value === value) {\n option.selected = true;\n return;\n }\n }\n if (!mounting || value !== undefined) {\n select.selectedIndex = -1; // no option should be selected\n }\n}\nfunction select_options(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n option.selected = ~value.indexOf(option.__value);\n }\n}\nfunction select_value(select) {\n const selected_option = select.querySelector(':checked');\n return selected_option && selected_option.__value;\n}\nfunction select_multiple_value(select) {\n return [].map.call(select.querySelectorAll(':checked'), option => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\nlet crossorigin;\nfunction is_crossorigin() {\n if (crossorigin === undefined) {\n crossorigin = false;\n try {\n if (typeof window !== 'undefined' && window.parent) {\n void window.parent.document;\n }\n }\n catch (error) {\n crossorigin = true;\n }\n }\n return crossorigin;\n}\nfunction add_iframe_resize_listener(node, fn) {\n const computed_style = getComputedStyle(node);\n if (computed_style.position === 'static') {\n node.style.position = 'relative';\n }\n const iframe = element('iframe');\n iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;');\n iframe.setAttribute('aria-hidden', 'true');\n iframe.tabIndex = -1;\n const crossorigin = is_crossorigin();\n let unsubscribe;\n if (crossorigin) {\n iframe.src = \"data:text/html,\";\n unsubscribe = listen(window, 'message', (event) => {\n if (event.source === iframe.contentWindow)\n fn();\n });\n }\n else {\n iframe.src = 'about:blank';\n iframe.onload = () => {\n unsubscribe = listen(iframe.contentWindow, 'resize', fn);\n // make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)\n // see https://github.com/sveltejs/svelte/issues/4233\n fn();\n };\n }\n append(node, iframe);\n return () => {\n if (crossorigin) {\n unsubscribe();\n }\n else if (unsubscribe && iframe.contentWindow) {\n unsubscribe();\n }\n detach(iframe);\n };\n}\nconst resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'content-box' });\nconst resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'border-box' });\nconst resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'device-pixel-content-box' });\nfunction toggle_class(element, name, toggle) {\n element.classList[toggle ? 'add' : 'remove'](name);\n}\nfunction custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n const e = document.createEvent('CustomEvent');\n e.initCustomEvent(type, bubbles, cancelable, detail);\n return e;\n}\nfunction query_selector_all(selector, parent = document.body) {\n return Array.from(parent.querySelectorAll(selector));\n}\nfunction head_selector(nodeId, head) {\n const result = [];\n let started = 0;\n for (const node of head.childNodes) {\n if (node.nodeType === 8 /* comment node */) {\n const comment = node.textContent.trim();\n if (comment === `HEAD_${nodeId}_END`) {\n started -= 1;\n result.push(node);\n }\n else if (comment === `HEAD_${nodeId}_START`) {\n started += 1;\n result.push(node);\n }\n }\n else if (started > 0) {\n result.push(node);\n }\n }\n return result;\n}\nclass HtmlTag {\n constructor(is_svg = false) {\n this.is_svg = false;\n this.is_svg = is_svg;\n this.e = this.n = null;\n }\n c(html) {\n this.h(html);\n }\n m(html, target, anchor = null) {\n if (!this.e) {\n if (this.is_svg)\n this.e = svg_element(target.nodeName);\n /** #7364 target for